Android 获取计算着色器的最大工作组大小?
我正在写一个OpenGL ES 3.1程序,想知道我正在运行的设备(它在Android 6上运行)的最大工作组大小 对于PC查询Android 获取计算着色器的最大工作组大小?,android,opengl-es,compute-shader,Android,Opengl Es,Compute Shader,我正在写一个OpenGL ES 3.1程序,想知道我正在运行的设备(它在Android 6上运行)的最大工作组大小 对于PC查询GL\u MAX\u COMPUTE\u WORK\u GROUP\u COUNT和GL\u MAX\u COMPUTE\u WORK\u GROUP\u SIZE效果很好,但我似乎无法在Android上执行相同的操作,当我尝试类似的操作时,我会得到OpenGL错误:InvalidEnum OpenTK代码: int[] work_grp_cnt = new int[3
GL\u MAX\u COMPUTE\u WORK\u GROUP\u COUNT
和GL\u MAX\u COMPUTE\u WORK\u GROUP\u SIZE
效果很好,但我似乎无法在Android上执行相同的操作,当我尝试类似的操作时,我会得到OpenGL错误:InvalidEnum
OpenTK代码:
int[] work_grp_cnt = new int[3];
GL.GetInteger(All.MaxComputeWorkGroupCount, work_grp_cnt);
与本机Android API相同:
int[] work_grp_cnt = new int[3];
IntBuffer maxCount = IntBuffer.Allocate(3);
GLES20.GlGetIntegerv(GLES31.GlMaxComputeWorkGroupCount, maxCount);
maxCount.Get(work_grp_cnt);
(在这两种情况下,GLGetInteger都会引发相同的InvalidEnum错误)
这在OpenGL ES 3.1中可能吗?我使用的是C语言中的Sony Xperia Z5,您必须调用
glGetIntegeri\u v
,它带有索引。对于GL\u MAX\u COMPUTE\u WORK\u GROUP\u COUNT
,索引是要查询的维度。它一次只返回一个值
您需要找到并使用此函数的Java等价物。在C中,您必须调用带有索引的
glGetIntegeri\u v
。对于GL\u MAX\u COMPUTE\u WORK\u GROUP\u COUNT
,索引是要查询的维度。它一次只返回一个值
您需要找到并使用该函数的Java等价物。正如@NicolBoas指出的,我调用了错误的函数。工作代码如下: OpenTK:
GL.GetInteger(All.MaxComputeWorkGroupCount, 0, out work_grp_cnt[0]);
GL.GetInteger(All.MaxComputeWorkGroupCount, 1, out work_grp_cnt[1]);
GL.GetInteger(All.MaxComputeWorkGroupCount, 2, out work_grp_cnt[2]);
GL.GetInteger(All.MaxComputeWorkGroupSize, 0, out work_grp_size[0]);
GL.GetInteger(All.MaxComputeWorkGroupSize, 1, out work_grp_size[1]);
GL.GetInteger(All.MaxComputeWorkGroupSize, 2, out work_grp_size[2]);
本机Android:
GLES31.GlGetIntegeri_v(GLES31.GlMaxComputeWorkGroupCount, 0, work_grp_cnt, 0);
GLES31.GlGetIntegeri_v(GLES31.GlMaxComputeWorkGroupCount, 1, work_grp_cnt, 1);
GLES31.GlGetIntegeri_v(GLES31.GlMaxComputeWorkGroupCount, 2, work_grp_cnt, 2);
GLES31.GlGetIntegeri_v(GLES31.GlMaxComputeWorkGroupSize, 0, work_grp_size, 0);
GLES31.GlGetIntegeri_v(GLES31.GlMaxComputeWorkGroupSize, 1, work_grp_size, 1);
GLES31.GlGetIntegeri_v(GLES31.GlMaxComputeWorkGroupSize, 2, work_grp_size, 2);
正如@NicolBoas指出的,我调用了错误的函数。工作代码如下: OpenTK:
GL.GetInteger(All.MaxComputeWorkGroupCount, 0, out work_grp_cnt[0]);
GL.GetInteger(All.MaxComputeWorkGroupCount, 1, out work_grp_cnt[1]);
GL.GetInteger(All.MaxComputeWorkGroupCount, 2, out work_grp_cnt[2]);
GL.GetInteger(All.MaxComputeWorkGroupSize, 0, out work_grp_size[0]);
GL.GetInteger(All.MaxComputeWorkGroupSize, 1, out work_grp_size[1]);
GL.GetInteger(All.MaxComputeWorkGroupSize, 2, out work_grp_size[2]);
本机Android:
GLES31.GlGetIntegeri_v(GLES31.GlMaxComputeWorkGroupCount, 0, work_grp_cnt, 0);
GLES31.GlGetIntegeri_v(GLES31.GlMaxComputeWorkGroupCount, 1, work_grp_cnt, 1);
GLES31.GlGetIntegeri_v(GLES31.GlMaxComputeWorkGroupCount, 2, work_grp_cnt, 2);
GLES31.GlGetIntegeri_v(GLES31.GlMaxComputeWorkGroupSize, 0, work_grp_size, 0);
GLES31.GlGetIntegeri_v(GLES31.GlMaxComputeWorkGroupSize, 1, work_grp_size, 1);
GLES31.GlGetIntegeri_v(GLES31.GlMaxComputeWorkGroupSize, 2, work_grp_size, 2);
我已经添加了与我的函数相当的Java,这是相同的错误。错误也在OpenGL方面,这让我认为我调用了错误的API,而不是像你所建议的那样我的语法错误。这不是同一个函数。“我”部分很重要。谢谢,你说得对。我发布了工作代码作为另一个答案。我添加了与我的函数相当的Java,这是相同的错误。错误也在OpenGL方面,这让我认为我调用了错误的API,而不是像你所建议的那样我的语法错误。这不是同一个函数。“我”部分很重要。谢谢,你说得对。我发布了工作代码作为另一个答案。