if (flags & DO_CLIP_USER) {
unsigned ucp_mask = ucp_enable;
- int num_written_clipdistance = pvs->draw->vs.vertex_shader->info.num_written_clipdistance;
+ int num_written_clipdistance =
+ draw_current_shader_num_written_clipdistances(pvs->draw);
while (ucp_mask) {
unsigned plane_idx = ffs(ucp_mask)-1;
ucp_mask &= ~(1 << plane_idx);
uint
draw_current_shader_clipdistance_output(const struct draw_context *draw, int index)
{
+ if (draw->gs.geometry_shader)
+ return draw->gs.geometry_shader->clipdistance_output[index];
return draw->vs.clipdistance_output[index];
}
+
+uint
+draw_current_shader_num_written_clipdistances(const struct draw_context *draw)
+{
+ if (draw->gs.geometry_shader)
+ return draw->gs.geometry_shader->info.num_written_clipdistance;
+ return draw->vs.vertex_shader->info.num_written_clipdistance;
+}
+
/**
* Return a pointer/handle for a driver/CSO rasterizer object which
* disabled culling, stippling, unfilled tris, etc.
gs->position_output = i;
if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_VIEWPORT_INDEX)
gs->viewport_index_output = i;
+ if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPDIST) {
+ if (gs->info.output_semantic_index[i] == 0)
+ gs->clipdistance_output[0] = i;
+ else
+ gs->clipdistance_output[1] = i;
+ }
}
gs->machine = draw->gs.tgsi.machine;
struct tgsi_shader_info info;
unsigned position_output;
unsigned viewport_index_output;
+ unsigned clipdistance_output[2];
unsigned max_output_vertices;
unsigned primitive_boundary;
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_num_written_clipdistances(const struct draw_context *draw);
int draw_alloc_extra_vertex_attrib(struct draw_context *draw,
uint semantic_name, uint semantic_index);
void draw_remove_extra_vertex_attribs(struct draw_context *draw);
info->output_semantic_index[reg] = (ubyte)fulldecl->Semantic.Index;
info->num_outputs++;
- if (procType == TGSI_PROCESSOR_VERTEX &&
+ if ((procType == TGSI_PROCESSOR_VERTEX || procType == TGSI_PROCESSOR_GEOMETRY) &&
fulldecl->Semantic.Name == TGSI_SEMANTIC_CLIPDIST) {
info->num_written_clipdistance += util_bitcount(fulldecl->Declaration.UsageMask);
}