Mesa (master): r300g: Update comments, function names in r300_state_inlines .

Corbin Simpson csimpson at kemper.freedesktop.org
Thu Oct 22 08:45:16 UTC 2009


Module: Mesa
Branch: master
Commit: 0a8cd4862c4f04308ab818077bab94417ffbf50b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a8cd4862c4f04308ab818077bab94417ffbf50b

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Wed Oct 21 23:26:02 2009 -0700

r300g: Update comments, function names in r300_state_inlines.

---

 src/gallium/drivers/r300/r300_state_derived.c |    2 +-
 src/gallium/drivers/r300/r300_state_inlines.h |   24 +++++++++++++++++++++---
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index e749bd9..42aee72 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -250,7 +250,7 @@ static void r300_vertex_psc(struct r300_context* r300,
         assert(tab[i] != -1);
 
         /* Add the attribute to the PSC table. */
-        temp = translate_vertex_data_type(vinfo->attrib[i].emit) |
+        temp = translate_draw_vertex_data_type(vinfo->attrib[i].emit) |
             tab[i] << R300_DST_VEC_LOC_SHIFT;
 
         if (i & 1) {
diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h
index 9135c55..c82d8e5 100644
--- a/src/gallium/drivers/r300/r300_state_inlines.h
+++ b/src/gallium/drivers/r300/r300_state_inlines.h
@@ -53,6 +53,7 @@ static INLINE uint32_t r300_translate_blend_function(int blend_func)
             return R300_COMB_FCN_MAX;
         default:
             debug_printf("r300: Unknown blend function %d\n", blend_func);
+            assert(0);
             break;
     }
     return 0;
@@ -100,6 +101,7 @@ static INLINE uint32_t r300_translate_blend_factor(int blend_fact)
         case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: */
         default:
             debug_printf("r300: Unknown blend factor %d\n", blend_fact);
+            assert(0);
             break;
     }
     return 0;
@@ -129,6 +131,7 @@ static INLINE uint32_t r300_translate_depth_stencil_function(int zs_func)
         default:
             debug_printf("r300: Unknown depth/stencil function %d\n",
                 zs_func);
+            assert(0);
             break;
     }
     return 0;
@@ -155,6 +158,7 @@ static INLINE uint32_t r300_translate_stencil_op(int s_op)
             return R300_ZS_INVERT;
         default:
             debug_printf("r300: Unknown stencil op %d", s_op);
+            assert(0);
             break;
     }
     return 0;
@@ -181,6 +185,7 @@ static INLINE uint32_t r300_translate_alpha_function(int alpha_func)
             return R300_FG_ALPHA_FUNC_ALWAYS;
         default:
             debug_printf("r300: Unknown alpha function %d", alpha_func);
+            assert(0);
             break;
     }
     return 0;
@@ -209,6 +214,7 @@ static INLINE uint32_t r300_translate_wrap(int wrap)
             return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
         default:
             debug_printf("r300: Unknown texture wrap %d", wrap);
+            assert(0);
             return 0;
     }
 }
@@ -228,6 +234,7 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip)
             break;
         default:
             debug_printf("r300: Unknown texture filter %d\n", min);
+            assert(0);
             break;
     }
     switch (mag) {
@@ -242,6 +249,7 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip)
             break;
         default:
             debug_printf("r300: Unknown texture filter %d\n", mag);
+            assert(0);
             break;
     }
     switch (mip) {
@@ -256,6 +264,7 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip)
             break;
         default:
             debug_printf("r300: Unknown texture filter %d\n", mip);
+            assert(0);
             break;
     }
 
@@ -279,6 +288,8 @@ static INLINE uint32_t r300_anisotropy(float max_aniso)
 
 /* Buffer formats. */
 
+/* Colorbuffer formats. This is the unswizzled format of the RB3D block's
+ * output. For the swizzling of the targets, check the shader's format. */
 static INLINE uint32_t r300_translate_colorformat(enum pipe_format format)
 {
     switch (format) {
@@ -313,11 +324,13 @@ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format)
             debug_printf("r300: Implementation error: "
                 "Got unsupported color format %s in %s\n",
                 pf_name(format), __FUNCTION__);
+            assert(0);
             break;
     }
     return 0;
 }
 
+/* Depthbuffer and stencilbuffer. Thankfully, we only support two kinds. */
 static INLINE uint32_t r300_translate_zsformat(enum pipe_format format)
 {
     switch (format) {
@@ -331,18 +344,22 @@ static INLINE uint32_t r300_translate_zsformat(enum pipe_format format)
             debug_printf("r300: Implementation error: "
                 "Got unsupported ZS format %s in %s\n",
                 pf_name(format), __FUNCTION__);
+            assert(0);
             break;
     }
     return 0;
 }
 
-/* Translate pipe_format into US_OUT_FMT.
+/* Shader output formats. This is essentially the swizzle from the shader
+ * to the RB3D block.
+ *
  * 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:
         case PIPE_FORMAT_X8R8G8B8_UNORM:
+        /* XXX */
         case PIPE_FORMAT_Z24S8_UNORM:
             return R300_US_OUT_FMT_C4_8 |
                 R300_C0_SEL_B | R300_C1_SEL_G |
@@ -356,6 +373,7 @@ static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format)
             debug_printf("r300: Implementation error: "
                 "Got unsupported output format %s in %s\n",
                 pf_name(format), __FUNCTION__);
+            assert(0);
             return R300_US_OUT_FMT_UNUSED;
     }
     return 0;
@@ -382,7 +400,8 @@ static INLINE uint32_t r300_translate_gb_pipes(int pipe_count)
     return 0;
 }
 
-static INLINE uint32_t translate_vertex_data_type(int type) {
+/* Translate Draw vertex types into PSC vertex types. */
+static INLINE uint32_t translate_draw_vertex_data_type(int type) {
     switch (type) {
         case EMIT_1F:
         case EMIT_1F_PSIZE:
@@ -406,7 +425,6 @@ static INLINE uint32_t translate_vertex_data_type(int type) {
             assert(0);
             break;
     }
-
     return 0;
 }
 




More information about the mesa-commit mailing list