r300g: extend compile error message
[mesa.git] / src / gallium / drivers / r300 / r300_fs.c
index 88303f074cd8a1039adf53e77b473fa91772abde..b2d3b5243c91e1685fddad29cb78315726572191 100644 (file)
@@ -137,6 +137,7 @@ static void get_external_state(
 {
     struct r300_textures_state *texstate = r300->textures_state.state;
     unsigned i;
+    unsigned char *swizzle;
 
     for (i = 0; i < texstate->sampler_state_count; i++) {
         struct r300_sampler_state* s = texstate->sampler_states[i];
@@ -146,9 +147,18 @@ static void get_external_state(
         }
 
         if (s->state.compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
-            /* XXX Gallium doesn't provide us with any information regarding
-             * this mode, so we are screwed. I'm setting 0 = LUMINANCE. */
-            state->unit[i].depth_texture_mode = 0;
+            state->unit[i].compare_mode_enabled = 1;
+
+            /* Pass depth texture swizzling to the compiler. */
+            if (texstate->sampler_views[i]) {
+                swizzle = texstate->sampler_views[i]->swizzle;
+
+                state->unit[i].depth_texture_swizzle =
+                    RC_MAKE_SWIZZLE(swizzle[0], swizzle[1],
+                                    swizzle[2], swizzle[3]);
+            } else {
+                state->unit[i].depth_texture_swizzle = RC_SWIZZLE_XYZW;
+            }
 
             /* Fortunately, no need to translate this. */
             state->unit[i].texture_compare_func = s->state.compare_func;
@@ -285,7 +295,8 @@ static void r300_translate_fragment_shader(
 
     if (compiler.Base.Error) {
         fprintf(stderr, "r300 FP: Compiler Error:\n%sUsing a dummy shader"
-                " instead.\n", compiler.Base.ErrorMsg);
+                " instead.\nIf there's an 'unknown opcode' message, please"
+                " file a bug report and attach this log.\n", compiler.Base.ErrorMsg);
 
         if (shader->dummy) {
             fprintf(stderr, "r300 FP: Cannot compile the dummy shader! "