diff --git a/include/osg/GLDefines b/include/osg/GLDefines index a413d639f..bcab84f29 100644 --- a/include/osg/GLDefines +++ b/include/osg/GLDefines @@ -674,6 +674,76 @@ typedef char GLchar; #define GL_ALPHA_TEST 0x0BC0 #endif +#ifndef GL_MESH_SHADER_NV + #define GL_MESH_SHADER_NV 0x9559 + #define GL_TASK_SHADER_NV 0x955A + + #define GL_MESH_UNIFORM_BLOCKS_NV 0x8E60 + #define GL_MESH_TEXTURE_IMAGE_UNITS_NV 0x8E61 + #define GL_MESH_IMAGE_UNIFORMS_NV 0x8E62 + #define GL_MESH_UNIFORM_COMPONENTS_NV 0x8E63 + #define GL_MESH_ATOMIC_COUNTER_BUFFERS_NV 0x8E64 + #define GL_MESH_ATOMIC_COUNTERS_NV 0x8E65 + #define GL_MESH_SHADER_STORAGE_BLOCKS_NV 0x8E66 + #define GL_COMBINED_MESH_UNIFORM_COMPONENTS_NV 0x8E67 + + #define GL_TASK_UNIFORM_BLOCKS_NV 0x8E68 + #define GL_TASK_TEXTURE_IMAGE_UNITS_NV 0x8E69 + #define GL_TASK_IMAGE_UNIFORMS_NV 0x8E6A + #define GL_TASK_UNIFORM_COMPONENTS_NV 0x8E6B + #define GL_TASK_ATOMIC_COUNTER_BUFFERS_NV 0x8E6C + #define GL_TASK_ATOMIC_COUNTERS_NV 0x8E6D + #define GL_TASK_SHADER_STORAGE_BLOCKS_NV 0x8E6E + #define GL_COMBINED_TASK_UNIFORM_COMPONENTS_NV 0x8E6F + + #define GL_MESH_WORK_GROUP_INVOCATIONS_NV 0x95A2 + #define GL_TASK_WORK_GROUP_INVOCATIONS_NV 0x95A3 + + #define GL_MESH_TOTAL_MEMORY_SIZE_NV 0x9536 + #define GL_TASK_TOTAL_MEMORY_SIZE_NV 0x9537 + + #define GL_MESH_OUTPUT_VERTICES_NV 0x9538 + #define GL_MESH_OUTPUT_PRIMITIVES_NV 0x9539 + + #define GL_TASK_OUTPUT_COUNT_NV 0x953A + + #define GL_DRAW_MESH_TASKS_COUNT_NV 0x953D + + #define GL_MESH_VIEWS_NV 0x9557 + + #define GL_MESH_OUTPUT_PER_VERTEX_GRANULARITY_NV 0x92DF + #define GL_MESH_OUTPUT_PER_PRIMITIVE_GRANULARITY_NV 0x9543 + + #define GL_MESH_WORK_GROUP_SIZE_NV 0x953B + #define GL_TASK_WORK_GROUP_SIZE_NV 0x953C + + #define GL_MESH_WORK_GROUP_SIZE_NV 0x953E + #define GL_TASK_WORK_GROUP_SIZE_NV 0x953F + + #define GL_MESH_VERTICES_OUT_NV 0x9579 + #define GL_MESH_PRIMITIVES_OUT_NV 0x957A + #define GL_MESH_OUTPUT_TYPE_NV 0x957B + + #define GL_UNIFORM_BLOCK_REFERENCED_BY_MESH_SHADER_NV 0x959C + #define GL_UNIFORM_BLOCK_REFERENCED_BY_TASK_SHADER_NV 0x959D + + #define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_MESH_SHADER_NV 0x959E + #define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TASK_SHADER_NV 0x959F + + #define GL_REFERENCED_BY_MESH_SHADER_NV 0x95A0 + #define GL_REFERENCED_BY_TASK_SHADER_NV 0x95A1 + + #define GL_MESH_SUBROUTINE_NV 0x957C + #define GL_TASK_SUBROUTINE_NV 0x957D + + #define GL_MESH_SUBROUTINE_UNIFORM_NV 0x957E + #define GL_TASK_SUBROUTINE_UNIFORM_NV 0x957F + + #define GL_MESH_SHADER_BIT_NV 0x00000040 + #define GL_TASK_SHADER_BIT_NV 0x00000080 +#endif + + namespace osg { #ifndef GL_VERSION_3_2 diff --git a/include/osg/GLExtensions b/include/osg/GLExtensions index dda2a5ed3..9e9da7f92 100644 --- a/include/osg/GLExtensions +++ b/include/osg/GLExtensions @@ -822,6 +822,17 @@ class OSG_EXPORT GLExtensions : public osg::Referenced void (GL_APIENTRY * glFogCoordPointer) (GLenum type, GLsizei stride, const GLvoid *pointer); void (GL_APIENTRY * glSecondaryColorPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); + + // Mesh shader extensions + bool isMeshShaderSupported; + + void (GL_APIENTRY * glDrawMeshTasksNV) (GLuint first, GLuint count); + void (GL_APIENTRY * glDrawMeshTasksIndirectNV) (GLintptr indirect); + void (GL_APIENTRY * glMultiDrawMeshTasksIndirectNV) (GLintptr indirect, GLsizei drawcount, GLsizei stride); + void (GL_APIENTRY * glMultiDrawMeshTasksIndirectCountNV) (GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); + + + // Max texture properties GLint glMaxTextureCoords; GLint glMaxTextureUnits; diff --git a/src/osg/GLExtensions.cpp b/src/osg/GLExtensions.cpp index e8f3eb67d..387f974bb 100644 --- a/src/osg/GLExtensions.cpp +++ b/src/osg/GLExtensions.cpp @@ -1305,6 +1305,19 @@ GLExtensions::GLExtensions(unsigned int in_contextID): osg::setGLExtensionFuncPtr(glObjectLabel, "glObjectLabel", validContext); + // Mesh shader extensions + isMeshShaderSupported = osg::isGLExtensionSupported(contextID, "GL_NV_mesh_shader"); + + osg::setGLExtensionFuncPtr(glDrawMeshTasksNV, "glDrawMeshTasksNV", validContext); + osg::setGLExtensionFuncPtr(glDrawMeshTasksIndirectNV, "glDrawMeshTasksIndirectNV", validContext); + osg::setGLExtensionFuncPtr(glMultiDrawMeshTasksIndirectNV, "glMultiDrawMeshTasksIndirectNV", validContext); + osg::setGLExtensionFuncPtr(glMultiDrawMeshTasksIndirectCountNV, "glMultiDrawMeshTasksIndirectCountNV", validContext); + + OSG_NOTICE<<"isMeshShaderSupported = "<