Use ShaderMap in Caps - Part I
This patch is the first one of the series that organize
implementation dependent resource limits on every type
of shader into ShaderMap and clean up all the related
code.
In the next patch all such resource limits are put in
the corresponding ShaderMaps.
BUG=angleproject:2169
Change-Id: I40cb58c55b2e82df33221ddb36eff0abcd7e8b22
Reviewed-on: https://chromium-review.googlesource.com/1034108
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index 4de0868..78087d7 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -1336,10 +1336,10 @@
*params = mCaps.maxCombinedTextureImageUnits;
break;
case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
- *params = mCaps.maxVertexTextureImageUnits;
+ *params = mCaps.maxShaderTextureImageUnits[ShaderType::Vertex];
break;
case GL_MAX_TEXTURE_IMAGE_UNITS:
- *params = mCaps.maxTextureImageUnits;
+ *params = mCaps.maxShaderTextureImageUnits[ShaderType::Fragment];
break;
case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
*params = mCaps.maxFragmentUniformVectors;
@@ -1383,10 +1383,10 @@
*params = mCaps.maxUniformBufferBindings;
break;
case GL_MAX_VERTEX_UNIFORM_BLOCKS:
- *params = mCaps.maxVertexUniformBlocks;
+ *params = mCaps.maxShaderUniformBlocks[ShaderType::Vertex];
break;
case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
- *params = mCaps.maxFragmentUniformBlocks;
+ *params = mCaps.maxShaderUniformBlocks[ShaderType::Fragment];
break;
case GL_MAX_COMBINED_UNIFORM_BLOCKS:
*params = mCaps.maxCombinedTextureImageUnits;
@@ -1522,7 +1522,7 @@
*params = mCaps.maxVertexImageUniforms;
break;
case GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS:
- *params = mCaps.maxVertexShaderStorageBlocks;
+ *params = mCaps.maxShaderStorageBlocks[ShaderType::Vertex];
break;
case GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS:
*params = mCaps.maxFragmentAtomicCounterBuffers;
@@ -1534,7 +1534,7 @@
*params = mCaps.maxFragmentImageUniforms;
break;
case GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS:
- *params = mCaps.maxFragmentShaderStorageBlocks;
+ *params = mCaps.maxShaderStorageBlocks[ShaderType::Fragment];
break;
case GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET:
*params = mCaps.minProgramTextureGatherOffset;
@@ -1546,10 +1546,10 @@
*params = mCaps.maxComputeWorkGroupInvocations;
break;
case GL_MAX_COMPUTE_UNIFORM_BLOCKS:
- *params = mCaps.maxComputeUniformBlocks;
+ *params = mCaps.maxShaderUniformBlocks[ShaderType::Compute];
break;
case GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS:
- *params = mCaps.maxComputeTextureImageUnits;
+ *params = mCaps.maxShaderTextureImageUnits[ShaderType::Compute];
break;
case GL_MAX_COMPUTE_SHARED_MEMORY_SIZE:
*params = mCaps.maxComputeSharedMemorySize;
@@ -1570,7 +1570,7 @@
*params = mCaps.maxCombinedComputeUniformComponents;
break;
case GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS:
- *params = mCaps.maxComputeShaderStorageBlocks;
+ *params = mCaps.maxShaderStorageBlocks[ShaderType::Compute];
break;
case GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
*params = mCaps.maxCombinedShaderOutputResources;
@@ -1617,7 +1617,7 @@
*params = mCaps.maxGeometryUniformComponents;
break;
case GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT:
- *params = mCaps.maxGeometryUniformBlocks;
+ *params = mCaps.maxShaderUniformBlocks[ShaderType::Geometry];
break;
case GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT:
*params = mCaps.maxCombinedGeometryUniformComponents;
@@ -1638,7 +1638,7 @@
*params = mCaps.maxGeometryShaderInvocations;
break;
case GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT:
- *params = mCaps.maxGeometryTextureImageUnits;
+ *params = mCaps.maxShaderTextureImageUnits[ShaderType::Geometry];
break;
case GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT:
*params = mCaps.maxGeometryAtomicCounterBuffers;
@@ -1650,7 +1650,7 @@
*params = mCaps.maxGeometryImageUniforms;
break;
case GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT:
- *params = mCaps.maxGeometryShaderStorageBlocks;
+ *params = mCaps.maxShaderStorageBlocks[ShaderType::Geometry];
break;
// GLES1 emulation: Caps queries
case GL_MAX_TEXTURE_UNITS:
@@ -3106,14 +3106,17 @@
LimitCap(&mCaps.maxVertexAttribBindings, MAX_VERTEX_ATTRIB_BINDINGS);
}
- LimitCap(&mCaps.maxVertexUniformBlocks, IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS);
+ LimitCap(&mCaps.maxShaderUniformBlocks[ShaderType::Vertex],
+ IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS);
LimitCap(&mCaps.maxVertexOutputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
LimitCap(&mCaps.maxFragmentInputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
// Limit textures as well, so we can use fast bitsets with texture bindings.
LimitCap(&mCaps.maxCombinedTextureImageUnits, IMPLEMENTATION_MAX_ACTIVE_TEXTURES);
- LimitCap(&mCaps.maxVertexTextureImageUnits, IMPLEMENTATION_MAX_ACTIVE_TEXTURES / 2);
- LimitCap(&mCaps.maxTextureImageUnits, IMPLEMENTATION_MAX_ACTIVE_TEXTURES / 2);
+ LimitCap(&mCaps.maxShaderTextureImageUnits[ShaderType::Vertex],
+ IMPLEMENTATION_MAX_ACTIVE_TEXTURES / 2);
+ LimitCap(&mCaps.maxShaderTextureImageUnits[ShaderType::Fragment],
+ IMPLEMENTATION_MAX_ACTIVE_TEXTURES / 2);
mCaps.maxSampleMaskWords = std::min<GLuint>(mCaps.maxSampleMaskWords, MAX_SAMPLE_MASK_WORDS);