Forráskód Böngészése

added glMultiDrawElementsIndirect, glVertexAttribDivisor

ncannasse 7 éve
szülő
commit
f3f6de32f1
3 módosított fájl, 20 hozzáadás és 1 törlés
  1. 3 0
      libs/sdl/GLImports.h
  2. 10 1
      libs/sdl/gl.c
  3. 7 0
      libs/sdl/sdl/GL.hx

+ 3 - 0
libs/sdl/GLImports.h

@@ -53,6 +53,7 @@ GL_IMPORT(glGetShaderiv, GETSHADERIV);
 GL_IMPORT(glGetProgramiv, GETPROGRAMIV);
 GL_IMPORT(glGetProgramiv, GETPROGRAMIV);
 GL_IMPORT(glVertexAttribPointer, VERTEXATTRIBPOINTER);
 GL_IMPORT(glVertexAttribPointer, VERTEXATTRIBPOINTER);
 GL_IMPORT(glVertexAttribIPointer, VERTEXATTRIBIPOINTER);
 GL_IMPORT(glVertexAttribIPointer, VERTEXATTRIBIPOINTER);
+GL_IMPORT(glVertexAttribDivisor, VERTEXATTRIBDIVISOR);
 GL_IMPORT(glBindFragDataLocation, BINDFRAGDATALOCATION);
 GL_IMPORT(glBindFragDataLocation, BINDFRAGDATALOCATION);
 GL_IMPORT(glGenVertexArrays, GENVERTEXARRAYS);
 GL_IMPORT(glGenVertexArrays, GENVERTEXARRAYS);
 GL_IMPORT(glBindVertexArray, BINDVERTEXARRAY);
 GL_IMPORT(glBindVertexArray, BINDVERTEXARRAY);
@@ -67,6 +68,8 @@ GL_IMPORT(glGetQueryObjectiv, GETQUERYOBJECTIV);
 GL_IMPORT(glGetUniformBlockIndex, GETUNIFORMBLOCKINDEX);
 GL_IMPORT(glGetUniformBlockIndex, GETUNIFORMBLOCKINDEX);
 GL_IMPORT(glUniformBlockBinding, UNIFORMBLOCKBINDING);
 GL_IMPORT(glUniformBlockBinding, UNIFORMBLOCKBINDING);
 
 
+GL_IMPORT(glMultiDrawElementsIndirect, MULTIDRAWELEMENTSINDIRECT);
+
 #if !defined(HL_MESA)
 #if !defined(HL_MESA)
 GL_IMPORT(glGetQueryObjectui64v, GETQUERYOBJECTUI64V);
 GL_IMPORT(glGetQueryObjectui64v, GETQUERYOBJECTUI64V);
 GL_IMPORT(glQueryCounter, QUERYCOUNTER);
 GL_IMPORT(glQueryCounter, QUERYCOUNTER);

+ 10 - 1
libs/sdl/gl.c

@@ -467,6 +467,10 @@ HL_PRIM void HL_NAME(gl_vertex_attrib_ipointer)( int index, int size, int type,
 	glVertexAttribIPointer(index, size, type, stride, (void*)(int_val)position);
 	glVertexAttribIPointer(index, size, type, stride, (void*)(int_val)position);
 }
 }
 
 
