Add threadgroups{x,y,z} SystemLimits;

This commit is contained in:
bjorn
2021-05-25 23:22:05 -06:00
committed by bjorn
parent 17c26dc902
commit f6559ce49e
5 changed files with 52 additions and 1 deletions
+3
View File
@@ -1878,6 +1878,9 @@ STRINGMAP_CLASS_BEGIN(Graphics, Graphics::SystemLimit, Graphics::LIMIT_MAX_ENUM,
{ "cubetexturesize", Graphics::LIMIT_CUBE_TEXTURE_SIZE },
{ "texelbuffersize", Graphics::LIMIT_TEXEL_BUFFER_SIZE },
{ "shaderstoragebuffersize", Graphics::LIMIT_SHADER_STORAGE_BUFFER_SIZE },
{ "threadgroupsx", Graphics::LIMIT_THREADGROUPS_X },
{ "threadgroupsy", Graphics::LIMIT_THREADGROUPS_Y },
{ "threadgroupsz", Graphics::LIMIT_THREADGROUPS_Z },
{ "rendertargets", Graphics::LIMIT_RENDER_TARGETS },
{ "texturemsaa", Graphics::LIMIT_TEXTURE_MSAA },
{ "anisotropy", Graphics::LIMIT_ANISOTROPY },
+3
View File
@@ -164,6 +164,9 @@ public:
LIMIT_TEXTURE_LAYERS,
LIMIT_TEXEL_BUFFER_SIZE,
LIMIT_SHADER_STORAGE_BUFFER_SIZE,
LIMIT_THREADGROUPS_X,
LIMIT_THREADGROUPS_Y,
LIMIT_THREADGROUPS_Z,
LIMIT_RENDER_TARGETS,
LIMIT_TEXTURE_MSAA,
LIMIT_ANISOTROPY,
+4 -1
View File
@@ -1543,10 +1543,13 @@ void Graphics::initCapabilities()
capabilities.limits[LIMIT_CUBE_TEXTURE_SIZE] = gl.getMaxCubeTextureSize();
capabilities.limits[LIMIT_TEXEL_BUFFER_SIZE] = gl.getMaxTexelBufferSize();
capabilities.limits[LIMIT_SHADER_STORAGE_BUFFER_SIZE] = gl.getMaxShaderStorageBufferSize();
capabilities.limits[LIMIT_THREADGROUPS_X] = gl.getMaxComputeWorkGroupsX();
capabilities.limits[LIMIT_THREADGROUPS_Y] = gl.getMaxComputeWorkGroupsY();
capabilities.limits[LIMIT_THREADGROUPS_Z] = gl.getMaxComputeWorkGroupsZ();
capabilities.limits[LIMIT_RENDER_TARGETS] = gl.getMaxRenderTargets();
capabilities.limits[LIMIT_TEXTURE_MSAA] = gl.getMaxSamples();
capabilities.limits[LIMIT_ANISOTROPY] = gl.getMaxAnisotropy();
static_assert(LIMIT_MAX_ENUM == 10, "Graphics::initCapabilities must be updated when adding a new system limit!");
static_assert(LIMIT_MAX_ENUM == 13, "Graphics::initCapabilities must be updated when adding a new system limit!");
for (int i = 0; i < TEXTURE_MAX_ENUM; i++)
capabilities.textureTypes[i] = gl.isTextureTypeSupported((TextureType) i);
+31
View File
@@ -103,6 +103,9 @@ OpenGL::OpenGL()
, maxTextureArrayLayers(0)
, maxTexelBufferSize(0)
, maxShaderStorageBufferSize(0)
, maxComputeWorkGroupsX(0)
, maxComputeWorkGroupsY(0)
, maxComputeWorkGroupsZ(0)
, maxRenderTargets(1)
, maxSamples(1)
, maxTextureUnits(1)
@@ -500,6 +503,19 @@ void OpenGL::initMaxValues()
maxShaderStorageBufferBindings = 0;
}
if (GLAD_ES_VERSION_3_1 || GLAD_VERSION_4_3)
{
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, &maxComputeWorkGroupsX);
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 1, &maxComputeWorkGroupsY);
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 2, &maxComputeWorkGroupsZ);
}
else
{
maxComputeWorkGroupsX = 0;
maxComputeWorkGroupsY = 0;
maxComputeWorkGroupsZ = 0;
}
int maxattachments = 1;
int maxdrawbuffers = 1;
@@ -1510,6 +1526,21 @@ int OpenGL::getMaxShaderStorageBufferSize() const
return maxShaderStorageBufferSize;
}
int OpenGL::getMaxComputeWorkGroupsX() const
{
return maxComputeWorkGroupsX;
}
int OpenGL::getMaxComputeWorkGroupsY() const
{
return maxComputeWorkGroupsY;
}
int OpenGL::getMaxComputeWorkGroupsZ() const
{
return maxComputeWorkGroupsZ;
}
int OpenGL::getMaxRenderTargets() const
{
return std::min(maxRenderTargets, MAX_COLOR_RENDER_TARGETS);
+11
View File
@@ -383,6 +383,14 @@ public:
**/
int getMaxShaderStorageBufferSize() const;
/**
* Returns the maximum number of compute work groups that can be
* dispatched in a given dimension.
*/
int getMaxComputeWorkGroupsX() const;
int getMaxComputeWorkGroupsY() const;
int getMaxComputeWorkGroupsZ() const;
/**
* Returns the maximum supported number of simultaneous render targets.
**/
@@ -467,6 +475,9 @@ private:
int maxTextureArrayLayers;
int maxTexelBufferSize;
int maxShaderStorageBufferSize;
int maxComputeWorkGroupsX;
int maxComputeWorkGroupsY;
int maxComputeWorkGroupsZ;
int maxRenderTargets;
int maxSamples;
int maxTextureUnits;