dri_interface: Introduce DRI tokens for the texBuffer texture formats
authorKristian Høgsberg <krh@bitplanet.net>
Tue, 9 Feb 2010 20:26:14 +0000 (15:26 -0500)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 9 Feb 2010 20:55:25 +0000 (15:55 -0500)
This used to take GLX tokens, but the DRI interface can't depend on GLX
defines.  We fix this by introducing DRI tokens that have the same value
as the GLX texture format tokens.

include/GL/internal/dri_interface.h
include/GL/internal/glcore.h
src/gallium/state_trackers/dri/dri_drawable.c
src/mesa/drivers/dri/intel/intel_tex_image.c
src/mesa/drivers/dri/r200/r200_texstate.c
src/mesa/drivers/dri/r300/r300_texstate.c
src/mesa/drivers/dri/r600/r600_texstate.c
src/mesa/drivers/dri/radeon/radeon_texstate.c

index ec6238f873420401741a3544c70215ceaca55768..58540d60057f06f4177515b90057a4adfede6fe8 100644 (file)
@@ -230,6 +230,13 @@ struct __DRItexOffsetExtensionRec {
 };
 
 
+/* Valid values for format in the setTexBuffer2 function below.  These
+ * values match the GLX tokens for compatibility reasons, but we
+ * define them here since the DRI interface can't depend on GLX. */
+#define __DRI_TEXTURE_FORMAT_NONE        0x20D8
+#define __DRI_TEXTURE_FORMAT_RGB         0x20D9
+#define __DRI_TEXTURE_FORMAT_RGBA        0x20DA
+
 #define __DRI_TEX_BUFFER "DRI_TexBuffer"
 #define __DRI_TEX_BUFFER_VERSION 2
 struct __DRItexBufferExtensionRec {
index 18f657662af973b836e905d833727b62c65e5fd4..547b1113707e231e771b82d87b42bed39fc56ccb 100644 (file)
@@ -178,8 +178,4 @@ typedef struct __GLcontextModesRec {
 #define GLX_TEXTURE_2D_BIT_EXT             0x00000002
 #define GLX_TEXTURE_RECTANGLE_BIT_EXT      0x00000004
 
-#define GLX_TEXTURE_FORMAT_NONE_EXT        0x20D8
-#define GLX_TEXTURE_FORMAT_RGB_EXT         0x20D9
-#define GLX_TEXTURE_FORMAT_RGBA_EXT        0x20DA
-
 #endif /* __gl_core_h_ */
index f7ed6605bf8c2308ec58d35c43ae0f7df1e3c854..ff21f2f9580ff59bc30dd5431504a40b5d389d5f 100644 (file)
@@ -268,7 +268,7 @@ void dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
 void dri2_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
                          __DRIdrawable *dPriv)
 {
-   dri2_set_tex_buffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+   dri2_set_tex_buffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
 }
 
 void
index 6402141170d5d181d73e85989a4dfef37e37f12c..d63292edd312fdf009f4cc77fd866ea130411f18 100644 (file)
@@ -728,7 +728,7 @@ intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname,
 
 void
 intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
-                  GLint glx_texture_format,
+                  GLint texture_format,
                   __DRIdrawable *dPriv)
 {
    struct gl_framebuffer *fb = dPriv->driverPrivate;
@@ -758,7 +758,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
    if (rb->region == NULL)
       return;
 
-   if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT)
+   if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
       internalFormat = GL_RGB;
    else
       internalFormat = GL_RGBA;
@@ -788,7 +788,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
 
    intelImage->face = target_to_face(target);
    intelImage->level = level;
-   if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT)
+   if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
       texImage->TexFormat = MESA_FORMAT_XRGB8888;
    else
       texImage->TexFormat = MESA_FORMAT_ARGB8888;
@@ -808,7 +808,7 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
    /* The old interface didn't have the format argument, so copy our
     * implementation's behavior at the time.
     */
-   intelSetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+   intelSetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
 }
 
 
index 458de085223430a583e85a8ff2bc704336e9db8b..9ccf30c3ac91462cb11f262b80f1a8f1d66d934a 100644 (file)
@@ -764,7 +764,7 @@ void r200SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
        }
 }
 
