[Mesa-dev] [PATCH 2/2] st/mesa: add support for gl_ClipDistance
Bryan Cain
bryancain3 at gmail.com
Tue Dec 13 08:59:43 PST 2011
---
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 1 +
src/mesa/state_tracker/st_program.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 9ef65c8..d50176d 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5036,6 +5036,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
|| progress;
progress = lower_quadop_vector(ir, false) || progress;
+ progress = lower_clip_distance(ir) || progress;
if (options->MaxIfDepth == 0)
progress = lower_discard(ir) || progress;
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 04d3ef6..73581dd 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -244,6 +244,14 @@ st_prepare_vertex_program(struct gl_context *ctx,
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_PSIZE;
stvp->output_semantic_index[slot] = 0;
break;
+ case VERT_RESULT_CLIP_DIST0:
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
+ stvp->output_semantic_index[slot] = 0;
+ break;
+ case VERT_RESULT_CLIP_DIST1:
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
+ stvp->output_semantic_index[slot] = 1;
+ break;
case VERT_RESULT_EDGE:
assert(0);
break;
@@ -541,6 +549,16 @@ st_translate_fragment_program(struct st_context *st,
input_semantic_index[slot] = 0;
interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
break;
+ case FRAG_ATTRIB_CLIP_DIST0:
+ input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
+ input_semantic_index[slot] = 0;
+ interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
+ break;
+ case FRAG_ATTRIB_CLIP_DIST1:
+ input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
+ input_semantic_index[slot] = 1;
+ interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
+ break;
/* In most cases, there is nothing special about these
* inputs, so adopt a convention to use the generic
* semantic name and the mesa FRAG_ATTRIB_ number as the
--
1.7.1
More information about the mesa-dev
mailing list