Commit e5685e08 by Jamie Madill

Fix failure initting 2D Array textures.

Our code currently failed in retrieving a NULL Image internally, when we relied on getting texture dimensions on an unitialized texture. BUG=angle:813 Change-Id: Iaf6791ee291e45daae9c80d6452c4d9154227fdb Reviewed-on: https://chromium-review.googlesource.com/229350Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org>
parent 970d2613
...@@ -2255,16 +2255,18 @@ TextureD3D_2DArray::~TextureD3D_2DArray() ...@@ -2255,16 +2255,18 @@ TextureD3D_2DArray::~TextureD3D_2DArray()
Image *TextureD3D_2DArray::getImage(int level, int layer) const Image *TextureD3D_2DArray::getImage(int level, int layer) const
{ {
ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS); ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
ASSERT(layer < mLayerCounts[level]); ASSERT((layer == 0 && mLayerCounts[level] == 0) ||
return mImageArray[level][layer]; layer < mLayerCounts[level]);
return (mImageArray[level] ? mImageArray[level][layer] : NULL);
} }
Image *TextureD3D_2DArray::getImage(const gl::ImageIndex &index) const Image *TextureD3D_2DArray::getImage(const gl::ImageIndex &index) const
{ {
ASSERT(index.mipIndex < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS); ASSERT(index.mipIndex < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
ASSERT(index.layerIndex < mLayerCounts[index.mipIndex]); ASSERT((index.layerIndex == 0 && mLayerCounts[index.mipIndex] == 0) ||
index.layerIndex < mLayerCounts[index.mipIndex]);
ASSERT(index.type == GL_TEXTURE_2D_ARRAY); ASSERT(index.type == GL_TEXTURE_2D_ARRAY);
return mImageArray[index.mipIndex][index.layerIndex]; return (mImageArray[index.mipIndex] ? mImageArray[index.mipIndex][index.layerIndex] : NULL);
} }
GLsizei TextureD3D_2DArray::getLayerCount(int level) const GLsizei TextureD3D_2DArray::getLayerCount(int level) const
......
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