st/mesa: move frag depth up a level.
authorDave Airlie <airlied@redhat.com>
Sat, 10 Dec 2011 17:30:37 +0000 (17:30 +0000)
committerDave Airlie <airlied@redhat.com>
Sat, 10 Dec 2011 17:30:37 +0000 (17:30 +0000)
This fixes the segfault, and seems to put this closer to where other
properties are being set. Hopefully it still conforms.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp
src/mesa/state_tracker/st_program.c

index cd4db255f54dff7877269e78e3403cd0ecfad94a..6cc655d70cf5f95b79f9ff36df30aef204e7b8e8 100644 (file)
@@ -4557,25 +4557,6 @@ st_translate_program(
                                            interpMode[i]);
       }
 
-      if (program->shader_program->FragDepthLayout != FRAG_DEPTH_LAYOUT_NONE) {
-         switch (program->shader_program->FragDepthLayout) {
-         case FRAG_DEPTH_LAYOUT_ANY:
-            ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_ANY);
-            break;
-         case FRAG_DEPTH_LAYOUT_GREATER:
-            ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_GREATER);
-            break;
-         case FRAG_DEPTH_LAYOUT_LESS:
-            ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_LESS);
-            break;
-         case FRAG_DEPTH_LAYOUT_UNCHANGED:
-            ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_UNCHANGED);
-            break;
-         default:
-            assert(0);
-         }
-      }
-
       if (proginfo->InputsRead & FRAG_BIT_WPOS) {
          /* Must do this after setting up t->inputs, and before
           * emitting constant references, below:
index 768da5114e65b0afd09bb36731f8bf36533a01e8..04d3ef60f51154c3c519743fccf9e4957bcb6379 100644 (file)
@@ -649,6 +649,25 @@ st_translate_fragment_program(struct st_context *st,
       if (write_all == GL_TRUE)
          ureg_property_fs_color0_writes_all_cbufs(ureg, 1);
 
+      if (stfp->Base.FragDepthLayout != FRAG_DEPTH_LAYOUT_NONE) {
+         switch (stfp->Base.FragDepthLayout) {
+         case FRAG_DEPTH_LAYOUT_ANY:
+            ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_ANY);
+            break;
+         case FRAG_DEPTH_LAYOUT_GREATER:
+            ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_GREATER);
+            break;
+         case FRAG_DEPTH_LAYOUT_LESS:
+            ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_LESS);
+            break;
+         case FRAG_DEPTH_LAYOUT_UNCHANGED:
+            ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_UNCHANGED);
+            break;
+         default:
+            assert(0);
+         }
+      }
+
       if (stfp->glsl_to_tgsi)
          st_translate_program(st->ctx,
                               TGSI_PROCESSOR_FRAGMENT,