Implemented GL defines and extensions for NV mesh shaders

This commit is contained in:
Robert Osfield 2021-03-29 13:07:42 +01:00
parent 6e728811da
commit 95486bd392
3 changed files with 94 additions and 0 deletions

View File

@ -674,6 +674,76 @@ typedef char GLchar;
#define GL_ALPHA_TEST 0x0BC0 #define GL_ALPHA_TEST 0x0BC0
#endif #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 namespace osg
{ {
#ifndef GL_VERSION_3_2 #ifndef GL_VERSION_3_2

View File

@ -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 * glFogCoordPointer) (GLenum type, GLsizei stride, const GLvoid *pointer);
void (GL_APIENTRY * glSecondaryColorPointer) (GLint size, 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 glMaxTextureCoords;
GLint glMaxTextureUnits; GLint glMaxTextureUnits;

View File

@ -1305,6 +1305,19 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
osg::setGLExtensionFuncPtr(glObjectLabel, "glObjectLabel", validContext); 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 = "<<isMeshShaderSupported<<std::endl;
OSG_NOTICE<<"glDrawMeshTasksNV = "<<glDrawMeshTasksNV<<std::endl;
OSG_NOTICE<<"glDrawMeshTasksIndirectNV = "<<glDrawMeshTasksIndirectNV<<std::endl;
OSG_NOTICE<<"glMultiDrawMeshTasksIndirectNV = "<<glMultiDrawMeshTasksIndirectNV<<std::endl;
OSG_NOTICE<<"glMultiDrawMeshTasksIndirectCountNV = "<<glMultiDrawMeshTasksIndirectCountNV<<std::endl;
} }
GLExtensions::~GLExtensions() GLExtensions::~GLExtensions()