Reputation: 486
Given a compute shader where I have set the local size of each dimension to the values x, y and z, is there any way for me to access that information from the c++ code? ie,
//Pseudo Code c++
int size[3]
x = get local sizes from linked compute shader
print(x);
//GLSL Code
layout (local_size_x = a number, local_size_y = a number, local_size_z = a number) in;
Upvotes: 3
Views: 1390
Reputation: 486
Having run around looking, I found the following on Khronos.org, on its page concerning glGetProgramiv
, found here:
https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetProgramiv.xhtml
GL_COMPUTE_WORK_GROUP_SIZE params returns an array of three integers containing the local work group size of the compute program as specified by its input layout qualifier(s). program must be the name of a program object that has been previously linked successfully and contains a binary for the compute shader stage.
This makes the line I needed
glGetProgramiv(ComputeShaderID, GL_COMPUTE_WORK_GROUP_SIZE, localWorkGroupSize);
where localWorkGroupSize
is an array of 3 integers.
Upvotes: 4