如何从 CPU 访问计算着色器本地工作组的大小?
How can I access the size of a Compute Shader's local work group from the CPU?
给定一个计算着色器,我已将每个维度的局部大小设置为值 x、y 和 z,我有什么方法可以从 C++ 代码访问该信息吗?即,
//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;
运行 环顾四周,我在 Khronos.org 上找到了以下关于 glGetProgramiv
的页面:
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.
这就是我需要的行
glGetProgramiv(ComputeShaderID, GL_COMPUTE_WORK_GROUP_SIZE, localWorkGroupSize);
其中 localWorkGroupSize
是一个包含 3 个整数的数组。
给定一个计算着色器,我已将每个维度的局部大小设置为值 x、y 和 z,我有什么方法可以从 C++ 代码访问该信息吗?即,
//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;
运行 环顾四周,我在 Khronos.org 上找到了以下关于 glGetProgramiv
的页面:
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.
这就是我需要的行
glGetProgramiv(ComputeShaderID, GL_COMPUTE_WORK_GROUP_SIZE, localWorkGroupSize);
其中 localWorkGroupSize
是一个包含 3 个整数的数组。