GL_BORDER_COLOR was previously reset only if the extension
GL_EXT_texture_border_clamp was supported. The extension become core
functionality with GLES 3.2. Changed the code to execute the appropriate
reset when either the extension is supported or the context is GLES 3.2
compatible.
Change-Id: I682a8326d04843d1192b9a91c6c1b57c0f4420b9
// Texture state.
// \todo [2013-04-08 pyry] Reset all levels?
{
// Texture state.
// \todo [2013-04-08 pyry] Reset all levels?
{
- const float borderColor[] = { 0.0f, 0.0f, 0.0f, 0.0f };
- int numTexUnits = 0;
+ const float borderColor[] = { 0.0f, 0.0f, 0.0f, 0.0f };
+ int numTexUnits = 0;
+ const bool supportsBorderClamp = ctxInfo.isExtensionSupported("GL_EXT_texture_border_clamp") || contextSupports(type, ApiType::es(3,2));
+
gl.getIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &numTexUnits);
for (int ndx = 0; ndx < numTexUnits; ndx++)
gl.getIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &numTexUnits);
for (int ndx = 0; ndx < numTexUnits; ndx++)
if (contextSupports(type, ApiType::es(3,1)))
gl.texParameteri(GL_TEXTURE_2D, GL_DEPTH_STENCIL_TEXTURE_MODE, GL_DEPTH_COMPONENT);
if (contextSupports(type, ApiType::es(3,1)))
gl.texParameteri(GL_TEXTURE_2D, GL_DEPTH_STENCIL_TEXTURE_MODE, GL_DEPTH_COMPONENT);
- if (ctxInfo.isExtensionSupported("GL_EXT_texture_border_clamp"))
+ if (supportsBorderClamp)
gl.texParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, &borderColor[0]);
// Reset cube map texture.
gl.texParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, &borderColor[0]);
// Reset cube map texture.
if (contextSupports(type, ApiType::es(3,1)))
gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_DEPTH_STENCIL_TEXTURE_MODE, GL_DEPTH_COMPONENT);
if (contextSupports(type, ApiType::es(3,1)))
gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_DEPTH_STENCIL_TEXTURE_MODE, GL_DEPTH_COMPONENT);
- if (ctxInfo.isExtensionSupported("GL_EXT_texture_border_clamp"))
+ if (supportsBorderClamp)
gl.texParameterfv(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BORDER_COLOR, &borderColor[0]);
if (contextSupports(type, ApiType::es(3,0)))
gl.texParameterfv(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BORDER_COLOR, &borderColor[0]);
if (contextSupports(type, ApiType::es(3,0)))
gl.texParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_MODE, GL_NONE);
gl.texParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
gl.texParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_MODE, GL_NONE);
gl.texParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
- if (ctxInfo.isExtensionSupported("GL_EXT_texture_border_clamp"))
+ if (supportsBorderClamp)
gl.texParameterfv(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BORDER_COLOR, &borderColor[0]);
}
gl.texParameterfv(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BORDER_COLOR, &borderColor[0]);
}
gl.texParameteri(GL_TEXTURE_3D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
gl.texParameteri(GL_TEXTURE_3D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
gl.texParameteri(GL_TEXTURE_3D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
gl.texParameteri(GL_TEXTURE_3D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
- if (ctxInfo.isExtensionSupported("GL_EXT_texture_border_clamp"))
+ if (supportsBorderClamp)
gl.texParameterfv(GL_TEXTURE_3D, GL_TEXTURE_BORDER_COLOR, &borderColor[0]);
}
gl.texParameterfv(GL_TEXTURE_3D, GL_TEXTURE_BORDER_COLOR, &borderColor[0]);
}
gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_COMPARE_MODE, GL_NONE);
gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_COMPARE_MODE, GL_NONE);
gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
- if (ctxInfo.isExtensionSupported("GL_EXT_texture_border_clamp"))
+ if (supportsBorderClamp)
gl.texParameterfv(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_BORDER_COLOR, &borderColor[0]);
}
}
gl.texParameterfv(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_BORDER_COLOR, &borderColor[0]);
}
}