r300g: YCbCr and sRGB textures.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 27 Jun 2009 18:58:00 +0000 (11:58 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 27 Jun 2009 19:07:59 +0000 (12:07 -0700)
src/gallium/drivers/r300/r300_reg.h
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_texture.h

index e57535fe9e1113635ecb092cd41aaddca41ae9f6..79c778f95433f35343db4ad4cf3cbe29fc3aabd1 100644 (file)
@@ -1565,7 +1565,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #      define R300_TX_FORMAT_CONST_Z           (4<<5)
 #      define R300_TX_FORMAT_CONST_W           (8<<5)
 
-#      define R300_TX_FORMAT_YUV_MODE          0x00800000
+#       define R300_TX_FORMAT_GAMMA               (1 << 21)
+#       define R300_TX_FORMAT_YUV_TO_RGB          (1 << 22)
 
 #define R300_TX_FORMAT2_0                  0x4500 /* obvious missing in gap */
 #       define R300_TX_PITCHMASK_SHIFT           0
index 42a7009481acbe1cea1769fd7be7b5bfae7dff1e..da1d5ffe2fda9ddbb9cacf287bc613de8cbaff91 100644 (file)
@@ -196,10 +196,13 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage,
                  PIPE_TEXTURE_USAGE_PRIMARY);
 
         /* Texture */
+        case PIPE_FORMAT_A8R8G8B8_SRGB:
+        case PIPE_FORMAT_R8G8B8A8_SRGB:
         case PIPE_FORMAT_DXT1_RGB:
         case PIPE_FORMAT_DXT1_RGBA:
         case PIPE_FORMAT_DXT3_RGBA:
         case PIPE_FORMAT_DXT5_RGBA:
+        case PIPE_FORMAT_YCBCR:
             return usage & PIPE_TEXTURE_USAGE_SAMPLER;
 
         /* Colorbuffer or texture */
index 5511cca48cb609cf150ba9d98e5e36e471a2ce05..3b56f0307c06d7de10f43e2f95c6ac6d4e3120f9 100644 (file)
@@ -44,6 +44,12 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format)
             return R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8);
         case PIPE_FORMAT_R8G8B8A8_UNORM:
             return R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8);
+        case PIPE_FORMAT_A8R8G8B8_SRGB:
+            return R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8) |
+                R300_TX_FORMAT_GAMMA;
+        case PIPE_FORMAT_R8G8B8A8_SRGB:
+            return R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8) |
+                R300_TX_FORMAT_GAMMA;
         /* DXT1 */
         case PIPE_FORMAT_DXT1_RGB:
             return R300_EASY_TX_FORMAT(X, Y, Z, ONE, DXT1);
@@ -55,6 +61,10 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format)
         /* DXT5 */
         case PIPE_FORMAT_DXT5_RGBA:
             return R300_EASY_TX_FORMAT(Y, Z, W, X, DXT5);
+        /* YVYU422 */
+        case PIPE_FORMAT_YCBCR:
+            return R300_EASY_TX_FORMAT(X, Y, Z, ONE, YVYU422) |
+                R300_TX_FORMAT_YUV_TO_RGB;
         /* W24_FP */
         case PIPE_FORMAT_Z24S8_UNORM:
             return R300_EASY_TX_FORMAT(X, X, X, X, W24_FP);