%%	-*- erlang -*-
% general options

{skip,    %% Skip these functions
 [
  %%% GLU 
  "glu",  %% The ones we want is specified in keep
  "gluQuad",
  "gluBegin",
  "gluEnd", 
  "gluNew",
  "gluDelete",
%%  "gluTess",
%%  "gluGetNurbs",
%%  "gluGetTess",
  
  %%% GL 
  "glProgramCallbackMESA",
  "glGetProgramRegisterfvMESA",
  "glGetPointerv",
  "glGetBufferPointerv", 
  "glGetVertexAttribPointerv",
  "glGetSeparableFilter",
  "glMultiDrawElements",
  "glMapBuffer",
  "glUnmapBuffer",
  "glEdgeFlagPointerEXT",
  "glWeightPointerARB",
  "glMatrixIndexPointerARB",
  "glPixelTransformParameter", 
  %% OpengGL 4.3

  "glDebugMessageCallback",
  "glGetProgramResourceiv",
  "glObjectLabel",
  "glGetObjectLabel",
  "glGetObjectPtrLabel",

  %% OpengGL 4.5  TODO
  "glGetTransformFeedbacki",
  "glGetNamed",
  "glBlitNamed",
  "glCheckNamed",
  "glNamed",
  "glMapNamed",
  "glUnmapNamed",
  "glClearNamed",
  "glCopyNamed",
  "glFlushNamed",
  "glInvalidateNamed",
  "glGetTexture",
  "glGetCompressedTexture",
  "glCopyTexture",
  "glTextureParam",
  "glTextureStorage",
  "glTextureSubImage",
  "glGetVertexArray",


  %% ARB
  "glCreateSyncFromCLeventARB",  % _cl_context _cl_event ??
  "glDebugMessageCallbackARB",
  "glVertexAttribL1ui64ARB",
  "glVertexAttribL1ui64vARB",
  "glGetVertexAttribLui64vARB",

  "glUniformHandleui64vARB",
  "glProgramUniformHandleui64vARB",
  "glFramebufferSampleLocationsfvARB",
  "glSpecializeShader",

  "glGetn", %*
  "glReadnPixels", %*
  
  "glVertexP2",  %*
  "glVertexP3",  %*
  "glVertexP4",  %*
  "glTexCoordP1",  %*
  "glTexCoordP2",  %*
  "glTexCoordP3",  %*
  "glTexCoordP4",  %*
  "glMultiTexCoordP1",  %*
  "glMultiTexCoordP2",  %*
  "glMultiTexCoordP3",  %*
  "glMultiTexCoordP4",  %*
  "glNormalP3",  %*
  "glColorP3",  %*
  "glColorP4",  %*
  "glSecondaryColorP3",  %*
  "glVertexAttribP1",  %*
  "glVertexAttribP2",  %*
  "glVertexAttribP3",  %*
  "glVertexAttribP4",  %*

  %% Bad API don't know what to allocate needs to ask
  "glGetActiveSubroutineUniformiv",
  "glGetActiveAtomicCounterBufferiv",

  %% EXT
  "glPixelStorex", "glPixelMapx", "glGetPixelMapxv", % Strange

  %% By default skip these extensions
  "SGI", "SGIX","SGIS","NV","NVX", "ATI","AMD","SUN","SUNX","GREMEDY","OES", "OVR", "MESA",
  "HP","IBM","INGR", "INTEL","APPLE","3DFX","PGI","EXT"]}.

%% Exceptions to the above
{keep, 
 [
  %% GL_EXT_framebuffer_object
  "glIsRenderbufferEXT",
  "glBindRenderbufferEXT",
  "glDeleteRenderbuffersEXT",
  "glGenRenderbuffersEXT",
  "glRenderbufferStorageEXT",
  "glGetRenderbufferParameterivEXT",
  "glIsFramebufferEXT",
  "glBindFramebufferEXT",
  "glDeleteFramebuffersEXT",
  "glGenFramebuffersEXT",
  "glCheckFramebufferStatusEXT",
  "glFramebufferTexture1DEXT",
  "glFramebufferTexture2DEXT",
  "glFramebufferTexture3DEXT",
  "glFramebufferRenderbufferEXT",
  "glGetFramebufferAttachmentParameterivEXT",
  "glGenerateMipmapEXT",
  %% GL_ATI_separate_stencil
  "glStencilOpSeparateATI",
  "glStencilFuncSeparateATI",
  %% GL_EXT_depth_bounds_test
  "glDepthBoundsEXT",
  %% GL_EXT_blend_equation_separate
  "glBlendEquationSeparateEXT",
  %%  GL_EXT_framebuffer_blit
  "glBlitFramebufferEXT",
  %% GL_EXT_framebuffer_multisample
  "glRenderbufferStorageMultisampleEXT",
    
  "gluBuild", % mipmaps*
  "gluCheckExtension", "gluErrorString", "gluGetString",
  "gluLookAt", "gluOrtho2D", "gluPerspective", "gluPickMatrix", 
  "gluScaleImage",

  "gluNewQuadric", "gluDeleteQuadric",
  "gluQuadricTexture", "gluQuadricOrientation", "gluQuadricNormals", "gluQuadricDrawStyle",
  "gluDisk", "gluCylinder", "gluPartialDisk", "gluSphere",

  "gluProject",  "gluUnProject"
 ]}.

{vector, [{"glMultiTexCoord",1}, {"glVertexAttrib",1}, {"glVertexAttribI",1}]}.

%% function specific information

{"glBitmap", {"bitmap", {base,idx_binary}}}.
{"glPolygonStipple", {"mask", binary}}.
{"glGetPolygonStipple", [{"mask", [{binary, 128},out, {single,true}]}]}.
{"glClipPlane",    {"equation", {single,{tuple,4}}}}.
{"glGetClipPlane", {"equation", {single,{tuple,4}}}}.
{"glLoadMatrix", {"m", {single,{tuple,matrix}}}}.
{"glMultMatrix", {"m", {single,{tuple,matrix}}}}.
{"glCallLists",   [{"n",     {c_only, {length, "lists"}}}, 
		   {"type",  {c_only, {constant, "GL_UNSIGNED_INT"}}},
		   {"lists", [{single,list},{type,"GLuint"}, {base,int}]}]}.
{"glLight",    {"params", {single, {tuple,undefined}}}}.
{"glGetLight", {"params", {single, {tuple, 4}}}}.
{"glMaterial", {"params", {single,{tuple,undefined}}}}.
{"glGetMaterial", {"params", {single, {tuple, 4}}}}.
{"glPixelMap", {"values", binary}}.
{"glGetPixelMap", {"values", [{base,memory}, in]}}.
{"glTexGen",    {"params",{single,{tuple,undefined}}}}.
{"glGetTexGen", {"params",{single,{tuple,4}}}}.
{"glTexEnv",    {"params",{single,{tuple,undefined}}}}.
{"glGetTexEnv", {"params",{single,{tuple,4}}}}.
{"glTexParameter", {"params",{single,{tuple,undefined}}}}.
{"glGetTexParameter", {"params",{single,{tuple,4}}}}.
{"glGetTexLevelParameter", {"params", {single,{tuple,1}}}}.
{"glGenTextures", [{"textures", {single,{list,"n","n"}}}]}.
{"glDeleteTextures", [{"n",     {c_only, {length, "textures"}}}, 
		      {"textures", [{single,list}]}]}.
{"glPrioritizeTextures", [{"n",     {c_only, {length, "textures"}}},
			  {"textures", [{single,list}]},
			  {"priorities", [{single,list}]}]}.
{"glAreTexturesResident", [{"n", {c_only,{length,"textures"}}},
			   {"textures", [{single,list}]},
			   {"residences", [{single,{list,"n","n"}}]}]}.
{"glMap", {"points", binary}}.
{"glGetMap", {"v", [{base,memory},in]}}.
{"glFog", {"params", {single,{tuple,undefined}}}}.
{"glColorTableParameter", {"params",{single,{tuple,4}}}}.
{"glGetColorTable", {"table", [{base,memory},in]}}.
{"glGetColorTableParameter", {"params", {single,{tuple,4}}}}.
{"glGetHistogram", {"values", [{base,memory}, in]}}.
{"glGetHistogramParameter", {"params", {single,{tuple,1}}}}.
{"glGetMinmax", {"values", [{base,memory}, in]}}.
{"glGetMinmaxParameter", {"params", {single,{tuple,1}}}}.
{"glGetConvolutionFilter", {"image", [{base,memory}, in]}}.
{"glConvolutionParameter", {"params", {single,{tuple,undefined}} }}.
{"glGetConvolutionParameter", {"params", {single,{tuple,4}}}}.

{"glRect", [{"v1", {single,{tuple,2}}},{"v2", {single,{tuple,2}}}]}.

{"glGetString",   {"result", string}}.
{"glGetBooleanv", {"params", {single,{list,16}}}}.
{"glGetDoublev",  {"params", {single,{list,16}}}}.
{"glGetFloatv",   {"params", {single,{list,16}}}}.
{"glGetIntegerv", {"params", {single,{list,16}}}}.
{"glGetInteger64v", [{"params", {single,{list,16}}}, {"data", {single,{list,16}}}]}.

{"glFeedbackBuffer", {"buffer", [{base,memory}, in]}}.
{"glSelectBuffer",   {"buffer", [{base,memory}, in]}}.
{"glReadPixels",     {"pixels", [{base,memory}, in]}}.
{"glGetTexImage",    {"pixels", [{base,memory}, in]}}.
{"glGetCompressedTexImage", {"img", [{base,memory}, in]}}.

{"glLoadTransposeMatrix", {"m", {single,{tuple,matrix}}}}.
{"glMultTransposeMatrix", {"m",{single,{tuple,matrix}}}}.


{"glMultiDrawArraysIndirect", []}.
{"glMultiDrawArraysIndirectCount", []}.

{"glMultiDrawArrays", [{"first", [in,{single,list}, list_binary]},
		       {"count", [in,{single,list}, list_binary]},
		       {"primcount", {c_only, {length,"count","first"}}},
                       {"drawcount", {c_only, {length,"count","first"}}}
                      ]}.

{"glGenQueries", {"ids", {single,{list, "n", "n"}}}}.
{"glGetQueryiv", {"params", {single, true}}}.
{"glGetQueryObject", {"params", {single, true}}}.

{"glPointParameter", {"params", {single,{tuple,undefined}} }}.
{"glDeleteQueries", [{"n",{c_only,{length,"ids"}}},{"ids",[{single,list}]}]}.
{"glGenBuffers", {"buffers",[{single,{list,"n","n"}}]}}.
{"glGetBufferSubData", {"data", [{base,memory}, in]}}.
{"glGetBufferParameteriv", {"params", {single,true}}}.
{"glDeleteBuffers", [{"n",{c_only,{length,"buffers"}}},{"buffers",[{single,list}]}]}.
{"glDrawBuffers",   [{"n",{c_only,{length,"bufs"}}},{"bufs",[{single,list}]}]}.

{"glShaderSource", [{"length", {c_only,{constant,"NULL"}}},
		    {"count",  {c_only,{length,"string"}}},
		    {"string", {single,list}}]}.

{"glGetActiveAttribARB", [{"length",[skip,{single, true}]},
			  {"size",  {single, true}},
			  {"type",  {single, true}},
			  {"name",  {string,"maxLength","length"}}
			 ]}.

{"glGetActiveAttrib", [{"length",[skip,{single, true}]},
		       {"size",  {single, true}},
		       {"type",  {single, true}},
		       {"name",  {string,"bufSize","length"}}
		      ]}.

