summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2010-02-09 15:26:14 -0500
committerKristian Høgsberg <krh@bitplanet.net>2010-02-09 15:55:25 -0500
commitdebf00e5fc3828f63e0f99d72c7fa6cd6ce012c5 (patch)
treec0e64c0a66bdb72a4616bac7efc4fa078b3cad66
parent8c593d3ea9fa137290480e73aeebcf807c920f50 (diff)
dri_interface: Introduce DRI tokens for the texBuffer texture formats
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.
-rw-r--r--include/GL/internal/dri_interface.h7
-rw-r--r--include/GL/internal/glcore.h4
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c8
-rw-r--r--src/mesa/drivers/dri/r200/r200_texstate.c8
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c8
-rw-r--r--src/mesa/drivers/dri/r600/r600_texstate.c6
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texstate.c8
8 files changed, 27 insertions, 24 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index ec6238f873..58540d6005 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -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 {
diff --git a/include/GL/internal/glcore.h b/include/GL/internal/glcore.h
index 18f657662a..547b111370 100644
--- a/include/GL/internal/glcore.h
+++ b/include/GL/internal/glcore.h
@@ -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_ */
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index f7ed6605bf..ff21f2f958 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -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
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 6402141170..d63292edd3 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -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);
}
diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c
index 458de08522..9ccf30c3ac 100644
--- a/src/mesa/drivers/dri/r200/r200_texstate.c
+++ b/src/mesa/drivers/dri/r200/r200_texstate.c
@@ -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);
}
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index 09e046859a..4ba6740e3d 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -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);
}
diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c
index 8228cd67c8..33f6595fd1 100644
--- a/src/mesa/drivers/dri/r600/r600_texstate.c
+++ b/src/mesa/drivers/dri/r600/r600_texstate.c
@@ -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);
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c
index 84ddcfd4fd..f852116dee 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texstate.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c
@@ -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);
}