return true if one of the vertices has been clipped
This commit is contained in:

committed by
Keith Whitwell

parent
aadbb1d7fb
commit
808f968f3a
@@ -148,12 +148,12 @@ struct draw_vertex_shader {
|
|||||||
/* Run the shader - this interface will get cleaned up in the
|
/* Run the shader - this interface will get cleaned up in the
|
||||||
* future:
|
* future:
|
||||||
*/
|
*/
|
||||||
void (*run)( struct draw_vertex_shader *shader,
|
boolean (*run)( struct draw_vertex_shader *shader,
|
||||||
struct draw_context *draw,
|
struct draw_context *draw,
|
||||||
const unsigned *elts,
|
const unsigned *elts,
|
||||||
unsigned count,
|
unsigned count,
|
||||||
struct vertex_header *vOut[] );
|
struct vertex_header *vOut[] );
|
||||||
|
|
||||||
|
|
||||||
void (*delete)( struct draw_vertex_shader * );
|
void (*delete)( struct draw_vertex_shader * );
|
||||||
};
|
};
|
||||||
|
@@ -64,7 +64,7 @@ vs_exec_prepare( struct draw_vertex_shader *shader,
|
|||||||
* \param count number of vertices to shade [1..4]
|
* \param count number of vertices to shade [1..4]
|
||||||
* \param vOut array of pointers to four output vertices
|
* \param vOut array of pointers to four output vertices
|
||||||
*/
|
*/
|
||||||
static void
|
static boolean
|
||||||
vs_exec_run( struct draw_vertex_shader *shader,
|
vs_exec_run( struct draw_vertex_shader *shader,
|
||||||
struct draw_context *draw,
|
struct draw_context *draw,
|
||||||
const unsigned *elts,
|
const unsigned *elts,
|
||||||
@@ -73,6 +73,7 @@ vs_exec_run( struct draw_vertex_shader *shader,
|
|||||||
{
|
{
|
||||||
struct tgsi_exec_machine *machine = &draw->machine;
|
struct tgsi_exec_machine *machine = &draw->machine;
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
unsigned int clipped = 0;
|
||||||
|
|
||||||
ALIGN16_DECL(struct tgsi_exec_vector, inputs, PIPE_MAX_ATTRIBS);
|
ALIGN16_DECL(struct tgsi_exec_vector, inputs, PIPE_MAX_ATTRIBS);
|
||||||
ALIGN16_DECL(struct tgsi_exec_vector, outputs, PIPE_MAX_ATTRIBS);
|
ALIGN16_DECL(struct tgsi_exec_vector, outputs, PIPE_MAX_ATTRIBS);
|
||||||
@@ -120,6 +121,7 @@ vs_exec_run( struct draw_vertex_shader *shader,
|
|||||||
if (!draw->rasterizer->bypass_clipping) {
|
if (!draw->rasterizer->bypass_clipping) {
|
||||||
vOut[i + j]->clipmask = compute_clipmask(vOut[i + j]->clip, draw->plane,
|
vOut[i + j]->clipmask = compute_clipmask(vOut[i + j]->clip, draw->plane,
|
||||||
draw->nr_planes);
|
draw->nr_planes);
|
||||||
|
clipped += vOut[i + j]->clipmask;
|
||||||
|
|
||||||
/* divide by w */
|
/* divide by w */
|
||||||
w = 1.0f / w;
|
w = 1.0f / w;
|
||||||
@@ -168,6 +170,7 @@ vs_exec_run( struct draw_vertex_shader *shader,
|
|||||||
#endif
|
#endif
|
||||||
} /* loop over vertices */
|
} /* loop over vertices */
|
||||||
}
|
}
|
||||||
|
return clipped != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -67,18 +67,19 @@ vs_llvm_prepare( struct draw_vertex_shader *base,
|
|||||||
* \param count number of vertices to shade [1..4]
|
* \param count number of vertices to shade [1..4]
|
||||||
* \param vOut array of pointers to four output vertices
|
* \param vOut array of pointers to four output vertices
|
||||||
*/
|
*/
|
||||||
static void
|
static boolean
|
||||||
vs_llvm_run( struct draw_vertex_shader *base,
|
vs_llvm_run( struct draw_vertex_shader *base,
|
||||||
struct draw_context *draw,
|
struct draw_context *draw,
|
||||||
const unsigned *elts,
|
const unsigned *elts,
|
||||||
unsigned count,
|
unsigned count,
|
||||||
struct vertex_header *vOut[] )
|
struct vertex_header *vOut[] )
|
||||||
{
|
{
|
||||||
struct draw_llvm_vertex_shader *shader =
|
struct draw_llvm_vertex_shader *shader =
|
||||||
(struct draw_llvm_vertex_shader *)base;
|
(struct draw_llvm_vertex_shader *)base;
|
||||||
|
|
||||||
struct tgsi_exec_machine *machine = &draw->machine;
|
struct tgsi_exec_machine *machine = &draw->machine;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
unsigned int clipped = 0;
|
||||||
|
|
||||||
ALIGN16_DECL(struct tgsi_exec_vector, inputs, PIPE_MAX_ATTRIBS);
|
ALIGN16_DECL(struct tgsi_exec_vector, inputs, PIPE_MAX_ATTRIBS);
|
||||||
ALIGN16_DECL(struct tgsi_exec_vector, outputs, PIPE_MAX_ATTRIBS);
|
ALIGN16_DECL(struct tgsi_exec_vector, outputs, PIPE_MAX_ATTRIBS);
|
||||||
@@ -125,19 +126,21 @@ vs_llvm_run( struct draw_vertex_shader *base,
|
|||||||
w = vOut[j]->clip[3] = machine->Outputs[0].xyzw[3].f[j];
|
w = vOut[j]->clip[3] = machine->Outputs[0].xyzw[3].f[j];
|
||||||
|
|
||||||
if (!draw->rasterizer->bypass_clipping) {
|
if (!draw->rasterizer->bypass_clipping) {
|
||||||
vOut[j]->clipmask = compute_clipmask(vOut[j]->clip, draw->plane, draw->nr_planes);
|
vOut[j]->clipmask = compute_clipmask(vOut[j]->clip, draw->plane,
|
||||||
|
draw->nr_planes);
|
||||||
|
clipped += vOut[j]->clipmask;
|
||||||
|
|
||||||
/* divide by w */
|
/* divide by w */
|
||||||
w = 1.0f / w;
|
w = 1.0f / w;
|
||||||
x *= w;
|
x *= w;
|
||||||
y *= w;
|
y *= w;
|
||||||
z *= w;
|
z *= w;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vOut[j]->clipmask = 0;
|
vOut[j]->clipmask = 0;
|
||||||
}
|
}
|
||||||
vOut[j]->edgeflag = 1;
|
vOut[j]->edgeflag = 1;
|
||||||
|
|
||||||
if (!draw->identity_viewport) {
|
if (!draw->identity_viewport) {
|
||||||
/* Viewport mapping */
|
/* Viewport mapping */
|
||||||
vOut[j]->data[0][0] = x * scale[0] + trans[0];
|
vOut[j]->data[0][0] = x * scale[0] + trans[0];
|
||||||
@@ -162,6 +165,7 @@ vs_llvm_run( struct draw_vertex_shader *base,
|
|||||||
vOut[j]->data[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
|
vOut[j]->data[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
|
||||||
}
|
}
|
||||||
} /* loop over vertices */
|
} /* loop over vertices */
|
||||||
|
return clipped != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -78,7 +78,7 @@ vs_sse_prepare( struct draw_vertex_shader *base,
|
|||||||
* \param count number of vertices to shade [1..4]
|
* \param count number of vertices to shade [1..4]
|
||||||
* \param vOut array of pointers to four output vertices
|
* \param vOut array of pointers to four output vertices
|
||||||
*/
|
*/
|
||||||
static void
|
static boolean
|
||||||
vs_sse_run( struct draw_vertex_shader *base,
|
vs_sse_run( struct draw_vertex_shader *base,
|
||||||
struct draw_context *draw,
|
struct draw_context *draw,
|
||||||
const unsigned *elts,
|
const unsigned *elts,
|
||||||
@@ -88,6 +88,7 @@ vs_sse_run( struct draw_vertex_shader *base,
|
|||||||
struct draw_sse_vertex_shader *shader = (struct draw_sse_vertex_shader *)base;
|
struct draw_sse_vertex_shader *shader = (struct draw_sse_vertex_shader *)base;
|
||||||
struct tgsi_exec_machine *machine = &draw->machine;
|
struct tgsi_exec_machine *machine = &draw->machine;
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
unsigned int clipped = 0;
|
||||||
|
|
||||||
ALIGN16_DECL(struct tgsi_exec_vector, inputs, PIPE_MAX_ATTRIBS);
|
ALIGN16_DECL(struct tgsi_exec_vector, inputs, PIPE_MAX_ATTRIBS);
|
||||||
ALIGN16_DECL(struct tgsi_exec_vector, outputs, PIPE_MAX_ATTRIBS);
|
ALIGN16_DECL(struct tgsi_exec_vector, outputs, PIPE_MAX_ATTRIBS);
|
||||||
@@ -143,6 +144,7 @@ vs_sse_run( struct draw_vertex_shader *base,
|
|||||||
if (!draw->rasterizer->bypass_clipping) {
|
if (!draw->rasterizer->bypass_clipping) {
|
||||||
vOut[i + j]->clipmask = compute_clipmask(vOut[i + j]->clip, draw->plane,
|
vOut[i + j]->clipmask = compute_clipmask(vOut[i + j]->clip, draw->plane,
|
||||||
draw->nr_planes);
|
draw->nr_planes);
|
||||||
|
clipped += vOut[i + j]->clipmask;
|
||||||
|
|
||||||
/* divide by w */
|
/* divide by w */
|
||||||
w = 1.0f / w;
|
w = 1.0f / w;
|
||||||
@@ -180,6 +182,7 @@ vs_sse_run( struct draw_vertex_shader *base,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return clipped != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user