Browse Source

SDL/GL: Add various missing GL features, expose relative mouse motion events. (#117)

Colby Klein 7 years ago
parent
commit
dd5a67fd49
5 changed files with 190 additions and 1 deletions
  1. 12 0
      libs/sdl/GLImports.h
  2. 94 0
      libs/sdl/gl.c
  3. 5 1
      libs/sdl/sdl.c
  4. 2 0
      libs/sdl/sdl/Event.hx
  5. 77 0
      libs/sdl/sdl/GL.hx

+ 12 - 0
libs/sdl/GLImports.h

@@ -18,28 +18,39 @@ GL_IMPORT(glCompileShader, COMPILESHADER);
 GL_IMPORT(glDeleteShader, DELETESHADER);
 GL_IMPORT(glGetShaderInfoLog, GETSHADERINFOLOG);
 GL_IMPORT(glGenerateMipmap, GENERATEMIPMAP);
+GL_IMPORT(glDispatchCompute, DISPATCHCOMPUTE);
+GL_IMPORT(glBlitFramebuffer, BLITFRAMEBUFFER);
 GL_IMPORT(glGenFramebuffers, GENFRAMEBUFFERS);
 GL_IMPORT(glBindFramebuffer, BINDFRAMEBUFFER);
+GL_IMPORT(glFramebufferTexture, FRAMEBUFFERTEXTURE);
 GL_IMPORT(glFramebufferTexture2D, FRAMEBUFFERTEXTURE2D);
 GL_IMPORT(glDeleteFramebuffers, DELETEFRAMEBUFFERS);
 GL_IMPORT(glGenRenderbuffers, GENRENDERBUFFERS);
 GL_IMPORT(glBindRenderbuffer, BINDRENDERBUFFER);
+GL_IMPORT(glTexImage2DMultisample, TEXIMAGE2DMULTISAMPLE);
 GL_IMPORT(glRenderbufferStorage, RENDERBUFFERSTORAGE);
+GL_IMPORT(glRenderbufferStorageMultisample, RENDERBUFFERSTORAGEMULTISAMPLE);
 GL_IMPORT(glFramebufferRenderbuffer, FRAMEBUFFERRENDERBUFFER);
 GL_IMPORT(glDeleteRenderbuffers, DELETERENDERBUFFERS);
 GL_IMPORT(glGenBuffers, GENBUFFERS);
 GL_IMPORT(glDrawBuffers, DRAWBUFFERS);
+GL_IMPORT(glDrawArraysInstanced, DRAWARRAYSINSTANCED);
+GL_IMPORT(glDrawElementsInstanced, DRAWELEMENTSINSTANCED);
 GL_IMPORT(glBindBuffer, BINDBUFFER);
+GL_IMPORT(glBindBufferBase, BINDBUFFERBASE);
 GL_IMPORT(glBufferData, BUFFERDATA);
 GL_IMPORT(glBufferSubData, BUFFERSUBDATA);
 GL_IMPORT(glEnableVertexAttribArray, ENABLEVERTEXATTRIBARRAY);
 GL_IMPORT(glDisableVertexAttribArray, DISABLEVERTEXATTRIBARRAY);
 GL_IMPORT(glDeleteBuffers, DELETEBUFFERS);
+GL_IMPORT(glMemoryBarrier, MEMORYBARRIER);
+GL_IMPORT(glBindImageTexture, BINDIMAGETEXTURE);
 GL_IMPORT(glUniform1i, UNIFORM1I);
 GL_IMPORT(glUniform4fv, UNIFORM4FV);
 GL_IMPORT(glGetShaderiv, GETSHADERIV);
 GL_IMPORT(glGetProgramiv, GETPROGRAMIV);
 GL_IMPORT(glVertexAttribPointer, VERTEXATTRIBPOINTER);
+GL_IMPORT(glVertexAttribIPointer, VERTEXATTRIBIPOINTER);
 GL_IMPORT(glBindFragDataLocation, BINDFRAGDATALOCATION);
 GL_IMPORT(glGenVertexArrays, GENVERTEXARRAYS);
 GL_IMPORT(glBindVertexArray, BINDVERTEXARRAY);
@@ -60,6 +71,7 @@ GL_IMPORT(glQueryCounter, QUERYCOUNTER);
 #if defined(_WIN32) || defined(HL_NX)
 GL_IMPORT(glBlendEquation, BLENDEQUATION);
 GL_IMPORT(glActiveTexture, ACTIVETEXTURE);
+GL_IMPORT(glTexImage3D, TEXIMAGE3D);
 #endif
 
 #if defined(HL_NX)

+ 94 - 0
libs/sdl/gl.c

@@ -150,6 +150,10 @@ HL_PRIM vbyte *HL_NAME(gl_get_string)(int name) {
 
 // state changes
 
+HL_PRIM void HL_NAME(gl_polygon_mode)(int face, int mode) {
+	glPolygonMode(face, mode);
+}
+
 HL_PRIM void HL_NAME(gl_enable)( int feature ) {
 	GLOG("%d",feature);
 	glEnable(feature);
@@ -363,6 +367,17 @@ HL_PRIM void HL_NAME(gl_bind_texture)( int t, vdynamic *texture ) {
 	glBindTexture(t, ZIDX(texture));
 }
 
+HL_PRIM void HL_NAME(gl_bind_image_texture)( int unit, int texture, int level, bool layered, int layer, int access, int format ) {
+#	if !defined(HL_IOS) && !defined(HL_TVOS) && !defined(HL_MAC)
+	glBindImageTexture(unit, texture, level, layered, layer, access, format);
+#	endif
+}
+
+HL_PRIM void HL_NAME(gl_tex_parameterf)( int t, int key, float value ) {
+	GLOG("%d,%d,%d",t,key,value);
+	glTexParameterf(t, key, value);
+}
+
 HL_PRIM void HL_NAME(gl_tex_parameteri)( int t, int key, int value ) {
 	GLOG("%d,%d,%d",t,key,value);
 	glTexParameteri(t, key, value);
@@ -373,6 +388,16 @@ HL_PRIM void HL_NAME(gl_tex_image2d)( int target, int level, int internalFormat,
 	glTexImage2D(target, level, internalFormat, width, height, border, format, type, image);
 }
 
+HL_PRIM void HL_NAME(gl_tex_image3d)( int target, int level, int internalFormat, int width, int height, int depth, int border, int format, int type, vbyte *image ) {
+	GLOG("%d,%d,%d,%d,%d,%d,%d,%d,%s",target,level,internalFormat,width,height,border,format,type,hexlog(image,16));
+	glTexImage3D(target, level, internalFormat, width, height, depth, border, format, type, image);
+}
+
+HL_PRIM void HL_NAME(gl_tex_image2d_multisample)( int target, int samples, int internalFormat, int width, int height, bool fixedsamplelocations) {
+	GLOG("%d,%d,%d,%d,%d,%d",target,samples,internalFormat,width,height,fixedsamplelocations);
+	glTexImage2DMultisample(target, samples, internalFormat, width, height, fixedsamplelocations);
+}
+
 HL_PRIM void HL_NAME(gl_generate_mipmap)( int t ) {
 	GLOG("%d",t);
 	glGenerateMipmap(t);
@@ -386,6 +411,10 @@ HL_PRIM void HL_NAME(gl_delete_texture)( vdynamic *t ) {
 
 // framebuffer
 
+HL_PRIM void HL_NAME(gl_blit_framebuffer)(int src_x0, int src_y0, int src_x1, int src_y1, int dst_x0, int dst_y0, int dst_x1, int dst_y1, int mask, int filter) {
+	glBlitFramebuffer(src_x0, src_y0, src_x1, src_y1, dst_x0, dst_y0, dst_x1, dst_y1, mask, filter);
+}
+
 HL_PRIM vdynamic *HL_NAME(gl_create_framebuffer)() {
 	unsigned int f = 0;
 	glGenFramebuffers(1, &f);
@@ -407,6 +436,11 @@ HL_PRIM void HL_NAME(gl_bind_framebuffer)( int target, vdynamic *f ) {
 	glBindFramebuffer(target, id);
 }
 
+HL_PRIM void HL_NAME(gl_framebuffer_texture)( int target, int attach, vdynamic *t, int level ) {
+	GLOG("%d,%d,%d,%d,%d",target,attach,ZIDX(t),level);
+	glFramebufferTexture(target, attach, ZIDX(t), level);
+}
+
 HL_PRIM void HL_NAME(gl_framebuffer_texture2d)( int target, int attach, int texTarget, vdynamic *t, int level ) {
 	GLOG("%d,%d,%d,%d,%d",target,attach,texTarget,ZIDX(t),level);
 	glFramebufferTexture2D(target, attach, texTarget, ZIDX(t), level);
@@ -461,6 +495,12 @@ HL_PRIM void HL_NAME(gl_renderbuffer_storage)( int target, int format, int width
 	glRenderbufferStorage(target, format, width, height);
 }
 
+
+HL_PRIM void HL_NAME(gl_renderbuffer_storage_multisample)( int target, int samples, int format, int width, int height ) {
+	GLOG("%d,%d,%d,%d,%d",target,samples,format,width,height);
+	glRenderbufferStorageMultisample(target, samples, format, width, height);
+}
+
 HL_PRIM void HL_NAME(gl_framebuffer_renderbuffer)( int frameTarget, int attach, int renderTarget, vdynamic *b ) {
 	GLOG("%d,%d,%d,%d",frameTarget,attach,renderTarget,ZIDX(b));
 	glFramebufferRenderbuffer(frameTarget, attach, renderTarget, ZIDX(b));
@@ -486,6 +526,11 @@ HL_PRIM void HL_NAME(gl_bind_buffer)( int target, vdynamic *b ) {
 	glBindBuffer(target, ZIDX(b));
 }
 
+HL_PRIM void HL_NAME(gl_bind_buffer_base)( int target, int index, vdynamic *b ) {
+	GLOG("%d,%d",target,ZIDX(b));
+	glBindBufferBase(target, index, ZIDX(b));
+}
+
 HL_PRIM void HL_NAME(gl_buffer_data_size)( int target, int size, int param ) {
 	GLOG("%d,%d,%d",target,size,param);
 	glBufferData(target, size, NULL, param);
@@ -516,6 +561,11 @@ HL_PRIM void HL_NAME(gl_vertex_attrib_pointer)( int index, int size, int type, b
 	glVertexAttribPointer(index, size, type, normalized, stride, (void*)(int_val)position);
 }
 
+HL_PRIM void HL_NAME(gl_vertex_attrib_ipointer)( int index, int size, int type, int stride, int position ) {
+	GLOG("%d,%d,%d,%d,%d",index,size,type,stride,position);
+	glVertexAttribIPointer(index, size, type, stride, (void*)(int_val)position);
+}
+
 HL_PRIM void HL_NAME(gl_delete_buffer)( vdynamic *b ) {
 	unsigned int bb = (unsigned)b->v.i;
 	GLOG("%d",bb);
@@ -548,6 +598,20 @@ HL_PRIM void HL_NAME(gl_uniform4fv)( vdynamic *u, vbyte *buffer, int bufPos, int
 	glUniform4fv(u->v.i, count, (float*)buffer + bufPos);
 }
 
+// compute
+HL_PRIM void HL_NAME(gl_dispatch_compute)( int num_groups_x, int num_groups_y, int num_groups_z ) {
+	GLOG("%d,%d,%d",num_groups_x,num_groups_y,num_groups_z);
+#	if !defined(HL_IOS) && !defined(HL_TVOS) && !defined(HL_MAC)
+	glDispatchCompute(num_groups_x, num_groups_y, num_groups_z);
+#	endif
+}
+
+HL_PRIM void HL_NAME(gl_memory_barrier)( int barriers ) {
+#	if !defined(HL_IOS) && !defined(HL_TVOS) && !defined(HL_MAC)
+	glMemoryBarrier(barriers);
+#	endif
+}
+
 // draw
 
 HL_PRIM void HL_NAME(gl_draw_elements)( int mode, int count, int type, int start ) {
@@ -555,6 +619,21 @@ HL_PRIM void HL_NAME(gl_draw_elements)( int mode, int count, int type, int start
 	glDrawElements(mode, count, type, (void*)(int_val)start);
 }
 
+HL_PRIM void HL_NAME(gl_draw_arrays)( int mode, int first, int count, int start ) {
+	GLOG("%d,%d,%d",mode,first,count);
+	glDrawArrays(mode,first,count);
+}
+
+HL_PRIM void HL_NAME(gl_draw_elements_instanced)( int mode, int count, int type, int start, int primcount ) {
+	GLOG("%d,%d,%d,%d,%d",mode,count,type,start,primcount);
+	glDrawElementsInstanced(mode,count,type,(void*)(int_val)start,primcount);
+}
+
+HL_PRIM void HL_NAME(gl_draw_arrays_instanced)( int mode, int first, int count, int start, int primcount ) {
+	GLOG("%d,%d,%d,%d",mode,first,count,primcount);
+	glDrawArraysInstanced(mode,first,count,primcount);
+}
+
 // queries
 
 HL_PRIM vdynamic *HL_NAME(gl_create_query)() {
@@ -631,6 +710,7 @@ DEFINE_PRIM(_VOID,gl_finish,_NO_ARG);
 DEFINE_PRIM(_VOID,gl_flush,_NO_ARG);
 DEFINE_PRIM(_VOID,gl_pixel_storei,_I32 _I32);
 DEFINE_PRIM(_BYTES,gl_get_string,_I32);
+DEFINE_PRIM(_VOID,gl_polygon_mode,_I32 _I32);
 DEFINE_PRIM(_VOID,gl_enable,_I32);
 DEFINE_PRIM(_VOID,gl_disable,_I32);
 DEFINE_PRIM(_VOID,gl_cull_face,_I32);
@@ -664,11 +744,16 @@ DEFINE_PRIM(_NULL(_I32),gl_create_texture,_NO_ARG);
 DEFINE_PRIM(_VOID,gl_active_texture,_I32);
 DEFINE_PRIM(_VOID,gl_bind_texture,_I32 _NULL(_I32));
 DEFINE_PRIM(_VOID,gl_tex_parameteri,_I32 _I32 _I32);
+DEFINE_PRIM(_VOID,gl_tex_parameterf,_I32 _I32 _F32);
 DEFINE_PRIM(_VOID,gl_tex_image2d,_I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _BYTES);
+DEFINE_PRIM(_VOID,gl_tex_image3d,_I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _BYTES);
+DEFINE_PRIM(_VOID,gl_tex_image2d_multisample,_I32 _I32 _I32 _I32 _I32 _BOOL);
 DEFINE_PRIM(_VOID,gl_generate_mipmap,_I32);
 DEFINE_PRIM(_VOID,gl_delete_texture,_NULL(_I32));
+DEFINE_PRIM(_VOID,gl_blit_framebuffer,_I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32);
 DEFINE_PRIM(_NULL(_I32),gl_create_framebuffer,_NO_ARG);
 DEFINE_PRIM(_VOID,gl_bind_framebuffer,_I32 _NULL(_I32));
+DEFINE_PRIM(_VOID,gl_framebuffer_texture,_I32 _I32 _NULL(_I32) _I32);
 DEFINE_PRIM(_VOID,gl_framebuffer_texture2d,_I32 _I32 _I32 _NULL(_I32) _I32);
 DEFINE_PRIM(_VOID,gl_delete_framebuffer,_NULL(_I32));
 DEFINE_PRIM(_VOID,gl_read_pixels,_I32 _I32 _I32 _I32 _I32 _I32 _BYTES);
@@ -677,20 +762,29 @@ DEFINE_PRIM(_VOID,gl_draw_buffers,_I32 _BYTES);
 DEFINE_PRIM(_NULL(_I32),gl_create_renderbuffer,_NO_ARG);
 DEFINE_PRIM(_VOID,gl_bind_renderbuffer,_I32 _NULL(_I32));
 DEFINE_PRIM(_VOID,gl_renderbuffer_storage,_I32 _I32 _I32 _I32);
+DEFINE_PRIM(_VOID,gl_renderbuffer_storage_multisample,_I32 _I32 _I32 _I32 _I32);
 DEFINE_PRIM(_VOID,gl_framebuffer_renderbuffer,_I32 _I32 _I32 _NULL(_I32));
 DEFINE_PRIM(_VOID,gl_delete_renderbuffer,_NULL(_I32));
 DEFINE_PRIM(_NULL(_I32),gl_create_buffer,_NO_ARG);
 DEFINE_PRIM(_VOID,gl_bind_buffer,_I32 _NULL(_I32));
+DEFINE_PRIM(_VOID,gl_bind_buffer_base,_I32 _I32 _NULL(_I32));
 DEFINE_PRIM(_VOID,gl_buffer_data_size,_I32 _I32 _I32);
 DEFINE_PRIM(_VOID,gl_buffer_data,_I32 _I32 _BYTES _I32);
 DEFINE_PRIM(_VOID,gl_buffer_sub_data,_I32 _I32 _BYTES _I32 _I32);
 DEFINE_PRIM(_VOID,gl_enable_vertex_attrib_array,_I32);
 DEFINE_PRIM(_VOID,gl_disable_vertex_attrib_array,_I32);
 DEFINE_PRIM(_VOID,gl_vertex_attrib_pointer,_I32 _I32 _I32 _BOOL _I32 _I32);
+DEFINE_PRIM(_VOID,gl_vertex_attrib_ipointer,_I32 _I32 _I32 _I32 _I32);
 DEFINE_PRIM(_VOID,gl_delete_buffer,_NULL(_I32));
 DEFINE_PRIM(_VOID,gl_uniform1i,_NULL(_I32) _I32);
 DEFINE_PRIM(_VOID,gl_uniform4fv,_NULL(_I32) _BYTES _I32 _I32);
+DEFINE_PRIM(_VOID,gl_bind_image_texture,_I32 _I32 _I32 _BOOL _I32 _I32 _I32);
+DEFINE_PRIM(_VOID,gl_dispatch_compute,_I32 _I32 _I32);
+DEFINE_PRIM(_VOID,gl_memory_barrier,_I32);
 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_arrays,_I32 _I32 _I32);
+DEFINE_PRIM(_VOID,gl_draw_arrays_instanced,_I32 _I32 _I32 _I32);
 DEFINE_PRIM(_NULL(_I32),gl_create_vertex_array,_NO_ARG);
 DEFINE_PRIM(_VOID,gl_bind_vertex_array,_NULL(_I32));
 DEFINE_PRIM(_VOID,gl_delete_vertex_array,_NULL(_I32));

+ 5 - 1
libs/sdl/sdl.c

@@ -69,6 +69,8 @@ typedef struct {
 	event_type type;
 	int mouseX;
 	int mouseY;
+	int mouseXRel;
+	int mouseYRel;
 	int button;
 	int wheelDelta;
 	ws_change state;
@@ -139,6 +141,8 @@ HL_PRIM bool HL_NAME(event_loop)( event_data *event ) {
 			event->type = MouseMove;
 			event->mouseX = e.motion.x;
 			event->mouseY = e.motion.y;
+			event->mouseXRel = e.motion.xrel;
+			event->mouseYRel = e.motion.yrel;
 			break;
 		case SDL_KEYDOWN:
 			event->type = KeyDown;
@@ -348,7 +352,7 @@ HL_PRIM const char *HL_NAME(detect_keyboard_layout)() {
 
 DEFINE_PRIM(_BOOL, init_once, _NO_ARG);
 DEFINE_PRIM(_VOID, gl_options, _I32 _I32 _I32 _I32 _I32 _I32);
-DEFINE_PRIM(_BOOL, event_loop, _OBJ(_I32 _I32 _I32 _I32 _I32 _I32 _I32 _BOOL _I32 _I32 _I32) );
+DEFINE_PRIM(_BOOL, event_loop, _OBJ(_I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _BOOL _I32 _I32 _I32) );
 DEFINE_PRIM(_VOID, quit, _NO_ARG);
 DEFINE_PRIM(_VOID, delay, _I32);
 DEFINE_PRIM(_I32, get_screen_width, _NO_ARG);

+ 2 - 0
libs/sdl/sdl/Event.hx

@@ -4,6 +4,8 @@ package sdl;
 	public var type : EventType;
 	public var mouseX : Int;
 	public var mouseY : Int;
+	public var mouseXRel : Int;
+	public var mouseYRel : Int;
 	public var button : Int;
 	public var wheelDelta : Int;
 	public var state : WindowStateChange;

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

@@ -82,6 +82,9 @@ class GL {
 
 	// state changes
 
+	public static function polygonMode( face : Int, mode : Int ) {
+	}
+
 	public static function enable( feature : Int ) {
 	}
 
@@ -202,10 +205,21 @@ class GL {
 	public static function texParameteri( t : Int, key : Int, value : Int ) {
 	}
 
+	public static function texParameterf( t : Int, key : Int, value : hl.F32 ) {
+	}
+
 	@:hlNative("sdl","gl_tex_image2d")
 	public static function texImage2D( target : Int, level : Int, internalFormat : Int, width : Int, height : Int, border : Int, format : Int, type : Int, image : hl.Bytes ) {
 	}
 
+	@:hlNative("sdl","gl_tex_image3d")
+	public static function texImage3D( target : Int, level : Int, internalFormat : Int, width : Int, height : Int, depth : Int, border : Int, format : Int, type : Int, image : hl.Bytes ) {
+	}
+
+	@:hlNative("sdl","gl_tex_image2d_multisample")
+	public static function texImage2DMultisample( target : Int, internalFormat : Int, samples : Int, width : Int, height : Int, fixedsamplelocations : Bool ) {
+	}
+
 	public static function generateMipmap( t : Int ) {
 	}
 
@@ -214,6 +228,9 @@ class GL {
 
 	// framebuffer
 
+	public static function blitFramebuffer( src_x0 : Int, src_y0 : Int, src_x1 : Int, src_y1 : Int, dst_x0 : Int, dst_y0 : Int, dst_x1 : Int, dst_y1 : Int, mask : Int, filter : Int ) {
+	}
+
 	public static function createFramebuffer() : Framebuffer {
 		return null;
 	}
@@ -225,6 +242,9 @@ class GL {
 	public static function framebufferTexture2D( target : Int, attach : Int, texTarget : Int, t : Texture, level : Int ) {
 	}
 
+	public static function framebufferTexture( target : Int, attach : Int, t : Texture, level : Int ) {
+	}
+
 	public static function deleteFramebuffer( f : Framebuffer ) {
 	}
 
@@ -249,6 +269,9 @@ class GL {
 	public static function renderbufferStorage( target : Int, format : Int, width : Int, height : Int ) {
 	}
 
+	public static function renderbufferStorageMultisample( target : Int, samples : Int, format : Int, width : Int, height : Int ) {
+	}
+
 	public static function framebufferRenderbuffer( frameTarget : Int, attach : Int, renderTarget : Int, b : Renderbuffer ) {
 	}
 
@@ -261,6 +284,9 @@ class GL {
 		return null;
 	}
 
+	public static function bindBufferBase( target : Int, index : Int, buffer : Buffer ) {
+	}
+
 	public static function bindBuffer( target : Int, b : Buffer ) {
 	}
 
@@ -282,6 +308,9 @@ class GL {
 	public static function vertexAttribPointer( index : Int, size : Int, type : Int, normalized : Bool, stride : Int, position : Int ) {
 	}
 
+	public static function vertexAttribIPointer( index : Int, size : Int, type : Int, stride : Int, position : Int ) {
+	}
+
 	public static function deleteBuffer( b : Buffer ) {
 	}
 
@@ -293,11 +322,28 @@ class GL {
 	public static function uniform4fv( u : Uniform, buffer : hl.Bytes, bufPos : Int, count : Int ) {
 	}
 
+	// compute
+
+	public static function dispatchCompute( num_groups_x : Int, num_groups_y : Int, num_groups_z : Int ) {
+	}
+
+	public static function memoryBarrier( barrier : Int ) {
+	}
+
 	// draw
 
 	public static function drawElements( mode : Int, count : Int, type : Int, start : Int ) {
 	}
 
+	public static function drawElementsInstanced( mode : Int, count : Int, type : Int, start : Int, primcount : Int ) {
+	}
+
+	public static function drawArrays( mode : Int, start : Int, count : Int ) {
+	}
+
+	public static function drawArraysInstanced( mode : Int, start : Int, count : Int, primcount : Int ) {
+	}
+
 	// queries
 
 	public static function createQuery() : Query {
@@ -406,6 +452,9 @@ class GL {
 	public static inline var ELEMENT_ARRAY_BUFFER           = 0x8893;
 	public static inline var ARRAY_BUFFER_BINDING           = 0x8894;
 	public static inline var ELEMENT_ARRAY_BUFFER_BINDING   = 0x8895;
+	public static inline var SHADER_STORAGE_BUFFER          = 0x90D2;
+	public static inline var UNIFORM_BUFFER                 = 0x8A11;
+	public static inline var QUERY_BUFFER                   = 0x9192;
 
 	public static inline var STREAM_DRAW                    = 0x88E0;
 	public static inline var STATIC_DRAW                    = 0x88E4;
@@ -421,6 +470,11 @@ class GL {
 	public static inline var BACK                           = 0x0405;
 	public static inline var FRONT_AND_BACK                 = 0x0408;
 
+	/* PolygonMode */
+	public static inline var POINT                          = 0x1B00;
+	public static inline var LINE                           = 0x1B01;
+	public static inline var FILL                           = 0x1B02;
+
 	/* DepthFunction */
 	/*      NEVER */
 	/*      LESS */
@@ -566,6 +620,7 @@ class GL {
 	public static inline var FRAGMENT_SHADER                  = 0x8B30;
 	public static inline var VERTEX_SHADER                    = 0x8B31;
 	public static inline var GEOMETRY_SHADER                  = 0x8DD9;
+	public static inline var COMPUTE_SHADER                   = 0x91B9;
 	public static inline var MAX_VERTEX_ATTRIBS               = 0x8869;
 	public static inline var MAX_VERTEX_UNIFORM_VECTORS       = 0x8DFB;
 	public static inline var MAX_VARYING_VECTORS              = 0x8DFC;
@@ -628,8 +683,11 @@ class GL {
 
 	/* TextureTarget */
 	public static inline var TEXTURE_2D                     = 0x0DE1;
+	public static inline var TEXTURE_2D_MULTISAMPLE         = 0x9100;
+	public static inline var TEXTURE_3D                     = 0x806F;
 	public static inline var TEXTURE                        = 0x1702;
 
+	public static inline var TEXTURE_CUBE_MAP_SEAMLESS      = 0x884F;
 	public static inline var TEXTURE_CUBE_MAP               = 0x8513;
 	public static inline var TEXTURE_BINDING_CUBE_MAP       = 0x8514;
 	public static inline var TEXTURE_CUBE_MAP_POSITIVE_X    = 0x8515;
@@ -724,6 +782,8 @@ class GL {
 	/* GLFramebuffer Object. */
 	public static inline var FRAMEBUFFER                    = 0x8D40;
 	public static inline var RENDERBUFFER                   = 0x8D41;
+	public static inline var READ_FRAMEBUFFER               = 0x8CA8;
+	public static inline var DRAW_FRAMEBUFFER               = 0x8CA9;
 
 	public static inline var RGBA4                          = 0x8056;
 	public static inline var RGB5_A1                        = 0x8057;
@@ -779,4 +839,21 @@ class GL {
 	public static inline var SAMPLES_PASSED                 = 0x8914;
 	public static inline var TIMESTAMP                      = 0x8E28;
 
+	/* Barriers */
+	public static inline var VERTEX_ATTRIB_ARRAY_BARRIER_BIT = 0x00000001;
+	public static inline var ELEMENT_ARRAY_BARRIER_BIT       = 0x00000002;
+	public static inline var UNIFORM_BARRIER_BIT             = 0x00000004;
+	public static inline var TEXTURE_FETCH_BARRIER_BIT       = 0x00000008;
+	public static inline var SHADER_IMAGE_ACCESS_BARRIER_BIT = 0x00000020;
+	public static inline var COMMAND_BARRIER_BIT             = 0x00000040;
+	public static inline var PIXEL_BUFFER_BARRIER_BIT        = 0x00000080;
+	public static inline var TEXTURE_UPDATE_BARRIER_BIT      = 0x00000100;
+	public static inline var BUFFER_UPDATE_BARRIER_BIT       = 0x00000200;
+	public static inline var FRAMEBUFFER_BARRIER_BIT         = 0x00000400;
+	public static inline var TRANSFORM_FEEDBACK_BARRIER_BIT  = 0x00000800;
+	public static inline var ATOMIC_COUNTER_BARRIER_BIT      = 0x00001000;
+	public static inline var SHADER_STORAGE_BARRIER_BIT      = 0x00002000;
+	public static inline var QUERY_BUFFER_BARRIER_BIT        = 0x00008000;
+	public static inline var ALL_BARRIER_BITS                = 0xFFFFFFFF;
+
 }