From a1b83464ffb1125b77e6f5664e0071f95167055d Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Thu, 27 Jan 2011 01:40:35 -0800 Subject: mesa: Propagate gl_FragDepth layout from GLSL IR to Mesa IR --- src/mesa/main/mtypes.h | 18 ++++++++++++++++++ src/mesa/program/ir_to_mesa.cpp | 23 +++++++++++++++++++++++ 2 files changed, 41 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 08b981883fb..37f39ceef35 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -867,6 +867,23 @@ struct gl_fog_attrib }; +/** + * \brief Layout qualifiers for gl_FragDepth. + * + * Extension AMD_conservative_depth allows gl_FragDepth to be redeclared with + * a layout qualifier. + * + * \see enum ir_depth_layout + */ +enum gl_frag_depth_layout { + FRAG_DEPTH_LAYOUT_NONE, /**< No layout is specified. */ + FRAG_DEPTH_LAYOUT_ANY, + FRAG_DEPTH_LAYOUT_GREATER, + FRAG_DEPTH_LAYOUT_LESS, + FRAG_DEPTH_LAYOUT_UNCHANGED +}; + + /** * Hint attribute group (GL_HINT_BIT). * @@ -1889,6 +1906,7 @@ struct gl_fragment_program GLboolean UsesKill; /**< shader uses KIL instruction */ GLboolean OriginUpperLeft; GLboolean PixelCenterInteger; + enum gl_frag_depth_layout FragDepthLayout; }; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index ee3eae6cfb0..e4a9a0f028a 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -727,6 +727,29 @@ ir_to_mesa_visitor::visit(ir_variable *ir) fp->OriginUpperLeft = ir->origin_upper_left; fp->PixelCenterInteger = ir->pixel_center_integer; + + } else if (strcmp(ir->name, "gl_FragDepth") == 0) { + struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog; + switch (ir->depth_layout) { + case ir_depth_layout_none: + fp->FragDepthLayout = FRAG_DEPTH_LAYOUT_NONE; + break; + case ir_depth_layout_any: + fp->FragDepthLayout = FRAG_DEPTH_LAYOUT_ANY; + break; + case ir_depth_layout_greater: + fp->FragDepthLayout = FRAG_DEPTH_LAYOUT_GREATER; + break; + case ir_depth_layout_less: + fp->FragDepthLayout = FRAG_DEPTH_LAYOUT_LESS; + break; + case ir_depth_layout_unchanged: + fp->FragDepthLayout = FRAG_DEPTH_LAYOUT_UNCHANGED; + break; + default: + assert(0); + break; + } } if (ir->mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) { -- cgit v1.2.3