Updated Image::copy to have a zoffset parameter.

TRAC #22705 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Geoff Lang git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2166 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 414e82af
...@@ -499,7 +499,7 @@ void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei ...@@ -499,7 +499,7 @@ void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei
if (!mImageArray[level]->isRenderableFormat()) if (!mImageArray[level]->isRenderableFormat())
{ {
mImageArray[level]->copy(0, 0, x, y, width, height, source); mImageArray[level]->copy(0, 0, 0, x, y, width, height, source);
mDirtyImages = true; mDirtyImages = true;
} }
else else
...@@ -533,7 +533,7 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo ...@@ -533,7 +533,7 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo
if (!mImageArray[level]->isRenderableFormat() || (!mTexStorage && !isSamplerComplete())) if (!mImageArray[level]->isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
{ {
mImageArray[level]->copy(xoffset, yoffset, x, y, width, height, source); mImageArray[level]->copy(xoffset, yoffset, 0, x, y, width, height, source);
mDirtyImages = true; mDirtyImages = true;
} }
else else
...@@ -1286,7 +1286,7 @@ void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint ...@@ -1286,7 +1286,7 @@ void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint
if (!mImageArray[faceindex][level]->isRenderableFormat()) if (!mImageArray[faceindex][level]->isRenderableFormat())
{ {
mImageArray[faceindex][level]->copy(0, 0, x, y, width, height, source); mImageArray[faceindex][level]->copy(0, 0, 0, x, y, width, height, source);
mDirtyImages = true; mDirtyImages = true;
} }
else else
...@@ -1326,7 +1326,7 @@ void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLi ...@@ -1326,7 +1326,7 @@ void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLi
if (!mImageArray[faceindex][level]->isRenderableFormat() || (!mTexStorage && !isSamplerComplete())) if (!mImageArray[faceindex][level]->isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
{ {
mImageArray[faceindex][level]->copy(0, 0, x, y, width, height, source); mImageArray[faceindex][level]->copy(0, 0, 0, x, y, width, height, source);
mDirtyImages = true; mDirtyImages = true;
} }
else else
......
...@@ -57,7 +57,7 @@ class Image ...@@ -57,7 +57,7 @@ class Image
virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
const void *input) = 0; const void *input) = 0;
virtual void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0; virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
static void loadAlphaDataToBGRA(GLsizei width, GLsizei height, GLsizei depth, static void loadAlphaDataToBGRA(GLsizei width, GLsizei height, GLsizei depth,
int inputRowPitch, int inputDepthPitch, const void *input, int inputRowPitch, int inputDepthPitch, const void *input,
......
...@@ -292,7 +292,7 @@ void Image11::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GL ...@@ -292,7 +292,7 @@ void Image11::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GL
unmap(); unmap();
} }
void Image11::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) void Image11::copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source)
{ {
gl::Renderbuffer *colorbuffer = source->getReadColorbuffer(); gl::Renderbuffer *colorbuffer = source->getReadColorbuffer();
...@@ -350,7 +350,7 @@ void Image11::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width ...@@ -350,7 +350,7 @@ void Image11::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width
srcBox.front = 0; srcBox.front = 0;
srcBox.back = 1; srcBox.back = 1;
deviceContext->CopySubresourceRegion(mStagingTexture, 0, xoffset, yoffset, 0, srcTex, subresourceIndex, &srcBox); deviceContext->CopySubresourceRegion(mStagingTexture, 0, xoffset, yoffset, zoffset, srcTex, subresourceIndex, &srcBox);
srcTex->Release(); srcTex->Release();
colorBufferTexture->Release(); colorBufferTexture->Release();
...@@ -364,7 +364,7 @@ void Image11::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width ...@@ -364,7 +364,7 @@ void Image11::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width
// determine the offset coordinate into the destination buffer // determine the offset coordinate into the destination buffer
GLsizei rowOffset = gl::ComputePixelSize(mActualFormat) * xoffset; GLsizei rowOffset = gl::ComputePixelSize(mActualFormat) * xoffset;
void *dataOffset = static_cast<unsigned char*>(mappedImage.pData) + mappedImage.RowPitch * yoffset + rowOffset; void *dataOffset = static_cast<unsigned char*>(mappedImage.pData) + mappedImage.RowPitch * yoffset + rowOffset + zoffset * mappedImage.DepthPitch;
mRenderer->readPixels(source, x, y, width, height, gl::ExtractFormat(mInternalFormat), mRenderer->readPixels(source, x, y, width, height, gl::ExtractFormat(mInternalFormat),
gl::ExtractType(mInternalFormat), mappedImage.RowPitch, false, 4, dataOffset); gl::ExtractType(mInternalFormat), mappedImage.RowPitch, false, 4, dataOffset);
......
...@@ -52,7 +52,7 @@ class Image11 : public Image ...@@ -52,7 +52,7 @@ class Image11 : public Image
virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
const void *input); const void *input);
virtual void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source); virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
protected: protected:
HRESULT map(D3D11_MAPPED_SUBRESOURCE *map); HRESULT map(D3D11_MAPPED_SUBRESOURCE *map);
......
...@@ -498,8 +498,11 @@ void Image9::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLs ...@@ -498,8 +498,11 @@ void Image9::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLs
} }
// This implements glCopyTex[Sub]Image2D for non-renderable internal texture formats and incomplete textures // This implements glCopyTex[Sub]Image2D for non-renderable internal texture formats and incomplete textures
void Image9::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) void Image9::copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source)
{ {
// ES3.0 only behaviour to copy into a 3d texture
ASSERT(zoffset == 0);
RenderTarget9 *renderTarget = NULL; RenderTarget9 *renderTarget = NULL;
IDirect3DSurface9 *surface = NULL; IDirect3DSurface9 *surface = NULL;
gl::Renderbuffer *colorbuffer = source->getColorbuffer(0); gl::Renderbuffer *colorbuffer = source->getColorbuffer(0);
......
...@@ -56,7 +56,7 @@ class Image9 : public Image ...@@ -56,7 +56,7 @@ class Image9 : public Image
virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
const void *input); const void *input);
virtual void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source); virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset,GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
private: private:
DISALLOW_COPY_AND_ASSIGN(Image9); DISALLOW_COPY_AND_ASSIGN(Image9);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment