Commit f4134d20 by Geoff Lang

Use gl::Data as a parameter to Texture::isSamplerComplete.

BUG=angle:861 Change-Id: I3fadf954e6d28dd82e361ceac4ba1967dbd7e8bf Reviewed-on: https://chromium-review.googlesource.com/235612Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent d8a2258c
......@@ -268,7 +268,7 @@ Error Texture2D::storage(GLsizei levels, GLenum internalformat, GLsizei width, G
}
// Tests for 2D texture sampling completeness. [OpenGL ES 2.0.24] section 3.8.2 page 85.
bool Texture2D::isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const
bool Texture2D::isSamplerComplete(const SamplerState &samplerState, const Data &data) const
{
GLsizei width = getBaseLevelWidth();
GLsizei height = getBaseLevelHeight();
......@@ -278,13 +278,12 @@ bool Texture2D::isSamplerComplete(const SamplerState &samplerState, const Textur
return false;
}
if (!textureCaps.get(getInternalFormat(0)).filterable && !IsPointSampled(samplerState))
if (!data.textureCaps->get(getInternalFormat(0)).filterable && !IsPointSampled(samplerState))
{
return false;
}
bool npotSupport = extensions.textureNPOT;
bool npotSupport = data.extensions->textureNPOT;
if (!npotSupport)
{
if ((samplerState.wrapS != GL_CLAMP_TO_EDGE && !gl::isPow2(width)) ||
......@@ -316,7 +315,7 @@ bool Texture2D::isSamplerComplete(const SamplerState &samplerState, const Textur
// MODE is NONE, and either the magnification filter is not NEAREST or the mini-
// fication filter is neither NEAREST nor NEAREST_MIPMAP_NEAREST.
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(getInternalFormat(0));
if (formatInfo.depthBits > 0 && clientVersion > 2)
if (formatInfo.depthBits > 0 && data.clientVersion > 2)
{
if (samplerState.compareMode == GL_NONE)
{
......@@ -521,18 +520,18 @@ Error TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei siz
}
// Tests for texture sampling completeness
bool TextureCubeMap::isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const
bool TextureCubeMap::isSamplerComplete(const SamplerState &samplerState, const Data &data) const
{
int size = getBaseLevelWidth();
bool mipmapping = IsMipmapFiltered(samplerState);
if (!textureCaps.get(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0)).filterable && !IsPointSampled(samplerState))
if (!data.textureCaps->get(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0)).filterable && !IsPointSampled(samplerState))
{
return false;
}
if (!gl::isPow2(size) && !extensions.textureNPOT)
if (!gl::isPow2(size) && !data.extensions->textureNPOT)
{
if (samplerState.wrapS != GL_CLAMP_TO_EDGE || samplerState.wrapT != GL_CLAMP_TO_EDGE || mipmapping)
{
......@@ -724,7 +723,7 @@ Error Texture3D::storage(GLsizei levels, GLenum internalformat, GLsizei width, G
return Error(GL_NO_ERROR);
}
bool Texture3D::isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const
bool Texture3D::isSamplerComplete(const SamplerState &samplerState, const Data &data) const
{
GLsizei width = getBaseLevelWidth();
GLsizei height = getBaseLevelHeight();
......@@ -735,7 +734,7 @@ bool Texture3D::isSamplerComplete(const SamplerState &samplerState, const Textur
return false;
}
if (!textureCaps.get(getInternalFormat(0)).filterable && !IsPointSampled(samplerState))
if (!data.textureCaps->get(getInternalFormat(0)).filterable && !IsPointSampled(samplerState))
{
return false;
}
......@@ -886,7 +885,7 @@ Error Texture2DArray::storage(GLsizei levels, GLenum internalformat, GLsizei wid
return Error(GL_NO_ERROR);
}
bool Texture2DArray::isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const
bool Texture2DArray::isSamplerComplete(const SamplerState &samplerState, const Data &data) const
{
GLsizei width = getBaseLevelWidth();
GLsizei height = getBaseLevelHeight();
......@@ -897,7 +896,7 @@ bool Texture2DArray::isSamplerComplete(const SamplerState &samplerState, const T
return false;
}
if (!textureCaps.get(getBaseLevelInternalFormat()).filterable && !IsPointSampled(samplerState))
if (!data.textureCaps->get(getBaseLevelInternalFormat()).filterable && !IsPointSampled(samplerState))
{
return false;
}
......
......@@ -38,6 +38,7 @@ namespace gl
class Framebuffer;
class FramebufferAttachment;
struct ImageIndex;
struct Data;
bool IsMipmapFiltered(const gl::SamplerState &samplerState);
......@@ -65,7 +66,7 @@ class Texture : public RefCountObject
GLsizei getHeight(const ImageIndex &index) const;
GLenum getInternalFormat(const ImageIndex &index) const;
virtual bool isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const = 0;
virtual bool isSamplerComplete(const SamplerState &samplerState, const Data &data) const = 0;
virtual Error generateMipmaps();
......@@ -124,7 +125,7 @@ class Texture2D : public Texture
Error copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
Error storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
virtual bool isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const;
virtual bool isSamplerComplete(const SamplerState &samplerState, const Data &data) const;
virtual void bindTexImage(egl::Surface *surface);
virtual void releaseTexImage();
......@@ -159,7 +160,7 @@ class TextureCubeMap : public Texture
Error copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
Error storage(GLsizei levels, GLenum internalformat, GLsizei size);
virtual bool isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const;
virtual bool isSamplerComplete(const SamplerState &samplerState, const Data &data) const;
bool isCubeComplete() const;
......@@ -193,7 +194,7 @@ class Texture3D : public Texture
Error subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const PixelUnpackState &unpack, const void *pixels);
Error storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
virtual bool isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const;
virtual bool isSamplerComplete(const SamplerState &samplerState, const Data &data) const;
private:
DISALLOW_COPY_AND_ASSIGN(Texture3D);
......@@ -222,7 +223,7 @@ class Texture2DArray : public Texture
Error subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const PixelUnpackState &unpack, const void *pixels);
Error storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
virtual bool isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const;
virtual bool isSamplerComplete(const SamplerState &samplerState, const Data &data) const;
private:
DISALLOW_COPY_AND_ASSIGN(Texture2DArray);
......
......@@ -409,7 +409,7 @@ gl::Error RendererD3D::applyTextures(const gl::Data &data, gl::SamplerType shade
}
// TODO: std::binary_search may become unavailable using older versions of GCC
if (texture->isSamplerComplete(sampler, *data.textureCaps, *data.extensions, data.clientVersion) &&
if (texture->isSamplerComplete(sampler, data) &&
!std::binary_search(framebufferSerials.begin(), framebufferSerials.begin() + framebufferSerialCount, texture->getTextureSerial()))
{
gl::Error error = setSamplerState(shaderType, samplerIndex, texture, sampler);
......
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