+HL_PRIM void HL_NAME(gl_vertex_attrib_divisor)( int index, int divisor ) {
+	glVertexAttribDivisor(index, divisor);
+}
+
 HL_PRIM void HL_NAME(gl_delete_buffer)( vdynamic *b ) {
 HL_PRIM void HL_NAME(gl_delete_buffer)( vdynamic *b ) {
 	unsigned int bb = (unsigned)b->v.i;
 	unsigned int bb = (unsigned)b->v.i;
 	glDeleteBuffers(1, &bb);
 	glDeleteBuffers(1, &bb);
@@ -517,6 +521,10 @@ HL_PRIM void HL_NAME(gl_draw_arrays_instanced)( int mode, int first, int count,
 	glDrawArraysInstanced(mode,first,count,primcount);
 	glDrawArraysInstanced(mode,first,count,primcount);
 }
 }
 
 
+HL_PRIM void HL_NAME(gl_multi_draw_elements_indirect)( int mode, int type, vbyte *data, int count, int stride ) {
+	glMultiDrawElementsIndirect(mode, type, data, count, stride);
+}
+
 // queries
 // queries
 
 
 HL_PRIM vdynamic *HL_NAME(gl_create_query)() {
 HL_PRIM vdynamic *HL_NAME(gl_create_query)() {
@@ -676,10 +684,11 @@ DEFINE_PRIM(_VOID,gl_draw_elements,_I32 _I32 _I32 _I32);
 DEFINE_PRIM(_VOID,gl_draw_elements_instanced,_I32 _I32 _I32 _I32 _I32);
 DEFINE_PRIM(_VOID,gl_draw_elements_instanced,_I32 _I32 _I32 _I32 _I32);
 DEFINE_PRIM(_VOID,gl_draw_arrays,_I32 _I32 _I32);
 DEFINE_PRIM(_VOID,gl_draw_arrays,_I32 _I32 _I32);
 DEFINE_PRIM(_VOID,gl_draw_arrays_instanced,_I32 _I32 _I32 _I32);
 DEFINE_PRIM(_VOID,gl_draw_arrays_instanced,_I32 _I32 _I32 _I32);
+DEFINE_PRIM(_VOID,gl_multi_draw_elements_indirect, _I32 _I32 _BYTES _I32 _I32);
 DEFINE_PRIM(_NULL(_I32),gl_create_vertex_array,_NO_ARG);
 DEFINE_PRIM(_NULL(_I32),gl_create_vertex_array,_NO_ARG);
 DEFINE_PRIM(_VOID,gl_bind_vertex_array,_NULL(_I32));
 DEFINE_PRIM(_VOID,gl_bind_vertex_array,_NULL(_I32));
 DEFINE_PRIM(_VOID,gl_delete_vertex_array,_NULL(_I32));
 DEFINE_PRIM(_VOID,gl_delete_vertex_array,_NULL(_I32));
-
+DEFINE_PRIM(_VOID,gl_vertex_attrib_divisor,_I32 _I32);
 
 
 DEFINE_PRIM(_NULL(_I32), gl_create_query, _NO_ARG);
 DEFINE_PRIM(_NULL(_I32), gl_create_query, _NO_ARG);
 DEFINE_PRIM(_VOID, gl_delete_query, _NULL(_I32));
 DEFINE_PRIM(_VOID, gl_delete_query, _NULL(_I32));

+ 7 - 0
libs/sdl/sdl/GL.hx

@@ -314,6 +314,9 @@ class GL {
 	public static function vertexAttribIPointer( index : Int, size : Int, type : Int, stride : Int, position : Int ) {
 	public static function vertexAttribIPointer( index : Int, size : Int, type : Int, stride : Int, position : Int ) {
 	}
 	}
 
 
+	public static function vertexAttribDivisor( index : Int, divisor : Int ) {
+	}
+
 	public static function deleteBuffer( b : Buffer ) {
 	public static function deleteBuffer( b : Buffer ) {
 	}
 	}
 
 
@@ -349,6 +352,9 @@ class GL {
 
 
 	public static function drawArraysInstanced( mode : Int, start : Int, count : Int, primcount : Int ) {
 	public static function drawArraysInstanced( mode : Int, start : Int, count : Int, primcount : Int ) {
 	}
 	}
+	
+	public static function multiDrawElementsIndirect( mode : Int, type : Int, data : hl.Bytes, count : Int, stride : Int ) {
+	}
 
 
 	// queries
 	// queries
 
 
@@ -824,6 +830,7 @@ class GL {
 	public static inline var RENDERBUFFER                   = 0x8D41;
 	public static inline var RENDERBUFFER                   = 0x8D41;
 	public static inline var READ_FRAMEBUFFER               = 0x8CA8;
 	public static inline var READ_FRAMEBUFFER               = 0x8CA8;
 	public static inline var DRAW_FRAMEBUFFER               = 0x8CA9;
 	public static inline var DRAW_FRAMEBUFFER               = 0x8CA9;
+	public static inline var DRAW_INDIRECT_BUFFER			= 0x8F3F;
 
 
 	public static inline var RGBA4                          = 0x8056;
 	public static inline var RGBA4                          = 0x8056;
 	public static inline var RGB5_A1                        = 0x8057;
 	public static inline var RGB5_A1                        = 0x8057;