summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2016-05-13 15:42:19 +1000
committerDave Airlie <[email protected]>2016-05-23 11:03:40 +1000
commitd17062a40e16454a15aa037a4d1d9e9562cedd46 (patch)
treea672ea54c162210a965561036258458bcfd7a1dc /src
parentbddb3b5375899e99e96d499a20083d6c95486a6f (diff)
draw: stop using CULLDIST semantic.
The way the HW works doesn't really fit with having two semantics for this. The GLSL compiler emits 2 vec4s and two properties, this makes draw use those instead of CULLDIST semantics. Reviewed-by: Roland Scheidegger <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/draw/draw_cliptest_tmp.h4
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c16
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.c7
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.h3
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_clip.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_cull.c25
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h5
-rw-r--r--src/gallium/auxiliary/draw/draw_vs.c10
-rw-r--r--src/gallium/auxiliary/draw/draw_vs.h3
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_scan.c3
11 files changed, 32 insertions, 50 deletions
diff --git a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h
index 34add829353..6fbefa56bf1 100644
--- a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h
+++ b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h
@@ -49,8 +49,8 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs,
int num_written_clipdistance =
draw_current_shader_num_written_clipdistances(pvs->draw);
- cd[0] = draw_current_shader_clipdistance_output(pvs->draw, 0);
- cd[1] = draw_current_shader_clipdistance_output(pvs->draw, 1);
+ cd[0] = draw_current_shader_ccdistance_output(pvs->draw, 0);
+ cd[1] = draw_current_shader_ccdistance_output(pvs->draw, 1);
if (cd[0] != pos || cd[1] != pos)
have_cd = true;
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 3f36b347dda..6305761f2db 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -887,12 +887,12 @@ draw_current_shader_clipvertex_output(const struct draw_context *draw)
}
uint
-draw_current_shader_clipdistance_output(const struct draw_context *draw, int index)
+draw_current_shader_ccdistance_output(const struct draw_context *draw, int index)
{
debug_assert(index < PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
if (draw->gs.geometry_shader)
- return draw->gs.geometry_shader->clipdistance_output[index];
- return draw->vs.clipdistance_output[index];
+ return draw->gs.geometry_shader->ccdistance_output[index];
+ return draw->vs.ccdistance_output[index];
}
@@ -904,16 +904,6 @@ draw_current_shader_num_written_clipdistances(const struct draw_context *draw)
return draw->vs.vertex_shader->info.num_written_clipdistance;
}
-
-uint
-draw_current_shader_culldistance_output(const struct draw_context *draw, int index)
-{
- debug_assert(index < PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
- if (draw->gs.geometry_shader)
- return draw->gs.geometry_shader->culldistance_output[index];
- return draw->vs.vertex_shader->culldistance_output[index];
-}
-
uint
draw_current_shader_num_written_culldistances(const struct draw_context *draw)
{
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 6cf8846627b..18af1d90667 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -803,12 +803,7 @@ draw_create_geometry_shader(struct draw_context *draw,
if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPDIST) {
debug_assert(gs->info.output_semantic_index[i] <
PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
- gs->clipdistance_output[gs->info.output_semantic_index[i]] = i;
- }
- if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_CULLDIST) {
- debug_assert(gs->info.output_semantic_index[i] <
- PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
- gs->culldistance_output[gs->info.output_semantic_index[i]] = i;
+ gs->ccdistance_output[gs->info.output_semantic_index[i]] = i;
}
}
diff --git a/src/gallium/auxiliary/draw/draw_gs.h b/src/gallium/auxiliary/draw/draw_gs.h
index d256a05d16e..149278dd080 100644
--- a/src/gallium/auxiliary/draw/draw_gs.h
+++ b/src/gallium/auxiliary/draw/draw_gs.h
@@ -68,8 +68,7 @@ struct draw_geometry_shader {
struct tgsi_shader_info info;
unsigned position_output;
unsigned viewport_index_output;
- unsigned clipdistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
- unsigned culldistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
+ unsigned ccdistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
unsigned max_output_vertices;
unsigned primitive_boundary;
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index c1460cc91c0..b098132033a 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1164,8 +1164,8 @@ generate_clipmask(struct draw_llvm *llvm,
unsigned ucp_enable = key->ucp_enable;
unsigned cd[2];
- cd[0] = llvm->draw->vs.clipdistance_output[0];
- cd[1] = llvm->draw->vs.clipdistance_output[1];
+ cd[0] = llvm->draw->vs.ccdistance_output[0];
+ cd[1] = llvm->draw->vs.ccdistance_output[1];
if (cd[0] != pos || cd[1] != pos)
have_cd = true;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index 2d92d650ab6..78845ac0450 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
@@ -368,7 +368,7 @@ static inline float getclipdist(const struct clip_stage *clipper,
int _idx = plane_idx - 6;
int cdi = _idx >= 4;
int vidx = cdi ? _idx - 4 : _idx;
- dp = vert->data[draw_current_shader_clipdistance_output(clipper->stage.draw, cdi)][vidx];
+ dp = vert->data[draw_current_shader_ccdistance_output(clipper->stage.draw, cdi)][vidx];
} else {
/*
* legacy user clip planes or gl_ClipVertex
diff --git a/src/gallium/auxiliary/draw/draw_pipe_cull.c b/src/gallium/auxiliary/draw/draw_pipe_cull.c
index 240f55190f5..3e8e4589597 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_cull.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_cull.c
@@ -68,15 +68,17 @@ static void cull_point( struct draw_stage *stage,
{
const unsigned num_written_culldistances =
draw_current_shader_num_written_culldistances(stage->draw);
+ const unsigned num_written_clipdistances =
+ draw_current_shader_num_written_clipdistances(stage->draw);
unsigned i;
debug_assert(num_written_culldistances);
for (i = 0; i < num_written_culldistances; ++i) {
- unsigned cull_idx = i / 4;
+ unsigned cull_idx = (num_written_clipdistances + i) / 4;
unsigned out_idx =
- draw_current_shader_culldistance_output(stage->draw, cull_idx);
- unsigned idx = i % 4;
+ draw_current_shader_ccdistance_output(stage->draw, cull_idx);
+ unsigned idx = (num_written_clipdistances + i) % 4;
float cull1 = header->v[0]->data[out_idx][idx];
boolean vert1_out = cull_distance_is_out(cull1);
if (vert1_out)
@@ -96,15 +98,17 @@ static void cull_line( struct draw_stage *stage,
{
const unsigned num_written_culldistances =
draw_current_shader_num_written_culldistances(stage->draw);
+ const unsigned num_written_clipdistances =
+ draw_current_shader_num_written_clipdistances(stage->draw);
unsigned i;
debug_assert(num_written_culldistances);
for (i = 0; i < num_written_culldistances; ++i) {
- unsigned cull_idx = i / 4;
+ unsigned cull_idx = (num_written_clipdistances + i) / 4;
unsigned out_idx =
- draw_current_shader_culldistance_output(stage->draw, cull_idx);
- unsigned idx = i % 4;
+ draw_current_shader_ccdistance_output(stage->draw, cull_idx);
+ unsigned idx = (num_written_clipdistances + i) % 4;
float cull1 = header->v[0]->data[out_idx][idx];
float cull2 = header->v[1]->data[out_idx][idx];
boolean vert1_out = cull_distance_is_out(cull1);
@@ -125,15 +129,16 @@ static void cull_tri( struct draw_stage *stage,
{
const unsigned num_written_culldistances =
draw_current_shader_num_written_culldistances(stage->draw);
-
+ const unsigned num_written_clipdistances =
+ draw_current_shader_num_written_clipdistances(stage->draw);
/* Do the distance culling */
if (num_written_culldistances) {
unsigned i;
for (i = 0; i < num_written_culldistances; ++i) {
- unsigned cull_idx = i / 4;
+ unsigned cull_idx = (num_written_clipdistances + i) / 4;
unsigned out_idx =
- draw_current_shader_culldistance_output(stage->draw, cull_idx);
- unsigned idx = i % 4;
+ draw_current_shader_ccdistance_output(stage->draw, cull_idx);
+ unsigned idx = (num_written_clipdistances + i) % 4;
float cull1 = header->v[0]->data[out_idx][idx];
float cull2 = header->v[1]->data[out_idx][idx];
float cull3 = header->v[2]->data[out_idx][idx];
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index a18f6632124..a6aa6105264 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -262,7 +262,7 @@ struct draw_context
uint position_output;
uint edgeflag_output;
uint clipvertex_output;
- uint clipdistance_output[2];
+ uint ccdistance_output[2];
/** Fields for TGSI interpreter / execution */
struct {
@@ -406,9 +406,8 @@ uint draw_current_shader_outputs(const struct draw_context *draw);
uint draw_current_shader_position_output(const struct draw_context *draw);
uint draw_current_shader_viewport_index_output(const struct draw_context *draw);
uint draw_current_shader_clipvertex_output(const struct draw_context *draw);
-uint draw_current_shader_clipdistance_output(const struct draw_context *draw, int index);
+uint draw_current_shader_ccdistance_output(const struct draw_context *draw, int index);
uint draw_current_shader_num_written_clipdistances(const struct draw_context *draw);
-uint draw_current_shader_culldistance_output(const struct draw_context *draw, int index);
uint draw_current_shader_num_written_culldistances(const struct draw_context *draw);
int draw_alloc_extra_vertex_attrib(struct draw_context *draw,
uint semantic_name, uint semantic_index);
diff --git a/src/gallium/auxiliary/draw/draw_vs.c b/src/gallium/auxiliary/draw/draw_vs.c
index ae94421ed4c..415c4fa949a 100644
--- a/src/gallium/auxiliary/draw/draw_vs.c
+++ b/src/gallium/auxiliary/draw/draw_vs.c
@@ -90,11 +90,7 @@ draw_create_vertex_shader(struct draw_context *draw,
else if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPDIST) {
debug_assert(vs->info.output_semantic_index[i] <
PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
- vs->clipdistance_output[vs->info.output_semantic_index[i]] = i;
- } else if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_CULLDIST) {
- debug_assert(vs->info.output_semantic_index[i] <
- PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
- vs->culldistance_output[vs->info.output_semantic_index[i]] = i;
+ vs->ccdistance_output[vs->info.output_semantic_index[i]] = i;
}
}
if (!found_clipvertex)
@@ -119,8 +115,8 @@ draw_bind_vertex_shader(struct draw_context *draw,
draw->vs.position_output = dvs->position_output;
draw->vs.edgeflag_output = dvs->edgeflag_output;
draw->vs.clipvertex_output = dvs->clipvertex_output;
- draw->vs.clipdistance_output[0] = dvs->clipdistance_output[0];
- draw->vs.clipdistance_output[1] = dvs->clipdistance_output[1];
+ draw->vs.ccdistance_output[0] = dvs->ccdistance_output[0];
+ draw->vs.ccdistance_output[1] = dvs->ccdistance_output[1];
dvs->prepare( dvs, draw );
draw_update_clip_flags(draw);
draw_update_viewport_flags(draw);
diff --git a/src/gallium/auxiliary/draw/draw_vs.h b/src/gallium/auxiliary/draw/draw_vs.h
index 24b29e70dd9..6a900224c11 100644
--- a/src/gallium/auxiliary/draw/draw_vs.h
+++ b/src/gallium/auxiliary/draw/draw_vs.h
@@ -113,8 +113,7 @@ struct draw_vertex_shader {
unsigned viewport_index_output;
unsigned edgeflag_output;
unsigned clipvertex_output;
- unsigned clipdistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
- unsigned culldistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
+ unsigned ccdistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
/* Extracted from shader:
*/
const float (*immediates)[4];
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index e07148d6783..1baf031d73e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -336,8 +336,7 @@ scan_declaration(struct tgsi_shader_info *info,
semName == TGSI_SEMANTIC_COLOR ||
semName == TGSI_SEMANTIC_BCOLOR ||
semName == TGSI_SEMANTIC_FOG ||
- semName == TGSI_SEMANTIC_CLIPDIST ||
- semName == TGSI_SEMANTIC_CULLDIST) {
+ semName == TGSI_SEMANTIC_CLIPDIST) {
switch (fulldecl->Interp.Interpolate) {
case TGSI_INTERPOLATE_COLOR:
case TGSI_INTERPOLATE_PERSPECTIVE: