From 3095a03ec3cb1f05b49362327d10a767299d7635 Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 1 Jul 2014 14:23:00 +0200 Subject: Synchronised files and solved compilaton errors --- xorg-server/hw/xwin/glx/genheaders.py | 26 +- xorg-server/hw/xwin/glx/gl.xml | 1750 +++++++++---- xorg-server/hw/xwin/glx/reg.py | 2 +- xorg-server/hw/xwin/glx/wgl.xml | 7 +- xorg-server/hw/xwin/glx/wglext.h | 4 +- xorg-server/hw/xwin/swrastwgl_dri/swrastwgl_dri.c | 2820 ++++++++++++++++++--- 6 files changed, 3792 insertions(+), 817 deletions(-) (limited to 'xorg-server') diff --git a/xorg-server/hw/xwin/glx/genheaders.py b/xorg-server/hw/xwin/glx/genheaders.py index baaf93de9..78a4a4321 100644 --- a/xorg-server/hw/xwin/glx/genheaders.py +++ b/xorg-server/hw/xwin/glx/genheaders.py @@ -130,7 +130,8 @@ allVersions = allExtensions = '.*' noVersions = noExtensions = None gl12andLaterPat = '1\.[2-9]|[234]\.[0-9]' gles2onlyPat = '2\.[0-9]' -gles2and3Pat = '[23]\.[0-9]' +gles2and30Pat = '2\.[0-9]|3.0' +gles2and30and31Pat = '2.[0-9]|3.[01]' es1CorePat = makeREstring(es1CoreList) # Extensions in old glcorearb.h but not yet tagged accordingly in gl.xml glCoreARBPat = None @@ -360,7 +361,7 @@ buildList = [ apicall = 'GL_APICALL ', apientry = 'GL_APIENTRY ', apientryp = 'GL_APIENTRYP '), - # GLES 2.0 extensions - GLES2/gl2ext.h + # GLES 3.1 / 3.0 / 2.0 extensions - GLES2/gl2ext.h CGeneratorOptions( filename = 'GLES2/gl2ext.h', apiname = 'gles2', @@ -379,12 +380,31 @@ buildList = [ apicall = 'GL_APICALL ', apientry = 'GL_APIENTRY ', apientryp = 'GL_APIENTRYP '), + # GLES 3.1 API - GLES3/gl31.h (no function pointers) + CGeneratorOptions( + filename = 'GLES3/gl31.h', + apiname = 'gles2', + profile = 'common', + versions = gles2and30and31Pat, + emitversions = allVersions, + defaultExtensions = None, # No default extensions + addExtensions = None, + removeExtensions = None, + prefixText = prefixStrings + gles3PlatformStrings + genDateCommentString, + genFuncPointers = False, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = False, # Core ES API functions are in the static link libraries + protectProtoStr = 'GL_GLEXT_PROTOTYPES', + apicall = 'GL_APICALL ', + apientry = 'GL_APIENTRY ', + apientryp = 'GL_APIENTRYP '), # GLES 3.0 API - GLES3/gl3.h (no function pointers) CGeneratorOptions( filename = 'GLES3/gl3.h', apiname = 'gles2', profile = 'common', - versions = gles2and3Pat, + versions = gles2and30Pat, emitversions = allVersions, defaultExtensions = None, # No default extensions addExtensions = None, diff --git a/xorg-server/hw/xwin/glx/gl.xml b/xorg-server/hw/xwin/glx/gl.xml index 669ff8d26..7f46d566c 100644 --- a/xorg-server/hw/xwin/glx/gl.xml +++ b/xorg-server/hw/xwin/glx/gl.xml @@ -1726,9 +1726,11 @@ typedef unsigned int GLhandleARB; + + @@ -1990,8 +1992,11 @@ typedef unsigned int GLhandleARB; + + + @@ -2078,6 +2083,7 @@ typedef unsigned int GLhandleARB; + @@ -2132,8 +2138,11 @@ typedef unsigned int GLhandleARB; + + + @@ -2364,6 +2373,7 @@ typedef unsigned int GLhandleARB; + @@ -2379,6 +2389,7 @@ typedef unsigned int GLhandleARB; + @@ -2430,7 +2441,8 @@ typedef unsigned int GLhandleARB; - + + @@ -2725,9 +2737,11 @@ typedef unsigned int GLhandleARB; + - + + @@ -2807,6 +2821,7 @@ typedef unsigned int GLhandleARB; + @@ -2938,9 +2953,7 @@ typedef unsigned int GLhandleARB; - - - + @@ -3334,7 +3347,7 @@ typedef unsigned int GLhandleARB; - + @@ -3411,7 +3424,7 @@ typedef unsigned int GLhandleARB; - + @@ -3458,6 +3471,7 @@ typedef unsigned int GLhandleARB; + @@ -3506,7 +3520,7 @@ typedef unsigned int GLhandleARB; - + @@ -3526,13 +3540,13 @@ typedef unsigned int GLhandleARB; - + - + @@ -3651,7 +3665,7 @@ typedef unsigned int GLhandleARB; - + @@ -3662,7 +3676,7 @@ typedef unsigned int GLhandleARB; - + @@ -3708,7 +3722,7 @@ typedef unsigned int GLhandleARB; - + @@ -3734,8 +3748,8 @@ typedef unsigned int GLhandleARB; - - + + @@ -3767,7 +3781,7 @@ typedef unsigned int GLhandleARB; - + @@ -3842,8 +3856,10 @@ typedef unsigned int GLhandleARB; + + @@ -3925,7 +3941,7 @@ typedef unsigned int GLhandleARB; - + @@ -3933,7 +3949,7 @@ typedef unsigned int GLhandleARB; - + @@ -3977,9 +3993,13 @@ typedef unsigned int GLhandleARB; + + + + @@ -3997,7 +4017,8 @@ typedef unsigned int GLhandleARB; - + + @@ -4049,7 +4070,7 @@ typedef unsigned int GLhandleARB; - + @@ -4130,10 +4151,12 @@ typedef unsigned int GLhandleARB; - + - + + + @@ -4142,7 +4165,7 @@ typedef unsigned int GLhandleARB; - + @@ -4158,7 +4181,7 @@ typedef unsigned int GLhandleARB; - + @@ -4191,7 +4214,7 @@ typedef unsigned int GLhandleARB; - + @@ -4216,13 +4239,13 @@ typedef unsigned int GLhandleARB; - + - + @@ -4248,7 +4271,7 @@ typedef unsigned int GLhandleARB; - + @@ -4320,21 +4343,25 @@ typedef unsigned int GLhandleARB; - + - + - + + + - + - + + + @@ -4462,7 +4489,7 @@ typedef unsigned int GLhandleARB; - + @@ -4623,7 +4650,7 @@ typedef unsigned int GLhandleARB; - + @@ -4736,7 +4763,7 @@ typedef unsigned int GLhandleARB; - + @@ -4765,14 +4792,14 @@ typedef unsigned int GLhandleARB; - + - + @@ -4805,14 +4832,14 @@ typedef unsigned int GLhandleARB; - + - + - + @@ -4943,7 +4970,9 @@ typedef unsigned int GLhandleARB; - + + + @@ -4983,7 +5012,7 @@ typedef unsigned int GLhandleARB; - + @@ -5136,7 +5165,7 @@ typedef unsigned int GLhandleARB; - + @@ -5164,7 +5193,7 @@ typedef unsigned int GLhandleARB; - + @@ -5201,7 +5230,7 @@ typedef unsigned int GLhandleARB; - + @@ -5352,7 +5381,7 @@ typedef unsigned int GLhandleARB; - + @@ -5406,7 +5435,7 @@ typedef unsigned int GLhandleARB; - + @@ -5494,13 +5523,13 @@ typedef unsigned int GLhandleARB; - + - + - + @@ -5589,9 +5618,11 @@ typedef unsigned int GLhandleARB; - + + + @@ -5606,15 +5637,16 @@ typedef unsigned int GLhandleARB; - + - + + @@ -5744,14 +5776,14 @@ typedef unsigned int GLhandleARB; - + - + @@ -5810,13 +5842,16 @@ typedef unsigned int GLhandleARB; - + - + + + + @@ -5922,7 +5957,7 @@ typedef unsigned int GLhandleARB; - + @@ -5944,9 +5979,13 @@ typedef unsigned int GLhandleARB; - + + + - + + + @@ -5965,7 +6004,7 @@ typedef unsigned int GLhandleARB; - + @@ -5973,26 +6012,28 @@ typedef unsigned int GLhandleARB; - + - + - + + + @@ -6013,13 +6054,13 @@ typedef unsigned int GLhandleARB; - + - + - + @@ -6027,12 +6068,16 @@ typedef unsigned int GLhandleARB; - + - + + + - + + + @@ -6158,7 +6203,7 @@ typedef unsigned int GLhandleARB; - + @@ -6182,7 +6227,9 @@ typedef unsigned int GLhandleARB; - + + + @@ -6203,7 +6250,7 @@ typedef unsigned int GLhandleARB; - + @@ -6215,7 +6262,7 @@ typedef unsigned int GLhandleARB; - + @@ -6230,7 +6277,7 @@ typedef unsigned int GLhandleARB; - + @@ -6263,7 +6310,7 @@ typedef unsigned int GLhandleARB; - + @@ -6274,6 +6321,7 @@ typedef unsigned int GLhandleARB; + @@ -6287,12 +6335,14 @@ typedef unsigned int GLhandleARB; - + + - + + @@ -6341,7 +6391,7 @@ typedef unsigned int GLhandleARB; - + @@ -6408,10 +6458,10 @@ typedef unsigned int GLhandleARB; - + - + @@ -6457,10 +6507,12 @@ typedef unsigned int GLhandleARB; - + - + + + @@ -6488,7 +6540,7 @@ typedef unsigned int GLhandleARB; - + @@ -6504,7 +6556,7 @@ typedef unsigned int GLhandleARB; - + @@ -6558,15 +6610,15 @@ typedef unsigned int GLhandleARB; - + - + - + @@ -6582,7 +6634,7 @@ typedef unsigned int GLhandleARB; - + @@ -6594,7 +6646,7 @@ typedef unsigned int GLhandleARB; - + @@ -6623,7 +6675,7 @@ typedef unsigned int GLhandleARB; - + @@ -6631,7 +6683,7 @@ typedef unsigned int GLhandleARB; - + @@ -6642,7 +6694,7 @@ typedef unsigned int GLhandleARB; - + @@ -6737,7 +6789,7 @@ typedef unsigned int GLhandleARB; - + @@ -6832,7 +6884,7 @@ typedef unsigned int GLhandleARB; - + @@ -6853,7 +6905,7 @@ typedef unsigned int GLhandleARB; - + @@ -6868,11 +6920,14 @@ typedef unsigned int GLhandleARB; - + + + + - + @@ -6895,7 +6950,7 @@ typedef unsigned int GLhandleARB; - + @@ -6935,11 +6990,15 @@ typedef unsigned int GLhandleARB; + + + + @@ -6947,34 +7006,60 @@ typedef unsigned int GLhandleARB; - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6986,14 +7071,20 @@ typedef unsigned int GLhandleARB; - + - + + + - + + + - + + + @@ -7004,7 +7095,7 @@ typedef unsigned int GLhandleARB; - + @@ -7076,20 +7167,32 @@ typedef unsigned int GLhandleARB; - + - + + + - + + + + + + + - + + + - + + + @@ -7112,14 +7215,14 @@ typedef unsigned int GLhandleARB; - + - + - + @@ -7159,7 +7262,7 @@ typedef unsigned int GLhandleARB; - + @@ -7170,21 +7273,27 @@ typedef unsigned int GLhandleARB; - + + + + + + + @@ -7233,7 +7342,7 @@ typedef unsigned int GLhandleARB; - + @@ -7392,14 +7501,17 @@ typedef unsigned int GLhandleARB; - + + + + @@ -7410,17 +7522,20 @@ typedef unsigned int GLhandleARB; + + + - + - + @@ -7432,27 +7547,32 @@ typedef unsigned int GLhandleARB; - + - + + + + + + @@ -7487,7 +7607,9 @@ typedef unsigned int GLhandleARB; + + @@ -7504,18 +7626,18 @@ typedef unsigned int GLhandleARB; - + - + - + @@ -7556,9 +7678,9 @@ typedef unsigned int GLhandleARB; - + - + @@ -7581,25 +7703,29 @@ typedef unsigned int GLhandleARB; + + - + + + - + - + - + @@ -7608,17 +7734,17 @@ typedef unsigned int GLhandleARB; - + - + - + @@ -7642,7 +7768,7 @@ typedef unsigned int GLhandleARB; - + @@ -7651,6 +7777,7 @@ typedef unsigned int GLhandleARB; + @@ -7662,25 +7789,36 @@ typedef unsigned int GLhandleARB; - + - + + + + + + + + + + - + + + - + @@ -7688,16 +7826,22 @@ typedef unsigned int GLhandleARB; - + + + + + - + + + @@ -7712,14 +7856,20 @@ typedef unsigned int GLhandleARB; + + + + + + @@ -7727,7 +7877,7 @@ typedef unsigned int GLhandleARB; - + @@ -7737,6 +7887,7 @@ typedef unsigned int GLhandleARB; + @@ -7769,8 +7920,11 @@ typedef unsigned int GLhandleARB; + + + @@ -7780,27 +7934,33 @@ typedef unsigned int GLhandleARB; + + - + + + + + - + - + - + - + @@ -7809,9 +7969,9 @@ typedef unsigned int GLhandleARB; - + - + @@ -7829,7 +7989,7 @@ typedef unsigned int GLhandleARB; - + @@ -7840,7 +8000,7 @@ typedef unsigned int GLhandleARB; - + @@ -7855,7 +8015,7 @@ typedef unsigned int GLhandleARB; - + @@ -7866,11 +8026,13 @@ typedef unsigned int GLhandleARB; - + - + + + @@ -7880,7 +8042,7 @@ typedef unsigned int GLhandleARB; - + @@ -7890,7 +8052,11 @@ typedef unsigned int GLhandleARB; - + + + + + - - + + @@ -8621,6 +8787,9 @@ typedef unsigned int GLhandleARB; void glBlendBarrierNV + + void glBlendBarrierKHR + void glBlendColor GLfloat red @@ -8704,11 +8873,24 @@ typedef unsigned int GLhandleARB; GLenum modeAlpha + + void glBlendEquationSeparateiEXT + GLuint buf + GLenum modeRGB + GLenum modeAlpha + + void glBlendEquationi GLuint buf GLenum mode + + void glBlendEquationiEXT + GLuint buf + GLenum mode + + void glBlendEquationiARB GLuint buf @@ -8787,6 +8969,15 @@ typedef unsigned int GLhandleARB; GLenum dstAlpha + + void glBlendFuncSeparateiEXT + GLuint buf + GLenum srcRGB + GLenum dstRGB + GLenum srcAlpha + GLenum dstAlpha + + void glBlendFunci GLuint buf @@ -8800,6 +8991,13 @@ typedef unsigned int GLhandleARB; GLenum dst + + void glBlendFunciEXT + GLuint buf + GLenum src + GLenum dst + + void glBlendParameteriNV GLenum pname @@ -9587,6 +9785,15 @@ typedef unsigned int GLhandleARB; GLboolean b GLboolean a + + void glColorMaskiEXT + GLuint index + GLboolean r + GLboolean g + GLboolean b + GLboolean a + + void glColorMaterial GLenum face @@ -10365,6 +10572,25 @@ typedef unsigned int GLhandleARB; GLsizei srcHeight GLsizei srcDepth + + void glCopyImageSubDataEXT + GLuint srcName + GLenum srcTarget + GLint srcLevel + GLint srcX + GLint srcY + GLint srcZ + GLuint dstName + GLenum dstTarget + GLint dstLevel + GLint dstX + GLint dstY + GLint dstZ + GLsizei srcWidth + GLsizei srcHeight + GLsizei srcDepth + + void glCopyImageSubDataNV GLuint srcName @@ -11262,6 +11488,12 @@ typedef unsigned int GLhandleARB; GLenum target GLuint index + + void glDisableiEXT + GLenum target + GLuint index + + void glDiscardFramebufferEXT GLenum target @@ -11765,6 +11997,12 @@ typedef unsigned int GLhandleARB; GLenum target GLuint index + + void glEnableiEXT + GLenum target + GLuint index + + void glEnd @@ -12906,7 +13144,7 @@ typedef unsigned int GLhandleARB; GLuint program GLuint uniformBlockIndex GLenum pname - GLint *params + GLint *params void glGetActiveUniformName @@ -12920,9 +13158,9 @@ typedef unsigned int GLhandleARB; void glGetActiveUniformsiv GLuint program GLsizei uniformCount - const GLuint *uniformIndices + const GLuint *uniformIndices GLenum pname - GLint *params + GLint *params void glGetActiveVaryingNV @@ -14783,12 +15021,26 @@ typedef unsigned int GLhandleARB; GLenum pname GLint *params + + void glGetSamplerParameterIivEXT + GLuint sampler + GLenum pname + GLint *params + + void glGetSamplerParameterIuiv GLuint sampler GLenum pname GLuint *params + + void glGetSamplerParameterIuivEXT + GLuint sampler + GLenum pname + GLuint *params + + void glGetSamplerParameterfv GLuint sampler @@ -15235,38 +15487,38 @@ typedef unsigned int GLhandleARB; void glGetUniformdv GLuint program GLint location - GLdouble *params + GLdouble *params void glGetUniformfv GLuint program GLint location - GLfloat *params + GLfloat *params void glGetUniformfvARB GLhandleARB programObj GLint location - GLfloat *params + GLfloat *params void glGetUniformi64vNV GLuint program GLint location - GLint64EXT *params + GLint64EXT *params void glGetUniformiv GLuint program GLint location - GLint *params + GLint *params void glGetUniformivARB GLhandleARB programObj GLint location - GLint *params + GLint *params @@ -16015,6 +16267,12 @@ typedef unsigned int GLhandleARB; GLenum target GLuint index + + GLboolean glIsEnablediEXT + GLenum target + GLuint index + + GLboolean glIsFenceAPPLE GLuint fence @@ -16966,6 +17224,10 @@ typedef unsigned int GLhandleARB; void glMemoryBarrier GLbitfield barriers + + void glMemoryBarrierByRegion + GLbitfield barriers + void glMemoryBarrierEXT GLbitfield barriers @@ -16980,6 +17242,11 @@ typedef unsigned int GLhandleARB; GLfloat value + + void glMinSampleShadingOES + GLfloat value + + void glMinmax GLenum target @@ -18621,6 +18888,12 @@ typedef unsigned int GLhandleARB; GLenum pname GLint value + + void glPatchParameteriEXT + GLenum pname + GLint value + + void glPathColorGenNV GLenum color @@ -19132,6 +19405,17 @@ typedef unsigned int GLhandleARB; const GLfloat *priorities + + void glPrimitiveBoundingBoxEXT + GLfloat minX + GLfloat minY + GLfloat minZ + GLfloat minW + GLfloat maxX + GLfloat maxY + GLfloat maxZ + GLfloat maxW + void glPrioritizeTexturesEXT GLsizei n @@ -21202,12 +21486,26 @@ typedef unsigned int GLhandleARB; GLenum pname const GLint *param + + void glSamplerParameterIivEXT + GLuint sampler + GLenum pname + const GLint *param + + void glSamplerParameterIuiv GLuint sampler GLenum pname const GLuint *param + + void glSamplerParameterIuivEXT + GLuint sampler + GLenum pname + const GLuint *param + + void glSamplerParameterf GLuint sampler @@ -21954,6 +22252,15 @@ typedef unsigned int GLhandleARB; GLintptr offset GLsizeiptr size + + void glTexBufferRangeEXT + GLenum target + GLenum internalformat + GLuint buffer + GLintptr offset + GLsizeiptr size + + void glTexBumpParameterfvATI GLenum pname @@ -22904,6 +23211,17 @@ typedef unsigned int GLhandleARB; GLsizei depth GLboolean fixedsamplelocations + + void glTexStorage3DMultisampleOES + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLboolean fixedsamplelocations + + void glTexStorageSparseAMD GLenum target @@ -23331,6 +23649,18 @@ typedef unsigned int GLhandleARB; GLuint minlayer GLuint numlayers + + void glTextureViewEXT + GLuint texture + GLenum target + GLuint origtexture + GLenum internalformat + GLuint minlevel + GLuint numlevels + GLuint minlayer + GLuint numlayers + + void glTrackMatrixNV GLenum target @@ -23341,7 +23671,7 @@ typedef unsigned int GLhandleARB; void glTransformFeedbackAttribsNV - GLuint count + GLsizei count const GLint *attribs GLenum bufferMode @@ -23417,7 +23747,7 @@ typedef unsigned int GLhandleARB; void glUniform1dv GLint location GLsizei count - const GLdouble *value + const GLdouble *value void glUniform1f @@ -23434,13 +23764,13 @@ typedef unsigned int GLhandleARB; void glUniform1fv GLint location GLsizei count - const GLfloat *value + const GLfloat *value void glUniform1fvARB GLint location GLsizei count - const GLfloat *value + const GLfloat *value @@ -23457,7 +23787,7 @@ typedef unsigned int GLhandleARB; void glUniform1i64vNV GLint location GLsizei count - const GLint64EXT *value + const GLint64EXT *value void glUniform1iARB @@ -23469,13 +23799,13 @@ typedef unsigned int GLhandleARB; void glUniform1iv GLint location GLsizei count - const GLint *value + const GLint *value void glUniform1ivARB GLint location GLsizei count - const GLint *value + const GLint *value @@ -23492,7 +23822,7 @@ typedef unsigned int GLhandleARB; void glUniform1ui64vNV GLint location GLsizei count - const GLuint64EXT *value + const GLuint64EXT *value void glUniform1uiEXT @@ -23504,13 +23834,13 @@ typedef unsigned int GLhandleARB; void glUniform1uiv GLint location GLsizei count - const GLuint *value + const GLuint *value void glUniform1uivEXT GLint location GLsizei count - const GLuint *value + const GLuint *value @@ -23523,7 +23853,7 @@ typedef unsigned int GLhandleARB; void glUniform2dv GLint location GLsizei count - const GLdouble *value + const GLdouble *value void glUniform2f @@ -23542,13 +23872,13 @@ typedef unsigned int GLhandleARB; void glUniform2fv GLint location GLsizei count - const GLfloat *value + const GLfloat *value void glUniform2fvARB GLint location GLsizei count - const GLfloat *value + const GLfloat *value @@ -23580,13 +23910,13 @@ typedef unsigned int GLhandleARB; void glUniform2iv GLint location GLsizei count - const GLint *value + const GLint *value void glUniform2ivARB GLint location GLsizei count - const GLint *value + const GLint *value @@ -23638,7 +23968,7 @@ typedef unsigned int GLhandleARB; void glUniform3dv GLint location GLsizei count - const GLdouble *value + const GLdouble *value void glUniform3f @@ -23659,13 +23989,13 @@ typedef unsigned int GLhandleARB; void glUniform3fv GLint location GLsizei count - const GLfloat *value + const GLfloat *value void glUniform3fvARB GLint location GLsizei count - const GLfloat *value + const GLfloat *value @@ -23700,13 +24030,13 @@ typedef unsigned int GLhandleARB; void glUniform3iv GLint location GLsizei count - const GLint *value + const GLint *value void glUniform3ivARB GLint location GLsizei count - const GLint *value + const GLint *value @@ -23762,7 +24092,7 @@ typedef unsigned int GLhandleARB; void glUniform4dv GLint location GLsizei count - const GLdouble *value + const GLdouble *value void glUniform4f @@ -23785,13 +24115,13 @@ typedef unsigned int GLhandleARB; void glUniform4fv GLint location GLsizei count - const GLfloat *value + const GLfloat *value void glUniform4fvARB GLint location GLsizei count - const GLfloat *value + const GLfloat *value @@ -23829,13 +24159,13 @@ typedef unsigned int GLhandleARB; void glUniform4iv GLint location GLsizei count - const GLint *value + const GLint *value void glUniform4ivARB GLint location GLsizei count - const GLint *value + const GLint *value @@ -23921,21 +24251,21 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLdouble *value + const GLdouble *value void glUniformMatrix2fv GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value void glUniformMatrix2fvARB GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -23943,14 +24273,14 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLdouble *value + const GLdouble *value void glUniformMatrix2x3fv GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -23958,7 +24288,7 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -23966,14 +24296,14 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLdouble *value + const GLdouble *value void glUniformMatrix2x4fv GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -23981,7 +24311,7 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -23989,21 +24319,21 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLdouble *value + const GLdouble *value void glUniformMatrix3fv GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value void glUniformMatrix3fvARB GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -24011,14 +24341,14 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLdouble *value + const GLdouble *value void glUniformMatrix3x2fv GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -24026,7 +24356,7 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -24034,14 +24364,14 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLdouble *value + const GLdouble *value void glUniformMatrix3x4fv GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -24049,7 +24379,7 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -24057,21 +24387,21 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLdouble *value + const GLdouble *value void glUniformMatrix4fv GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value void glUniformMatrix4fvARB GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -24079,14 +24409,14 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLdouble *value + const GLdouble *value void glUniformMatrix4x2fv GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -24094,7 +24424,7 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -24102,14 +24432,14 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLdouble *value + const GLdouble *value void glUniformMatrix4x3fv GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -24117,7 +24447,7 @@ typedef unsigned int GLhandleARB; GLint location GLsizei count GLboolean transpose - const GLfloat *value + const GLfloat *value @@ -24135,7 +24465,7 @@ typedef unsigned int GLhandleARB; void glUniformui64vNV GLint location GLsizei count - const GLuint64EXT *value + const GLuint64EXT *value void glUnlockArraysEXT @@ -28894,11 +29224,13 @@ typedef unsigned int GLhandleARB; + + @@ -28917,6 +29249,7 @@ typedef unsigned int GLhandleARB; + @@ -30242,8 +30575,6 @@ typedef unsigned int GLhandleARB; - - @@ -30464,6 +30795,7 @@ typedef unsigned int GLhandleARB; + @@ -30721,6 +31053,7 @@ typedef unsigned int GLhandleARB; + @@ -32245,6 +32578,298 @@ typedef unsigned int GLhandleARB; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -32286,10 +32911,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -32326,6 +32948,74 @@ typedef unsigned int GLhandleARB; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -32340,6 +33030,7 @@ typedef unsigned int GLhandleARB; + @@ -32419,18 +33110,9 @@ typedef unsigned int GLhandleARB; - - - - - - - - - - - - + + + @@ -32455,18 +33137,14 @@ typedef unsigned int GLhandleARB; - - - - - - - - - + + + + + @@ -32480,8 +33158,31 @@ typedef unsigned int GLhandleARB; - - + + + + @@ -32694,10 +33395,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -32821,10 +33519,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -32957,10 +33652,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -33086,23 +33778,14 @@ typedef unsigned int GLhandleARB; - - - - + - - - - - - - - + + @@ -33206,10 +33889,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -33966,10 +34646,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -34004,10 +34681,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -34151,14 +34825,9 @@ typedef unsigned int GLhandleARB; - - - - - - - - + + + @@ -34229,10 +34898,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -34310,14 +34976,8 @@ typedef unsigned int GLhandleARB; - - - - - - - - + + @@ -34363,19 +35023,13 @@ typedef unsigned int GLhandleARB; - - - - + - - - - + @@ -34389,10 +35043,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -34590,10 +35241,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -34620,10 +35268,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -34700,18 +35345,9 @@ typedef unsigned int GLhandleARB; - - - - - - - - - - - - + + + @@ -35377,10 +36013,14 @@ typedef unsigned int GLhandleARB; - + + + + + @@ -35782,10 +36422,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -35917,6 +36554,11 @@ typedef unsigned int GLhandleARB; + + + + + @@ -36398,6 +37040,46 @@ typedef unsigned int GLhandleARB; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -36529,6 +37211,45 @@ typedef unsigned int GLhandleARB; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -36603,6 +37324,9 @@ typedef unsigned int GLhandleARB; + + + @@ -36659,10 +37383,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -36700,10 +37421,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -36837,10 +37555,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -36859,6 +37574,12 @@ typedef unsigned int GLhandleARB; + + + + + + @@ -36874,6 +37595,8 @@ typedef unsigned int GLhandleARB; + + @@ -37020,6 +37743,7 @@ typedef unsigned int GLhandleARB; + @@ -37081,18 +37805,18 @@ typedef unsigned int GLhandleARB; - - - - - - - - - + + + + + + + + + @@ -37132,6 +37856,59 @@ typedef unsigned int GLhandleARB; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -37205,6 +37982,41 @@ typedef unsigned int GLhandleARB; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -37263,10 +38075,20 @@ typedef unsigned int GLhandleARB; - + + + + + + + + + + + @@ -37522,6 +38344,16 @@ typedef unsigned int GLhandleARB; + + + + + + + + + + @@ -38024,9 +38856,7 @@ typedef unsigned int GLhandleARB; - - - + @@ -38085,6 +38915,27 @@ typedef unsigned int GLhandleARB; + + + + + + + + + + + + + + + + + + + + + @@ -38416,10 +39267,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -38582,10 +39430,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -38692,14 +39537,8 @@ typedef unsigned int GLhandleARB; - - - - - - - - + + @@ -38726,10 +39565,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -38754,10 +39590,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -38800,10 +39633,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -38995,10 +39825,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -39233,22 +40060,10 @@ typedef unsigned int GLhandleARB; - - - - - - - - - - - - - - - - + + + + @@ -39343,14 +40158,8 @@ typedef unsigned int GLhandleARB; - - - - - - - - + + @@ -39379,10 +40188,15 @@ typedef unsigned int GLhandleARB; - + + + + + + @@ -39426,14 +40240,8 @@ typedef unsigned int GLhandleARB; - - - - - - - - + + @@ -39462,10 +40270,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -39892,14 +40697,8 @@ typedef unsigned int GLhandleARB; - - - - - - - - + + @@ -40107,14 +40906,8 @@ typedef unsigned int GLhandleARB; - - - - - - - - + + @@ -40398,6 +41191,22 @@ typedef unsigned int GLhandleARB; + + + + + + + + + + + + + + + + @@ -40533,35 +41342,39 @@ typedef unsigned int GLhandleARB; - - - - + - - - - + - + + + - + + - + + - + + + + + + + @@ -41006,10 +41819,7 @@ typedef unsigned int GLhandleARB; - - - - + @@ -41256,9 +42066,7 @@ typedef unsigned int GLhandleARB; - - - + diff --git a/xorg-server/hw/xwin/glx/reg.py b/xorg-server/hw/xwin/glx/reg.py index 1bbe0a052..9248b6624 100644 --- a/xorg-server/hw/xwin/glx/reg.py +++ b/xorg-server/hw/xwin/glx/reg.py @@ -222,7 +222,7 @@ def regSortFeatures(featureList): # the . Defaults to None. Usually the same as apiname. # addExtensions - regex matching names of additional extensions # to include. Defaults to None. -# removeExtenions - regex matching names of extensions to +# removeExtensions - regex matching names of extensions to # remove (after defaultExtensions and addExtensions). Defaults # to None. # sortProcedure - takes a list of FeatureInfo objects and sorts diff --git a/xorg-server/hw/xwin/glx/wgl.xml b/xorg-server/hw/xwin/glx/wgl.xml index 102185a03..0114547c2 100644 --- a/xorg-server/hw/xwin/glx/wgl.xml +++ b/xorg-server/hw/xwin/glx/wgl.xml @@ -326,11 +326,11 @@ - + - + @@ -372,7 +372,8 @@ - + + diff --git a/xorg-server/hw/xwin/glx/wglext.h b/xorg-server/hw/xwin/glx/wglext.h index cf9781ddd..5860c867a 100644 --- a/xorg-server/hw/xwin/glx/wglext.h +++ b/xorg-server/hw/xwin/glx/wglext.h @@ -33,7 +33,7 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** -** Khronos $Revision: 25401 $ on $Date: 2014-02-18 15:43:24 -0800 (Tue, 18 Feb 2014) $ +** Khronos $Revision: 27191 $ on $Date: 2014-06-30 15:11:33 -0700 (Mon, 30 Jun 2014) $ */ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) @@ -41,7 +41,7 @@ extern "C" { #include #endif -#define WGL_WGLEXT_VERSION 20140203 +#define WGL_WGLEXT_VERSION 20140630 /* Generated C header for: * API: wgl diff --git a/xorg-server/hw/xwin/swrastwgl_dri/swrastwgl_dri.c b/xorg-server/hw/xwin/swrastwgl_dri/swrastwgl_dri.c index 52b7203b5..6036f347f 100644 --- a/xorg-server/hw/xwin/swrastwgl_dri/swrastwgl_dri.c +++ b/xorg-server/hw/xwin/swrastwgl_dri/swrastwgl_dri.c @@ -30,6 +30,11 @@ BOOL doubleBuffered = FALSE; struct __DRIscreenRec { int ScreenNum; + int max_gl_core_version; + int max_gl_compat_version; + int max_gl_es1_version; + int max_gl_es2_version; + const __DRIextension **extensions; const __DRIswrastLoaderExtension *swrast_loader; }; @@ -492,7 +497,6 @@ static const struct { unsigned int attrib, offset; } attribMap[] = { __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen), __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue), __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha), - __ATTRIB(__DRI_ATTRIB_FLOAT_MODE, floatMode), __ATTRIB(__DRI_ATTRIB_RED_MASK, redMask), __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask), __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask), @@ -520,376 +524,2516 @@ static const struct { unsigned int attrib, offset; } attribMap[] = { #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) -__DRIconfig ** -driCreateConfigs(GLenum fb_format, GLenum fb_type, - const uint8_t * depth_bits, const uint8_t * stencil_bits, - unsigned num_depth_stencil_bits, - const GLenum * db_modes, unsigned num_db_modes, - const uint8_t * msaa_samples, unsigned num_msaa_modes, - GLboolean enable_accum) +/** + * Mesa texture/renderbuffer image formats. + */ +typedef enum { - static const uint8_t bits_table[4][4] = { - /* R G B A */ - { 3, 3, 2, 0 }, /* Any GL_UNSIGNED_BYTE_3_3_2 */ - { 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */ - { 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */ - { 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */ - }; - - static const uint32_t masks_table_rgb[6][4] = { - { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 3_3_2 */ - { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 2_3_3_REV */ - { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */ - { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5_REV */ - { 0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000 }, /* 8_8_8_8 */ - { 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 } /* 8_8_8_8_REV */ - }; - - static const uint32_t masks_table_rgba[6][4] = { - { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 3_3_2 */ - { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 2_3_3_REV */ - { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */ - { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5_REV */ - { 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF }, /* 8_8_8_8 */ - { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 }, /* 8_8_8_8_REV */ - }; - - static const uint32_t masks_table_bgr[6][4] = { - { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 3_3_2 */ - { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 2_3_3_REV */ - { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */ - { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5_REV */ - { 0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000 }, /* 8_8_8_8 */ - { 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 }, /* 8_8_8_8_REV */ - }; - - static const uint32_t masks_table_bgra[6][4] = { - { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 3_3_2 */ - { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 2_3_3_REV */ - { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */ - { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5_REV */ - { 0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF }, /* 8_8_8_8 */ - { 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 }, /* 8_8_8_8_REV */ - }; - - static const uint8_t bytes_per_pixel[6] = { - 1, /* 3_3_2 */ - 1, /* 2_3_3_REV */ - 2, /* 5_6_5 */ - 2, /* 5_6_5_REV */ - 4, /* 8_8_8_8 */ - 4 /* 8_8_8_8_REV */ - - }; - - const uint8_t * bits; - const uint32_t * masks; - int index; - __DRIconfig **configs, **c; - - struct gl_config *modes; - unsigned i, j, k, h; - unsigned num_modes; - unsigned num_accum_bits = (enable_accum) ? 2 : 1; - - PRINTF(__FUNCTION__"\n"); - switch ( fb_type ) { - case GL_UNSIGNED_BYTE_3_3_2: - index = 0; - break; - case GL_UNSIGNED_BYTE_2_3_3_REV: - index = 1; - break; - case GL_UNSIGNED_SHORT_5_6_5: - index = 2; - break; - case GL_UNSIGNED_SHORT_5_6_5_REV: - index = 3; - break; - case GL_UNSIGNED_INT_8_8_8_8: - index = 4; - break; - case GL_UNSIGNED_INT_8_8_8_8_REV: - index = 5; - break; - default: - fprintf( stderr, "[%s:%u] Unknown framebuffer type 0x%04x.\n", - __FUNCTION__, __LINE__, fb_type ); - return NULL; - } - - - /* Valid types are GL_UNSIGNED_SHORT_5_6_5 and GL_UNSIGNED_INT_8_8_8_8 and - * the _REV versions. - * - * Valid formats are GL_RGBA, GL_RGB, and GL_BGRA. - */ + MESA_FORMAT_NONE = 0, + + /** + * \name Basic hardware formats + * + * The mesa format name specification is as follows: + * + * There shall be 3 naming format base types: those for component array + * formats (type A); those for compressed formats (type C); and those for + * packed component formats (type P). With type A formats, color component + * order does not change with endianess. Each format name shall begin with + * MESA_FORMAT_, followed by a component label (from the Component Label + * list below) for each component in the order that the component(s) occur + * in the format, except for non-linear color formats where the first + * letter shall be 'S'. For type P formats, each component label is + * followed by the number of bits that represent it in the fundamental + * data type used by the format. + * + * Following the listing of the component labels shall be an underscore; a + * compression type followed by an underscore for Type C formats only; a + * storage type from the list below; and a bit with for type A formats, + * which is the bit width for each array element. + * + * + * ---------- Format Base Type A: Array ---------- + * MESA_FORMAT_[component list]_[storage type][array element bit width] + * + * examples: + * MESA_FORMAT_A_SNORM8 - uchar[i] = A + * MESA_FORMAT_RGBA_16 - ushort[i * 4 + 0] = R, ushort[i * 4 + 1] = G, + * ushort[i * 4 + 2] = B, ushort[i * 4 + 3] = A + * MESA_FORMAT_Z_UNORM32 - float[i] = Z + * + * + * + * ---------- Format Base Type C: Compressed ---------- + * MESA_FORMAT_[component list*][_*][compression type][storage type*] + * * where required + * + * examples: + * MESA_FORMAT_RGB_ETC1 + * MESA_FORMAT_RGBA_ETC2 + * MESA_FORMAT_LATC1_UNORM + * MESA_FORMAT_RGBA_FXT1 + * + * + * + * ---------- Format Base Type P: Packed ---------- + * MESA_FORMAT_[[component list,bit width][storage type*][_]][_][storage type**] + * * when type differs between component + * ** when type applies to all components + * + * examples: msb <------ TEXEL BITS -----------> lsb + * MESA_FORMAT_A8B8G8R8_UNORM, AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR + * MESA_FORMAT_R5G6B5_UNORM RRRR RGGG GGGB BBBB + * MESA_FORMAT_B4G4R4X4_UNORM BBBB GGGG RRRR XXXX + * MESA_FORMAT_Z32_FLOAT_S8X24_UINT + * MESA_FORMAT_R10G10B10A2_UINT + * MESA_FORMAT_R9G9B9E5_FLOAT + * + * + * + * ---------- Component Labels: ---------- + * A - Alpha + * B - Blue + * DU - Delta U + * DV - Delta V + * E - Shared Exponent + * G - Green + * I - Intensity + * L - Luminance + * R - Red + * S - Stencil (when not followed by RGB or RGBA) + * U - Chrominance + * V - Chrominance + * Y - Luma + * X - Packing bits + * Z - Depth + * + * + * + * ---------- Type C Compression Types: ---------- + * DXT1 - Color component labels shall be given + * DXT3 - Color component labels shall be given + * DXT5 - Color component labels shall be given + * ETC1 - No other information required + * ETC2 - No other information required + * FXT1 - Color component labels shall be given + * FXT3 - Color component labels shall be given + * LATC1 - Fundamental data type shall be given + * LATC2 - Fundamental data type shall be given + * RGTC1 - Color component labels and data type shall be given + * RGTC2 - Color component labels and data type shall be given + * + * + * + * ---------- Storage Types: ---------- + * FLOAT + * SINT + * UINT + * SNORM + * UNORM + * SRGB - RGB components, or L are UNORMs in sRGB color space. + * Alpha, if present is linear. + * + */ - switch ( fb_format ) { - case GL_RGB: - masks = masks_table_rgb[ index ]; - break; + /* Packed unorm formats */ /* msb <------ TEXEL BITS -----------> lsb */ + /* ---- ---- ---- ---- ---- ---- ---- ---- */ + MESA_FORMAT_A8B8G8R8_UNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ + MESA_FORMAT_X8B8G8R8_UNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ + MESA_FORMAT_R8G8B8A8_UNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_R8G8B8X8_UNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_B8G8R8A8_UNORM, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_B8G8R8X8_UNORM, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_A8R8G8B8_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ + MESA_FORMAT_X8R8G8B8_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */ + MESA_FORMAT_L16A16_UNORM, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */ + MESA_FORMAT_A16L16_UNORM, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */ + MESA_FORMAT_B5G6R5_UNORM, /* RRRR RGGG GGGB BBBB */ + MESA_FORMAT_R5G6B5_UNORM, /* BBBB BGGG GGGR RRRR */ + MESA_FORMAT_B4G4R4A4_UNORM, /* AAAA RRRR GGGG BBBB */ + MESA_FORMAT_B4G4R4X4_UNORM, /* xxxx RRRR GGGG BBBB */ + MESA_FORMAT_A4R4G4B4_UNORM, /* BBBB GGGG RRRR AAAA */ + MESA_FORMAT_A1B5G5R5_UNORM, /* RRRR RGGG GGBB BBBA */ + MESA_FORMAT_B5G5R5A1_UNORM, /* ARRR RRGG GGGB BBBB */ + MESA_FORMAT_B5G5R5X1_UNORM, /* xRRR RRGG GGGB BBBB */ + MESA_FORMAT_A1R5G5B5_UNORM, /* BBBB BGGG GGRR RRRA */ + MESA_FORMAT_L8A8_UNORM, /* AAAA AAAA LLLL LLLL */ + MESA_FORMAT_A8L8_UNORM, /* LLLL LLLL AAAA AAAA */ + MESA_FORMAT_R8G8_UNORM, /* GGGG GGGG RRRR RRRR */ + MESA_FORMAT_G8R8_UNORM, /* RRRR RRRR GGGG GGGG */ + MESA_FORMAT_L4A4_UNORM, /* AAAA LLLL */ + MESA_FORMAT_B2G3R3_UNORM, /* RRRG GGBB */ + + MESA_FORMAT_R16G16_UNORM, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ + MESA_FORMAT_G16R16_UNORM, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ + MESA_FORMAT_B10G10R10A2_UNORM,/* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ + MESA_FORMAT_B10G10R10X2_UNORM,/* xxRR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ + MESA_FORMAT_R10G10B10A2_UNORM,/* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */ + + MESA_FORMAT_S8_UINT_Z24_UNORM,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ + MESA_FORMAT_X8_UINT_Z24_UNORM,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */ + MESA_FORMAT_Z24_UNORM_S8_UINT,/* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ + MESA_FORMAT_Z24_UNORM_X8_UINT,/* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ + + MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ + MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ + + /* Array unorm formats */ + MESA_FORMAT_A_UNORM8, /* ubyte[i] = A */ + MESA_FORMAT_A_UNORM16, /* ushort[i] = A */ + MESA_FORMAT_L_UNORM8, /* ubyte[i] = L */ + MESA_FORMAT_L_UNORM16, /* ushort[i] = L */ + MESA_FORMAT_I_UNORM8, /* ubyte[i] = I */ + MESA_FORMAT_I_UNORM16, /* ushort[i] = I */ + MESA_FORMAT_R_UNORM8, /* ubyte[i] = R */ + MESA_FORMAT_R_UNORM16, /* ushort[i] = R */ + MESA_FORMAT_BGR_UNORM8, /* ubyte[i*3] = B, [i*3+1] = G, [i*3+2] = R */ + MESA_FORMAT_RGB_UNORM8, /* ubyte[i*3] = R, [i*3+1] = G, [i*3+2] = B */ + MESA_FORMAT_RGBA_UNORM16, /* ushort[i] = R, [1] = G, [2] = B, [3] = A */ + MESA_FORMAT_RGBX_UNORM16, + + MESA_FORMAT_Z_UNORM16, /* ushort[i] = Z */ + MESA_FORMAT_Z_UNORM32, /* uint[i] = Z */ + MESA_FORMAT_S_UINT8, /* ubyte[i] = S */ + + /* Packed signed/normalized formats */ + /* msb <------ TEXEL BITS -----------> lsb */ + /* ---- ---- ---- ---- ---- ---- ---- ---- */ + MESA_FORMAT_A8B8G8R8_SNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ + MESA_FORMAT_X8B8G8R8_SNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ + MESA_FORMAT_R8G8B8A8_SNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_R8G8B8X8_SNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_R16G16_SNORM, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ + MESA_FORMAT_G16R16_SNORM, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ + MESA_FORMAT_R8G8_SNORM, /* GGGG GGGG RRRR RRRR */ + MESA_FORMAT_G8R8_SNORM, /* RRRR RRRR GGGG GGGG */ + MESA_FORMAT_L8A8_SNORM, /* AAAA AAAA LLLL LLLL */ + + /* Array signed/normalized formats */ + MESA_FORMAT_A_SNORM8, /* byte[i] = A */ + MESA_FORMAT_A_SNORM16, /* short[i] = A */ + MESA_FORMAT_L_SNORM8, /* byte[i] = L */ + MESA_FORMAT_L_SNORM16, /* short[i] = L */ + MESA_FORMAT_I_SNORM8, /* byte[i] = I */ + MESA_FORMAT_I_SNORM16, /* short[i] = I */ + MESA_FORMAT_R_SNORM8, /* byte[i] = R */ + MESA_FORMAT_R_SNORM16, /* short[i] = R */ + MESA_FORMAT_LA_SNORM16, /* short[i * 2] = L, [i * 2 + 1] = A */ + MESA_FORMAT_RGB_SNORM16, /* short[i*3] = R, [i*3+1] = G, [i*3+2] = B */ + MESA_FORMAT_RGBA_SNORM16, /* ... */ + MESA_FORMAT_RGBX_SNORM16, /* ... */ + + /* Packed sRGB formats */ + MESA_FORMAT_A8B8G8R8_SRGB, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ + MESA_FORMAT_B8G8R8A8_SRGB, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_B8G8R8X8_SRGB, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_R8G8B8A8_SRGB, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_R8G8B8X8_SRGB, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_L8A8_SRGB, /* AAAA AAAA LLLL LLLL */ + + /* Array sRGB formats */ + MESA_FORMAT_L_SRGB8, /* ubyte[i] = L */ + MESA_FORMAT_BGR_SRGB8, /* ubyte[i*3] = B, [i*3+1] = G, [i*3+2] = R */ + + /* Packed float formats */ + MESA_FORMAT_R9G9B9E5_FLOAT, + MESA_FORMAT_R11G11B10_FLOAT, /* BBBB BBBB BBGG GGGG GGGG GRRR RRRR RRRR */ + MESA_FORMAT_Z32_FLOAT_S8X24_UINT, /* (float, x24s8) */ + + /* Array float formats */ + MESA_FORMAT_A_FLOAT16, + MESA_FORMAT_A_FLOAT32, + MESA_FORMAT_L_FLOAT16, + MESA_FORMAT_L_FLOAT32, + MESA_FORMAT_LA_FLOAT16, + MESA_FORMAT_LA_FLOAT32, + MESA_FORMAT_I_FLOAT16, + MESA_FORMAT_I_FLOAT32, + MESA_FORMAT_R_FLOAT16, + MESA_FORMAT_R_FLOAT32, + MESA_FORMAT_RG_FLOAT16, + MESA_FORMAT_RG_FLOAT32, + MESA_FORMAT_RGB_FLOAT16, + MESA_FORMAT_RGB_FLOAT32, + MESA_FORMAT_RGBA_FLOAT16, + MESA_FORMAT_RGBA_FLOAT32, /* float[0] = R, [1] = G, [2] = B, [3] = A */ + MESA_FORMAT_RGBX_FLOAT16, + MESA_FORMAT_RGBX_FLOAT32, + MESA_FORMAT_Z_FLOAT32, + + /* Packed signed/unsigned non-normalized integer formats */ + MESA_FORMAT_B10G10R10A2_UINT, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ + MESA_FORMAT_R10G10B10A2_UINT, /* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */ + + /* Array signed/unsigned non-normalized integer formats */ + MESA_FORMAT_A_UINT8, + MESA_FORMAT_A_UINT16, + MESA_FORMAT_A_UINT32, + MESA_FORMAT_A_SINT8, + MESA_FORMAT_A_SINT16, + MESA_FORMAT_A_SINT32, + + MESA_FORMAT_I_UINT8, + MESA_FORMAT_I_UINT16, + MESA_FORMAT_I_UINT32, + MESA_FORMAT_I_SINT8, + MESA_FORMAT_I_SINT16, + MESA_FORMAT_I_SINT32, + + MESA_FORMAT_L_UINT8, + MESA_FORMAT_L_UINT16, + MESA_FORMAT_L_UINT32, + MESA_FORMAT_L_SINT8, + MESA_FORMAT_L_SINT16, + MESA_FORMAT_L_SINT32, + + MESA_FORMAT_LA_UINT8, + MESA_FORMAT_LA_UINT16, + MESA_FORMAT_LA_UINT32, + MESA_FORMAT_LA_SINT8, + MESA_FORMAT_LA_SINT16, + MESA_FORMAT_LA_SINT32, + + MESA_FORMAT_R_UINT8, + MESA_FORMAT_R_UINT16, + MESA_FORMAT_R_UINT32, + MESA_FORMAT_R_SINT8, + MESA_FORMAT_R_SINT16, + MESA_FORMAT_R_SINT32, + + MESA_FORMAT_RG_UINT8, + MESA_FORMAT_RG_UINT16, + MESA_FORMAT_RG_UINT32, + MESA_FORMAT_RG_SINT8, + MESA_FORMAT_RG_SINT16, + MESA_FORMAT_RG_SINT32, + + MESA_FORMAT_RGB_UINT8, + MESA_FORMAT_RGB_UINT16, + MESA_FORMAT_RGB_UINT32, + MESA_FORMAT_RGB_SINT8, + MESA_FORMAT_RGB_SINT16, + MESA_FORMAT_RGB_SINT32, + + MESA_FORMAT_RGBA_UINT8, + MESA_FORMAT_RGBA_UINT16, + MESA_FORMAT_RGBA_UINT32, + MESA_FORMAT_RGBA_SINT8, + MESA_FORMAT_RGBA_SINT16, + MESA_FORMAT_RGBA_SINT32, + + MESA_FORMAT_RGBX_UINT8, + MESA_FORMAT_RGBX_UINT16, + MESA_FORMAT_RGBX_UINT32, + MESA_FORMAT_RGBX_SINT8, + MESA_FORMAT_RGBX_SINT16, + MESA_FORMAT_RGBX_SINT32, + + /* DXT compressed formats */ + MESA_FORMAT_RGB_DXT1, + MESA_FORMAT_RGBA_DXT1, + MESA_FORMAT_RGBA_DXT3, + MESA_FORMAT_RGBA_DXT5, + + /* DXT sRGB compressed formats */ + MESA_FORMAT_SRGB_DXT1, + MESA_FORMAT_SRGBA_DXT1, + MESA_FORMAT_SRGBA_DXT3, + MESA_FORMAT_SRGBA_DXT5, + + /* FXT1 compressed formats */ + MESA_FORMAT_RGB_FXT1, + MESA_FORMAT_RGBA_FXT1, + + /* RGTC compressed formats */ + MESA_FORMAT_R_RGTC1_UNORM, + MESA_FORMAT_R_RGTC1_SNORM, + MESA_FORMAT_RG_RGTC2_UNORM, + MESA_FORMAT_RG_RGTC2_SNORM, + + /* LATC1/2 compressed formats */ + MESA_FORMAT_L_LATC1_UNORM, + MESA_FORMAT_L_LATC1_SNORM, + MESA_FORMAT_LA_LATC2_UNORM, + MESA_FORMAT_LA_LATC2_SNORM, + + /* ETC1/2 compressed formats */ + MESA_FORMAT_ETC1_RGB8, + MESA_FORMAT_ETC2_RGB8, + MESA_FORMAT_ETC2_SRGB8, + MESA_FORMAT_ETC2_RGBA8_EAC, + MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC, + MESA_FORMAT_ETC2_R11_EAC, + MESA_FORMAT_ETC2_RG11_EAC, + MESA_FORMAT_ETC2_SIGNED_R11_EAC, + MESA_FORMAT_ETC2_SIGNED_RG11_EAC, + MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1, + MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1, + + MESA_FORMAT_COUNT +} + mesa_format; - case GL_RGBA: - masks = masks_table_rgba[ index ]; - break; +/** + * Information about texture formats. + */ +struct gl_format_info +{ + mesa_format Name; - case GL_BGR: - masks = masks_table_bgr[ index ]; - break; + /** text name for debugging */ + const char *StrName; - case GL_BGRA: - masks = masks_table_bgra[ index ]; - break; + /** + * Base format is one of GL_RED, GL_RG, GL_RGB, GL_RGBA, GL_ALPHA, + * GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_YCBCR_MESA, + * GL_DEPTH_COMPONENT, GL_STENCIL_INDEX, GL_DEPTH_STENCIL. + */ + GLenum BaseFormat; - default: - fprintf( stderr, "[%s:%u] Unknown framebuffer format 0x%04x.\n", - __FUNCTION__, __LINE__, fb_format ); - return NULL; - } + /** + * Logical data type: one of GL_UNSIGNED_NORMALIZED, GL_SIGNED_NORMALIZED, + * GL_UNSIGNED_INT, GL_INT, GL_FLOAT. + */ + GLenum DataType; + + GLubyte RedBits; + GLubyte GreenBits; + GLubyte BlueBits; + GLubyte AlphaBits; + GLubyte LuminanceBits; + GLubyte IntensityBits; + GLubyte IndexBits; + GLubyte DepthBits; + GLubyte StencilBits; + + /** + * To describe compressed formats. If not compressed, Width=Height=1. + */ + GLubyte BlockWidth, BlockHeight; + GLubyte BytesPerBlock; +}; - switch ( bytes_per_pixel[ index ] ) { - case 1: - bits = bits_table[0]; - break; - case 2: - bits = bits_table[1]; - break; - default: - bits = ((fb_format == GL_RGB) || (fb_format == GL_BGR)) - ? bits_table[2] - : bits_table[3]; - break; - } +/** + * Info about each format. + * These must be in the same order as the MESA_FORMAT_* enums so that + * we can do lookups without searching. + */ +static struct gl_format_info format_info[MESA_FORMAT_COUNT] = +{ + /* Packed unorm formats */ + { + MESA_FORMAT_NONE, /* Name */ + "MESA_FORMAT_NONE", /* StrName */ + GL_NONE, /* BaseFormat */ + GL_NONE, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 0, 0, 0 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_A8B8G8R8_UNORM, /* Name */ + "MESA_FORMAT_A8B8G8R8_UNORM",/* StrName */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_X8B8G8R8_UNORM, /* Name */ + "MESA_FORMAT_X8B8G8R8_UNORM",/* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_R8G8B8A8_UNORM, /* Name */ + "MESA_FORMAT_R8G8B8A8_UNORM",/* StrName */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_R8G8B8X8_UNORM, /* Name */ + "MESA_FORMAT_R8G8B8X8_UNORM",/* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_B8G8R8A8_UNORM, /* Name */ + "MESA_FORMAT_B8G8R8A8_UNORM",/* StrName */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_B8G8R8X8_UNORM, /* Name */ + "MESA_FORMAT_B8G8R8X8_UNORM",/* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_A8R8G8B8_UNORM, /* Name */ + "MESA_FORMAT_A8R8G8B8_UNORM",/* StrName */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_X8R8G8B8_UNORM, /* Name */ + "MESA_FORMAT_X8R8G8B8_UNORM",/* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_L16A16_UNORM, /* Name */ + "MESA_FORMAT_L16A16_UNORM", /* StrName */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ + 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_A16L16_UNORM, /* Name */ + "MESA_FORMAT_A16L16_UNORM", /* StrName */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ + 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_B5G6R5_UNORM, /* Name */ + "MESA_FORMAT_B5G6R5_UNORM", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_R5G6B5_UNORM, /* Name */ + "MESA_FORMAT_R5G6B5_UNORM", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_B4G4R4A4_UNORM, /* Name */ + "MESA_FORMAT_B4G4R4A4_UNORM",/* StrName */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_B4G4R4X4_UNORM, + "MESA_FORMAT_B4G4R4X4_UNORM", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_A4R4G4B4_UNORM, /* Name */ + "MESA_FORMAT_A4R4G4B4_UNORM",/* StrName */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_A1B5G5R5_UNORM, /* Name */ + "MESA_FORMAT_A1B5G5R5_UNORM",/* StrName */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_B5G5R5A1_UNORM, /* Name */ + "MESA_FORMAT_B5G5R5A1_UNORM",/* StrName */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_B5G5R5X1_UNORM, + "MESA_FORMAT_B5G5R5X1_UNORM", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 5, 5, 5, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_A1R5G5B5_UNORM, /* Name */ + "MESA_FORMAT_A1R5G5B5_UNORM",/* StrName */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_L8A8_UNORM, /* Name */ + "MESA_FORMAT_L8A8_UNORM", /* StrName */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ + 8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_A8L8_UNORM, /* Name */ + "MESA_FORMAT_A8L8_UNORM", /* StrName */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ + 8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_R8G8_UNORM, + "MESA_FORMAT_R8G8_UNORM", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_G8R8_UNORM, + "MESA_FORMAT_G8R8_UNORM", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_L4A4_UNORM, /* Name */ + "MESA_FORMAT_L4A4_UNORM", /* StrName */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 4, /* Red/Green/Blue/AlphaBits */ + 4, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_B2G3R3_UNORM, /* Name */ + "MESA_FORMAT_B2G3R3_UNORM", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 3, 3, 2, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_R16G16_UNORM, + "MESA_FORMAT_R16G16_UNORM", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_G16R16_UNORM, + "MESA_FORMAT_G16R16_UNORM", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_B10G10R10A2_UNORM, + "MESA_FORMAT_B10G10R10A2_UNORM", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 10, 10, 10, 2, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_B10G10R10X2_UNORM, + "MESA_FORMAT_B10G10R10X2_UNORM", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 10, 10, 10, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R10G10B10A2_UNORM, + "MESA_FORMAT_R10G10B10A2_UNORM", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 10, 10, 10, 2, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_S8_UINT_Z24_UNORM, /* Name */ + "MESA_FORMAT_S8_UINT_Z24_UNORM", /* StrName */ + GL_DEPTH_STENCIL, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_X8_UINT_Z24_UNORM, /* Name */ + "MESA_FORMAT_X8_UINT_Z24_UNORM", /* StrName */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_Z24_UNORM_S8_UINT, /* Name */ + "MESA_FORMAT_Z24_UNORM_S8_UINT", /* StrName */ + GL_DEPTH_STENCIL, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_Z24_UNORM_X8_UINT, /* Name */ + "MESA_FORMAT_Z24_UNORM_X8_UINT", /* StrName */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_YCBCR, /* Name */ + "MESA_FORMAT_YCBCR", /* StrName */ + GL_YCBCR_MESA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_YCBCR_REV, /* Name */ + "MESA_FORMAT_YCBCR_REV", /* StrName */ + GL_YCBCR_MESA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + + /* Array unorm formats */ + { + MESA_FORMAT_A_UNORM8, /* Name */ + "MESA_FORMAT_A_UNORM8", /* StrName */ + GL_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_A_UNORM16, /* Name */ + "MESA_FORMAT_A_UNORM16", /* StrName */ + GL_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_L_UNORM8, /* Name */ + "MESA_FORMAT_L_UNORM8", /* StrName */ + GL_LUMINANCE, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_L_UNORM16, /* Name */ + "MESA_FORMAT_L_UNORM16", /* StrName */ + GL_LUMINANCE, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_I_UNORM8, /* Name */ + "MESA_FORMAT_I_UNORM8", /* StrName */ + GL_INTENSITY, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 8, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_I_UNORM16, /* Name */ + "MESA_FORMAT_I_UNORM16", /* StrName */ + GL_INTENSITY, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 16, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_R_UNORM8, + "MESA_FORMAT_R_UNORM8", + GL_RED, + GL_UNSIGNED_NORMALIZED, + 8, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_R_UNORM16, + "MESA_FORMAT_R_UNORM16", + GL_RED, + GL_UNSIGNED_NORMALIZED, + 16, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_BGR_UNORM8, /* Name */ + "MESA_FORMAT_BGR_UNORM8", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 3 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_RGB_UNORM8, /* Name */ + "MESA_FORMAT_RGB_UNORM8", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 3 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_RGBA_UNORM16, + "MESA_FORMAT_RGBA_UNORM16", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBX_UNORM16, + "MESA_FORMAT_RGBX_UNORM16", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_Z_UNORM16, /* Name */ + "MESA_FORMAT_Z_UNORM16", /* StrName */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 16, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_Z_UNORM32, /* Name */ + "MESA_FORMAT_Z_UNORM32", /* StrName */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 32, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_S_UINT8, /* Name */ + "MESA_FORMAT_S_UINT8", /* StrName */ + GL_STENCIL_INDEX, /* BaseFormat */ + GL_UNSIGNED_INT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 8, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + + /* Packed signed/normalized formats */ + { + MESA_FORMAT_A8B8G8R8_SNORM, + "MESA_FORMAT_A8B8G8R8_SNORM", + GL_RGBA, + GL_SIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_X8B8G8R8_SNORM, + "MESA_FORMAT_X8B8G8R8_SNORM", + GL_RGB, + GL_SIGNED_NORMALIZED, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 /* 4 bpp, but no alpha */ + }, + { + MESA_FORMAT_R8G8B8A8_SNORM, + "MESA_FORMAT_R8G8B8A8_SNORM", + GL_RGBA, + GL_SIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R8G8B8X8_SNORM, + "MESA_FORMAT_R8G8B8X8_SNORM", + GL_RGB, + GL_SIGNED_NORMALIZED, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R16G16_SNORM, + "MESA_FORMAT_R16G16_SNORM", + GL_RG, + GL_SIGNED_NORMALIZED, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_G16R16_SNORM, + "MESA_FORMAT_G16R16_SNORM", + GL_RG, + GL_SIGNED_NORMALIZED, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R8G8_SNORM, + "MESA_FORMAT_R8G8_SNORM", + GL_RG, + GL_SIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_G8R8_SNORM, + "MESA_FORMAT_G8R8_SNORM", + GL_RG, + GL_SIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_L8A8_SNORM, + "MESA_FORMAT_L8A8_SNORM", + GL_LUMINANCE_ALPHA, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 8, + 8, 0, 0, 0, 0, + 1, 1, 2 + }, + + /* Array signed/normalized formats */ + { + MESA_FORMAT_A_SNORM8, + "MESA_FORMAT_A_SNORM8", + GL_ALPHA, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 8, + 0, 0, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_A_SNORM16, + "MESA_FORMAT_A_SNORM16", + GL_ALPHA, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 16, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_L_SNORM8, + "MESA_FORMAT_L_SNORM8", + GL_LUMINANCE, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 8, 0, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_L_SNORM16, + "MESA_FORMAT_L_SNORM16", + GL_LUMINANCE, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 16, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_I_SNORM8, + "MESA_FORMAT_I_SNORM8", + GL_INTENSITY, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 0, 8, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_I_SNORM16, + "MESA_FORMAT_I_SNORM16", + GL_INTENSITY, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 0, 16, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_R_SNORM8, /* Name */ + "MESA_FORMAT_R_SNORM8", /* StrName */ + GL_RED, /* BaseFormat */ + GL_SIGNED_NORMALIZED, /* DataType */ + 8, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_R_SNORM16, + "MESA_FORMAT_R_SNORM16", + GL_RED, + GL_SIGNED_NORMALIZED, + 16, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_LA_SNORM16, + "MESA_FORMAT_LA_SNORM16", + GL_LUMINANCE_ALPHA, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 16, + 16, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RGB_SNORM16, + "MESA_FORMAT_RGB_SNORM16", + GL_RGB, + GL_SIGNED_NORMALIZED, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 6 + }, + { + MESA_FORMAT_RGBA_SNORM16, + "MESA_FORMAT_RGBA_SNORM16", + GL_RGBA, + GL_SIGNED_NORMALIZED, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBX_SNORM16, + "MESA_FORMAT_RGBX_SNORM16", + GL_RGB, + GL_SIGNED_NORMALIZED, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + + /* Packed sRGB formats */ + { + MESA_FORMAT_A8B8G8R8_SRGB, + "MESA_FORMAT_A8B8G8R8_SRGB", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_B8G8R8A8_SRGB, + "MESA_FORMAT_B8G8R8A8_SRGB", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_B8G8R8X8_SRGB, + "MESA_FORMAT_B8G8R8X8_SRGB", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R8G8B8A8_SRGB, + "MESA_FORMAT_R8G8B8A8_SRGB", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R8G8B8X8_SRGB, + "MESA_FORMAT_R8G8B8X8_SRGB", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_L8A8_SRGB, + "MESA_FORMAT_L8A8_SRGB", + GL_LUMINANCE_ALPHA, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, 8, + 8, 0, 0, 0, 0, + 1, 1, 2 + }, + + /* Array sRGB formats */ + { + MESA_FORMAT_L_SRGB8, + "MESA_FORMAT_L_SRGB8", + GL_LUMINANCE, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, 0, + 8, 0, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_BGR_SRGB8, + "MESA_FORMAT_BGR_SRGB8", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 3 + }, + + /* Packed float formats */ + { + MESA_FORMAT_R9G9B9E5_FLOAT, + "MESA_FORMAT_RGB9_E5", + GL_RGB, + GL_FLOAT, + 9, 9, 9, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R11G11B10_FLOAT, + "MESA_FORMAT_R11G11B10_FLOAT", + GL_RGB, + GL_FLOAT, + 11, 11, 10, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_Z32_FLOAT_S8X24_UINT, /* Name */ + "MESA_FORMAT_Z32_FLOAT_S8X24_UINT", /* StrName */ + GL_DEPTH_STENCIL, /* BaseFormat */ + /* DataType here is used to answer GL_TEXTURE_DEPTH_TYPE queries, and is + * never used for stencil because stencil is always GL_UNSIGNED_INT. + */ + GL_FLOAT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 32, 8, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 8 /* BlockWidth/Height,Bytes */ + }, + + /* Array float formats */ + { + MESA_FORMAT_A_FLOAT16, + "MESA_FORMAT_A_FLOAT16", + GL_ALPHA, + GL_FLOAT, + 0, 0, 0, 16, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_A_FLOAT32, + "MESA_FORMAT_A_FLOAT32", + GL_ALPHA, + GL_FLOAT, + 0, 0, 0, 32, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_L_FLOAT16, + "MESA_FORMAT_L_FLOAT16", + GL_LUMINANCE, + GL_FLOAT, + 0, 0, 0, 0, + 16, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_L_FLOAT32, + "MESA_FORMAT_L_FLOAT32", + GL_LUMINANCE, + GL_FLOAT, + 0, 0, 0, 0, + 32, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_LA_FLOAT16, + "MESA_FORMAT_LA_FLOAT16", + GL_LUMINANCE_ALPHA, + GL_FLOAT, + 0, 0, 0, 16, + 16, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_LA_FLOAT32, + "MESA_FORMAT_LA_FLOAT32", + GL_LUMINANCE_ALPHA, + GL_FLOAT, + 0, 0, 0, 32, + 32, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_I_FLOAT16, + "MESA_FORMAT_I_FLOAT16", + GL_INTENSITY, + GL_FLOAT, + 0, 0, 0, 0, + 0, 16, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_I_FLOAT32, + "MESA_FORMAT_I_FLOAT32", + GL_INTENSITY, + GL_FLOAT, + 0, 0, 0, 0, + 0, 32, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R_FLOAT16, + "MESA_FORMAT_R_FLOAT16", + GL_RED, + GL_FLOAT, + 16, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_R_FLOAT32, + "MESA_FORMAT_R_FLOAT32", + GL_RED, + GL_FLOAT, + 32, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RG_FLOAT16, + "MESA_FORMAT_RG_FLOAT16", + GL_RG, + GL_FLOAT, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RG_FLOAT32, + "MESA_FORMAT_RG_FLOAT32", + GL_RG, + GL_FLOAT, + 32, 32, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGB_FLOAT16, + "MESA_FORMAT_RGB_FLOAT16", + GL_RGB, + GL_FLOAT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 6 + }, + { + MESA_FORMAT_RGB_FLOAT32, + "MESA_FORMAT_RGB_FLOAT32", + GL_RGB, + GL_FLOAT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 12 + }, + { + MESA_FORMAT_RGBA_FLOAT16, + "MESA_FORMAT_RGBA_FLOAT16", + GL_RGBA, + GL_FLOAT, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBA_FLOAT32, + "MESA_FORMAT_RGBA_FLOAT32", + GL_RGBA, + GL_FLOAT, + 32, 32, 32, 32, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + MESA_FORMAT_RGBX_FLOAT16, + "MESA_FORMAT_RGBX_FLOAT16", + GL_RGB, + GL_FLOAT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBX_FLOAT32, + "MESA_FORMAT_RGBX_FLOAT32", + GL_RGB, + GL_FLOAT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + MESA_FORMAT_Z_FLOAT32, /* Name */ + "MESA_FORMAT_Z_FLOAT32", /* StrName */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 32, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + + /* Packed signed/unsigned non-normalized integer formats */ + { + MESA_FORMAT_B10G10R10A2_UINT, + "MESA_FORMAT_B10G10R10A2_UINT", + GL_RGBA, + GL_UNSIGNED_INT, + 10, 10, 10, 2, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R10G10B10A2_UINT, + "MESA_FORMAT_R10G10B10A2_UINT", + GL_RGBA, + GL_UNSIGNED_INT, + 10, 10, 10, 2, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + + /* Array signed/unsigned non-normalized integer formats */ + { + MESA_FORMAT_A_UINT8, + "MESA_FORMAT_A_UINT8", + GL_ALPHA, + GL_UNSIGNED_INT, + 0, 0, 0, 8, + 0, 0, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_A_UINT16, + "MESA_FORMAT_A_UINT16", + GL_ALPHA, + GL_UNSIGNED_INT, + 0, 0, 0, 16, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_A_UINT32, + "MESA_FORMAT_A_UINT32", + GL_ALPHA, + GL_UNSIGNED_INT, + 0, 0, 0, 32, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_A_SINT8, + "MESA_FORMAT_A_SINT8", + GL_ALPHA, + GL_INT, + 0, 0, 0, 8, + 0, 0, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_A_SINT16, + "MESA_FORMAT_A_SINT16", + GL_ALPHA, + GL_INT, + 0, 0, 0, 16, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_A_SINT32, + "MESA_FORMAT_A_SINT32", + GL_ALPHA, + GL_INT, + 0, 0, 0, 32, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_I_UINT8, + "MESA_FORMAT_I_UINT8", + GL_INTENSITY, + GL_UNSIGNED_INT, + 0, 0, 0, 0, + 0, 8, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_I_UINT16, + "MESA_FORMAT_I_UINT16", + GL_INTENSITY, + GL_UNSIGNED_INT, + 0, 0, 0, 0, + 0, 16, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_I_UINT32, + "MESA_FORMAT_I_UINT32", + GL_INTENSITY, + GL_UNSIGNED_INT, + 0, 0, 0, 0, + 0, 32, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_I_SINT8, + "MESA_FORMAT_I_SINT8", + GL_INTENSITY, + GL_INT, + 0, 0, 0, 0, + 0, 8, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_I_SINT16, + "MESA_FORMAT_I_SINT16", + GL_INTENSITY, + GL_INT, + 0, 0, 0, 0, + 0, 16, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_I_SINT32, + "MESA_FORMAT_I_SINT32", + GL_INTENSITY, + GL_INT, + 0, 0, 0, 0, + 0, 32, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_L_UINT8, + "MESA_FORMAT_L_UINT8", + GL_LUMINANCE, + GL_UNSIGNED_INT, + 0, 0, 0, 0, + 8, 0, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_L_UINT16, + "MESA_FORMAT_L_UINT16", + GL_LUMINANCE, + GL_UNSIGNED_INT, + 0, 0, 0, 0, + 16, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_L_UINT32, + "MESA_FORMAT_L_UINT32", + GL_LUMINANCE, + GL_UNSIGNED_INT, + 0, 0, 0, 0, + 32, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_L_SINT8, + "MESA_FORMAT_L_SINT8", + GL_LUMINANCE, + GL_INT, + 0, 0, 0, 0, + 8, 0, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_L_SINT16, + "MESA_FORMAT_L_SINT16", + GL_LUMINANCE, + GL_INT, + 0, 0, 0, 0, + 16, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_L_SINT32, + "MESA_FORMAT_L_SINT32", + GL_LUMINANCE, + GL_INT, + 0, 0, 0, 0, + 32, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_LA_UINT8, + "MESA_FORMAT_LA_UINT8", + GL_LUMINANCE_ALPHA, + GL_UNSIGNED_INT, + 0, 0, 0, 8, + 8, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_LA_UINT16, + "MESA_FORMAT_LA_UINT16", + GL_LUMINANCE_ALPHA, + GL_UNSIGNED_INT, + 0, 0, 0, 16, + 16, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_LA_UINT32, + "MESA_FORMAT_LA_UINT32", + GL_LUMINANCE_ALPHA, + GL_UNSIGNED_INT, + 0, 0, 0, 32, + 32, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_LA_SINT8, + "MESA_FORMAT_LA_SINT8", + GL_LUMINANCE_ALPHA, + GL_INT, + 0, 0, 0, 8, + 8, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_LA_SINT16, + "MESA_FORMAT_LA_SINT16", + GL_LUMINANCE_ALPHA, + GL_INT, + 0, 0, 0, 16, + 16, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_LA_SINT32, + "MESA_FORMAT_LA_SINT32", + GL_LUMINANCE_ALPHA, + GL_INT, + 0, 0, 0, 32, + 32, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_R_UINT8, + "MESA_FORMAT_R_UINT8", + GL_RED, + GL_UNSIGNED_INT, + 8, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_R_UINT16, + "MESA_FORMAT_R_UINT16", + GL_RED, + GL_UNSIGNED_INT, + 16, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_R_UINT32, + "MESA_FORMAT_R_UINT32", + GL_RED, + GL_UNSIGNED_INT, + 32, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R_SINT8, + "MESA_FORMAT_R_SINT8", + GL_RED, + GL_INT, + 8, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_R_SINT16, + "MESA_FORMAT_R_SINT16", + GL_RED, + GL_INT, + 16, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_R_SINT32, + "MESA_FORMAT_R_SINT32", + GL_RED, + GL_INT, + 32, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RG_UINT8, + "MESA_FORMAT_RG_UINT8", + GL_RG, + GL_UNSIGNED_INT, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_RG_UINT16, + "MESA_FORMAT_RG_UINT16", + GL_RG, + GL_UNSIGNED_INT, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RG_UINT32, + "MESA_FORMAT_RG_UINT32", + GL_RG, + GL_UNSIGNED_INT, + 32, 32, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RG_SINT8, + "MESA_FORMAT_RG_SINT8", + GL_RG, + GL_INT, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_RG_SINT16, + "MESA_FORMAT_RG_SINT16", + GL_RG, + GL_INT, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RG_SINT32, + "MESA_FORMAT_RG_SINT32", + GL_RG, + GL_INT, + 32, 32, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGB_UINT8, + "MESA_FORMAT_RGB_UINT8", + GL_RGB, + GL_UNSIGNED_INT, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 3 + }, + { + MESA_FORMAT_RGB_UINT16, + "MESA_FORMAT_RGB_UINT16", + GL_RGB, + GL_UNSIGNED_INT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 6 + }, + { + MESA_FORMAT_RGB_UINT32, + "MESA_FORMAT_RGB_UINT32", + GL_RGB, + GL_UNSIGNED_INT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 12 + }, + { + MESA_FORMAT_RGB_SINT8, + "MESA_FORMAT_RGB_SINT8", + GL_RGB, + GL_INT, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 3 + }, + { + MESA_FORMAT_RGB_SINT16, + "MESA_FORMAT_RGB_SINT16", + GL_RGB, + GL_INT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 6 + }, + { + MESA_FORMAT_RGB_SINT32, + "MESA_FORMAT_RGB_SINT32", + GL_RGB, + GL_INT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 12 + }, + { + MESA_FORMAT_RGBA_UINT8, + "MESA_FORMAT_RGBA_UINT8", + GL_RGBA, + GL_UNSIGNED_INT, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RGBA_UINT16, + "MESA_FORMAT_RGBA_UINT16", + GL_RGBA, + GL_UNSIGNED_INT, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBA_UINT32, + "MESA_FORMAT_RGBA_UINT32", + GL_RGBA, + GL_UNSIGNED_INT, + 32, 32, 32, 32, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + MESA_FORMAT_RGBA_SINT8, + "MESA_FORMAT_RGBA_SINT8", + GL_RGBA, + GL_INT, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RGBA_SINT16, + "MESA_FORMAT_RGBA_SINT16", + GL_RGBA, + GL_INT, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBA_SINT32, + "MESA_FORMAT_RGBA_SINT32", + GL_RGBA, + GL_INT, + 32, 32, 32, 32, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + MESA_FORMAT_RGBX_UINT8, + "MESA_FORMAT_RGBX_UINT8", + GL_RGB, + GL_UNSIGNED_INT, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RGBX_UINT16, + "MESA_FORMAT_RGBX_UINT16", + GL_RGB, + GL_UNSIGNED_INT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBX_UINT32, + "MESA_FORMAT_RGBX_UINT32", + GL_RGB, + GL_UNSIGNED_INT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + MESA_FORMAT_RGBX_SINT8, + "MESA_FORMAT_RGBX_SINT8", + GL_RGB, + GL_INT, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RGBX_SINT16, + "MESA_FORMAT_RGBX_SINT16", + GL_RGB, + GL_INT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBX_SINT32, + "MESA_FORMAT_RGBX_SINT32", + GL_RGB, + GL_INT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + + /* DXT compressed formats */ + { + MESA_FORMAT_RGB_DXT1, /* Name */ + "MESA_FORMAT_RGB_DXT1", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_RGBA_DXT1, + "MESA_FORMAT_RGBA_DXT1", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, + 0, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_RGBA_DXT3, + "MESA_FORMAT_RGBA_DXT3", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + { + MESA_FORMAT_RGBA_DXT5, + "MESA_FORMAT_RGBA_DXT5", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + + /* DXT sRGB compressed formats */ + { + MESA_FORMAT_SRGB_DXT1, /* Name */ + "MESA_FORMAT_SRGB_DXT1", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_SRGBA_DXT1, + "MESA_FORMAT_SRGBA_DXT1", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, + 0, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_SRGBA_DXT3, + "MESA_FORMAT_SRGBA_DXT3", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + { + MESA_FORMAT_SRGBA_DXT5, + "MESA_FORMAT_SRGBA_DXT5", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + + /* FXT1 compressed formats */ + { + MESA_FORMAT_RGB_FXT1, + "MESA_FORMAT_RGB_FXT1", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 0, /* approx Red/Green/BlueBits */ + 0, 0, 0, 0, 0, + 8, 4, 16 /* 16 bytes per 8x4 block */ + }, + { + MESA_FORMAT_RGBA_FXT1, + "MESA_FORMAT_RGBA_FXT1", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 1, /* approx Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, + 8, 4, 16 /* 16 bytes per 8x4 block */ + }, + + /* RGTC compressed formats */ + { + MESA_FORMAT_R_RGTC1_UNORM, + "MESA_FORMAT_R_RGTC1_UNORM", + GL_RED, + GL_UNSIGNED_NORMALIZED, + 8, 0, 0, 0, + 0, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_R_RGTC1_SNORM, + "MESA_FORMAT_R_RGTC1_SNORM", + GL_RED, + GL_SIGNED_NORMALIZED, + 8, 0, 0, 0, + 0, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_RG_RGTC2_UNORM, + "MESA_FORMAT_RG_RGTC2_UNORM", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + { + MESA_FORMAT_RG_RGTC2_SNORM, + "MESA_FORMAT_RG_RGTC2_SNORM", + GL_RG, + GL_SIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + + /* LATC1/2 compressed formats */ + { + MESA_FORMAT_L_LATC1_UNORM, + "MESA_FORMAT_L_LATC1_UNORM", + GL_LUMINANCE, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, 0, + 4, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_L_LATC1_SNORM, + "MESA_FORMAT_L_LATC1_SNORM", + GL_LUMINANCE, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 4, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_LA_LATC2_UNORM, + "MESA_FORMAT_LA_LATC2_UNORM", + GL_LUMINANCE_ALPHA, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, 4, + 4, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + { + MESA_FORMAT_LA_LATC2_SNORM, + "MESA_FORMAT_LA_LATC2_SNORM", + GL_LUMINANCE_ALPHA, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 4, + 4, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + + /* ETC1/2 compressed formats */ + { + MESA_FORMAT_ETC1_RGB8, + "MESA_FORMAT_ETC1_RGB8", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_ETC2_RGB8, + "MESA_FORMAT_ETC2_RGB8", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_ETC2_SRGB8, + "MESA_FORMAT_ETC2_SRGB8", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_ETC2_RGBA8_EAC, + "MESA_FORMAT_ETC2_RGBA8_EAC", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + { + MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC, + "MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + { + MESA_FORMAT_ETC2_R11_EAC, + "MESA_FORMAT_ETC2_R11_EAC", + GL_RED, + GL_UNSIGNED_NORMALIZED, + 11, 0, 0, 0, + 0, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_ETC2_RG11_EAC, + "MESA_FORMAT_ETC2_RG11_EAC", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 11, 11, 0, 0, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + { + MESA_FORMAT_ETC2_SIGNED_R11_EAC, + "MESA_FORMAT_ETC2_SIGNED_R11_EAC", + GL_RED, + GL_SIGNED_NORMALIZED, + 11, 0, 0, 0, + 0, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_ETC2_SIGNED_RG11_EAC, + "MESA_FORMAT_ETC2_SIGNED_RG11_EAC", + GL_RG, + GL_SIGNED_NORMALIZED, + 11, 11, 0, 0, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + { + MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1, + "MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 1, + 0, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1, + "MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 1, + 0, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, +}; - num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * num_msaa_modes; - configs = calloc(1, (num_modes + 1) * sizeof *configs); - if (configs == NULL) - return NULL; +static const struct gl_format_info * +_mesa_get_format_info(mesa_format format) +{ + const struct gl_format_info *info = &format_info[format]; + assert(info->Name == format); + return info; +} - c = configs; - for ( k = 0 ; k < num_depth_stencil_bits ; k++ ) { - for ( i = 0 ; i < num_db_modes ; i++ ) { - for ( h = 0 ; h < num_msaa_modes; h++ ) { - for ( j = 0 ; j < num_accum_bits ; j++ ) { - *c = malloc (sizeof **c); - modes = &(*c)->modes; - c++; - - memset(modes, 0, sizeof *modes); - modes->redBits = bits[0]; - modes->greenBits = bits[1]; - modes->blueBits = bits[2]; - modes->alphaBits = bits[3]; - modes->redMask = masks[0]; - modes->greenMask = masks[1]; - modes->blueMask = masks[2]; - modes->alphaMask = masks[3]; - modes->rgbBits = modes->redBits + modes->greenBits - + modes->blueBits + modes->alphaBits; - - modes->accumRedBits = 16 * j; - modes->accumGreenBits = 16 * j; - modes->accumBlueBits = 16 * j; - modes->accumAlphaBits = (masks[3] != 0) ? 16 * j : 0; - modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG; - - modes->stencilBits = stencil_bits[k]; - modes->depthBits = depth_bits[k]; - - modes->transparentPixel = GLX_NONE; - modes->transparentRed = GLX_DONT_CARE; - modes->transparentGreen = GLX_DONT_CARE; - modes->transparentBlue = GLX_DONT_CARE; - modes->transparentAlpha = GLX_DONT_CARE; - modes->transparentIndex = GLX_DONT_CARE; - modes->rgbMode = GL_TRUE; - - if ( db_modes[i] == GLX_NONE ) { - modes->doubleBufferMode = GL_FALSE; - } - else { - modes->doubleBufferMode = GL_TRUE; - modes->swapMethod = db_modes[i]; - } - - modes->samples = msaa_samples[h]; - modes->sampleBuffers = modes->samples ? 1 : 0; - - - modes->haveAccumBuffer = ((modes->accumRedBits + - modes->accumGreenBits + - modes->accumBlueBits + - modes->accumAlphaBits) > 0); - modes->haveDepthBuffer = (modes->depthBits > 0); - modes->haveStencilBuffer = (modes->stencilBits > 0); - - modes->bindToTextureRgb = GL_TRUE; - modes->bindToTextureRgba = GL_TRUE; - modes->bindToMipmapTexture = GL_FALSE; - modes->bindToTextureTargets = - __DRI_ATTRIB_TEXTURE_1D_BIT | - __DRI_ATTRIB_TEXTURE_2D_BIT | - __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT; - - modes->sRGBCapable = GL_FALSE; - } - } - } - } - *c = NULL; - return configs; +/** Return string name of format (for debugging) */ +const char * +_mesa_get_format_name(mesa_format format) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + return info->StrName; } -static __DRIconfig ** -swrastFillInModes(__DRIscreen *psp, - unsigned pixel_bits, unsigned depth_bits, - unsigned stencil_bits, GLboolean have_back_buffer) +/** + * Return bits per component for the given format. + * \param format one of MESA_FORMAT_x + * \param pname the component, such as GL_RED_BITS, GL_TEXTURE_BLUE_BITS, etc. + */ +GLint +_mesa_get_format_bits(mesa_format format, GLenum pname) { - __DRIconfig **configs; - unsigned depth_buffer_factor; - unsigned back_buffer_factor; - GLenum fb_format; - GLenum fb_type; - - /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't - * support pageflipping at all. - */ - static const GLenum back_buffer_modes[] = { - GLX_NONE, GLX_SWAP_UNDEFINED_OML - }; - - uint8_t depth_bits_array[4]; - uint8_t stencil_bits_array[4]; - uint8_t msaa_samples_array[1]; - - (void) psp; - (void) have_back_buffer; - - PRINTF(__FUNCTION__"\n"); - - depth_bits_array[0] = 0; - depth_bits_array[1] = 0; - depth_bits_array[2] = depth_bits; - depth_bits_array[3] = depth_bits; - - /* Just like with the accumulation buffer, always provide some modes - * with a stencil buffer. - */ - stencil_bits_array[0] = 0; - stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits; - stencil_bits_array[2] = 0; - stencil_bits_array[3] = (stencil_bits == 0) ? 8 : stencil_bits; - - msaa_samples_array[0] = 0; + const struct gl_format_info *info = _mesa_get_format_info(format); + + switch (pname) { + case GL_RED_BITS: + case GL_TEXTURE_RED_SIZE: + case GL_RENDERBUFFER_RED_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: + return info->RedBits; + case GL_GREEN_BITS: + case GL_TEXTURE_GREEN_SIZE: + case GL_RENDERBUFFER_GREEN_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: + return info->GreenBits; + case GL_BLUE_BITS: + case GL_TEXTURE_BLUE_SIZE: + case GL_RENDERBUFFER_BLUE_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: + return info->BlueBits; + case GL_ALPHA_BITS: + case GL_TEXTURE_ALPHA_SIZE: + case GL_RENDERBUFFER_ALPHA_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: + return info->AlphaBits; + case GL_TEXTURE_INTENSITY_SIZE: + return info->IntensityBits; + case GL_TEXTURE_LUMINANCE_SIZE: + return info->LuminanceBits; + case GL_INDEX_BITS: + return info->IndexBits; + case GL_DEPTH_BITS: + case GL_TEXTURE_DEPTH_SIZE_ARB: + case GL_RENDERBUFFER_DEPTH_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: + return info->DepthBits; + case GL_STENCIL_BITS: + case GL_TEXTURE_STENCIL_SIZE_EXT: + case GL_RENDERBUFFER_STENCIL_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: + return info->StencilBits; + default: + ErrorF("bad pname in _mesa_get_format_bits(): %d\n",pname); + return 0; + } +} - depth_buffer_factor = 4; - back_buffer_factor = 2; +/** + * Return color encoding for given format. + * \return GL_LINEAR or GL_SRGB + */ +GLenum +_mesa_get_format_color_encoding(mesa_format format) +{ + /* XXX this info should be encoded in gl_format_info */ + switch (format) { + case MESA_FORMAT_BGR_SRGB8: + case MESA_FORMAT_A8B8G8R8_SRGB: + case MESA_FORMAT_B8G8R8A8_SRGB: + case MESA_FORMAT_R8G8B8A8_SRGB: + case MESA_FORMAT_L_SRGB8: + case MESA_FORMAT_L8A8_SRGB: + case MESA_FORMAT_SRGB_DXT1: + case MESA_FORMAT_SRGBA_DXT1: + case MESA_FORMAT_SRGBA_DXT3: + case MESA_FORMAT_SRGBA_DXT5: + case MESA_FORMAT_R8G8B8X8_SRGB: + case MESA_FORMAT_ETC2_SRGB8: + case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC: + case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1: + case MESA_FORMAT_B8G8R8X8_SRGB: + return GL_SRGB; + default: + return GL_LINEAR; + } +} - switch (pixel_bits) { - case 8: - fb_format = GL_RGB; - fb_type = GL_UNSIGNED_BYTE_2_3_3_REV; +__DRIconfig ** +driCreateConfigs(mesa_format format, + const uint8_t * depth_bits, const uint8_t * stencil_bits, + unsigned num_depth_stencil_bits, + const GLenum * db_modes, unsigned num_db_modes, + const uint8_t * msaa_samples, unsigned num_msaa_modes, + GLboolean enable_accum) +{ + static const uint32_t masks_table[][4] = { + /* MESA_FORMAT_B5G6R5_UNORM */ + { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, + /* MESA_FORMAT_B8G8R8X8_UNORM */ + { 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 }, + /* MESA_FORMAT_B8G8R8A8_UNORM */ + { 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 }, + /* MESA_FORMAT_B10G10R10X2_UNORM */ + { 0x3FF00000, 0x000FFC00, 0x000003FF, 0x00000000 }, + /* MESA_FORMAT_B10G10R10A2_UNORM */ + { 0x3FF00000, 0x000FFC00, 0x000003FF, 0xC0000000 }, + }; + + const uint32_t * masks; + __DRIconfig **configs, **c; + struct gl_config *modes; + unsigned i, j, k, h; + unsigned num_modes; + unsigned num_accum_bits = (enable_accum) ? 2 : 1; + int red_bits; + int green_bits; + int blue_bits; + int alpha_bits; + bool is_srgb; + + switch (format) { + case MESA_FORMAT_B5G6R5_UNORM: + masks = masks_table[0]; break; - case 16: - fb_format = GL_RGB; - fb_type = GL_UNSIGNED_SHORT_5_6_5; + case MESA_FORMAT_B8G8R8X8_UNORM: + masks = masks_table[1]; break; - case 24: - fb_format = GL_BGR; - fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; + case MESA_FORMAT_B8G8R8A8_UNORM: + case MESA_FORMAT_B8G8R8A8_SRGB: + masks = masks_table[2]; break; - case 32: - fb_format = GL_BGRA; - fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; + case MESA_FORMAT_B10G10R10X2_UNORM: + masks = masks_table[3]; break; - default: - fprintf(stderr, "[%s:%u] bad depth %d\n", __FUNCTION__, __LINE__, - pixel_bits); + case MESA_FORMAT_B10G10R10A2_UNORM: + masks = masks_table[4]; + break; + default: + fprintf(stderr, "[%s:%u] Unknown framebuffer type %s (%d).\n", + __FUNCTION__, __LINE__, + _mesa_get_format_name(format), format); return NULL; - } + } + + red_bits = _mesa_get_format_bits(format, GL_RED_BITS); + green_bits = _mesa_get_format_bits(format, GL_GREEN_BITS); + blue_bits = _mesa_get_format_bits(format, GL_BLUE_BITS); + alpha_bits = _mesa_get_format_bits(format, GL_ALPHA_BITS); + is_srgb = _mesa_get_format_color_encoding(format) == GL_SRGB; + + num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * num_msaa_modes; + configs = calloc(1, (num_modes + 1) * sizeof *configs); + if (configs == NULL) + return NULL; + + c = configs; + for ( k = 0 ; k < num_depth_stencil_bits ; k++ ) { + for ( i = 0 ; i < num_db_modes ; i++ ) { + for ( h = 0 ; h < num_msaa_modes; h++ ) { + for ( j = 0 ; j < num_accum_bits ; j++ ) { + *c = malloc (sizeof **c); + modes = &(*c)->modes; + c++; + + memset(modes, 0, sizeof *modes); + modes->redBits = red_bits; + modes->greenBits = green_bits; + modes->blueBits = blue_bits; + modes->alphaBits = alpha_bits; + modes->redMask = masks[0]; + modes->greenMask = masks[1]; + modes->blueMask = masks[2]; + modes->alphaMask = masks[3]; + modes->rgbBits = modes->redBits + modes->greenBits + + modes->blueBits + modes->alphaBits; + + modes->accumRedBits = 16 * j; + modes->accumGreenBits = 16 * j; + modes->accumBlueBits = 16 * j; + modes->accumAlphaBits = (masks[3] != 0) ? 16 * j : 0; + modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG; + + modes->stencilBits = stencil_bits[k]; + modes->depthBits = depth_bits[k]; + + modes->transparentPixel = GLX_NONE; + modes->transparentRed = GLX_DONT_CARE; + modes->transparentGreen = GLX_DONT_CARE; + modes->transparentBlue = GLX_DONT_CARE; + modes->transparentAlpha = GLX_DONT_CARE; + modes->transparentIndex = GLX_DONT_CARE; + modes->rgbMode = GL_TRUE; + + if ( db_modes[i] == GLX_NONE ) { + modes->doubleBufferMode = GL_FALSE; + } + else { + modes->doubleBufferMode = GL_TRUE; + modes->swapMethod = db_modes[i]; + } + + modes->samples = msaa_samples[h]; + modes->sampleBuffers = modes->samples ? 1 : 0; + + + modes->haveAccumBuffer = ((modes->accumRedBits + + modes->accumGreenBits + + modes->accumBlueBits + + modes->accumAlphaBits) > 0); + modes->haveDepthBuffer = (modes->depthBits > 0); + modes->haveStencilBuffer = (modes->stencilBits > 0); + + modes->bindToTextureRgb = GL_TRUE; + modes->bindToTextureRgba = GL_TRUE; + modes->bindToMipmapTexture = GL_FALSE; + modes->bindToTextureTargets = + __DRI_ATTRIB_TEXTURE_1D_BIT | + __DRI_ATTRIB_TEXTURE_2D_BIT | + __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT; + + modes->yInverted = GL_TRUE; + modes->sRGBCapable = is_srgb; + } + } + } + } + *c = NULL; + + return configs; +} - configs = driCreateConfigs(fb_format, fb_type, - depth_bits_array, stencil_bits_array, - depth_buffer_factor, back_buffer_modes, - back_buffer_factor, msaa_samples_array, 1, - GL_TRUE); - if (configs == NULL) { - fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __FUNCTION__, - __LINE__); - return NULL; - } +static __DRIconfig ** +swrastFillInModes(__DRIscreen *psp, + unsigned pixel_bits, unsigned depth_bits, + unsigned stencil_bits, GLboolean have_back_buffer) +{ + __DRIconfig **configs; + unsigned depth_buffer_factor; + unsigned back_buffer_factor; + mesa_format format; + + /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't + * support pageflipping at all. + */ + static const GLenum back_buffer_modes[] = { + GLX_NONE, GLX_SWAP_UNDEFINED_OML + }; + + uint8_t depth_bits_array[4]; + uint8_t stencil_bits_array[4]; + uint8_t msaa_samples_array[1]; + + (void) psp; + (void) have_back_buffer; + + depth_bits_array[0] = 0; + depth_bits_array[1] = 0; + depth_bits_array[2] = depth_bits; + depth_bits_array[3] = depth_bits; + + /* Just like with the accumulation buffer, always provide some modes + * with a stencil buffer. + */ + stencil_bits_array[0] = 0; + stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits; + stencil_bits_array[2] = 0; + stencil_bits_array[3] = (stencil_bits == 0) ? 8 : stencil_bits; + + msaa_samples_array[0] = 0; + + depth_buffer_factor = 4; + back_buffer_factor = 2; + + switch (pixel_bits) { + case 16: + format = MESA_FORMAT_B5G6R5_UNORM; + break; + case 24: + format = MESA_FORMAT_B8G8R8X8_UNORM; + break; + case 32: + format = MESA_FORMAT_B8G8R8A8_UNORM; + break; + default: + fprintf(stderr, "[%s:%u] bad depth %d\n", __FUNCTION__, __LINE__, + pixel_bits); + return NULL; + } + + configs = driCreateConfigs(format, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, back_buffer_modes, + back_buffer_factor, msaa_samples_array, 1, + GL_TRUE); + if (configs == NULL) { + fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __FUNCTION__, + __LINE__); + return NULL; + } - return configs; + return configs; } -__DRIconfig **driConcatConfigs(__DRIconfig **a, __DRIconfig **b) +__DRIconfig **driConcatConfigs(__DRIconfig **a, + __DRIconfig **b) { - __DRIconfig **all; - int i, j, index; + __DRIconfig **all; + int i, j, index; - PRINTF(__FUNCTION__"\n"); + if (a == NULL || a[0] == NULL) + return b; + else if (b == NULL || b[0] == NULL) + return a; - i = 0; - while (a[i] != NULL) + i = 0; + while (a[i] != NULL) i++; - j = 0; - while (b[j] != NULL) + j = 0; + while (b[j] != NULL) j++; - all = malloc((i + j + 1) * sizeof *all); - index = 0; - for (i = 0; a[i] != NULL; i++) - all[index++] = a[i]; - for (j = 0; b[j] != NULL; j++) - all[index++] = b[j]; - all[index++] = NULL; + all = malloc((i + j + 1) * sizeof *all); + index = 0; + for (i = 0; a[i] != NULL; i++) + all[index++] = a[i]; + for (j = 0; b[j] != NULL; j++) + all[index++] = b[j]; + all[index++] = NULL; - free(a); - free(b); + free(a); + free(b); - return all; + return all; } /** * Return the value of a configuration attribute. The attribute is * indicated by the index. */ -static int driGetConfigAttribIndex(const __DRIconfig *config, unsigned int index, unsigned int *value) +static int +driGetConfigAttribIndex(const __DRIconfig *config, + unsigned int index, unsigned int *value) { - switch (attribMap[index].attrib) { - case __DRI_ATTRIB_RENDER_TYPE: - /* no support for color index mode */ - *value = __DRI_ATTRIB_RGBA_BIT; - break; - case __DRI_ATTRIB_CONFIG_CAVEAT: - if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG) - *value = __DRI_ATTRIB_NON_CONFORMANT_CONFIG; - else if (config->modes.visualRating == GLX_SLOW_CONFIG) - *value = __DRI_ATTRIB_SLOW_BIT; - else - *value = 0; - break; - case __DRI_ATTRIB_SWAP_METHOD: - /* XXX no return value??? */ - break; - - case __DRI_ATTRIB_FLOAT_MODE: - /* this field is not int-sized */ - *value = config->modes.floatMode; - break; - - default: - /* any other int-sized field */ - *value = *(unsigned int *) - ((char *) &config->modes + attribMap[index].offset); - break; - } + switch (attribMap[index].attrib) { + case __DRI_ATTRIB_RENDER_TYPE: + /* no support for color index mode */ + *value = __DRI_ATTRIB_RGBA_BIT; + break; + case __DRI_ATTRIB_CONFIG_CAVEAT: + if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG) + *value = __DRI_ATTRIB_NON_CONFORMANT_CONFIG; + else if (config->modes.visualRating == GLX_SLOW_CONFIG) + *value = __DRI_ATTRIB_SLOW_BIT; + else + *value = 0; + break; + case __DRI_ATTRIB_SWAP_METHOD: + /* XXX no return value??? */ + break; + + default: + /* any other int-sized field */ + *value = *(unsigned int *) + ((char *) &config->modes + attribMap[index].offset); + + break; + } return GL_TRUE; } + /** * Get the value of a configuration attribute. * \param attrib the attribute (one of the _DRI_ATTRIB_x tokens) @@ -932,18 +3076,20 @@ static const __DRIconfig **dri_init_screen(__DRIscreen * psp) PRINTF(__FUNCTION__": psp %x\n", psp); - psp->extensions = dri_screen_extensions; + psp->max_gl_compat_version = 21; + psp->max_gl_es1_version = 11; + psp->max_gl_es2_version = 20; + + psp->extensions = dri_screen_extensions; - configs8 = swrastFillInModes(psp, 8, 8, 0, 1); - configs16 = swrastFillInModes(psp, 16, 16, 0, 1); - configs24 = swrastFillInModes(psp, 24, 24, 8, 1); - configs32 = swrastFillInModes(psp, 32, 24, 8, 1); + configs16 = swrastFillInModes(psp, 16, 16, 0, 1); + configs24 = swrastFillInModes(psp, 24, 24, 8, 1); + configs32 = swrastFillInModes(psp, 32, 24, 8, 1); - configs16 = driConcatConfigs(configs8, configs16); - configs24 = driConcatConfigs(configs16, configs24); - configs32 = driConcatConfigs(configs24, configs32); + configs24 = driConcatConfigs(configs16, configs24); + configs32 = driConcatConfigs(configs24, configs32); - return (const __DRIconfig **)configs32; + return (const __DRIconfig **)configs32; } static __DRIscreen *driCreateNewScreen(int scrn, const __DRIextension **extensions, const __DRIconfig ***driver_configs, void *data) -- cgit v1.2.3