{"glGetActiveUniformARB", [{"length",[skip,{single, true}]},
			   {"size",  {single, true}},
			   {"type",  {single, true}},
			   {"name",  {string,"maxLength","length"}}
			  ]}.
{"glGetActiveUniform", [{"length",[skip,{single, true}]},
			{"size",  {single, true}},
			{"type",  {single, true}},
			{"name",  {string,"bufSize","length"}}
		       ]}.

{"glGetAttachedShaders", [{"count", [skip,{single,true}]},
			  {"obj", {single, {list,"maxCount","count"}}},
                          {"shaders", {single, {list,"maxCount","count"}}}
			 ]}.

{"glGetProgramiv", {"params", {single,true}}}.

{"glGetProgramInfoLog", [{"length", [skip,{single,true}]},
			 {"infoLog", {string,"bufSize","length"}}
			]}.
{"glGetShaderiv", {"params", {single,true}}}.
{"glGetShaderInfoLog", [{"length", [skip,{single,true}]},
			{"infoLog", {string,"bufSize","length"}}
		       ]}.

{"glGetShaderSourceARB", [{"length", [skip,{single,true}]},
			  {"source", {string,"maxLength","length"}}
			 ]}.
{"glGetShaderSource", [{"length", [skip,{single,true}]},
		       {"source", {string,"bufSize","length"}}
		      ]}.


{"glGetUniform", {"params", {single,{tuple,16}}}}.
{"glGetVertexAttrib", {"params", {single,{tuple,4}}}}.

