Commit fc0be049 by Shahbaz Youssefi Committed by Commit Bot

Fix GL_MAX_COMBINED_UNIFORM_BLOCKS query

This was previously returning maxCombinedTextureImageUnits instead of maxCombinedUniformBlocks. Fixing that exposed a bug in the GL backend where the combined values were sometimes capped to vertex+fragment values and sometimes not capped at all. The reasoning for such capping was that the combined limits as queried from GL contains stages not available in GLES (such as tessellation). However, the capping failed to take geometry shader limits into account. This change adjusts such capping to vertex+fragment+geometry. It also applies the cappping to all combined limits, rather than a select few. Bug: angleproject:2099 Change-Id: I7231058b5d7f80b1b2452d9f87d4b0ab6e1cdb17 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1572487Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent b8149075
...@@ -1513,7 +1513,7 @@ void Context::getIntegervImpl(GLenum pname, GLint *params) ...@@ -1513,7 +1513,7 @@ void Context::getIntegervImpl(GLenum pname, GLint *params)
*params = mState.mCaps.maxShaderUniformBlocks[ShaderType::Fragment]; *params = mState.mCaps.maxShaderUniformBlocks[ShaderType::Fragment];
break; break;
case GL_MAX_COMBINED_UNIFORM_BLOCKS: case GL_MAX_COMBINED_UNIFORM_BLOCKS:
*params = mState.mCaps.maxCombinedTextureImageUnits; *params = mState.mCaps.maxCombinedUniformBlocks;
break; break;
case GL_MAX_VERTEX_OUTPUT_COMPONENTS: case GL_MAX_VERTEX_OUTPUT_COMPONENTS:
*params = mState.mCaps.maxVertexOutputComponents; *params = mState.mCaps.maxVertexOutputComponents;
......
...@@ -404,6 +404,17 @@ static void LimitVersion(gl::Version *curVersion, const gl::Version &maxVersion) ...@@ -404,6 +404,17 @@ static void LimitVersion(gl::Version *curVersion, const gl::Version &maxVersion)
} }
} }
void CapCombinedLimitToESShaders(GLuint *combinedLimit, gl::ShaderMap<GLuint> &perShaderLimit)
{
GLuint combinedESLimit = 0;
for (gl::ShaderType shaderType : gl::kAllGraphicsShaderTypes)
{
combinedESLimit += perShaderLimit[shaderType];
}
*combinedLimit = std::min(*combinedLimit, combinedESLimit);
}
void GenerateCaps(const FunctionsGL *functions, void GenerateCaps(const FunctionsGL *functions,
const WorkaroundsGL &workarounds, const WorkaroundsGL &workarounds,
gl::Caps *caps, gl::Caps *caps,
...@@ -714,15 +725,8 @@ void GenerateCaps(const FunctionsGL *functions, ...@@ -714,15 +725,8 @@ void GenerateCaps(const FunctionsGL *functions,
caps->maxUniformBlockSize = QuerySingleGLInt64(functions, GL_MAX_UNIFORM_BLOCK_SIZE); caps->maxUniformBlockSize = QuerySingleGLInt64(functions, GL_MAX_UNIFORM_BLOCK_SIZE);
caps->uniformBufferOffsetAlignment = caps->uniformBufferOffsetAlignment =
QuerySingleGLInt(functions, GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT); QuerySingleGLInt(functions, GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT);
caps->maxCombinedUniformBlocks =
GLuint maxCombinedUniformBlocks =
QuerySingleGLInt(functions, GL_MAX_COMBINED_UNIFORM_BLOCKS); QuerySingleGLInt(functions, GL_MAX_COMBINED_UNIFORM_BLOCKS);
// The real cap contains the limits for shader types that are not available to ES, so limit
// the cap to the sum of vertex+fragment shader caps.
caps->maxCombinedUniformBlocks = std::min(
maxCombinedUniformBlocks, caps->maxShaderUniformBlocks[gl::ShaderType::Vertex] +
caps->maxShaderUniformBlocks[gl::ShaderType::Fragment]);
caps->maxCombinedShaderUniformComponents[gl::ShaderType::Vertex] = caps->maxCombinedShaderUniformComponents[gl::ShaderType::Vertex] =
QuerySingleGLInt64(functions, GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS); QuerySingleGLInt64(functions, GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS);
caps->maxCombinedShaderUniformComponents[gl::ShaderType::Fragment] = caps->maxCombinedShaderUniformComponents[gl::ShaderType::Fragment] =
...@@ -770,8 +774,8 @@ void GenerateCaps(const FunctionsGL *functions, ...@@ -770,8 +774,8 @@ void GenerateCaps(const FunctionsGL *functions,
// Determine the max combined texture image units by adding the vertex and fragment limits. If // Determine the max combined texture image units by adding the vertex and fragment limits. If
// the real cap is queried, it would contain the limits for shader types that are not available // the real cap is queried, it would contain the limits for shader types that are not available
// to ES. // to ES.
caps->maxCombinedTextureImageUnits = caps->maxShaderTextureImageUnits[gl::ShaderType::Vertex] + caps->maxCombinedTextureImageUnits =
caps->maxShaderTextureImageUnits[gl::ShaderType::Fragment]; QuerySingleGLInt(functions, GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
// Table 6.34, implementation dependent transform feedback limits // Table 6.34, implementation dependent transform feedback limits
if (functions->isAtLeastGL(gl::Version(4, 0)) || if (functions->isAtLeastGL(gl::Version(4, 0)) ||
...@@ -1331,6 +1335,18 @@ void GenerateCaps(const FunctionsGL *functions, ...@@ -1331,6 +1335,18 @@ void GenerateCaps(const FunctionsGL *functions,
QuerySingleGLInt(functions, GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT); QuerySingleGLInt(functions, GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT);
} }
// The real combined caps contain limits for shader types that are not available to ES, so limit
// the caps to the sum of vertex+fragment+geometry shader caps.
CapCombinedLimitToESShaders(&caps->maxCombinedUniformBlocks, caps->maxShaderUniformBlocks);
CapCombinedLimitToESShaders(&caps->maxCombinedTextureImageUnits,
caps->maxShaderTextureImageUnits);
CapCombinedLimitToESShaders(&caps->maxCombinedShaderStorageBlocks,
caps->maxShaderStorageBlocks);
CapCombinedLimitToESShaders(&caps->maxCombinedImageUniforms, caps->maxShaderImageUniforms);
CapCombinedLimitToESShaders(&caps->maxCombinedAtomicCounterBuffers,
caps->maxShaderAtomicCounterBuffers);
CapCombinedLimitToESShaders(&caps->maxCombinedAtomicCounters, caps->maxShaderAtomicCounters);
// EXT_blend_func_extended. // EXT_blend_func_extended.
// Note that this could be implemented also on top of native EXT_blend_func_extended, but it's // Note that this could be implemented also on top of native EXT_blend_func_extended, but it's
// currently not fully implemented. // currently not fully implemented.
......
...@@ -533,6 +533,7 @@ ...@@ -533,6 +533,7 @@
2950 VULKAN : dEQP-GLES3.functional.implementation_limits.max_uniform_block_size = SKIP 2950 VULKAN : dEQP-GLES3.functional.implementation_limits.max_uniform_block_size = SKIP
2950 VULKAN : dEQP-GLES3.functional.implementation_limits.max_combined_vertex_uniform_components = SKIP 2950 VULKAN : dEQP-GLES3.functional.implementation_limits.max_combined_vertex_uniform_components = SKIP
2950 VULKAN : dEQP-GLES3.functional.implementation_limits.max_combined_fragment_uniform_components = SKIP 2950 VULKAN : dEQP-GLES3.functional.implementation_limits.max_combined_fragment_uniform_components = SKIP
2950 VULKAN : dEQP-GLES3.functional.implementation_limits.max_combined_uniform_blocks = SKIP
2950 VULKAN : dEQP-GLES3.functional.implementation_limits.max_transform_feedback_* = SKIP 2950 VULKAN : dEQP-GLES3.functional.implementation_limits.max_transform_feedback_* = SKIP
// 3D texture (anglebug.com/3188), 2D array (anglebug.com/3189): // 3D texture (anglebug.com/3188), 2D array (anglebug.com/3189):
...@@ -700,6 +701,7 @@ ...@@ -700,6 +701,7 @@
2950 VULKAN : dEQP-GLES3.functional.state_query.integers.max_elements_vertices_getfloat = FAIL 2950 VULKAN : dEQP-GLES3.functional.state_query.integers.max_elements_vertices_getfloat = FAIL
2950 VULKAN : dEQP-GLES3.functional.state_query.integers.max_vertex_uniform_blocks_get* = FAIL 2950 VULKAN : dEQP-GLES3.functional.state_query.integers.max_vertex_uniform_blocks_get* = FAIL
2950 VULKAN : dEQP-GLES3.functional.state_query.integers.max_fragment_uniform_blocks_get* = FAIL 2950 VULKAN : dEQP-GLES3.functional.state_query.integers.max_fragment_uniform_blocks_get* = FAIL
2950 VULKAN : dEQP-GLES3.functional.state_query.integers.max_combined_uniform_blocks_get* = FAIL
2950 VULKAN : dEQP-GLES3.functional.state_query.integers.max_fragment_input_components_get* = FAIL 2950 VULKAN : dEQP-GLES3.functional.state_query.integers.max_fragment_input_components_get* = FAIL
2950 VULKAN : dEQP-GLES3.functional.state_query.integers.max_program_texel_offset_get* = FAIL 2950 VULKAN : dEQP-GLES3.functional.state_query.integers.max_program_texel_offset_get* = FAIL
2950 VULKAN : dEQP-GLES3.functional.state_query.integers.max_uniform_buffer_bindings_get* = FAIL 2950 VULKAN : dEQP-GLES3.functional.state_query.integers.max_uniform_buffer_bindings_get* = FAIL
...@@ -739,11 +741,8 @@ ...@@ -739,11 +741,8 @@
// Android Vulkan failures // Android Vulkan failures
2950 ANDROID VULKAN : dEQP-GLES3.functional.implementation_limits.max_combined_texture_image_units = FAIL 2950 ANDROID VULKAN : dEQP-GLES3.functional.implementation_limits.max_combined_texture_image_units = FAIL
2950 ANDROID VULKAN : dEQP-GLES3.functional.implementation_limits.max_combined_uniform_blocks = FAIL
2950 ANDROID VULKAN : dEQP-GLES3.functional.state_query.integers.max_combined_texture_image_units_getfloat = FAIL 2950 ANDROID VULKAN : dEQP-GLES3.functional.state_query.integers.max_combined_texture_image_units_getfloat = FAIL
2950 ANDROID VULKAN : dEQP-GLES3.functional.state_query.integers.max_combined_texture_image_units_getinteger64 = FAIL 2950 ANDROID VULKAN : dEQP-GLES3.functional.state_query.integers.max_combined_texture_image_units_getinteger64 = FAIL
2950 ANDROID VULKAN : dEQP-GLES3.functional.state_query.integers.max_combined_uniform_blocks_getfloat = FAIL
2950 ANDROID VULKAN : dEQP-GLES3.functional.state_query.integers.max_combined_uniform_blocks_getinteger64 = FAIL
2950 ANDROID VULKAN : dEQP-GLES3.functional.fragment_ops.blend.fbo_srgb.rgb_func_alpha_func.* = SKIP 2950 ANDROID VULKAN : dEQP-GLES3.functional.fragment_ops.blend.fbo_srgb.rgb_func_alpha_func.* = SKIP
2950 ANDROID VULKAN : dEQP-GLES3.functional.fragment_ops.depth_stencil.stencil_ops.* = SKIP 2950 ANDROID VULKAN : dEQP-GLES3.functional.fragment_ops.depth_stencil.stencil_ops.* = SKIP
2950 ANDROID VULKAN : dEQP-GLES3.functional.polygon_offset.* = FAIL 2950 ANDROID VULKAN : dEQP-GLES3.functional.polygon_offset.* = FAIL
......
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