public static void PrintGPUInfo() { string versionOpenGL = GL.GetString(StringName.Version); Console.Out.WriteLine("GL version:" + versionOpenGL); int[] work_grp_cnt = new int[3]; int[] work_grp_size = new int[3]; int maxComputeWorkGroupInvocations; #if __WINDOWS__ int version; GL.GetInteger(GetPName.MajorVersion, out version); if (version < 4) { throw new NotSupportedException("You need at least OpenGL 4 to run on Desktop!"); } GetIndexedPName maxWorkGroupCount = (GetIndexedPName)All.MaxComputeWorkGroupCount; GL.GetInteger(maxWorkGroupCount, 0, out work_grp_cnt[0]); GL.GetInteger(maxWorkGroupCount, 1, out work_grp_cnt[1]); GL.GetInteger(maxWorkGroupCount, 2, out work_grp_cnt[2]); GetIndexedPName maxComputeGroupSize = (GetIndexedPName)All.MaxComputeWorkGroupSize; GL.GetInteger(maxComputeGroupSize, 0, out work_grp_size[0]); GL.GetInteger(maxComputeGroupSize, 1, out work_grp_size[1]); GL.GetInteger(maxComputeGroupSize, 2, out work_grp_size[2]); GL.GetInteger((GetPName)All.MaxComputeWorkGroupInvocations, out maxComputeWorkGroupInvocations); #else /* According to Quallcomm docs: * * GL_MAX_COMPUTE_WORK_GROUP_COUNT is guaranteed that the limit will not be less than 65535 in any of the * three dimensions. * * GL_MAX_COMPUTE_WORK_GROUP_SIZE The maximum size is guaranteed to be at least 128 in the case of the x and y * dimensions, and 64 in the case of z * * GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS is guaranteed to be no lower than 128. */ OpenTK.Graphics.ES31.GL.GetInteger(OpenTK.Graphics.ES31.All.MaxComputeWorkGroupCount, 0, out work_grp_cnt[0]); OpenTK.Graphics.ES31.GL.GetInteger(OpenTK.Graphics.ES31.All.MaxComputeWorkGroupCount, 1, out work_grp_cnt[1]); OpenTK.Graphics.ES31.GL.GetInteger(OpenTK.Graphics.ES31.All.MaxComputeWorkGroupCount, 2, out work_grp_cnt[2]); OpenTK.Graphics.ES31.GL.GetInteger(OpenTK.Graphics.ES31.All.MaxComputeWorkGroupSize, 0, out work_grp_size[0]); OpenTK.Graphics.ES31.GL.GetInteger(OpenTK.Graphics.ES31.All.MaxComputeWorkGroupSize, 1, out work_grp_size[1]); OpenTK.Graphics.ES31.GL.GetInteger(OpenTK.Graphics.ES31.All.MaxComputeWorkGroupSize, 2, out work_grp_size[2]); OpenTK.Graphics.ES31.GL.GetInteger(OpenTK.Graphics.ES31.All.MaxComputeWorkGroupInvocations, out maxComputeWorkGroupInvocations); #endif Console.Out.WriteLine("max global (total) work group size " + string.Join(",", work_grp_cnt)); Console.Out.WriteLine("max local (in one shader) work group sizes " + string.Join(",", work_grp_size)); Console.Out.WriteLine("max total local workgroup elements " + maxComputeWorkGroupInvocations); }
internal static int GetInt32(GetIndexedPName pname, int index) { int result; try { using (Lock()) GL.GetInteger(pname, index, out result); } catch (Exception exception) { throw new InvalidOperationException("Exception thrown with GetInt32(GetIndexedPName." + pname + ")", exception); } return(result); }
internal static Vector3i GetVector3i(GetIndexedPName pname) { Vector3i result; using (Lock()) { GL.GetInteger(pname, 0, out result.X); GL.GetInteger(pname, 1, out result.Y); GL.GetInteger(pname, 2, out result.Z); } return result; }
internal static int GetInt32(GetIndexedPName pname, int index) { int result; try { using (Lock()) GL.GetInteger(pname, index, out result); } catch (Exception exception) { throw new InvalidOperationException("Exception thrown with GetInt32(GetIndexedPName." + pname + ")", exception); } return result; }