r300-gallium: Clean up some emit, and some state handlers.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Fri, 20 Mar 2009 03:32:08 +0000 (20:32 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Fri, 20 Mar 2009 21:53:20 +0000 (14:53 -0700)
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_emit.h
src/gallium/drivers/r300/r300_state_inlines.h

index a2e771bd1b2c25a11df182df6c89ce24b58ff225..9bfb89626cd56be102036ff1d7e084267fa94796 100644 (file)
@@ -152,21 +152,6 @@ void r500_emit_fragment_shader(struct r300_context* r300,
     END_CS;
 }
 
-/* Translate pipe_format into US_OUT_FMT. Note that formats are stored from
- * C3 to C0. */
-uint32_t translate_out_fmt(enum pipe_format format)
-{
-    switch (format) {
-        case PIPE_FORMAT_A8R8G8B8_UNORM:
-            return R300_US_OUT_FMT_C4_8 |
-                R300_C0_SEL_B | R300_C1_SEL_G |
-                R300_C2_SEL_R | R300_C3_SEL_A;
-        default:
-            return R300_US_OUT_FMT_UNUSED;
-    }
-    return 0;
-}
-
 /* XXX add pitch, stride, clean up */
 void r300_emit_fb_state(struct r300_context* r300,
                         struct pipe_framebuffer_state* fb)
@@ -182,7 +167,7 @@ void r300_emit_fb_state(struct r300_context* r300,
         OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
 
         OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i),
-            translate_out_fmt(fb->cbufs[i]->format));
+            r300_translate_out_fmt(fb->cbufs[i]->format));
     }
 
     if (fb->zsbuf) {
index 4aba1ee08ce8ad01e06110753759516385886e05..0bc1f90e6ab1fb89656110bbf41359f8aef710d7 100644 (file)
@@ -28,6 +28,7 @@
 #include "r300_context.h"
 #include "r300_cs.h"
 #include "r300_screen.h"
+#include "r300_state_inlines.h"
 
 void r300_emit_blend_state(struct r300_context* r300,
                            struct r300_blend_state* blend);
@@ -52,11 +53,20 @@ void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs);
 void r300_emit_rs_block_state(struct r300_context* r300,
                               struct r300_rs_block* rs);
 
+void r300_emit_sampler(struct r300_context* r300,
+                       struct r300_sampler_state* sampler, unsigned offset);
+
 void r300_emit_scissor_state(struct r300_context* r300,
                              struct r300_scissor_state* scissor);
 
+void r300_emit_texture(struct r300_context* r300,
+                       struct r300_texture* tex, unsigned offset);
+
 void r300_emit_vertex_format_state(struct r300_context* r300);
 
+void r300_emit_viewport_state(struct r300_context* r300,
+                              struct r300_viewport_state* viewport);
+
 /* Emit all dirty state. */
 void r300_emit_dirty_state(struct r300_context* r300);
 
index fd92c71756bbcbaf78641a62ed5c943807eb15c8..b80ff1c1abab5cd8039cfb11d60211b9202e7195 100644 (file)
@@ -297,8 +297,7 @@ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format)
         case PIPE_FORMAT_A32R32G32B32:
             return R300_COLOR_FORMAT_ARGB32323232;
         case PIPE_FORMAT_A16R16G16B16:
-            return R300_COLOR_FORMAT_ARGB16161616; */
-        /* XXX Not in pipe_format
+            return R300_COLOR_FORMAT_ARGB16161616;
         case PIPE_FORMAT_A10R10G10B10_UNORM:
             return R500_COLOR_FORMAT_ARGB10101010;
         case PIPE_FORMAT_A2R10G10B10_UNORM:
@@ -306,7 +305,7 @@ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format)
         case PIPE_FORMAT_I10_UNORM:
             return R500_COLOR_FORMAT_I10; */
         default:
-            debug_printf("r300: Implementation error: " \
+            debug_printf("r300: Implementation error: "
                 "Got unsupported color format %s in %s\n",
                 pf_name(format), __FUNCTION__);
             break;
@@ -324,7 +323,7 @@ static INLINE uint32_t r300_translate_zsformat(enum pipe_format format)
         case PIPE_FORMAT_Z24S8_UNORM:
             return R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL;
         default:
-            debug_printf("r300: Implementation error: " \
+            debug_printf("r300: Implementation error: "
                 "Got unsupported ZS format %s in %s\n",
                 pf_name(format), __FUNCTION__);
             break;
@@ -332,6 +331,24 @@ static INLINE uint32_t r300_translate_zsformat(enum pipe_format format)
     return 0;
 }
 
+/* Translate pipe_format into US_OUT_FMT.
+ * Note that formats are stored from C3 to C0. */
+static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format)
+{
+    switch (format) {
+        case PIPE_FORMAT_A8R8G8B8_UNORM:
+            return R300_US_OUT_FMT_C4_8 |
+                R300_C0_SEL_B | R300_C1_SEL_G |
+                R300_C2_SEL_R | R300_C3_SEL_A;
+        default:
+            debug_printf("r300: Implementation error: "
+                "Got unsupported output format %s in %s\n",
+                pf_name(format), __FUNCTION__);
+            return R300_US_OUT_FMT_UNUSED;
+    }
+    return 0;
+}
+
 /* Non-CSO state. (For now.) */
 
 static INLINE uint32_t r300_translate_gb_pipes(int pipe_count)