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 <sroland@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
bddb3b5375
commit
d17062a40e
|
@ -49,8 +49,8 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs,
|
||||||
int num_written_clipdistance =
|
int num_written_clipdistance =
|
||||||
draw_current_shader_num_written_clipdistances(pvs->draw);
|
draw_current_shader_num_written_clipdistances(pvs->draw);
|
||||||
|
|
||||||
cd[0] = draw_current_shader_clipdistance_output(pvs->draw, 0);
|
cd[0] = draw_current_shader_ccdistance_output(pvs->draw, 0);
|
||||||
cd[1] = draw_current_shader_clipdistance_output(pvs->draw, 1);
|
cd[1] = draw_current_shader_ccdistance_output(pvs->draw, 1);
|
||||||
|
|
||||||
if (cd[0] != pos || cd[1] != pos)
|
if (cd[0] != pos || cd[1] != pos)
|
||||||
have_cd = true;
|
have_cd = true;
|
||||||
|
|
|
@ -887,12 +887,12 @@ draw_current_shader_clipvertex_output(const struct draw_context *draw)
|
||||||
}
|
}
|
||||||
|
|
||||||
uint
|
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);
|
debug_assert(index < PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
|
||||||
if (draw->gs.geometry_shader)
|
if (draw->gs.geometry_shader)
|
||||||
return draw->gs.geometry_shader->clipdistance_output[index];
|
return draw->gs.geometry_shader->ccdistance_output[index];
|
||||||
return draw->vs.clipdistance_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;
|
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
|
uint
|
||||||
draw_current_shader_num_written_culldistances(const struct draw_context *draw)
|
draw_current_shader_num_written_culldistances(const struct draw_context *draw)
|
||||||
{
|
{
|
||||||
|
|
|
@ -803,12 +803,7 @@ draw_create_geometry_shader(struct draw_context *draw,
|
||||||
if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPDIST) {
|
if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPDIST) {
|
||||||
debug_assert(gs->info.output_semantic_index[i] <
|
debug_assert(gs->info.output_semantic_index[i] <
|
||||||
PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
|
PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
|
||||||
gs->clipdistance_output[gs->info.output_semantic_index[i]] = i;
|
gs->ccdistance_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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,7 @@ struct draw_geometry_shader {
|
||||||
struct tgsi_shader_info info;
|
struct tgsi_shader_info info;
|
||||||
unsigned position_output;
|
unsigned position_output;
|
||||||
unsigned viewport_index_output;
|
unsigned viewport_index_output;
|
||||||
unsigned clipdistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
|
unsigned ccdistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
|
||||||
unsigned culldistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
|
|
||||||
|
|
||||||
unsigned max_output_vertices;
|
unsigned max_output_vertices;
|
||||||
unsigned primitive_boundary;
|
unsigned primitive_boundary;
|
||||||
|
|
|
@ -1164,8 +1164,8 @@ generate_clipmask(struct draw_llvm *llvm,
|
||||||
unsigned ucp_enable = key->ucp_enable;
|
unsigned ucp_enable = key->ucp_enable;
|
||||||
unsigned cd[2];
|
unsigned cd[2];
|
||||||
|
|
||||||
cd[0] = llvm->draw->vs.clipdistance_output[0];
|
cd[0] = llvm->draw->vs.ccdistance_output[0];
|
||||||
cd[1] = llvm->draw->vs.clipdistance_output[1];
|
cd[1] = llvm->draw->vs.ccdistance_output[1];
|
||||||
|
|
||||||
if (cd[0] != pos || cd[1] != pos)
|
if (cd[0] != pos || cd[1] != pos)
|
||||||
have_cd = true;
|
have_cd = true;
|
||||||
|
|
|
@ -368,7 +368,7 @@ static inline float getclipdist(const struct clip_stage *clipper,
|
||||||
int _idx = plane_idx - 6;
|
int _idx = plane_idx - 6;
|
||||||
int cdi = _idx >= 4;
|
int cdi = _idx >= 4;
|
||||||
int vidx = cdi ? _idx - 4 : _idx;
|
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 {
|
} else {
|
||||||
/*
|
/*
|
||||||
* legacy user clip planes or gl_ClipVertex
|
* legacy user clip planes or gl_ClipVertex
|
||||||
|
|
|
@ -68,15 +68,17 @@ static void cull_point( struct draw_stage *stage,
|
||||||
{
|
{
|
||||||
const unsigned num_written_culldistances =
|
const unsigned num_written_culldistances =
|
||||||
draw_current_shader_num_written_culldistances(stage->draw);
|
draw_current_shader_num_written_culldistances(stage->draw);
|
||||||
|
const unsigned num_written_clipdistances =
|
||||||
|
draw_current_shader_num_written_clipdistances(stage->draw);
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
debug_assert(num_written_culldistances);
|
debug_assert(num_written_culldistances);
|
||||||
|
|
||||||
for (i = 0; i < num_written_culldistances; ++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 =
|
unsigned out_idx =
|
||||||
draw_current_shader_culldistance_output(stage->draw, cull_idx);
|
draw_current_shader_ccdistance_output(stage->draw, cull_idx);
|
||||||
unsigned idx = i % 4;
|
unsigned idx = (num_written_clipdistances + i) % 4;
|
||||||
float cull1 = header->v[0]->data[out_idx][idx];
|
float cull1 = header->v[0]->data[out_idx][idx];
|
||||||
boolean vert1_out = cull_distance_is_out(cull1);
|
boolean vert1_out = cull_distance_is_out(cull1);
|
||||||
if (vert1_out)
|
if (vert1_out)
|
||||||
|
@ -96,15 +98,17 @@ static void cull_line( struct draw_stage *stage,
|
||||||
{
|
{
|
||||||
const unsigned num_written_culldistances =
|
const unsigned num_written_culldistances =
|
||||||
draw_current_shader_num_written_culldistances(stage->draw);
|
draw_current_shader_num_written_culldistances(stage->draw);
|
||||||
|
const unsigned num_written_clipdistances =
|
||||||
|
draw_current_shader_num_written_clipdistances(stage->draw);
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
debug_assert(num_written_culldistances);
|
debug_assert(num_written_culldistances);
|
||||||
|
|
||||||
for (i = 0; i < num_written_culldistances; ++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 =
|
unsigned out_idx =
|
||||||
draw_current_shader_culldistance_output(stage->draw, cull_idx);
|
draw_current_shader_ccdistance_output(stage->draw, cull_idx);
|
||||||
unsigned idx = i % 4;
|
unsigned idx = (num_written_clipdistances + i) % 4;
|
||||||
float cull1 = header->v[0]->data[out_idx][idx];
|
float cull1 = header->v[0]->data[out_idx][idx];
|
||||||
float cull2 = header->v[1]->data[out_idx][idx];
|
float cull2 = header->v[1]->data[out_idx][idx];
|
||||||
boolean vert1_out = cull_distance_is_out(cull1);
|
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 =
|
const unsigned num_written_culldistances =
|
||||||
draw_current_shader_num_written_culldistances(stage->draw);
|
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 */
|
/* Do the distance culling */
|
||||||
if (num_written_culldistances) {
|
if (num_written_culldistances) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for (i = 0; i < num_written_culldistances; ++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 =
|
unsigned out_idx =
|
||||||
draw_current_shader_culldistance_output(stage->draw, cull_idx);
|
draw_current_shader_ccdistance_output(stage->draw, cull_idx);
|
||||||
unsigned idx = i % 4;
|
unsigned idx = (num_written_clipdistances + i) % 4;
|
||||||
float cull1 = header->v[0]->data[out_idx][idx];
|
float cull1 = header->v[0]->data[out_idx][idx];
|
||||||
float cull2 = header->v[1]->data[out_idx][idx];
|
float cull2 = header->v[1]->data[out_idx][idx];
|
||||||
float cull3 = header->v[2]->data[out_idx][idx];
|
float cull3 = header->v[2]->data[out_idx][idx];
|
||||||
|
|
|
@ -262,7 +262,7 @@ struct draw_context
|
||||||
uint position_output;
|
uint position_output;
|
||||||
uint edgeflag_output;
|
uint edgeflag_output;
|
||||||
uint clipvertex_output;
|
uint clipvertex_output;
|
||||||
uint clipdistance_output[2];
|
uint ccdistance_output[2];
|
||||||
|
|
||||||
/** Fields for TGSI interpreter / execution */
|
/** Fields for TGSI interpreter / execution */
|
||||||
struct {
|
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_position_output(const struct draw_context *draw);
|
||||||
uint draw_current_shader_viewport_index_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_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_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);
|
uint draw_current_shader_num_written_culldistances(const struct draw_context *draw);
|
||||||
int draw_alloc_extra_vertex_attrib(struct draw_context *draw,
|
int draw_alloc_extra_vertex_attrib(struct draw_context *draw,
|
||||||
uint semantic_name, uint semantic_index);
|
uint semantic_name, uint semantic_index);
|
||||||
|
|
|
@ -90,11 +90,7 @@ draw_create_vertex_shader(struct draw_context *draw,
|
||||||
else if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPDIST) {
|
else if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPDIST) {
|
||||||
debug_assert(vs->info.output_semantic_index[i] <
|
debug_assert(vs->info.output_semantic_index[i] <
|
||||||
PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
|
PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
|
||||||
vs->clipdistance_output[vs->info.output_semantic_index[i]] = i;
|
vs->ccdistance_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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found_clipvertex)
|
if (!found_clipvertex)
|
||||||
|
@ -119,8 +115,8 @@ draw_bind_vertex_shader(struct draw_context *draw,
|
||||||
draw->vs.position_output = dvs->position_output;
|
draw->vs.position_output = dvs->position_output;
|
||||||
draw->vs.edgeflag_output = dvs->edgeflag_output;
|
draw->vs.edgeflag_output = dvs->edgeflag_output;
|
||||||
draw->vs.clipvertex_output = dvs->clipvertex_output;
|
draw->vs.clipvertex_output = dvs->clipvertex_output;
|
||||||
draw->vs.clipdistance_output[0] = dvs->clipdistance_output[0];
|
draw->vs.ccdistance_output[0] = dvs->ccdistance_output[0];
|
||||||
draw->vs.clipdistance_output[1] = dvs->clipdistance_output[1];
|
draw->vs.ccdistance_output[1] = dvs->ccdistance_output[1];
|
||||||
dvs->prepare( dvs, draw );
|
dvs->prepare( dvs, draw );
|
||||||
draw_update_clip_flags(draw);
|
draw_update_clip_flags(draw);
|
||||||
draw_update_viewport_flags(draw);
|
draw_update_viewport_flags(draw);
|
||||||
|
|
|
@ -113,8 +113,7 @@ struct draw_vertex_shader {
|
||||||
unsigned viewport_index_output;
|
unsigned viewport_index_output;
|
||||||
unsigned edgeflag_output;
|
unsigned edgeflag_output;
|
||||||
unsigned clipvertex_output;
|
unsigned clipvertex_output;
|
||||||
unsigned clipdistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
|
unsigned ccdistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
|
||||||
unsigned culldistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
|
|
||||||
/* Extracted from shader:
|
/* Extracted from shader:
|
||||||
*/
|
*/
|
||||||
const float (*immediates)[4];
|
const float (*immediates)[4];
|
||||||
|
|
|
@ -336,8 +336,7 @@ scan_declaration(struct tgsi_shader_info *info,
|
||||||
semName == TGSI_SEMANTIC_COLOR ||
|
semName == TGSI_SEMANTIC_COLOR ||
|
||||||
semName == TGSI_SEMANTIC_BCOLOR ||
|
semName == TGSI_SEMANTIC_BCOLOR ||
|
||||||
semName == TGSI_SEMANTIC_FOG ||
|
semName == TGSI_SEMANTIC_FOG ||
|
||||||
semName == TGSI_SEMANTIC_CLIPDIST ||
|
semName == TGSI_SEMANTIC_CLIPDIST) {
|
||||||
semName == TGSI_SEMANTIC_CULLDIST) {
|
|
||||||
switch (fulldecl->Interp.Interpolate) {
|
switch (fulldecl->Interp.Interpolate) {
|
||||||
case TGSI_INTERPOLATE_COLOR:
|
case TGSI_INTERPOLATE_COLOR:
|
||||||
case TGSI_INTERPOLATE_PERSPECTIVE:
|
case TGSI_INTERPOLATE_PERSPECTIVE:
|
||||||
|
|
Loading…
Reference in New Issue