{
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
draw->viewport = *viewport; /* struct copy */
+ draw->identity_viewport = (viewport->scale[0] == 1.0f &&
+ viewport->scale[1] == 1.0f &&
+ viewport->scale[2] == 1.0f &&
+ viewport->scale[3] == 1.0f &&
+ viewport->translate[0] == 0.0f &&
+ viewport->translate[1] == 0.0f &&
+ viewport->translate[2] == 0.0f &&
+ viewport->translate[3] == 0.0f);
}
}
/* drawing done here: */
- if (!draw->rasterizer->bypass_vs ||
- !draw_pt_arrays(draw, prim, start, count)) {
+ if (!draw_pt_arrays(draw, prim, start, count)) {
/* we have to run the whole pipeline */
draw_prim(draw, prim, start, count);
}
struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
struct draw_vertex_shader *vertex_shader;
+ boolean identity_viewport;
+
uint num_vs_outputs; /**< convenience, from vertex_shader */
/* user-space vertex data, buffers */
machine->Consts = (float (*)[4]) draw->user.constants;
machine->Inputs = ALIGN16_ASSIGN(inputs);
- machine->Outputs = ALIGN16_ASSIGN(outputs);
+ if (draw->rasterizer->bypass_vs) {
+ /* outputs are just the inputs */
+ machine->Outputs = machine->Inputs;
+ }
+ else {
+ machine->Outputs = ALIGN16_ASSIGN(outputs);
+ }
draw->vertex_fetch.fetch_func( draw, machine, elts, count );
- /* run interpreter */
- tgsi_exec_machine_run( machine );
-
+ if (!draw->rasterizer->bypass_vs) {
+ /* run interpreter */
+ tgsi_exec_machine_run( machine );
+ }
/* store machine results */
for (j = 0; j < count; j++) {
if (!draw->rasterizer->bypass_clipping) {
vOut[j]->clipmask = compute_clipmask(vOut[j]->clip, draw->plane, draw->nr_planes);
- vOut[j]->edgeflag = 1;
+ }
+ else {
+ vOut[j]->clipmask = 0;
+ }
+ vOut[j]->edgeflag = 1;
+ if (!draw->identity_viewport) {
/* divide by w */
w = 1.0f / w;
x *= w;
vOut[j]->data[0][3] = w;
}
else {
- vOut[j]->clipmask = 0;
- vOut[j]->edgeflag = 1;
vOut[j]->data[0][0] = x;
vOut[j]->data[0][1] = y;
vOut[j]->data[0][2] = z;
machine->Consts = (float (*)[4]) draw->user.constants;
machine->Inputs = ALIGN16_ASSIGN(inputs);
- machine->Outputs = ALIGN16_ASSIGN(outputs);
+ if (draw->rasterizer->bypass_vs) {
+ /* outputs are just the inputs */
+ machine->Outputs = machine->Inputs;
+ }
+ else {
+ machine->Outputs = ALIGN16_ASSIGN(outputs);
+ }
+
draw->vertex_fetch.fetch_func( draw, machine, elts, count );
- /* run shader */
- gallivm_cpu_vs_exec(shader->llvm_prog,
- machine->Inputs,
- machine->Outputs,
- machine->Consts,
- machine->Temps);
+ if (!draw->rasterizer->bypass_vs) {
+ /* run shader */
+ gallivm_cpu_vs_exec(shader->llvm_prog,
+ machine->Inputs,
+ machine->Outputs,
+ machine->Consts,
+ machine->Temps);
+ }
/* store machine results */
for (j = 0; j < count; j++) {
unsigned slot;
float x, y, z, w;
- if (!draw->rasterizer->bypass_clipping) {
- x = vOut[j]->clip[0] = machine->Outputs[0].xyzw[0].f[j];
- y = vOut[j]->clip[1] = machine->Outputs[0].xyzw[1].f[j];
- z = vOut[j]->clip[2] = machine->Outputs[0].xyzw[2].f[j];
- w = vOut[j]->clip[3] = machine->Outputs[0].xyzw[3].f[j];
+ x = vOut[j]->clip[0] = machine->Outputs[0].xyzw[0].f[j];
+ y = vOut[j]->clip[1] = machine->Outputs[0].xyzw[1].f[j];
+ z = vOut[j]->clip[2] = machine->Outputs[0].xyzw[2].f[j];
+ w = vOut[j]->clip[3] = machine->Outputs[0].xyzw[3].f[j];
+ if (!draw->rasterizer->bypass_clipping) {
vOut[j]->clipmask = compute_clipmask(vOut[j]->clip, draw->plane, draw->nr_planes);
- vOut[j]->edgeflag = 1;
+ }
+ else {
+ vOut[j]->clipmask = 0;
+ }
+ vOut[j]->edgeflag = 1;
+ if (!draw->identity_viewport) {
/* divide by w */
w = 1.0f / w;
x *= w;
vOut[j]->data[0][3] = w;
}
else {
- vOut[j]->clipmask = 0;
- vOut[j]->edgeflag = 1;
vOut[j]->data[0][0] = x;
vOut[j]->data[0][1] = y;
vOut[j]->data[0][2] = z;
/* Consts does not require 16 byte alignment. */
machine->Consts = (float (*)[4]) draw->user.constants;
machine->Inputs = ALIGN16_ASSIGN(inputs);
- machine->Outputs = ALIGN16_ASSIGN(outputs);
+ if (draw->rasterizer->bypass_vs) {
+ /* outputs are just the inputs */
+ machine->Outputs = machine->Inputs;
+ }
+ else {
+ machine->Outputs = ALIGN16_ASSIGN(outputs);
+ }
/* Fetch vertices. This may at some point be integrated into the
draw->vertex_fetch.fetch_func( draw, machine, elts, count );
- /* run compiled shader
- */
- shader->func(
- machine->Inputs,
- machine->Outputs,
- machine->Consts,
- machine->Temps );
+ if (!draw->rasterizer->bypass_vs) {
+ /* run compiled shader
+ */
+ shader->func(machine->Inputs,
+ machine->Outputs,
+ machine->Consts,
+ machine->Temps );
+ }
/* XXX: Computing the clipmask and emitting results should be done
if (!draw->rasterizer->bypass_clipping) {
vOut[j]->clipmask = compute_clipmask(vOut[j]->clip, draw->plane, draw->nr_planes);
- vOut[j]->edgeflag = 1;
+ }
+ else {
+ vOut[j]->clipmask = 0;
+ }
+ vOut[j]->edgeflag = 1;
+ if (!draw->identity_viewport) {
/* divide by w */
w = 1.0f / w;
x *= w;
vOut[j]->data[0][3] = w;
}
else {
- vOut[j]->clipmask = 0;
- vOut[j]->edgeflag = 1;
vOut[j]->data[0][0] = x;
vOut[j]->data[0][1] = y;
vOut[j]->data[0][2] = z;