{"glUniform1", [{"count",{c_only,{length,"value"}}}, {"value", [{single,list}]}]}.
{"glUniform2", [{"count",{c_only,{length,"value"}}}, {"value", [{single,{tuple_list,2}}]}]}.
{"glUniform3", [{"count",{c_only,{length,"value"}}}, {"value", [{single,{tuple_list,3}}]}]}.
{"glUniform4", [{"count",{c_only,{length,"value"}}}, {"value", [{single,{tuple_list,4}}]}]}.
{"glUniformMatrix2fv",   [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,4}}]}]}.
{"glUniformMatrix3fv",   [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,9}}]}]}.
{"glUniformMatrix4fv",   [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,16}}]}]}.
{"glUniformMatrix2x3fv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,6}}]}]}.
{"glUniformMatrix3x2fv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,6}}]}]}.
{"glUniformMatrix2x4fv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,8}}]}]}.
{"glUniformMatrix4x2fv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,8}}]}]}.
{"glUniformMatrix3x4fv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,12}}]}]}.
{"glUniformMatrix4x3fv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,12}}]}]}.
{"glVertexAttrib4", {"v", {single, {tuple,4}}}}.


{"glWeight", [{"size",{c_only,{length,"weights"}}}, {"weights", {single,list}}]}.
{"glMatrixIndex", [{"size",{c_only,{length,"indices"}}}, {"indices", {single,list}}]}.


{"glProgramStringARB", [{"len",{c_only,{size,"string"}}},
			{"string",[{base,string},{single,true}]}]}.
{"glGetProgramStringARB", {"string", [in,{base,memory}]}}.
{"glGenProgramsARB", {"programs", {single,{list,"n","n"}}}}.
{"glDeleteProgramsARB", [{"n",{c_only,{length,"programs"}}},{"programs",{single,list}}]}.
{"glProgramEnvParameter4", {"params", {single,{tuple,4}}}}.
{"glGetProgramEnvParameter", {"params", {single,{tuple,4}}}}.
{"glProgramLocalParameter", {"params", {single,{tuple,4}}}}.
{"glGetProgramLocalParameter", {"params", {single,{tuple,4}}}}.
{"glGetObjectParameter", {"params", {single,true}}}.
{"glGetInfoLogARB", [{"length", [skip,{single,true}]},
		     {"infoLog", {string,"maxLength","length"}}
		    ]}.
{"glGetAttachedObjectsARB", [{"count", [skip,{single,true}]},
			     {"obj", {single, {list,"maxCount","count"}}}
			    ]}.

{"glGenRenderbuffersEXT", {"renderbuffers", {single,{list,"n","n"}}}}.
{"glDeleteRenderbuffersEXT",[{"n",{c_only,{length,"renderbuffers"}}},{"renderbuffers",{single,list}}]}.
{"glDeleteFramebuffersEXT", [{"n",{c_only,{length,"framebuffers"}}},{"framebuffers",{single,list}}]}.
{"glGetRenderbufferParameterivEXT", {"params", {single,true}}}.

{"glGetFramebufferAttachmentParameterivEXT", {"params",{single,true}}}.
{"glGenFramebuffersEXT", {"framebuffers",{single,{list,"n","n"}}}}.

{"gluPickMatrix", {"viewport", [in, {single, {tuple, 4}}]}}.
{"gluProject",   [{"model", {single, {tuple, matrix}}},
		  {"proj", {single, {tuple, matrix}}},
		  {"view", {single, {tuple, 4}}},
		  {"winX", [{single,true},out]},
		  {"winY", [{single,true},out]},
		  {"winZ", [{single,true},out]}]}.
{"gluUnProject", [{"model", {single, {tuple, matrix}}},
		  {"proj", {single, {tuple, matrix}}},
		  {"view", {single, {tuple, 4}}},
		  {"objX",[{single,true},out]},
		  {"objY",[{single,true},out]},
		  {"objZ",[{single,true},out]},
		  {"objW",[{single,true},out]}]}. 
{"gluBuild", {"data", [binary]}}.
{"gluScaleImage", [{"dataIn", [in, binary]}, {"dataOut", [in, {base, memory}]}]}.
{"gluCheckExtension", [{"extName", string}, 
		       {"extString", string}]}.
{"gluErrorString", {"result", string}}.
{"gluGetString", {"result", string}}.

{"gluDeleteQuadric", {"quad", in}}.
{"gluQuadric",     {"quad", in}}.
{"gluSphere",      {"quad", in}}.
{"gluPartialDisk", {"quad", in}}.
{"gluDisk",        {"quad", in}}.
{"gluCylinder",    {"quad", in}}.

%% OpenGL 3.0 and later
{"glGetBooleani_v", {"data", {single,{list,16}}}}.
{"glGetIntegeri_v", {"data", {single,{list,16}}}}.
{"glGetFloati_v",   {"data", {single,{list,16}}}}.
{"glGetDoublei_v",   {"data", {single,{list,16}}}}.
{"glGetInteger64i_v", {"data", {single,{list,16}}}}.

{"glGetBufferParameteriv", {"params", {single,{list,16}}}}.
{"glGetBufferParameteri64v", {"params", {single,{list,16}}}}.

{"glTransformFeedbackVaryings", [{"count", {c_only,{length,"varyings"}}},
				 {"varyings", [{base,string}, {single,list}]}]}.
{"glGetTransformFeedbackVarying", [{"size", {single, true}},{"type", {single, true}},
				   {"length", [skip, {single, true}]},
				   {"name", {string,"bufSize","length"}}]}.

{"glGenRenderbuffers", {"renderbuffers", {single,{list,"n","n"}}}}.
{"glGenFramebuffers", {"framebuffers",{single,{list,"n","n"}}}}.
{"glGetRenderbufferParameteriv", {"params", {single,true}}}.
{"glGetFramebufferAttachmentParameteriv", {"params",{single,true}}}.
{"glGenVertexArrays", {"arrays", {single, {list,"n","n"}}}}.
{"glGenRenderbuffers", {"renderbuffers", {single,{list,"n","n"}}}}.
{"glDeleteRenderbuffers",[{"n",{c_only,{length,"renderbuffers"}}},
			  {"renderbuffers",{single,list}}]}.
{"glDeleteFramebuffers", [{"n",{c_only,{length,"framebuffers"}}},
			  {"framebuffers",{single,list}}]}.
{"glVertexAttribI4", {"v", {single, {tuple,4}}}}.
%% {"glVertexAttribI4", {"v", }}.
%% {"glVertexAttribI4ubv", {"v", }}.
%% {"glVertexAttribI4usv", {"v", }}.
{"glClearBuffer", {"value", {single, {tuple, undefined}}}}.
{"glDeleteVertexArrays", [{"n",{c_only,{length,"arrays"}}},{"arrays", {single, list}}]}.

{"glGetUniformIndices", [{"uniformCount", {c_only, {length, "uniformNames"}}},
			 {"uniformNames", [{base,string}, {single,list}]},
			 {"uniformIndices", [out, {single,{list, "uniformCount", "uniformCount"}}]}]}.
{"glGetActiveUniformsiv", [{"uniformCount", {c_only, {length, "uniformIndices"}}},
			   {"uniformIndices", {single,list}},
			   {"params", [out, {single, {list, "uniformCount", "uniformCount"}}]}]}.

{"glGetActiveUniformName", [{"length",[skip,{single, true}]},
			    {"uniformName", {string,"bufSize","length"}}]}.
{"glGetActiveUniformBlockName", [{"length",[skip,{single, true}]},
				 {"uniformBlockName", {string,"bufSize","length"}}]}.
{"glGetActiveUniformBlockiv", {"params", [in, {base,memory}]}}.


{"glGetSynciv", [{"values", {single, {list, "bufSize","length"}}},
		 {"length", [skip,{single, true}]}]}.

{"glGetMultisamplefv", {"val", [out, {single, {tuple,2}}]}}.


{"glNamedStringARB", [{"stringlen", {c_only, {size, "string"}}},
		      {"namelen", {c_only, {size, "name"}}}]}.
{"glDeleteNamedStringARB", [{"namelen", {c_only, {size, "name"}}}]}.
{"glIsNamedStringARB", [{"namelen", {c_only, {size, "name"}}}]}.
{"glGetNamedStringARB",[{"namelen", {c_only, {size, "name"}}},
			{"stringlen",[skip,{single, true}]},
			{"string", {string,"bufSize","stringlen"}}]}.
{"glGetNamedStringivARB",[{"namelen", {c_only, {size, "name"}}},
			  {"params",  [out, {single, true}]}]}.
{"glCompileShaderIncludeARB", [{"length", {c_only,{constant,"NULL"}}},
			       {"count",  {c_only,{length,"path"}}},
			       {"path", {single,list}}]}.


{"glGenSamplers", {"samplers", {single, {list,"count","count"}}}}.
{"glDeleteSamplers", [{"count", {c_only, {length, "samplers"}}}, 
		      {"samplers", {single, list}}]}.
{"glGetSamplerParameter", {"params", {single, {list, 4}}}}.
{"glSamplerParameterI", {"param", {single, list}}}.
{"glSamplerParameterfv", {"param", {single, list}}}.
{"glSamplerParameteriv", {"param", {single, list}}}.

%{"glGetActiveSubroutineUniformiv", {"values", }}.
{"glGetActiveSubroutineUniformName", [{"length",[skip,{single, true}]},
				      {"name", {string,"bufsize","length"}}]}.
{"glGetActiveSubroutineName", [{"length",[skip,{single, true}]},
			       {"name", {string,"bufsize","length"}}]}.
{"glGetProgramStageiv", {"values", {single, true}}}.
{"glUniformSubroutinesuiv", [{"count",{c_only,{length,"indices"}}},{"indices", {single, list}}]}.

{"glGenTransformFeedbacks", {"ids", {single, {list,"n","n"}}}}.
{"glDeleteTransformFeedbacks", [{"n", {c_only, {length, "ids"}}},
				{"ids", {single, list}}]}.

{"glPatchParameterfv", {"values", {single, list}}}.


{"glGetQueryIndexediv", {"params", {single, true} }}.
{"glShaderBinary", [{"count", {c_only, {length, "shaders"}}},
		    {"length", {c_only, {size, "binary"}}},
		    {"shaders", {single, list}},
		    {"binary", binary}
		   ]}.
{"glGetShaderPrecisionFormat", [{"range", {single, {tuple, 2}}},
				{"precision", {single, true}}]}.

{"glGetProgramBinary", [{"length",[skip,{single, true}]},
			{"binary", [out, {binary, "bufSize", "length"}]},
			{"binaryFormat", {single, true}}]}.
{"glProgramBinary", [{"binary", binary}, {"length", {c_only, {size, "binary"}}}]}.

{"glGenProgramPipelines", {"pipelines", {single, {list,"n","n"}}}}.
{"glDeleteProgramPipelines", [{"n", {c_only, {length, "pipelines"}}}, 
			      {"pipelines", {single, list}}]}.

{"glCreateShaderProgramv", [{"count", {c_only, {length, "strings"}}},
			    {"strings", {single, list}}]}.
{"glGetProgramPipelineInfoLog", [{"length", [skip,{single, true}]},
				 {"infoLog", {string,"bufSize","length"}}]}.
{"glGetProgramPipelineiv", {"params", {single, true}}}.


%% {"glCreateSyncFromCLeventARB", {"context", }}.

{"glDebugMessageControl", [{"count", {c_only, {length, "ids"}}},
 			      {"ids", {single, list}}]}.
{"glDebugMessageInsert", {"length", {c_only, {size, "buf"}}}}.

{"glGetDebugMessageLog", [{"sources", {single, {list, "count", "result"}}},
                          {"types", {single, {list, "count", "result"}}},
                          {"ids", {single, {list, "count", "result"}}},
                          {"severities", {single, {list, "count", "result"}}},
                          {"lengths", [{c_only, undefined}, {single, {list, "count", "result"}}]},
                          {"messageLog", [
                                          {single, {list, "count", "result", "lengths"}},
                                          {size, "bufSize"}
                                         ]}]}.


{"glUniformMatrix2dv",   [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,4}}]}]}.
{"glUniformMatrix3dv",   [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,9}}]}]}.
{"glUniformMatrix4dv",   [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,16}}]}]}.
{"glUniformMatrix2x3dv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,6}}]}]}.
{"glUniformMatrix3x2dv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,6}}]}]}.
{"glUniformMatrix2x4dv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,8}}]}]}.
{"glUniformMatrix4x2dv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,8}}]}]}.
{"glUniformMatrix3x4dv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,12}}]}]}.
{"glUniformMatrix4x3dv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,12}}]}]}.

{"glProgramUniform1", [{"count",{c_only,{length,"value"}}}, {"value", [{single,list}]}]}.
{"glProgramUniform2", [{"count",{c_only,{length,"value"}}}, {"value", [{single,{tuple_list,2}}]}]}.
{"glProgramUniform3", [{"count",{c_only,{length,"value"}}}, {"value", [{single,{tuple_list,3}}]}]}.
{"glProgramUniform4", [{"count",{c_only,{length,"value"}}}, {"value", [{single,{tuple_list,4}}]}]}.

{"glProgramUniformMatrix2fv",   [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,4}}]}]}.
{"glProgramUniformMatrix2dv",   [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,4}}]}]}.
{"glProgramUniformMatrix3dv",   [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,9}}]}]}.
{"glProgramUniformMatrix3fv",   [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,9}}]}]}.
{"glProgramUniformMatrix4dv",   [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,16}}]}]}.
{"glProgramUniformMatrix4fv",   [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,16}}]}]}.
{"glProgramUniformMatrix2x3fv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,6}}]}]}.
{"glProgramUniformMatrix3x2fv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,6}}]}]}.
{"glProgramUniformMatrix2x4fv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,8}}]}]}.
{"glProgramUniformMatrix4x2fv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,8}}]}]}.
{"glProgramUniformMatrix3x4fv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,12}}]}]}.
{"glProgramUniformMatrix4x3fv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,12}}]}]}.

{"glProgramUniformMatrix2x3dv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,6}}]}]}.
{"glProgramUniformMatrix3x2dv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,6}}]}]}.
{"glProgramUniformMatrix2x4dv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,8}}]}]}.
{"glProgramUniformMatrix4x2dv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,8}}]}]}.
{"glProgramUniformMatrix3x4dv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,12}}]}]}.
{"glProgramUniformMatrix4x3dv", [{"count",{c_only,{length,"value"}}},{"value", [{single,{tuple_list,12}}]}]}.

{"glViewportArrayv", [{"count",{c_only,{length,"v"}}}, {"v", [{single,{tuple_list,4}}]}]}.
{"glViewportIndexedfv", {"v", {single,{tuple,4}}}}.
{"glScissorArrayv", [{"count",{c_only,{length,"v"}}}, {"v", [{single,{tuple_list,4}}]}]}.
{"glScissorIndexedv", {"v", {single,{tuple,4}}}}.
{"glDepthRangeArrayv", [{"count",{c_only,{length,"v"}}}, {"v", [{single,{tuple_list,2}}]}]}.

{"glGetInternalformativ", {"params", [out, {single, {list, "bufSize", "bufSize"}}]}}.

%% OpenGL 4.3
{"glGetInternalformati64v", {"params", [out, {single, {list, "bufSize", "bufSize"}}]}}.
{"glGetFramebufferParameteriv", {"params", {single,true}}}.
{"glGetProgramInterfaceiv", {"params", {single,true}}}.
{"glGetProgramResourceName", [{"name",  {string,"bufSize","length"}},
                              {"length", [{single, true}, {c_only, {constant, "NULL"}}]}]}.
{"glInvalidateFramebuffer", [{"numAttachments",{c_only,{length,"attachments"}}},{"attachments", {single,list}}]}.
{"glInvalidateSubFramebuffer", [{"numAttachments",{c_only,{length,"attachments"}}},{"attachments", {single,list}}]}.
{"glBindBuffersBase", [{"count",{c_only,{length,"buffers"}}},{"buffers", {single,list}}]}.
{"glBindBuffersRange", [{"count",{c_only,{length,"buffers"}}},{"buffers", {single,list}},
                        {"offsets", {single,list}},{"sizes", {single,list}}]}.
{"glBindTextures", [{"count",{c_only,{length,"textures"}}},{"textures", {single,list}}]}.
{"glBindSamplers", [{"count",{c_only,{length,"samplers"}}},{"samplers", {single,list}}]}.
{"glBindImageTextures", [{"count",{c_only,{length,"textures"}}},{"textures", {single,list}}]}.
{"glBindVertexBuffers", [{"count",{c_only,{length,"buffers"}}},{"buffers", {single,list}},
                         {"offsets", {single,list}},{"strides", {single,list}}]}.
{"glVertexArrayVertexBuffers", [{"count",{c_only,{length,"buffers"}}},{"buffers", {single,list}},
                                {"offsets", {single,list}},{"strides", {single,list}}]}.

%% OpenGL 4.4

{"glCreateBuffers", {"buffers",[{single,{list,"n","n"}}]}}.
{"glCreateTextures", {"textures", {single,{list,"n","n"}}}}.
{"glCreateProgramPipelines", {"pipelines", {single, {list,"n","n"}}}}.
{"glCreateQueries", {"ids", {single,{list, "n", "n"}}}}.
{"glCreateSamplers", {"samplers", {single, {list,"n","n"}}}}.
{"glCreateVertexArrays", {"arrays", {single, {list,"n","n"}}}}.
{"glCreateTransformFeedbacks", {"ids", {single, {list,"n","n"}}}}.
{"glCreateFramebuffers", {"framebuffers",{single,{list,"n","n"}}}}.
{"glCreateRenderbuffers", {"renderbuffers", {single,{list,"n","n"}}}}.

%% OpenGL 4.5
%% Mostly skipped see above
