[Nouveau] [PATCH 04/11] mesa/st: add support for GL_ARB_cull_distance
Tobias Klausmann
tobias.johannes.klausmann at mni.thm.de
Sun May 24 10:58:02 PDT 2015
Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de>
---
src/mesa/state_tracker/st_extensions.c | 4 ++++
src/mesa/state_tracker/st_program.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 23a4588..63f3334 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -466,6 +466,7 @@ void st_init_extensions(struct pipe_screen *screen,
{ o(ARB_conditional_render_inverted), PIPE_CAP_CONDITIONAL_RENDER_INVERTED },
{ o(ARB_texture_view), PIPE_CAP_SAMPLER_VIEW_TARGET },
{ o(ARB_clip_control), PIPE_CAP_CLIP_HALFZ },
+ { o(ARB_cull_distance), PIPE_CAP_CULL_DISTANCE },
{ o(EXT_polygon_offset_clamp), PIPE_CAP_POLYGON_OFFSET_CLAMP },
};
@@ -678,6 +679,9 @@ void st_init_extensions(struct pipe_screen *screen,
if (glsl_feature_level >= 410)
extensions->ARB_shader_precision = GL_TRUE;
+ if (glsl_feature_level >= 130)
+ extensions->ARB_cull_distance = GL_TRUE;
+
/* This extension needs full OpenGL 3.2, but we don't know if that's
* supported at this point. Only check the GLSL version. */
if (consts->GLSLVersion >= 150 &&
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index a9110d3..79e8ad7 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -253,6 +253,14 @@ st_prepare_vertex_program(struct gl_context *ctx,
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
stvp->output_semantic_index[slot] = 1;
break;
+ case VARYING_SLOT_CULL_DIST0:
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CULLDIST;
+ stvp->output_semantic_index[slot] = 0;
+ break;
+ case VARYING_SLOT_CULL_DIST1:
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CULLDIST;
+ stvp->output_semantic_index[slot] = 1;
+ break;
case VARYING_SLOT_EDGE:
assert(0);
break;
@@ -606,6 +614,16 @@ st_translate_fragment_program(struct st_context *st,
input_semantic_index[slot] = 1;
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
break;
+ case VARYING_SLOT_CULL_DIST0:
+ input_semantic_name[slot] = TGSI_SEMANTIC_CULLDIST;
+ input_semantic_index[slot] = 0;
+ interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
+ break;
+ case VARYING_SLOT_CULL_DIST1:
+ input_semantic_name[slot] = TGSI_SEMANTIC_CULLDIST;
+ input_semantic_index[slot] = 1;
+ interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
+ break;
/* In most cases, there is nothing special about these
* inputs, so adopt a convention to use the generic
* semantic name and the mesa VARYING_SLOT_ number as the
@@ -941,6 +959,14 @@ st_translate_geometry_program(struct st_context *st,
input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
input_semantic_index[slot] = 1;
break;
+ case VARYING_SLOT_CULL_DIST0:
+ input_semantic_name[slot] = TGSI_SEMANTIC_CULLDIST;
+ input_semantic_index[slot] = 0;
+ break;
+ case VARYING_SLOT_CULL_DIST1:
+ input_semantic_name[slot] = TGSI_SEMANTIC_CULLDIST;
+ input_semantic_index[slot] = 1;
+ break;
case VARYING_SLOT_PSIZ:
input_semantic_name[slot] = TGSI_SEMANTIC_PSIZE;
input_semantic_index[slot] = 0;
@@ -1028,6 +1054,14 @@ st_translate_geometry_program(struct st_context *st,
gs_output_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
gs_output_semantic_index[slot] = 1;
break;
+ case VARYING_SLOT_CULL_DIST0:
+ gs_output_semantic_name[slot] = TGSI_SEMANTIC_CULLDIST;
+ gs_output_semantic_index[slot] = 0;
+ break;
+ case VARYING_SLOT_CULL_DIST1:
+ gs_output_semantic_name[slot] = TGSI_SEMANTIC_CULLDIST;
+ gs_output_semantic_index[slot] = 1;
+ break;
case VARYING_SLOT_LAYER:
gs_output_semantic_name[slot] = TGSI_SEMANTIC_LAYER;
gs_output_semantic_index[slot] = 0;
--
2.4.1
More information about the Nouveau
mailing list