-void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format,
+void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format,
                       __DRIdrawable *dPriv)
 {
        struct gl_texture_unit *texUnit;
@@ -781,7 +781,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
 
        type = GL_BGRA;
        format = GL_UNSIGNED_BYTE;
-       internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4);
+       internalFormat = (texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4);
 
        radeon = pDRICtx->driverPrivate;
        rmesa = pDRICtx->driverPrivate;
@@ -832,7 +832,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
        pitch_val = rb->pitch;
        switch (rb->cpp) {
        case 4:
-               if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT)
+               if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
                        t->pp_txformat = tx_table_le[MESA_FORMAT_RGB888].format;
                else
                        t->pp_txformat = tx_table_le[MESA_FORMAT_ARGB8888].format;
@@ -862,7 +862,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
 
 void r200SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
 {
-        r200SetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+        r200SetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
 }
 
 
index 09e046859a47e6e2d0050e2a73d4db2637225c42..4ba6740e3d921ad7078a9b52b7ddad888fe1b9fc 100644 (file)
@@ -415,7 +415,7 @@ void r300SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
        t->pp_txpitch |= pitch_val;
 }
 
-void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format, __DRIdrawable *dPriv)
+void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format, __DRIdrawable *dPriv)
 {
        struct gl_texture_unit *texUnit;
        struct gl_texture_object *texObj;
@@ -431,7 +431,7 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
 
        type = GL_BGRA;
        format = GL_UNSIGNED_BYTE;
-       internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4);
+       internalFormat = (texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4);
 
        radeon = pDRICtx->driverPrivate;
        rmesa = pDRICtx->driverPrivate;
@@ -481,7 +481,7 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
        pitch_val = rb->pitch;
        switch (rb->cpp) {
        case 4:
-               if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT)
+               if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
                        t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8);
                else
                        t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8);
@@ -520,5 +520,5 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
 
 void r300SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
 {
-        r300SetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+        r300SetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
 }
index 8228cd67c8e7ef7719779b02cc3767130f827d97..33f6595fd1902c790c552f7f39bc1775db5894cb 100644 (file)
@@ -988,7 +988,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
 
        type = GL_BGRA;
        format = GL_UNSIGNED_BYTE;
-       internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4);
+       internalFormat = (glx_texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4);
 
        radeon = pDRICtx->driverPrivate;
        rmesa = pDRICtx->driverPrivate;
@@ -1037,7 +1037,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
        pitch_val = rb->pitch;
        switch (rb->cpp) {
        case 4:
-               if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) {
+               if (glx_texture_format == __DRI_TEXTURE_FORMAT_RGB) {
                        SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8,
                                 SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
 
@@ -1116,5 +1116,5 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
 
 void r600SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
 {
-        r600SetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+        r600SetTexBuffer2(pDRICtx, target, __DRM_TEXTURE_FORMAT_RGBA, dPriv);
 }
index 84ddcfd4fd36c9462cc84ec887ad5510ce71ea0d..f852116deeb37f7d371eee34e26eb508366467ba 100644 (file)
@@ -639,7 +639,7 @@ void radeonSetTexOffset(__DRIcontext * pDRICtx, GLint texname,
        }
 }
 
-void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format,
+void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format,
                         __DRIdrawable *dPriv)
 {
        struct gl_texture_unit *texUnit;
@@ -656,7 +656,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_
 
        type = GL_BGRA;
        format = GL_UNSIGNED_BYTE;
-       internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4);
+       internalFormat = (texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4);
 
        radeon = pDRICtx->driverPrivate;
        rmesa = pDRICtx->driverPrivate;
@@ -705,7 +705,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_
        t->override_offset = 0;
        switch (rb->cpp) {
        case 4:
-               if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT)
+               if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
                        t->pp_txformat = tx_table[MESA_FORMAT_RGB888].format;
                else
                        t->pp_txformat = tx_table[MESA_FORMAT_ARGB8888].format;
@@ -740,7 +740,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_
 
 void radeonSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
 {
-        radeonSetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+        radeonSetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
 }