summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i965
diff options
context:
space:
mode:
authorJakob Bornecrantz <wallbraker@gmail.com>2009-11-07 17:47:00 +0000
committerJakob Bornecrantz <wallbraker@gmail.com>2009-11-07 17:47:00 +0000
commitcbad97b68504a64650cb77bad96962310ab9c7f9 (patch)
tree72b73f630bf2fe34ecadef21f2f56a60eebecb3d /src/gallium/drivers/i965
parent229f6b9a7e699b814e07ba762de97a5ebcffce51 (diff)
i965g: Fixup texture formats
Diffstat (limited to 'src/gallium/drivers/i965')
-rw-r--r--src/gallium/drivers/i965/brw_screen.c45
-rw-r--r--src/gallium/drivers/i965/brw_screen_texture.c66
2 files changed, 74 insertions, 37 deletions
diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c
index af885320a7..05da72ebb2 100644
--- a/src/gallium/drivers/i965/brw_screen.c
+++ b/src/gallium/drivers/i965/brw_screen.c
@@ -201,31 +201,62 @@ brw_is_format_supported(struct pipe_screen *screen,
unsigned geom_flags)
{
static const enum pipe_format tex_supported[] = {
- PIPE_FORMAT_R8G8B8A8_UNORM,
- PIPE_FORMAT_A8R8G8B8_UNORM,
- PIPE_FORMAT_R5G6B5_UNORM,
PIPE_FORMAT_L8_UNORM,
- PIPE_FORMAT_A8_UNORM,
PIPE_FORMAT_I8_UNORM,
+ PIPE_FORMAT_A8_UNORM,
+ PIPE_FORMAT_L16_UNORM,
+ /*PIPE_FORMAT_I16_UNORM,*/
+ /*PIPE_FORMAT_A16_UNORM,*/
PIPE_FORMAT_A8L8_UNORM,
+ PIPE_FORMAT_R5G6B5_UNORM,
+ PIPE_FORMAT_A1R5G5B5_UNORM,
+ PIPE_FORMAT_A4R4G4B4_UNORM,
+ PIPE_FORMAT_X8R8G8B8_UNORM,
+ PIPE_FORMAT_A8R8G8B8_UNORM,
+ /* video */
PIPE_FORMAT_YCBCR,
PIPE_FORMAT_YCBCR_REV,
+ /* compressed */
+ /*PIPE_FORMAT_FXT1_RGBA,*/
+ PIPE_FORMAT_DXT1_RGB,
+ PIPE_FORMAT_DXT1_RGBA,
+ PIPE_FORMAT_DXT3_RGBA,
+ PIPE_FORMAT_DXT5_RGBA,
+ /* sRGB */
+ PIPE_FORMAT_R8G8B8A8_SRGB,
+ PIPE_FORMAT_A8L8_SRGB,
+ PIPE_FORMAT_L8_SRGB,
+ PIPE_FORMAT_DXT1_SRGB,
+ /* depth */
+ PIPE_FORMAT_Z32_FLOAT,
PIPE_FORMAT_X8Z24_UNORM,
PIPE_FORMAT_S8Z24_UNORM,
+ PIPE_FORMAT_Z16_UNORM,
+ /* signed */
+ PIPE_FORMAT_R8G8_SNORM,
+ PIPE_FORMAT_R8G8B8A8_SNORM,
PIPE_FORMAT_NONE /* list terminator */
};
- static const enum pipe_format surface_supported[] = {
+ static const enum pipe_format render_supported[] = {
+ PIPE_FORMAT_X8R8G8B8_UNORM,
PIPE_FORMAT_A8R8G8B8_UNORM,
PIPE_FORMAT_R5G6B5_UNORM,
+ PIPE_FORMAT_NONE /* list terminator */
+ };
+ static const enum pipe_format depth_supported[] = {
+ PIPE_FORMAT_Z32_FLOAT,
PIPE_FORMAT_X8Z24_UNORM,
PIPE_FORMAT_S8Z24_UNORM,
+ PIPE_FORMAT_Z16_UNORM,
PIPE_FORMAT_NONE /* list terminator */
};
const enum pipe_format *list;
uint i;
- if(tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET)
- list = surface_supported;
+ if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL)
+ list = depth_supported;
+ else if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET)
+ list = render_supported;
else
list = tex_supported;
diff --git a/src/gallium/drivers/i965/brw_screen_texture.c b/src/gallium/drivers/i965/brw_screen_texture.c
index 9ca60b46d3..666ec70d42 100644
--- a/src/gallium/drivers/i965/brw_screen_texture.c
+++ b/src/gallium/drivers/i965/brw_screen_texture.c
@@ -73,16 +73,19 @@ static GLuint translate_tex_format( enum pipe_format pf )
case PIPE_FORMAT_A8_UNORM:
return BRW_SURFACEFORMAT_A8_UNORM;
- case PIPE_FORMAT_A8L8_UNORM:
- return BRW_SURFACEFORMAT_L8A8_UNORM;
+ case PIPE_FORMAT_L16_UNORM:
+ return BRW_SURFACEFORMAT_L16_UNORM;
- case PIPE_FORMAT_A8R8G8B8_UNORM: /* XXX */
- case PIPE_FORMAT_B8G8R8A8_UNORM: /* XXX */
- case PIPE_FORMAT_R8G8B8A8_UNORM: /* XXX */
- return BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
+ /* XXX: Add these to gallium
+ case PIPE_FORMAT_I16_UNORM:
+ return BRW_SURFACEFORMAT_I16_UNORM;
- case PIPE_FORMAT_R8G8B8X8_UNORM:
- return BRW_SURFACEFORMAT_R8G8B8X8_UNORM;
+ case PIPE_FORMAT_A16_UNORM:
+ return BRW_SURFACEFORMAT_A16_UNORM;
+ */
+
+ case PIPE_FORMAT_A8L8_UNORM:
+ return BRW_SURFACEFORMAT_L8A8_UNORM;
case PIPE_FORMAT_R5G6B5_UNORM:
return BRW_SURFACEFORMAT_B5G6R5_UNORM;
@@ -93,19 +96,15 @@ static GLuint translate_tex_format( enum pipe_format pf )
case PIPE_FORMAT_A4R4G4B4_UNORM:
return BRW_SURFACEFORMAT_B4G4R4A4_UNORM;
+ case PIPE_FORMAT_X8R8G8B8_UNORM:
+ return BRW_SURFACEFORMAT_R8G8B8X8_UNORM;
- case PIPE_FORMAT_L16_UNORM:
- return BRW_SURFACEFORMAT_L16_UNORM;
-
- /* XXX: Z texturing:
- case PIPE_FORMAT_I16_UNORM:
- return BRW_SURFACEFORMAT_I16_UNORM;
- */
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ return BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
- /* XXX: Z texturing:
- case PIPE_FORMAT_A16_UNORM:
- return BRW_SURFACEFORMAT_A16_UNORM;
- */
+ /*
+ * Video formats
+ */
case PIPE_FORMAT_YCBCR_REV:
return BRW_SURFACEFORMAT_YCRCB_NORMAL;
@@ -113,6 +112,9 @@ static GLuint translate_tex_format( enum pipe_format pf )
case PIPE_FORMAT_YCBCR:
return BRW_SURFACEFORMAT_YCRCB_SWAPUVY;
+ /*
+ * Compressed formats.
+ */
/* XXX: Add FXT to gallium?
case PIPE_FORMAT_FXT1_RGBA:
return BRW_SURFACEFORMAT_FXT1;
@@ -130,6 +132,10 @@ static GLuint translate_tex_format( enum pipe_format pf )
case PIPE_FORMAT_DXT5_RGBA:
return BRW_SURFACEFORMAT_BC3_UNORM;
+ /*
+ * sRGB formats
+ */
+
case PIPE_FORMAT_R8G8B8A8_SRGB:
return BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB;
@@ -142,24 +148,24 @@ static GLuint translate_tex_format( enum pipe_format pf )
case PIPE_FORMAT_DXT1_SRGB:
return BRW_SURFACEFORMAT_BC1_UNORM_SRGB;
+ /*
+ * Depth formats
+ */
+
+ case PIPE_FORMAT_Z16_UNORM:
+ return BRW_SURFACEFORMAT_I16_UNORM;
+
case PIPE_FORMAT_S8Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
return BRW_SURFACEFORMAT_I24X8_UNORM;
-#if 0
- /* XXX: these different surface formats don't seem to
- * make any difference for shadow sampler/compares.
- */
- if (depth_mode == GL_INTENSITY)
- return BRW_SURFACEFORMAT_I24X8_UNORM;
- else if (depth_mode == GL_ALPHA)
- return BRW_SURFACEFORMAT_A24X8_UNORM;
- else
- return BRW_SURFACEFORMAT_L24X8_UNORM;
-#endif
+ case PIPE_FORMAT_Z32_FLOAT:
+ return BRW_SURFACEFORMAT_I32_FLOAT;
/* XXX: presumably for bump mapping. Add this to mesa state
* tracker?
+ *
+ * XXX: Add flipped versions of these formats to Gallium.
*/
case PIPE_FORMAT_R8G8_SNORM:
return BRW_SURFACEFORMAT_R8G8_SNORM;