summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/Makefile46
-rw-r--r--src/gallium/auxiliary/draw/SConscript46
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c84
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h22
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.c338
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.h76
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aaline.c126
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aapoint.c294
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_clip.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_cull.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_offset.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_pstipple.c79
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_stipple.c5
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_wide_line.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_wide_point.c14
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h35
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c12
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.h8
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch.c35
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c56
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_post_vs.c65
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_util.c16
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h4
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_vcache.c5
-rw-r--r--src/gallium/auxiliary/draw/draw_vs.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_vs.h1
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos.c250
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_varient.c5
28 files changed, 1042 insertions, 594 deletions
diff --git a/src/gallium/auxiliary/draw/Makefile b/src/gallium/auxiliary/draw/Makefile
deleted file mode 100644
index 5041dcc072..0000000000
--- a/src/gallium/auxiliary/draw/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-TOP = ../../../..
-include $(TOP)/configs/current
-
-LIBNAME = draw
-
-C_SOURCES = \
- draw_context.c \
- draw_pipe.c \
- draw_pipe_aaline.c \
- draw_pipe_aapoint.c \
- draw_pipe_clip.c \
- draw_pipe_cull.c \
- draw_pipe_flatshade.c \
- draw_pipe_offset.c \
- draw_pipe_pstipple.c \
- draw_pipe_stipple.c \
- draw_pipe_twoside.c \
- draw_pipe_unfilled.c \
- draw_pipe_util.c \
- draw_pipe_validate.c \
- draw_pipe_vbuf.c \
- draw_pipe_wide_line.c \
- draw_pipe_wide_point.c \
- draw_pt.c \
- draw_pt_elts.c \
- draw_pt_emit.c \
- draw_pt_fetch.c \
- draw_pt_fetch_emit.c \
- draw_pt_fetch_shade_emit.c \
- draw_pt_fetch_shade_pipeline.c \
- draw_pt_post_vs.c \
- draw_pt_util.c \
- draw_pt_varray.c \
- draw_pt_vcache.c \
- draw_vertex.c \
- draw_vs.c \
- draw_vs_varient.c \
- draw_vs_aos.c \
- draw_vs_aos_io.c \
- draw_vs_aos_machine.c \
- draw_vs_exec.c \
- draw_vs_llvm.c \
- draw_vs_ppc.c \
- draw_vs_sse.c
-
-include ../../Makefile.template
diff --git a/src/gallium/auxiliary/draw/SConscript b/src/gallium/auxiliary/draw/SConscript
deleted file mode 100644
index 5f05aa324a..0000000000
--- a/src/gallium/auxiliary/draw/SConscript
+++ /dev/null
@@ -1,46 +0,0 @@
-Import('*')
-
-draw = env.ConvenienceLibrary(
- target = 'draw',
- source = [
- 'draw_context.c',
- 'draw_pipe.c',
- 'draw_pipe_aaline.c',
- 'draw_pipe_aapoint.c',
- 'draw_pipe_clip.c',
- 'draw_pipe_cull.c',
- 'draw_pipe_flatshade.c',
- 'draw_pipe_offset.c',
- 'draw_pipe_pstipple.c',
- 'draw_pipe_stipple.c',
- 'draw_pipe_twoside.c',
- 'draw_pipe_unfilled.c',
- 'draw_pipe_util.c',
- 'draw_pipe_validate.c',
- 'draw_pipe_vbuf.c',
- 'draw_pipe_wide_line.c',
- 'draw_pipe_wide_point.c',
- 'draw_pt.c',
- 'draw_pt_elts.c',
- 'draw_pt_emit.c',
- 'draw_pt_fetch.c',
- 'draw_pt_fetch_emit.c',
- 'draw_pt_fetch_shade_emit.c',
- 'draw_pt_fetch_shade_pipeline.c',
- 'draw_pt_post_vs.c',
- 'draw_pt_util.c',
- 'draw_pt_varray.c',
- 'draw_pt_vcache.c',
- 'draw_vertex.c',
- 'draw_vs.c',
- 'draw_vs_aos.c',
- 'draw_vs_aos_io.c',
- 'draw_vs_aos_machine.c',
- 'draw_vs_exec.c',
- 'draw_vs_llvm.c',
- 'draw_vs_ppc.c',
- 'draw_vs_sse.c',
- 'draw_vs_varient.c'
- ])
-
-auxiliaries.insert(0, draw)
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index a4f1fcddc1..667aa46b20 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -36,6 +36,7 @@
#include "draw_context.h"
#include "draw_vbuf.h"
#include "draw_vs.h"
+#include "draw_gs.h"
#include "draw_pt.h"
#include "draw_pipe.h"
@@ -67,6 +68,9 @@ struct draw_context *draw_create( void )
if (!draw_vs_init( draw ))
goto fail;
+ if (!draw_gs_init( draw ))
+ goto fail;
+
return draw;
fail:
@@ -231,11 +235,19 @@ draw_set_mapped_vertex_buffer(struct draw_context *draw,
void
draw_set_mapped_constant_buffer(struct draw_context *draw,
- const void *buffer,
+ unsigned shader_type,
+ const void *buffer,
unsigned size )
{
- draw->pt.user.constants = buffer;
- draw_vs_set_constants( draw, (const float (*)[4])buffer, size );
+ debug_assert(shader_type == PIPE_SHADER_VERTEX ||
+ shader_type == PIPE_SHADER_GEOMETRY);
+ if (shader_type == PIPE_SHADER_VERTEX) {
+ draw->pt.user.vs_constants = buffer;
+ draw_vs_set_constants( draw, (const float (*)[4])buffer, size );
+ } else if (shader_type == PIPE_SHADER_GEOMETRY) {
+ draw->pt.user.gs_constants = buffer;
+ draw_gs_set_constants( draw, (const float (*)[4])buffer, size );
+ }
}
@@ -298,7 +310,7 @@ draw_set_force_passthrough( struct draw_context *draw, boolean enable )
* a post-transformed vertex.
*
* With this function, drivers that use the draw module should have no reason
- * to track the current vertex shader.
+ * to track the current vertex/geometry shader.
*
* Note that the draw module may sometimes generate vertices with extra
* attributes (such as texcoords for AA lines). The driver can call this
@@ -309,43 +321,59 @@ draw_set_force_passthrough( struct draw_context *draw, boolean enable )
* work for the drivers.
*/
int
-draw_find_vs_output(const struct draw_context *draw,
- uint semantic_name, uint semantic_index)
+draw_find_shader_output(const struct draw_context *draw,
+ uint semantic_name, uint semantic_index)
{
const struct draw_vertex_shader *vs = draw->vs.vertex_shader;
+ const struct draw_geometry_shader *gs = draw->gs.geometry_shader;
uint i;
- for (i = 0; i < vs->info.num_outputs; i++) {
- if (vs->info.output_semantic_name[i] == semantic_name &&
- vs->info.output_semantic_index[i] == semantic_index)
+ const struct tgsi_shader_info *info = &vs->info;
+
+ if (gs)
+ info = &gs->info;
+
+ for (i = 0; i < info->num_outputs; i++) {
+ if (info->output_semantic_name[i] == semantic_name &&
+ info->output_semantic_index[i] == semantic_index)
return i;
}
/* XXX there may be more than one extra vertex attrib.
* For example, simulated gl_FragCoord and gl_PointCoord.
*/
- if (draw->extra_vp_outputs.semantic_name == semantic_name &&
- draw->extra_vp_outputs.semantic_index == semantic_index) {
- return draw->extra_vp_outputs.slot;
+ if (draw->extra_shader_outputs.semantic_name == semantic_name &&
+ draw->extra_shader_outputs.semantic_index == semantic_index) {
+ return draw->extra_shader_outputs.slot;
}
+
return 0;
}
/**
- * Return number of vertex shader outputs.
+ * Return number of the shader outputs.
+ *
+ * If geometry shader is present, its output will be returned,
+ * if not vertex shader is used.
*/
uint
-draw_num_vs_outputs(const struct draw_context *draw)
+draw_num_shader_outputs(const struct draw_context *draw)
{
uint count = draw->vs.vertex_shader->info.num_outputs;
- if (draw->extra_vp_outputs.slot > 0)
+
+ /* if geometry shader is present, its outputs go to te
+ * driver, not the vertex shaders */
+ if (draw->gs.geometry_shader)
+ count = draw->gs.geometry_shader->info.num_outputs;
+
+ if (draw->extra_shader_outputs.slot > 0)
count++;
return count;
}
/**
- * Provide TGSI sampler objects for vertex shaders that use texture fetches.
+ * Provide TGSI sampler objects for vertex/geometry shaders that use texture fetches.
* This might only be used by software drivers for the time being.
*/
void
@@ -355,6 +383,8 @@ draw_texture_samplers(struct draw_context *draw,
{
draw->vs.num_samplers = num_samplers;
draw->vs.samplers = samplers;
+ draw->gs.num_samplers = num_samplers;
+ draw->gs.samplers = samplers;
}
@@ -366,13 +396,6 @@ void draw_set_render( struct draw_context *draw,
draw->render = render;
}
-void draw_set_edgeflags( struct draw_context *draw,
- const unsigned *edgeflag )
-{
- draw->pt.user.edgeflag = edgeflag;
-}
-
-
/**
@@ -428,3 +451,18 @@ void draw_do_flush( struct draw_context *draw, unsigned flags )
draw->flushing = FALSE;
}
}
+
+
+int draw_current_shader_outputs(struct draw_context *draw)
+{
+ if (draw->gs.geometry_shader)
+ return draw->gs.num_gs_outputs;
+ return draw->vs.num_vs_outputs;
+}
+
+int draw_current_shader_position_output(struct draw_context *draw)
+{
+ if (draw->gs.geometry_shader)
+ return draw->gs.position_output;
+ return draw->vs.position_output;
+}
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index d529e4e9a2..b716209df2 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -45,6 +45,7 @@ struct pipe_context;
struct draw_context;
struct draw_stage;
struct draw_vertex_shader;
+struct draw_geometry_shader;
struct tgsi_sampler;
@@ -85,11 +86,11 @@ draw_install_pstipple_stage(struct draw_context *draw, struct pipe_context *pipe
int
-draw_find_vs_output(const struct draw_context *draw,
- uint semantic_name, uint semantic_index);
+draw_find_shader_output(const struct draw_context *draw,
+ uint semantic_name, uint semantic_index);
uint
-draw_num_vs_outputs(const struct draw_context *draw);
+draw_num_shader_outputs(const struct draw_context *draw);
void
@@ -112,6 +113,17 @@ void draw_delete_vertex_shader(struct draw_context *draw,
struct draw_vertex_shader *dvs);
+/*
+ * Geometry shader functions
+ */
+struct draw_geometry_shader *
+draw_create_geometry_shader(struct draw_context *draw,
+ const struct pipe_shader_state *shader);
+void draw_bind_geometry_shader(struct draw_context *draw,
+ struct draw_geometry_shader *dvs);
+void draw_delete_geometry_shader(struct draw_context *draw,
+ struct draw_geometry_shader *dvs);
+
/*
* Vertex data functions
@@ -140,12 +152,10 @@ void draw_set_mapped_vertex_buffer(struct draw_context *draw,
unsigned attr, const void *buffer);
void draw_set_mapped_constant_buffer(struct draw_context *draw,
+ unsigned shader_type,
const void *buffer,
unsigned size );
-void draw_set_edgeflags( struct draw_context *draw,
- const unsigned *edgeflag );
-
/***********************************************************************
* draw_prim.c
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
new file mode 100644
index 0000000000..5db2e75542
--- /dev/null
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -0,0 +1,338 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMWare Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "draw_gs.h"
+
+#include "draw_private.h"
+#include "draw_context.h"
+
+#include "tgsi/tgsi_parse.h"
+#include "tgsi/tgsi_exec.h"
+
+#include "pipe/p_shader_tokens.h"
+
+#include "util/u_math.h"
+#include "util/u_memory.h"
+
+#define MAX_PRIM_VERTICES 6
+/* fixme: move it from here */
+#define MAX_PRIMITIVES 64
+
+boolean
+draw_gs_init( struct draw_context *draw )
+{
+ draw->gs.machine = tgsi_exec_machine_create();
+ if (!draw->gs.machine)
+ return FALSE;
+
+ draw->gs.machine->Primitives = align_malloc(
+ MAX_PRIMITIVES * sizeof(struct tgsi_exec_vector), 16);
+ if (!draw->gs.machine->Primitives)
+ return FALSE;
+ memset(draw->gs.machine->Primitives, 0,
+ MAX_PRIMITIVES * sizeof(struct tgsi_exec_vector));
+
+ return TRUE;
+}
+
+
+void draw_gs_set_constants( struct draw_context *draw,
+ const float (*constants)[4],
+ unsigned size )
+{
+}
+
+
+struct draw_geometry_shader *
+draw_create_geometry_shader(struct draw_context *draw,
+ const struct pipe_shader_state *state)
+{
+ struct draw_geometry_shader *gs;
+ int i;
+
+ gs = CALLOC_STRUCT(draw_geometry_shader);
+
+ if (!gs)
+ return NULL;
+
+ gs->state = *state;
+ gs->state.tokens = tgsi_dup_tokens(state->tokens);
+ if (!gs->state.tokens) {
+ FREE(gs);
+ return NULL;
+ }
+
+ tgsi_scan_shader(state->tokens, &gs->info);
+
+ /* setup the defaults */
+ gs->input_primitive = PIPE_PRIM_TRIANGLES;
+ gs->output_primitive = PIPE_PRIM_TRIANGLE_STRIP;
+ gs->max_output_vertices = 32;
+
+ for (i = 0; i < gs->info.num_properties; ++i) {
+ if (gs->info.properties[i].name ==
+ TGSI_PROPERTY_GS_INPUT_PRIM)
+ gs->input_primitive = gs->info.properties[i].data[0];
+ else if (gs->info.properties[i].name ==
+ TGSI_PROPERTY_GS_OUTPUT_PRIM)
+ gs->output_primitive = gs->info.properties[i].data[0];
+ else if (gs->info.properties[i].name ==
+ TGSI_PROPERTY_GS_MAX_VERTICES)
+ gs->max_output_vertices = gs->info.properties[i].data[0];
+ }
+
+ gs->machine = draw->gs.machine;
+
+ if (gs)
+ {
+ uint i;
+ for (i = 0; i < gs->info.num_outputs; i++) {
+ if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_POSITION &&
+ gs->info.output_semantic_index[i] == 0)
+ gs->position_output = i;
+ }
+ }
+
+ return gs;
+}
+
+void draw_bind_geometry_shader(struct draw_context *draw,
+ struct draw_geometry_shader *dgs)
+{
+ draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
+
+ if (dgs) {
+ draw->gs.geometry_shader = dgs;
+ draw->gs.num_gs_outputs = dgs->info.num_outputs;
+ draw->gs.position_output = dgs->position_output;
+ draw_geometry_shader_prepare(dgs, draw);
+ }
+ else {
+ draw->gs.geometry_shader = NULL;
+ draw->gs.num_gs_outputs = 0;
+ }
+}
+
+void draw_delete_geometry_shader(struct draw_context *draw,
+ struct draw_geometry_shader *dgs)
+{
+ FREE(dgs);
+}
+
+static INLINE int num_vertices_for_prim(int prim)
+{
+ switch(prim) {
+ case PIPE_PRIM_POINTS:
+ return 1;
+ case PIPE_PRIM_LINES:
+ return 2;
+ case PIPE_PRIM_LINE_LOOP:
+ return 2;
+ case PIPE_PRIM_LINE_STRIP:
+ return 2;
+ case PIPE_PRIM_TRIANGLES:
+ return 3;
+ case PIPE_PRIM_TRIANGLE_STRIP:
+ return 3;
+ case PIPE_PRIM_TRIANGLE_FAN:
+ return 3;
+ case PIPE_PRIM_LINES_ADJACENCY:
+ case PIPE_PRIM_LINE_STRIP_ADJACENCY:
+ return 4;
+ case PIPE_PRIM_TRIANGLES_ADJACENCY:
+ case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
+ return 6;
+ default:
+ assert(!"Bad geometry shader input");
+ return 0;
+ }
+}
+
+static void draw_fetch_geometry_input(struct draw_geometry_shader *shader,
+ int start_primitive,
+ int num_primitives,
+ const float (*input_ptr)[4],
+ unsigned input_vertex_stride,
+ unsigned inputs_from_vs)
+{
+ struct tgsi_exec_machine *machine = shader->machine;
+ unsigned slot, vs_slot, k, j;
+ unsigned num_vertices = num_vertices_for_prim(shader->input_primitive);
+ int idx = 0;
+
+ for (slot = 0, vs_slot = 0; slot < shader->info.num_inputs; slot++) {
+ /*debug_printf("Slot = %d (semantic = %d)\n", slot,
+ shader->info.input_semantic_name[slot]);*/
+ if (shader->info.input_semantic_name[slot] ==
+ TGSI_SEMANTIC_PRIMID) {
+ for (j = 0; j < num_primitives; ++j) {
+ machine->Inputs[idx].xyzw[0].f[j] = (float)start_primitive + j;
+ machine->Inputs[idx].xyzw[1].f[j] = (float)start_primitive + j;
+ machine->Inputs[idx].xyzw[2].f[j] = (float)start_primitive + j;
+ machine->Inputs[idx].xyzw[3].f[j] = (float)start_primitive + j;
+ }
+ ++idx;
+ } else {
+ for (j = 0; j < num_primitives; ++j) {
+ int vidx = idx;
+ const float (*prim_ptr)[4];
+ /*debug_printf(" %d) Prim (num_verts = %d)\n", start_primitive + j,
+ num_vertices);*/
+ prim_ptr = (const float (*)[4])(
+ (const char *)input_ptr +
+ (j * num_vertices * input_vertex_stride));
+
+ for (k = 0; k < num_vertices; ++k, ++vidx) {
+ const float (*input)[4];
+ input = (const float (*)[4])(
+ (const char *)prim_ptr + (k * input_vertex_stride));
+ vidx = k * TGSI_EXEC_MAX_INPUT_ATTRIBS + slot;
+ /*debug_printf("\t%d)(%d) Input vert:\n", vidx, k);*/
+#if 1
+ assert(!util_is_inf_or_nan(input[vs_slot][0]));
+ assert(!util_is_inf_or_nan(input[vs_slot][1]));
+ assert(!util_is_inf_or_nan(input[vs_slot][2]));
+ assert(!util_is_inf_or_nan(input[vs_slot][3]));
+#endif
+ machine->Inputs[vidx].xyzw[0].f[j] = input[vs_slot][0];
+ machine->Inputs[vidx].xyzw[1].f[j] = input[vs_slot][1];
+ machine->Inputs[vidx].xyzw[2].f[j] = input[vs_slot][2];
+ machine->Inputs[vidx].xyzw[3].f[j] = input[vs_slot][3];
+#if 0
+ debug_printf("\t\t%d %f %f %f %f\n", slot,
+ machine->Inputs[vidx].xyzw[0].f[j],
+ machine->Inputs[vidx].xyzw[1].f[j],
+ machine->Inputs[vidx].xyzw[2].f[j],
+ machine->Inputs[vidx].xyzw[3].f[j]);
+#endif
+ }
+ }
+ ++vs_slot;
+ idx += num_vertices;
+ }
+ }
+}
+
+static INLINE void
+draw_geometry_fetch_outputs(struct draw_geometry_shader *shader,
+ int num_primitives,
+ float (*output)[4],
+ unsigned vertex_size)
+{
+ struct tgsi_exec_machine *machine = shader->machine;
+ unsigned prim_idx, j, slot;
+
+ /* Unswizzle all output results.
+ */
+ /* FIXME: handle all the primitives produced by the gs, not just
+ * the first one
+ unsigned prim_count =
+ mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0];*/
+ for (prim_idx = 0; prim_idx < num_primitives; ++prim_idx) {
+ unsigned num_verts_per_prim = machine->Primitives[0];
+ for (j = 0; j < num_verts_per_prim; j++) {
+ int idx = (prim_idx * num_verts_per_prim + j) *
+ shader->info.num_outputs;
+#ifdef DEBUG_OUTPUTS
+ debug_printf("%d) Output vert:\n", idx);
+#endif
+ for (slot = 0; slot < shader->info.num_outputs; slot++) {
+ output[slot][0] = machine->Outputs[idx + slot].xyzw[0].f[prim_idx];
+ output[slot][1] = machine->Outputs[idx + slot].xyzw[1].f[prim_idx];
+ output[slot][2] = machine->Outputs[idx + slot].xyzw[2].f[prim_idx];
+ output[slot][3] = machine->Outputs[idx + slot].xyzw[3].f[prim_idx];
+#ifdef DEBUG_OUTPUTS
+ debug_printf("\t%d: %f %f %f %f\n", slot,
+ output[slot][0],
+ output[slot][1],
+ output[slot][2],
+ output[slot][3]);
+#endif
+ debug_assert(!util_is_inf_or_nan(output[slot][0]));
+ }
+ output = (float (*)[4])((char *)output + vertex_size);
+ }
+ }
+}
+
+void draw_geometry_shader_run(struct draw_geometry_shader *shader,
+ const float (*input)[4],
+ float (*output)[4],
+ const float (*constants)[4],
+ unsigned count,
+ unsigned input_stride,
+ unsigned vertex_size)
+{
+ struct tgsi_exec_machine *machine = shader->machine;
+ unsigned int i;
+ unsigned num_vertices = num_vertices_for_prim(shader->input_primitive);
+ unsigned num_primitives = count/num_vertices;
+ unsigned inputs_from_vs = 0;
+
+ machine->Consts = constants;
+
+ for (i = 0; i < shader->info.num_inputs; ++i) {
+ if (shader->info.input_semantic_name[i] != TGSI_SEMANTIC_PRIMID)
+ ++inputs_from_vs;
+ }
+
+ for (i = 0; i < num_primitives; ++i) {
+ unsigned int max_primitives = 1;
+
+ draw_fetch_geometry_input(shader, i, max_primitives, input,
+ input_stride, inputs_from_vs);
+
+ tgsi_set_exec_mask(machine,
+ 1,
+ max_primitives > 1,
+ max_primitives > 2,
+ max_primitives > 3);
+
+ /* run interpreter */
+ tgsi_exec_machine_run(machine);
+
+ draw_geometry_fetch_outputs(shader, max_primitives,
+ output, vertex_size);
+ }
+}
+
+void draw_geometry_shader_delete(struct draw_geometry_shader *shader)
+{
+ FREE((void*) shader->state.tokens);
+ FREE(shader);
+}
+
+void draw_geometry_shader_prepare(struct draw_geometry_shader *shader,
+ struct draw_context *draw)
+{
+ if (shader->machine->Tokens != shader->state.tokens) {
+ tgsi_exec_machine_bind_shader(shader->machine,
+ shader->state.tokens,
+ draw->gs.num_samplers,
+ draw->gs.samplers);
+ }
+}
diff --git a/src/gallium/auxiliary/draw/draw_gs.h b/src/gallium/auxiliary/draw/draw_gs.h
new file mode 100644
index 0000000000..d6a97d9c4e
--- /dev/null
+++ b/src/gallium/auxiliary/draw/draw_gs.h
@@ -0,0 +1,76 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMWare Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef DRAW_GS_H
+#define DRAW_GS_H
+
+#include "draw_context.h"
+#include "draw_private.h"
+
+
+#define MAX_TGSI_PRIMITIVES 4
+
+struct draw_context;
+
+/**
+ * Private version of the compiled geometry shader
+ */
+struct draw_geometry_shader {
+ struct draw_context *draw;
+
+ struct tgsi_exec_machine *machine;
+
+ /* This member will disappear shortly:*/
+ struct pipe_shader_state state;
+
+ struct tgsi_shader_info info;
+ unsigned position_output;
+
+ unsigned max_output_vertices;
+ unsigned input_primitive;
+ unsigned output_primitive;
+
+ /* Extracted from shader:
+ */
+ const float (*immediates)[4];
+};
+
+void draw_geometry_shader_run(struct draw_geometry_shader *shader,
+ const float (*input)[4],
+ float (*output)[4],
+ const float (*constants)[4],
+ unsigned count,
+ unsigned input_stride,
+ unsigned output_stride);
+
+void draw_geometry_shader_prepare(struct draw_geometry_shader *shader,
+ struct draw_context *draw);
+
+void draw_geometry_shader_delete(struct draw_geometry_shader *shader);
+
+
+#endif
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 9f956715a2..4585dcdb48 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -35,6 +35,8 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
+
+#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -139,29 +141,29 @@ aa_transform_decl(struct tgsi_transform_context *ctx,
struct aa_transform_context *aactx = (struct aa_transform_context *) ctx;
if (decl->Declaration.File == TGSI_FILE_OUTPUT &&
- decl->Semantic.SemanticName == TGSI_SEMANTIC_COLOR &&
- decl->Semantic.SemanticIndex == 0) {
- aactx->colorOutput = decl->DeclarationRange.First;
+ decl->Semantic.Name == TGSI_SEMANTIC_COLOR &&
+ decl->Semantic.Index == 0) {
+ aactx->colorOutput = decl->Range.First;
}
else if (decl->Declaration.File == TGSI_FILE_SAMPLER) {
uint i;
- for (i = decl->DeclarationRange.First;
- i <= decl->DeclarationRange.Last; i++) {
+ for (i = decl->Range.First;
+ i <= decl->Range.Last; i++) {
aactx->samplersUsed |= 1 << i;
}
}
else if (decl->Declaration.File == TGSI_FILE_INPUT) {
- if ((int) decl->DeclarationRange.Last > aactx->maxInput)
- aactx->maxInput = decl->DeclarationRange.Last;
- if (decl->Semantic.SemanticName == TGSI_SEMANTIC_GENERIC &&
- (int) decl->Semantic.SemanticIndex > aactx->maxGeneric) {
- aactx->maxGeneric = decl->Semantic.SemanticIndex;
+ if ((int) decl->Range.Last > aactx->maxInput)
+ aactx->maxInput = decl->Range.Last;
+ if (decl->Semantic.Name == TGSI_SEMANTIC_GENERIC &&
+ (int) decl->Semantic.Index > aactx->maxGeneric) {
+ aactx->maxGeneric = decl->Semantic.Index;
}
}
else if (decl->Declaration.File == TGSI_FILE_TEMPORARY) {
uint i;
- for (i = decl->DeclarationRange.First;
- i <= decl->DeclarationRange.Last; i++) {
+ for (i = decl->Range.First;
+ i <= decl->Range.Last; i++) {
aactx->tempsUsed |= (1 << i);
}
}
@@ -228,30 +230,30 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
/* XXX this could be linear... */
decl.Declaration.Interpolate = TGSI_INTERPOLATE_PERSPECTIVE;
decl.Declaration.Semantic = 1;
- decl.Semantic.SemanticName = TGSI_SEMANTIC_GENERIC;
- decl.Semantic.SemanticIndex = aactx->maxGeneric + 1;
- decl.DeclarationRange.First =
- decl.DeclarationRange.Last = aactx->maxInput + 1;
+ decl.Semantic.Name = TGSI_SEMANTIC_GENERIC;
+ decl.Semantic.Index = aactx->maxGeneric + 1;
+ decl.Range.First =
+ decl.Range.Last = aactx->maxInput + 1;
ctx->emit_declaration(ctx, &decl);
/* declare new sampler */
decl = tgsi_default_full_declaration();
decl.Declaration.File = TGSI_FILE_SAMPLER;
- decl.DeclarationRange.First =
- decl.DeclarationRange.Last = aactx->freeSampler;
+ decl.Range.First =
+ decl.Range.Last = aactx->freeSampler;
ctx->emit_declaration(ctx, &decl);
/* declare new temp regs */
decl = tgsi_default_full_declaration();
decl.Declaration.File = TGSI_FILE_TEMPORARY;
- decl.DeclarationRange.First =
- decl.DeclarationRange.Last = aactx->texTemp;
+ decl.Range.First =
+ decl.Range.Last = aactx->texTemp;
ctx->emit_declaration(ctx, &decl);
decl = tgsi_default_full_declaration();
decl.Declaration.File = TGSI_FILE_TEMPORARY;
- decl.DeclarationRange.First =
- decl.DeclarationRange.Last = aactx->colorTemp;
+ decl.Range.First =
+ decl.Range.Last = aactx->colorTemp;
ctx->emit_declaration(ctx, &decl);
aactx->firstInstruction = FALSE;
@@ -265,14 +267,15 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_TEX;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = aactx->texTemp;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = aactx->texTemp;
newInst.Instruction.NumSrcRegs = 2;
- newInst.InstructionExtTexture.Texture = TGSI_TEXTURE_2D;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_INPUT;
- newInst.FullSrcRegisters[0].SrcRegister.Index = aactx->maxInput + 1;
- newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER;
- newInst.FullSrcRegisters[1].SrcRegister.Index = aactx->freeSampler;
+ newInst.Instruction.Texture = TRUE;
+ newInst.Texture.Texture = TGSI_TEXTURE_2D;
+ newInst.Src[0].Register.File = TGSI_FILE_INPUT;
+ newInst.Src[0].Register.Index = aactx->maxInput + 1;
+ newInst.Src[1].Register.File = TGSI_FILE_SAMPLER;
+ newInst.Src[1].Register.Index = aactx->freeSampler;
ctx->emit_instruction(ctx, &newInst);
@@ -280,26 +283,26 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_MOV;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_OUTPUT;
- newInst.FullDstRegisters[0].DstRegister.Index = aactx->colorOutput;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_XYZ;
+ newInst.Dst[0].Register.File = TGSI_FILE_OUTPUT;
+ newInst.Dst[0].Register.Index = aactx->colorOutput;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_XYZ;
newInst.Instruction.NumSrcRegs = 1;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = aactx->colorTemp;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = aactx->colorTemp;
ctx->emit_instruction(ctx, &newInst);
/* MUL alpha */
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_MUL;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_OUTPUT;
- newInst.FullDstRegisters[0].DstRegister.Index = aactx->colorOutput;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_W;
+ newInst.Dst[0].Register.File = TGSI_FILE_OUTPUT;
+ newInst.Dst[0].Register.Index = aactx->colorOutput;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_W;
newInst.Instruction.NumSrcRegs = 2;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = aactx->colorTemp;
- newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[1].SrcRegister.Index = aactx->texTemp;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = aactx->colorTemp;
+ newInst.Src[1].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[1].Register.Index = aactx->texTemp;
ctx->emit_instruction(ctx, &newInst);
/* END */
@@ -316,11 +319,11 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
uint i;
for (i = 0; i < inst->Instruction.NumDstRegs; i++) {
- struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i];
- if (dst->DstRegister.File == TGSI_FILE_OUTPUT &&
- dst->DstRegister.Index == aactx->colorOutput) {
- dst->DstRegister.File = TGSI_FILE_TEMPORARY;
- dst->DstRegister.Index = aactx->colorTemp;
+ struct tgsi_full_dst_register *dst = &inst->Dst[i];
+ if (dst->Register.File == TGSI_FILE_OUTPUT &&
+ dst->Register.Index == aactx->colorOutput) {
+ dst->Register.File = TGSI_FILE_TEMPORARY;
+ dst->Register.Index = aactx->colorTemp;
}
}
@@ -398,10 +401,9 @@ aaline_create_texture(struct aaline_stage *aaline)
texTemp.target = PIPE_TEXTURE_2D;
texTemp.format = PIPE_FORMAT_A8_UNORM; /* XXX verify supported by driver! */
texTemp.last_level = MAX_TEXTURE_LEVEL;
- texTemp.width[0] = 1 << MAX_TEXTURE_LEVEL;
- texTemp.height[0] = 1 << MAX_TEXTURE_LEVEL;
- texTemp.depth[0] = 1;
- pf_get_block(texTemp.format, &texTemp.block);
+ texTemp.width0 = 1 << MAX_TEXTURE_LEVEL;
+ texTemp.height0 = 1 << MAX_TEXTURE_LEVEL;
+ texTemp.depth0 = 1;
aaline->texture = screen->texture_create(screen, &texTemp);
if (!aaline->texture)
@@ -413,11 +415,11 @@ aaline_create_texture(struct aaline_stage *aaline)
*/
for (level = 0; level <= MAX_TEXTURE_LEVEL; level++) {
struct pipe_transfer *transfer;
- const uint size = aaline->texture->width[level];
+ const uint size = u_minify(aaline->texture->width0, level);
ubyte *data;
uint i, j;
- assert(aaline->texture->width[level] == aaline->texture->height[level]);
+ assert(aaline->texture->width0 == aaline->texture->height0);
/* This texture is new, no need to flush.
*/
@@ -658,13 +660,13 @@ aaline_first_line(struct draw_stage *stage, struct prim_header *header)
}
/* update vertex attrib info */
- aaline->tex_slot = draw->vs.num_vs_outputs;
- aaline->pos_slot = draw->vs.position_output;
+ aaline->tex_slot = draw_current_shader_outputs(draw);
+ aaline->pos_slot = draw_current_shader_position_output(draw);;
/* advertise the extra post-transformed vertex attribute */
- draw->extra_vp_outputs.semantic_name = TGSI_SEMANTIC_GENERIC;
- draw->extra_vp_outputs.semantic_index = aaline->fs->generic_attrib;
- draw->extra_vp_outputs.slot = aaline->tex_slot;
+ draw->extra_shader_outputs.semantic_name = TGSI_SEMANTIC_GENERIC;
+ draw->extra_shader_outputs.semantic_index = aaline->fs->generic_attrib;
+ draw->extra_shader_outputs.slot = aaline->tex_slot;
/* how many samplers? */
/* we'll use sampler/texture[pstip->sampler_unit] for the stipple */
@@ -705,7 +707,7 @@ aaline_flush(struct draw_stage *stage, unsigned flags)
aaline->state.texture);
draw->suspend_flushing = FALSE;
- draw->extra_vp_outputs.slot = 0;
+ draw->extra_shader_outputs.slot = 0;
}
@@ -896,16 +898,16 @@ draw_install_aaline_stage(struct draw_context *draw, struct pipe_context *pipe)
aaline->driver_bind_fs_state = pipe->bind_fs_state;
aaline->driver_delete_fs_state = pipe->delete_fs_state;
- aaline->driver_bind_sampler_states = pipe->bind_sampler_states;
- aaline->driver_set_sampler_textures = pipe->set_sampler_textures;
+ aaline->driver_bind_sampler_states = pipe->bind_fragment_sampler_states;
+ aaline->driver_set_sampler_textures = pipe->set_fragment_sampler_textures;
/* override the driver's functions */
pipe->create_fs_state = aaline_create_fs_state;
pipe->bind_fs_state = aaline_bind_fs_state;
pipe->delete_fs_state = aaline_delete_fs_state;
- pipe->bind_sampler_states = aaline_bind_sampler_states;
- pipe->set_sampler_textures = aaline_set_sampler_textures;
+ pipe->bind_fragment_sampler_states = aaline_bind_sampler_states;
+ pipe->set_fragment_sampler_textures = aaline_set_sampler_textures;
/* Install once everything is known to be OK:
*/
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
index ae1712fe12..d86717e518 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
@@ -131,22 +131,22 @@ aa_transform_decl(struct tgsi_transform_context *ctx,
struct aa_transform_context *aactx = (struct aa_transform_context *) ctx;
if (decl->Declaration.File == TGSI_FILE_OUTPUT &&
- decl->Semantic.SemanticName == TGSI_SEMANTIC_COLOR &&
- decl->Semantic.SemanticIndex == 0) {
- aactx->colorOutput = decl->DeclarationRange.First;
+ decl->Semantic.Name == TGSI_SEMANTIC_COLOR &&
+ decl->Semantic.Index == 0) {
+ aactx->colorOutput = decl->Range.First;
}
else if (decl->Declaration.File == TGSI_FILE_INPUT) {
- if ((int) decl->DeclarationRange.Last > aactx->maxInput)
- aactx->maxInput = decl->DeclarationRange.Last;
- if (decl->Semantic.SemanticName == TGSI_SEMANTIC_GENERIC &&
- (int) decl->Semantic.SemanticIndex > aactx->maxGeneric) {
- aactx->maxGeneric = decl->Semantic.SemanticIndex;
+ if ((int) decl->Range.Last > aactx->maxInput)
+ aactx->maxInput = decl->Range.Last;
+ if (decl->Semantic.Name == TGSI_SEMANTIC_GENERIC &&
+ (int) decl->Semantic.Index > aactx->maxGeneric) {
+ aactx->maxGeneric = decl->Semantic.Index;
}
}
else if (decl->Declaration.File == TGSI_FILE_TEMPORARY) {
uint i;
- for (i = decl->DeclarationRange.First;
- i <= decl->DeclarationRange.Last; i++) {
+ for (i = decl->Range.First;
+ i <= decl->Range.Last; i++) {
aactx->tempsUsed |= (1 << i);
}
}
@@ -198,23 +198,23 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
/* XXX this could be linear... */
decl.Declaration.Interpolate = TGSI_INTERPOLATE_PERSPECTIVE;
decl.Declaration.Semantic = 1;
- decl.Semantic.SemanticName = TGSI_SEMANTIC_GENERIC;
- decl.Semantic.SemanticIndex = aactx->maxGeneric + 1;
- decl.DeclarationRange.First =
- decl.DeclarationRange.Last = texInput;
+ decl.Semantic.Name = TGSI_SEMANTIC_GENERIC;
+ decl.Semantic.Index = aactx->maxGeneric + 1;
+ decl.Range.First =
+ decl.Range.Last = texInput;
ctx->emit_declaration(ctx, &decl);
/* declare new temp regs */
decl = tgsi_default_full_declaration();
decl.Declaration.File = TGSI_FILE_TEMPORARY;
- decl.DeclarationRange.First =
- decl.DeclarationRange.Last = tmp0;
+ decl.Range.First =
+ decl.Range.Last = tmp0;
ctx->emit_declaration(ctx, &decl);
decl = tgsi_default_full_declaration();
decl.Declaration.File = TGSI_FILE_TEMPORARY;
- decl.DeclarationRange.First =
- decl.DeclarationRange.Last = aactx->colorTemp;
+ decl.Range.First =
+ decl.Range.Last = aactx->colorTemp;
ctx->emit_declaration(ctx, &decl);
aactx->firstInstruction = FALSE;
@@ -234,30 +234,30 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_MUL;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = tmp0;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_XY;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = tmp0;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_XY;
newInst.Instruction.NumSrcRegs = 2;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_INPUT;
- newInst.FullSrcRegisters[0].SrcRegister.Index = texInput;
- newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_INPUT;
- newInst.FullSrcRegisters[1].SrcRegister.Index = texInput;
+ newInst.Src[0].Register.File = TGSI_FILE_INPUT;
+ newInst.Src[0].Register.Index = texInput;
+ newInst.Src[1].Register.File = TGSI_FILE_INPUT;
+ newInst.Src[1].Register.Index = texInput;
ctx->emit_instruction(ctx, &newInst);
/* ADD t0.x, t0.x, t0.y; # x^2 + y^2 */
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_ADD;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = tmp0;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = tmp0;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X;
newInst.Instruction.NumSrcRegs = 2;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X;
- newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[1].SrcRegister.Index = tmp0;
- newInst.FullSrcRegisters[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = tmp0;
+ newInst.Src[0].Register.SwizzleX = TGSI_SWIZZLE_X;
+ newInst.Src[1].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[1].Register.Index = tmp0;
+ newInst.Src[1].Register.SwizzleX = TGSI_SWIZZLE_Y;
ctx->emit_instruction(ctx, &newInst);
#if NORMALIZE /* OPTIONAL normalization of length */
@@ -265,24 +265,24 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_RSQ;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = tmp0;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = tmp0;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X;
newInst.Instruction.NumSrcRegs = 1;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = tmp0;
ctx->emit_instruction(ctx, &newInst);
/* RCP t0.x, t0.x; */
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_RCP;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = tmp0;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = tmp0;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X;
newInst.Instruction.NumSrcRegs = 1;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = tmp0;
ctx->emit_instruction(ctx, &newInst);
#endif
@@ -290,16 +290,16 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_SGT;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = tmp0;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_Y;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = tmp0;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Y;
newInst.Instruction.NumSrcRegs = 2;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X;
- newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_INPUT;
- newInst.FullSrcRegisters[1].SrcRegister.Index = texInput;
- newInst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_W;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = tmp0;
+ newInst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_X;
+ newInst.Src[1].Register.File = TGSI_FILE_INPUT;
+ newInst.Src[1].Register.Index = texInput;
+ newInst.Src[1].Register.SwizzleY = TGSI_SWIZZLE_W;
ctx->emit_instruction(ctx, &newInst);
/* KIL -tmp0.yyyy; # if -tmp0.y < 0, KILL */
@@ -307,13 +307,13 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
newInst.Instruction.Opcode = TGSI_OPCODE_KIL;
newInst.Instruction.NumDstRegs = 0;
newInst.Instruction.NumSrcRegs = 1;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Y;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y;
- newInst.FullSrcRegisters[0].SrcRegister.Negate = 1;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = tmp0;
+ newInst.Src[0].Register.SwizzleX = TGSI_SWIZZLE_Y;
+ newInst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_Y;
+ newInst.Src[0].Register.SwizzleZ = TGSI_SWIZZLE_Y;
+ newInst.Src[0].Register.SwizzleW = TGSI_SWIZZLE_Y;
+ newInst.Src[0].Register.Negate = 1;
ctx->emit_instruction(ctx, &newInst);
@@ -323,77 +323,77 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_SUB;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = tmp0;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_Z;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = tmp0;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Z;
newInst.Instruction.NumSrcRegs = 2;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_INPUT;
- newInst.FullSrcRegisters[0].SrcRegister.Index = texInput;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_W;
- newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_INPUT;
- newInst.FullSrcRegisters[1].SrcRegister.Index = texInput;
- newInst.FullSrcRegisters[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Z;
+ newInst.Src[0].Register.File = TGSI_FILE_INPUT;
+ newInst.Src[0].Register.Index = texInput;
+ newInst.Src[0].Register.SwizzleZ = TGSI_SWIZZLE_W;
+ newInst.Src[1].Register.File = TGSI_FILE_INPUT;
+ newInst.Src[1].Register.Index = texInput;
+ newInst.Src[1].Register.SwizzleZ = TGSI_SWIZZLE_Z;
ctx->emit_instruction(ctx, &newInst);
/* RCP t0.z, t0.z; # t0.z = 1 / m */
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_RCP;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = tmp0;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_Z;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = tmp0;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Z;
newInst.Instruction.NumSrcRegs = 1;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Z;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = tmp0;
+ newInst.Src[0].Register.SwizzleX = TGSI_SWIZZLE_Z;
ctx->emit_instruction(ctx, &newInst);
/* SUB t0.y, 1, t0.x; # d = 1 - d */
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_SUB;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = tmp0;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_Y;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = tmp0;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Y;
newInst.Instruction.NumSrcRegs = 2;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_INPUT;
- newInst.FullSrcRegisters[0].SrcRegister.Index = texInput;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_W;
- newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[1].SrcRegister.Index = tmp0;
- newInst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_X;
+ newInst.Src[0].Register.File = TGSI_FILE_INPUT;
+ newInst.Src[0].Register.Index = texInput;
+ newInst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_W;
+ newInst.Src[1].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[1].Register.Index = tmp0;
+ newInst.Src[1].Register.SwizzleY = TGSI_SWIZZLE_X;
ctx->emit_instruction(ctx, &newInst);
/* MUL t0.w, t0.y, t0.z; # coverage = d * m */
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_MUL;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = tmp0;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_W;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = tmp0;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_W;
newInst.Instruction.NumSrcRegs = 2;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y;
- newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[1].SrcRegister.Index = tmp0;
- newInst.FullSrcRegisters[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_Z;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = tmp0;
+ newInst.Src[0].Register.SwizzleW = TGSI_SWIZZLE_Y;
+ newInst.Src[1].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[1].Register.Index = tmp0;
+ newInst.Src[1].Register.SwizzleW = TGSI_SWIZZLE_Z;
ctx->emit_instruction(ctx, &newInst);
/* SLE t0.y, t0.x, tex.z; # bool b = distance <= k */
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_SLE;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = tmp0;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_Y;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = tmp0;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Y;
newInst.Instruction.NumSrcRegs = 2;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X;
- newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_INPUT;
- newInst.FullSrcRegisters[1].SrcRegister.Index = texInput;
- newInst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_Z;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = tmp0;
+ newInst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_X;
+ newInst.Src[1].Register.File = TGSI_FILE_INPUT;
+ newInst.Src[1].Register.Index = texInput;
+ newInst.Src[1].Register.SwizzleY = TGSI_SWIZZLE_Z;
ctx->emit_instruction(ctx, &newInst);
/* CMP t0.w, -t0.y, tex.w, t0.w;
@@ -405,29 +405,29 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_CMP;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = tmp0;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_W;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = tmp0;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_W;
newInst.Instruction.NumSrcRegs = 3;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Y;
- newInst.FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y;
- newInst.FullSrcRegisters[0].SrcRegister.Negate = 1;
- newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_INPUT;
- newInst.FullSrcRegisters[1].SrcRegister.Index = texInput;
- newInst.FullSrcRegisters[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_W;
- newInst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_W;
- newInst.FullSrcRegisters[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_W;
- newInst.FullSrcRegisters[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_W;
- newInst.FullSrcRegisters[2].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[2].SrcRegister.Index = tmp0;
- newInst.FullSrcRegisters[2].SrcRegister.SwizzleX = TGSI_SWIZZLE_W;
- newInst.FullSrcRegisters[2].SrcRegister.SwizzleY = TGSI_SWIZZLE_W;
- newInst.FullSrcRegisters[2].SrcRegister.SwizzleZ = TGSI_SWIZZLE_W;
- newInst.FullSrcRegisters[2].SrcRegister.SwizzleW = TGSI_SWIZZLE_W;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = tmp0;
+ newInst.Src[0].Register.SwizzleX = TGSI_SWIZZLE_Y;
+ newInst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_Y;
+ newInst.Src[0].Register.SwizzleZ = TGSI_SWIZZLE_Y;
+ newInst.Src[0].Register.SwizzleW = TGSI_SWIZZLE_Y;
+ newInst.Src[0].Register.Negate = 1;
+ newInst.Src[1].Register.File = TGSI_FILE_INPUT;
+ newInst.Src[1].Register.Index = texInput;
+ newInst.Src[1].Register.SwizzleX = TGSI_SWIZZLE_W;
+ newInst.Src[1].Register.SwizzleY = TGSI_SWIZZLE_W;
+ newInst.Src[1].Register.SwizzleZ = TGSI_SWIZZLE_W;
+ newInst.Src[1].Register.SwizzleW = TGSI_SWIZZLE_W;
+ newInst.Src[2].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[2].Register.Index = tmp0;
+ newInst.Src[2].Register.SwizzleX = TGSI_SWIZZLE_W;
+ newInst.Src[2].Register.SwizzleY = TGSI_SWIZZLE_W;
+ newInst.Src[2].Register.SwizzleZ = TGSI_SWIZZLE_W;
+ newInst.Src[2].Register.SwizzleW = TGSI_SWIZZLE_W;
ctx->emit_instruction(ctx, &newInst);
}
@@ -439,26 +439,26 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_MOV;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_OUTPUT;
- newInst.FullDstRegisters[0].DstRegister.Index = aactx->colorOutput;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_XYZ;
+ newInst.Dst[0].Register.File = TGSI_FILE_OUTPUT;
+ newInst.Dst[0].Register.Index = aactx->colorOutput;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_XYZ;
newInst.Instruction.NumSrcRegs = 1;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = aactx->colorTemp;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = aactx->colorTemp;
ctx->emit_instruction(ctx, &newInst);
/* MUL result.color.w, colorTemp, tmp0.w; */
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_MUL;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_OUTPUT;
- newInst.FullDstRegisters[0].DstRegister.Index = aactx->colorOutput;
- newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_W;
+ newInst.Dst[0].Register.File = TGSI_FILE_OUTPUT;
+ newInst.Dst[0].Register.Index = aactx->colorOutput;
+ newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_W;
newInst.Instruction.NumSrcRegs = 2;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = aactx->colorTemp;
- newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[1].SrcRegister.Index = aactx->tmp0;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = aactx->colorTemp;
+ newInst.Src[1].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[1].Register.Index = aactx->tmp0;
ctx->emit_instruction(ctx, &newInst);
}
else {
@@ -468,11 +468,11 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
uint i;
for (i = 0; i < inst->Instruction.NumDstRegs; i++) {
- struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i];
- if (dst->DstRegister.File == TGSI_FILE_OUTPUT &&
- dst->DstRegister.Index == aactx->colorOutput) {
- dst->DstRegister.File = TGSI_FILE_TEMPORARY;
- dst->DstRegister.Index = aactx->colorTemp;
+ struct tgsi_full_dst_register *dst = &inst->Dst[i];
+ if (dst->Register.File == TGSI_FILE_OUTPUT &&
+ dst->Register.Index == aactx->colorOutput) {
+ dst->Register.File = TGSI_FILE_TEMPORARY;
+ dst->Register.Index = aactx->colorTemp;
}
}
}
@@ -687,14 +687,14 @@ aapoint_first_point(struct draw_stage *stage, struct prim_header *header)
bind_aapoint_fragment_shader(aapoint);
/* update vertex attrib info */
- aapoint->tex_slot = draw->vs.num_vs_outputs;
+ aapoint->tex_slot = draw_current_shader_outputs(draw);
assert(aapoint->tex_slot > 0); /* output[0] is vertex pos */
- aapoint->pos_slot = draw->vs.position_output;
+ aapoint->pos_slot = draw_current_shader_position_output(draw);
- draw->extra_vp_outputs.semantic_name = TGSI_SEMANTIC_GENERIC;
- draw->extra_vp_outputs.semantic_index = aapoint->fs->generic_attrib;
- draw->extra_vp_outputs.slot = aapoint->tex_slot;
+ draw->extra_shader_outputs.semantic_name = TGSI_SEMANTIC_GENERIC;
+ draw->extra_shader_outputs.semantic_index = aapoint->fs->generic_attrib;
+ draw->extra_shader_outputs.slot = aapoint->tex_slot;
/* find psize slot in post-transform vertex */
aapoint->psize_slot = -1;
@@ -731,7 +731,7 @@ aapoint_flush(struct draw_stage *stage, unsigned flags)
aapoint->driver_bind_fs_state(pipe, aapoint->fs->driver_fs);
draw->suspend_flushing = FALSE;
- draw->extra_vp_outputs.slot = 0;
+ draw->extra_shader_outputs.slot = 0;
}
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index 0670268a19..205cda5eab 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
@@ -114,8 +114,8 @@ static void interp( const struct clipper *clip,
const struct vertex_header *out,
const struct vertex_header *in )
{
- const unsigned nr_attrs = clip->stage.draw->vs.num_vs_outputs;
- const unsigned pos_attr = clip->stage.draw->vs.position_output;
+ const unsigned nr_attrs = draw_current_shader_outputs(clip->stage.draw);
+ const unsigned pos_attr = draw_current_shader_position_output(clip->stage.draw);
unsigned j;
/* Vertex header.
diff --git a/src/gallium/auxiliary/draw/draw_pipe_cull.c b/src/gallium/auxiliary/draw/draw_pipe_cull.c
index 0a70483858..11b39db599 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_cull.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_cull.c
@@ -55,7 +55,7 @@ static INLINE struct cull_stage *cull_stage( struct draw_stage *stage )
static void cull_tri( struct draw_stage *stage,
struct prim_header *header )
{
- const unsigned pos = stage->draw->vs.position_output;
+ const unsigned pos = draw_current_shader_position_output(stage->draw);
/* Window coords: */
const float *v0 = header->v[0]->data[pos];
diff --git a/src/gallium/auxiliary/draw/draw_pipe_offset.c b/src/gallium/auxiliary/draw/draw_pipe_offset.c
index 40798a5d6e..e829492423 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_offset.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_offset.c
@@ -63,7 +63,7 @@ static INLINE struct offset_stage *offset_stage( struct draw_stage *stage )
static void do_offset_tri( struct draw_stage *stage,
struct prim_header *header )
{
- const unsigned pos = stage->draw->vs.position_output;
+ const unsigned pos = draw_current_shader_position_output(stage->draw);
struct offset_stage *offset = offset_stage(stage);
float inv_det = 1.0f / header->det;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index 283502cdf3..0cc2b71864 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -38,6 +38,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
+#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -133,20 +134,20 @@ pstip_transform_decl(struct tgsi_transform_context *ctx,
if (decl->Declaration.File == TGSI_FILE_SAMPLER) {
uint i;
- for (i = decl->DeclarationRange.First;
- i <= decl->DeclarationRange.Last; i++) {
+ for (i = decl->Range.First;
+ i <= decl->Range.Last; i++) {
pctx->samplersUsed |= 1 << i;
}
}
else if (decl->Declaration.File == TGSI_FILE_INPUT) {
- pctx->maxInput = MAX2(pctx->maxInput, (int) decl->DeclarationRange.Last);
- if (decl->Semantic.SemanticName == TGSI_SEMANTIC_POSITION)
- pctx->wincoordInput = (int) decl->DeclarationRange.First;
+ pctx->maxInput = MAX2(pctx->maxInput, (int) decl->Range.Last);
+ if (decl->Semantic.Name == TGSI_SEMANTIC_POSITION)
+ pctx->wincoordInput = (int) decl->Range.First;
}
else if (decl->Declaration.File == TGSI_FILE_TEMPORARY) {
uint i;
- for (i = decl->DeclarationRange.First;
- i <= decl->DeclarationRange.Last; i++) {
+ for (i = decl->Range.First;
+ i <= decl->Range.Last; i++) {
pctx->tempsUsed |= (1 << i);
}
}
@@ -226,25 +227,25 @@ pstip_transform_inst(struct tgsi_transform_context *ctx,
decl.Declaration.File = TGSI_FILE_INPUT;
decl.Declaration.Interpolate = TGSI_INTERPOLATE_LINEAR; /* XXX? */
decl.Declaration.Semantic = 1;
- decl.Semantic.SemanticName = TGSI_SEMANTIC_POSITION;
- decl.Semantic.SemanticIndex = 0;
- decl.DeclarationRange.First =
- decl.DeclarationRange.Last = wincoordInput;
+ decl.Semantic.Name = TGSI_SEMANTIC_POSITION;
+ decl.Semantic.Index = 0;
+ decl.Range.First =
+ decl.Range.Last = wincoordInput;
ctx->emit_declaration(ctx, &decl);
}
/* declare new sampler */
decl = tgsi_default_full_declaration();
decl.Declaration.File = TGSI_FILE_SAMPLER;
- decl.DeclarationRange.First =
- decl.DeclarationRange.Last = pctx->freeSampler;
+ decl.Range.First =
+ decl.Range.Last = pctx->freeSampler;
ctx->emit_declaration(ctx, &decl);
/* declare new temp regs */
decl = tgsi_default_full_declaration();
decl.Declaration.File = TGSI_FILE_TEMPORARY;
- decl.DeclarationRange.First =
- decl.DeclarationRange.Last = pctx->texTemp;
+ decl.Range.First =
+ decl.Range.Last = pctx->texTemp;
ctx->emit_declaration(ctx, &decl);
/* emit immediate = {1/32, 1/32, 1, 1}
@@ -280,27 +281,28 @@ pstip_transform_inst(struct tgsi_transform_context *ctx,
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_MUL;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = pctx->texTemp;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = pctx->texTemp;
newInst.Instruction.NumSrcRegs = 2;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_INPUT;
- newInst.FullSrcRegisters[0].SrcRegister.Index = wincoordInput;
- newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_IMMEDIATE;
- newInst.FullSrcRegisters[1].SrcRegister.Index = pctx->numImmed;
+ newInst.Src[0].Register.File = TGSI_FILE_INPUT;
+ newInst.Src[0].Register.Index = wincoordInput;
+ newInst.Src[1].Register.File = TGSI_FILE_IMMEDIATE;
+ newInst.Src[1].Register.Index = pctx->numImmed;
ctx->emit_instruction(ctx, &newInst);
/* TEX texTemp, texTemp, sampler; */
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_TEX;
newInst.Instruction.NumDstRegs = 1;
- newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullDstRegisters[0].DstRegister.Index = pctx->texTemp;
+ newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Dst[0].Register.Index = pctx->texTemp;
newInst.Instruction.NumSrcRegs = 2;
- newInst.InstructionExtTexture.Texture = TGSI_TEXTURE_2D;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = pctx->texTemp;
- newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER;
- newInst.FullSrcRegisters[1].SrcRegister.Index = pctx->freeSampler;
+ newInst.Instruction.Texture = TRUE;
+ newInst.Texture.Texture = TGSI_TEXTURE_2D;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = pctx->texTemp;
+ newInst.Src[1].Register.File = TGSI_FILE_SAMPLER;
+ newInst.Src[1].Register.Index = pctx->freeSampler;
ctx->emit_instruction(ctx, &newInst);
/* KIL -texTemp; # if -texTemp < 0, KILL fragment */
@@ -308,9 +310,9 @@ pstip_transform_inst(struct tgsi_transform_context *ctx,
newInst.Instruction.Opcode = TGSI_OPCODE_KIL;
newInst.Instruction.NumDstRegs = 0;
newInst.Instruction.NumSrcRegs = 1;
- newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
- newInst.FullSrcRegisters[0].SrcRegister.Index = pctx->texTemp;
- newInst.FullSrcRegisters[0].SrcRegister.Negate = 1;
+ newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ newInst.Src[0].Register.Index = pctx->texTemp;
+ newInst.Src[0].Register.Negate = 1;
ctx->emit_instruction(ctx, &newInst);
}
@@ -427,10 +429,9 @@ pstip_create_texture(struct pstip_stage *pstip)
texTemp.target = PIPE_TEXTURE_2D;
texTemp.format = PIPE_FORMAT_A8_UNORM; /* XXX verify supported by driver! */
texTemp.last_level = 0;
- texTemp.width[0] = 32;
- texTemp.height[0] = 32;
- texTemp.depth[0] = 1;
- pf_get_block(texTemp.format, &texTemp.block);
+ texTemp.width0 = 32;
+ texTemp.height0 = 32;
+ texTemp.depth0 = 1;
pstip->texture = screen->texture_create(screen, &texTemp);
if (pstip->texture == NULL)
@@ -754,8 +755,8 @@ draw_install_pstipple_stage(struct draw_context *draw,
pstip->driver_bind_fs_state = pipe->bind_fs_state;
pstip->driver_delete_fs_state = pipe->delete_fs_state;
- pstip->driver_bind_sampler_states = pipe->bind_sampler_states;
- pstip->driver_set_sampler_textures = pipe->set_sampler_textures;
+ pstip->driver_bind_sampler_states = pipe->bind_fragment_sampler_states;
+ pstip->driver_set_sampler_textures = pipe->set_fragment_sampler_textures;
pstip->driver_set_polygon_stipple = pipe->set_polygon_stipple;
/* override the driver's functions */
@@ -763,8 +764,8 @@ draw_install_pstipple_stage(struct draw_context *draw,
pipe->bind_fs_state = pstip_bind_fs_state;
pipe->delete_fs_state = pstip_delete_fs_state;
- pipe->bind_sampler_states = pstip_bind_sampler_states;
- pipe->set_sampler_textures = pstip_set_sampler_textures;
+ pipe->bind_fragment_sampler_states = pstip_bind_sampler_states;
+ pipe->set_fragment_sampler_textures = pstip_set_sampler_textures;
pipe->set_polygon_stipple = pstip_set_polygon_stipple;
return TRUE;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_stipple.c b/src/gallium/auxiliary/draw/draw_pipe_stipple.c
index 6e921bac27..70fbab9ea7 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_stipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_stipple.c
@@ -73,7 +73,8 @@ screen_interp( struct draw_context *draw,
const struct vertex_header *v1 )
{
uint attr;
- for (attr = 0; attr < draw->vs.num_vs_outputs; attr++) {
+ int num_outputs = draw_current_shader_outputs(draw);
+ for (attr = 0; attr < num_outputs; attr++) {
const float *val0 = v0->data[attr];
const float *val1 = v1->data[attr];
float *newv = dst->data[attr];
@@ -121,7 +122,7 @@ stipple_line(struct draw_stage *stage, struct prim_header *header)
struct stipple_stage *stipple = stipple_stage(stage);
struct vertex_header *v0 = header->v[0];
struct vertex_header *v1 = header->v[1];
- const unsigned pos = stage->draw->vs.position_output;
+ const unsigned pos = draw_current_shader_position_output(stage->draw);
const float *pos0 = v0->data[pos];
const float *pos1 = v1->data[pos];
float start = 0;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
index f32cbef983..3073c87082 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
@@ -59,7 +59,7 @@ static void wideline_line( struct draw_stage *stage,
struct prim_header *header )
{
/*const struct wideline_stage *wide = wideline_stage(stage);*/
- const unsigned pos = stage->draw->vs.position_output;
+ const unsigned pos = draw_current_shader_position_output(stage->draw);
const float half_width = 0.5f * stage->draw->rasterizer->line_width;
struct prim_header tri;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
index 7d76a7dbf3..8dc50c0ab4 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
@@ -112,7 +112,7 @@ static void set_texcoords(const struct widepoint_stage *wide,
if (wide->point_coord_fs_input >= 0) {
/* put gl_PointCoord into the extra vertex slot */
- uint slot = wide->stage.draw->extra_vp_outputs.slot;
+ uint slot = wide->stage.draw->extra_shader_outputs.slot;
v->data[slot][0] = tc[0];
v->data[slot][1] = tc[1];
v->data[slot][2] = 0.0F;
@@ -130,7 +130,7 @@ static void widepoint_point( struct draw_stage *stage,
struct prim_header *header )
{
const struct widepoint_stage *wide = widepoint_stage(stage);
- const unsigned pos = stage->draw->vs.position_output;
+ const unsigned pos = draw_current_shader_position_output(stage->draw);
const boolean sprite = (boolean) stage->draw->rasterizer->point_sprite;
float half_size;
float left_adj, right_adj, bot_adj, top_adj;
@@ -257,13 +257,13 @@ static void widepoint_first_point( struct draw_stage *stage,
wide->point_coord_fs_input = find_pntc_input_attrib(draw);
/* setup extra vp output (point coord implemented as a texcoord) */
- draw->extra_vp_outputs.semantic_name = TGSI_SEMANTIC_GENERIC;
- draw->extra_vp_outputs.semantic_index = 0;
- draw->extra_vp_outputs.slot = draw->vs.num_vs_outputs;
+ draw->extra_shader_outputs.semantic_name = TGSI_SEMANTIC_GENERIC;
+ draw->extra_shader_outputs.semantic_index = 0;
+ draw->extra_shader_outputs.slot = draw_current_shader_outputs(draw);
}
else {
wide->point_coord_fs_input = -1;
- draw->extra_vp_outputs.slot = 0;
+ draw->extra_shader_outputs.slot = 0;
}
wide->psize_slot = -1;
@@ -287,7 +287,7 @@ static void widepoint_flush( struct draw_stage *stage, unsigned flags )
{
stage->point = widepoint_first_point;
stage->next->flush( stage->next, flags );
- stage->draw->extra_vp_outputs.slot = 0;
+ stage->draw->extra_shader_outputs.slot = 0;
}
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 41fcb16a0a..e49041556b 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -142,8 +142,6 @@ struct draw_context
/* user-space vertex data, buffers */
struct {
- const unsigned *edgeflag;
-
/** vertex element/index buffer (ex: glDrawElements) */
const void *elts;
/** bytes per index (0, 1, 2 or 4) */
@@ -154,8 +152,9 @@ struct draw_context
/** vertex arrays */
const void *vbuffer[PIPE_MAX_ATTRIBS];
- /** constant buffer (for vertex shader) */
- const void *constants;
+ /** constant buffer (for vertex/geometry shader) */
+ const void *vs_constants;
+ const void *gs_constants;
} user;
boolean test_fse; /* enable FSE even though its not correct (eg for softpipe) */
@@ -184,6 +183,7 @@ struct draw_context
struct draw_vertex_shader *vertex_shader;
uint num_vs_outputs; /**< convenience, from vertex_shader */
uint position_output;
+ uint edgeflag_output;
/** TGSI program interpreter runtime state */
struct tgsi_exec_machine *machine;
@@ -212,6 +212,18 @@ struct draw_context
struct translate_cache *emit_cache;
} vs;
+ struct {
+ struct draw_geometry_shader *geometry_shader;
+ uint num_gs_outputs; /**< convenience, from geometry_shader */
+ uint position_output;
+
+ /** TGSI program interpreter runtime state */
+ struct tgsi_exec_machine *machine;
+
+ uint num_samplers;
+ struct tgsi_sampler **samplers;
+ } gs;
+
/* Clip derived state:
*/
float plane[12][4];
@@ -223,7 +235,7 @@ struct draw_context
uint semantic_name;
uint semantic_index;
int slot;
- } extra_vp_outputs;
+ } extra_shader_outputs;
unsigned reduced_prim;
@@ -246,6 +258,19 @@ void draw_vs_set_constants( struct draw_context *,
+/*******************************************************************************
+ * Geometry shading code:
+ */
+boolean draw_gs_init( struct draw_context *draw );
+void draw_gs_set_constants( struct draw_context *,
+ const float (*constants)[4],
+ unsigned size );
+
+/*******************************************************************************
+ * Common shading code:
+ */
+int draw_current_shader_outputs(struct draw_context *draw);
+int draw_current_shader_position_output(struct draw_context *draw);
/*******************************************************************************
* Vertex processing (was passthrough) code:
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index dbb5ac7182..2801dbafe4 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -192,7 +192,8 @@ draw_print_arrays(struct draw_context *draw, uint prim, int start, uint count)
prim, start, count);
for (i = 0; i < count; i++) {
- uint ii, j;
+ uint ii = 0;
+ uint j;
if (draw->pt.user.elts) {
/* indexed arrays */
@@ -313,12 +314,3 @@ draw_arrays(struct draw_context *draw, unsigned prim,
/* drawing done here: */
draw_pt_arrays(draw, prim, start, count);
}
-
-boolean draw_pt_get_edgeflag( struct draw_context *draw,
- unsigned idx )
-{
- if (draw->pt.user.edgeflag)
- return (draw->pt.user.edgeflag[idx/32] & (1 << (idx%32))) != 0;
- else
- return 1;
-}
diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h
index 7a17a9fb6b..20edf7a227 100644
--- a/src/gallium/auxiliary/draw/draw_pt.h
+++ b/src/gallium/auxiliary/draw/draw_pt.h
@@ -149,11 +149,6 @@ struct draw_pt_middle_end *draw_pt_middle_fse( struct draw_context *draw );
struct draw_pt_middle_end *draw_pt_fetch_pipeline_or_emit(struct draw_context *draw);
-/* More helpers:
- */
-boolean draw_pt_get_edgeflag( struct draw_context *draw,
- unsigned idx );
-
/*******************************************************************************
* HW vertex emit:
@@ -217,7 +212,8 @@ boolean draw_pt_post_vs_run( struct pt_post_vs *pvs,
void draw_pt_post_vs_prepare( struct pt_post_vs *pvs,
boolean bypass_clipping,
boolean bypass_viewport,
- boolean opengl );
+ boolean opengl,
+ boolean need_edgeflags );
struct pt_post_vs *draw_pt_post_vs_create( struct draw_context *draw );
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c
index 65c3a34c34..305bfef435 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch.c
@@ -42,11 +42,11 @@ struct pt_fetch {
struct translate *translate;
unsigned vertex_size;
- boolean need_edgeflags;
struct translate_cache *cache;
};
+
/* Perform the fetch from API vertex elements & vertex buffers, to a
* contiguous set of float[4] attributes as required for the
* vertex_shader->run_linear() method.
@@ -120,7 +120,12 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch,
fetch->translate = translate_cache_find(fetch->cache, &key);
{
- static struct vertex_header vh = { 0, 1, 0, UNDEFINED_VERTEX_ID, { .0f, .0f, .0f, .0f } };
+ static struct vertex_header vh = { 0,
+ 1,
+ 0,
+ UNDEFINED_VERTEX_ID,
+ { .0f, .0f, .0f, .0f } };
+
fetch->translate->set_buffer(fetch->translate,
draw->pt.nr_vertex_buffers,
&vh,
@@ -128,9 +133,6 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch,
}
}
- fetch->need_edgeflags = ((draw->rasterizer->fill_cw != PIPE_POLYGON_MODE_FILL ||
- draw->rasterizer->fill_ccw != PIPE_POLYGON_MODE_FILL) &&
- draw->pt.user.edgeflag);
}
@@ -158,17 +160,6 @@ void draw_pt_fetch_run( struct pt_fetch *fetch,
count,
verts );
- /* Edgeflags are hard to fit into a translate program, populate
- * them separately if required. In the setup above they are
- * defaulted to one, so only need this if there is reason to change
- * that default:
- */
- if (fetch->need_edgeflags) {
- for (i = 0; i < count; i++) {
- struct vertex_header *vh = (struct vertex_header *)(verts + i * fetch->vertex_size);
- vh->edgeflag = draw_pt_get_edgeflag( draw, elts[i] );
- }
- }
}
@@ -193,18 +184,6 @@ void draw_pt_fetch_run_linear( struct pt_fetch *fetch,
start,
count,
verts );
-
- /* Edgeflags are hard to fit into a translate program, populate
- * them separately if required. In the setup above they are
- * defaulted to one, so only need this if there is reason to change
- * that default:
- */
- if (fetch->need_edgeflags) {
- for (i = 0; i < count; i++) {
- struct vertex_header *vh = (struct vertex_header *)(verts + i * fetch->vertex_size);
- vh->edgeflag = draw_pt_get_edgeflag( draw, start + i );
- }
- }
}
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
index df6c265b7e..1a9df4cac5 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
@@ -32,6 +32,7 @@
#include "draw/draw_vertex.h"
#include "draw/draw_pt.h"
#include "draw/draw_vs.h"
+#include "draw/draw_gs.h"
#include "translate/translate.h"
@@ -85,9 +86,9 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle,
draw_pt_post_vs_prepare( fpme->post_vs,
(boolean)draw->bypass_clipping,
(boolean)(draw->identity_viewport ||
- draw->rasterizer->bypass_vs_clip_and_viewport),
- (boolean)draw->rasterizer->gl_rasterization_rules );
-
+ draw->rasterizer->bypass_vs_clip_and_viewport),
+ (boolean)draw->rasterizer->gl_rasterization_rules,
+ (draw->vs.edgeflag_output ? true : false) );
if (!(opt & PT_PIPELINE)) {
draw_pt_emit_prepare( fpme->emit,
@@ -119,7 +120,8 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle,
{
struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle;
struct draw_context *draw = fpme->draw;
- struct draw_vertex_shader *shader = draw->vs.vertex_shader;
+ struct draw_vertex_shader *vshader = draw->vs.vertex_shader;
+ struct draw_geometry_shader *gshader = draw->gs.geometry_shader;
unsigned opt = fpme->opt;
unsigned alloc_count = align( fetch_count, 4 );
@@ -147,13 +149,21 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle,
*/
if (opt & PT_SHADE)
{
- shader->run_linear(shader,
- (const float (*)[4])pipeline_verts->data,
- ( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.constants,
- fetch_count,
- fpme->vertex_size,
- fpme->vertex_size);
+ vshader->run_linear(vshader,
+ (const float (*)[4])pipeline_verts->data,
+ ( float (*)[4])pipeline_verts->data,
+ (const float (*)[4])draw->pt.user.vs_constants,
+ fetch_count,
+ fpme->vertex_size,
+ fpme->vertex_size);
+ if (gshader)
+ draw_geometry_shader_run(gshader,
+ (const float (*)[4])pipeline_verts->data,
+ ( float (*)[4])pipeline_verts->data,
+ (const float (*)[4])draw->pt.user.gs_constants,
+ fetch_count,
+ fpme->vertex_size,
+ fpme->vertex_size);
}
if (draw_pt_post_vs_run( fpme->post_vs,
@@ -196,6 +206,7 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle,
struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle;
struct draw_context *draw = fpme->draw;
struct draw_vertex_shader *shader = draw->vs.vertex_shader;
+ struct draw_geometry_shader *geometry_shader = draw->gs.geometry_shader;
unsigned opt = fpme->opt;
unsigned alloc_count = align( count, 4 );
@@ -226,10 +237,19 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle,
shader->run_linear(shader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.constants,
+ (const float (*)[4])draw->pt.user.vs_constants,
count,
fpme->vertex_size,
fpme->vertex_size);
+
+ if (geometry_shader)
+ draw_geometry_shader_run(geometry_shader,
+ (const float (*)[4])pipeline_verts->data,
+ ( float (*)[4])pipeline_verts->data,
+ (const float (*)[4])draw->pt.user.gs_constants,
+ count,
+ fpme->vertex_size,
+ fpme->vertex_size);
}
if (draw_pt_post_vs_run( fpme->post_vs,
@@ -270,6 +290,7 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle
struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle;
struct draw_context *draw = fpme->draw;
struct draw_vertex_shader *shader = draw->vs.vertex_shader;
+ struct draw_geometry_shader *geometry_shader = draw->gs.geometry_shader;
unsigned opt = fpme->opt;
unsigned alloc_count = align( count, 4 );
@@ -296,10 +317,19 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle
shader->run_linear(shader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.constants,
+ (const float (*)[4])draw->pt.user.vs_constants,
count,
fpme->vertex_size,
fpme->vertex_size);
+
+ if (geometry_shader)
+ draw_geometry_shader_run(geometry_shader,
+ (const float (*)[4])pipeline_verts->data,
+ ( float (*)[4])pipeline_verts->data,
+ (const float (*)[4])draw->pt.user.gs_constants,
+ count,
+ fpme->vertex_size,
+ fpme->vertex_size);
}
if (draw_pt_post_vs_run( fpme->post_vs,
diff --git a/src/gallium/auxiliary/draw/draw_pt_post_vs.c b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
index 6c1cb48e8b..55151823a1 100644
--- a/src/gallium/auxiliary/draw/draw_pt_post_vs.c
+++ b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
@@ -100,7 +100,7 @@ static boolean post_vs_cliptest_viewport_gl( struct pt_post_vs *pvs,
struct vertex_header *out = vertices;
const float *scale = pvs->draw->viewport.scale;
const float *trans = pvs->draw->viewport.translate;
- const unsigned pos = pvs->draw->vs.position_output;
+ const unsigned pos = draw_current_shader_position_output(pvs->draw);
unsigned clipped = 0;
unsigned j;
@@ -147,6 +147,39 @@ static boolean post_vs_cliptest_viewport_gl( struct pt_post_vs *pvs,
+/* As above plus edgeflags
+ */
+static boolean
+post_vs_cliptest_viewport_gl_edgeflag(struct pt_post_vs *pvs,
+ struct vertex_header *vertices,
+ unsigned count,
+ unsigned stride )
+{
+ unsigned j;
+ boolean needpipe;
+
+ needpipe = post_vs_cliptest_viewport_gl( pvs, vertices, count, stride);
+
+ /* If present, copy edgeflag VS output into vertex header.
+ * Otherwise, leave header as is.
+ */
+ if (pvs->draw->vs.edgeflag_output) {
+ struct vertex_header *out = vertices;
+ int ef = pvs->draw->vs.edgeflag_output;
+
+ for (j = 0; j < count; j++) {
+ const float *edgeflag = out->data[ef];
+ out->edgeflag = !(edgeflag[0] != 1.0f);
+ needpipe |= !out->edgeflag;
+ out = (struct vertex_header *)( (char *)out + stride );
+ }
+ }
+ return needpipe;
+}
+
+
+
+
/* If bypass_clipping is set, skip cliptest and rhw divide.
*/
static boolean post_vs_viewport( struct pt_post_vs *pvs,
@@ -157,7 +190,7 @@ static boolean post_vs_viewport( struct pt_post_vs *pvs,
struct vertex_header *out = vertices;
const float *scale = pvs->draw->viewport.scale;
const float *trans = pvs->draw->viewport.translate;
- const unsigned pos = pvs->draw->vs.position_output;
+ const unsigned pos = draw_current_shader_position_output(pvs->draw);
unsigned j;
if (0) debug_printf("%s\n", __FUNCTION__);
@@ -201,17 +234,29 @@ boolean draw_pt_post_vs_run( struct pt_post_vs *pvs,
void draw_pt_post_vs_prepare( struct pt_post_vs *pvs,
boolean bypass_clipping,
boolean bypass_viewport,
- boolean opengl )
+ boolean opengl,
+ boolean need_edgeflags )
{
- if (bypass_clipping) {
- if (bypass_viewport)
- pvs->run = post_vs_none;
- else
- pvs->run = post_vs_viewport;
+ if (!need_edgeflags) {
+ if (bypass_clipping) {
+ if (bypass_viewport)
+ pvs->run = post_vs_none;
+ else
+ pvs->run = post_vs_viewport;
+ }
+ else {
+ /* if (opengl) */
+ pvs->run = post_vs_cliptest_viewport_gl;
+ }
}
else {
- /* if (opengl) */
- pvs->run = post_vs_cliptest_viewport_gl;
+ /* If we need to copy edgeflags to the vertex header, it should
+ * mean we're running the primitive pipeline. Hence the bypass
+ * flags should be false.
+ */
+ assert(!bypass_clipping);
+ assert(!bypass_viewport);
+ pvs->run = post_vs_cliptest_viewport_gl_edgeflag;
}
}
diff --git a/src/gallium/auxiliary/draw/draw_pt_util.c b/src/gallium/auxiliary/draw/draw_pt_util.c
index b61fa29143..17c3b8cec2 100644
--- a/src/gallium/auxiliary/draw/draw_pt_util.c
+++ b/src/gallium/auxiliary/draw/draw_pt_util.c
@@ -50,16 +50,32 @@ void draw_pt_split_prim(unsigned prim, unsigned *first, unsigned *incr)
*first = 2;
*incr = 1;
break;
+ case PIPE_PRIM_LINES_ADJACENCY:
+ *first = 4;
+ *incr = 2;
+ break;
+ case PIPE_PRIM_LINE_STRIP_ADJACENCY:
+ *first = 4;
+ *incr = 1;
+ break;
case PIPE_PRIM_TRIANGLES:
*first = 3;
*incr = 3;
break;
+ case PIPE_PRIM_TRIANGLES_ADJACENCY:
+ *first = 6;
+ *incr = 3;
+ break;
case PIPE_PRIM_TRIANGLE_STRIP:
case PIPE_PRIM_TRIANGLE_FAN:
case PIPE_PRIM_POLYGON:
*first = 3;
*incr = 1;
break;
+ case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
+ *first = 6;
+ *incr = 1;
+ break;
case PIPE_PRIM_QUADS:
*first = 4;
*incr = 4;
diff --git a/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h b/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h
index 010c7a18a7..f0aec5feba 100644
--- a/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h
+++ b/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h
@@ -36,6 +36,10 @@ static void FUNC(struct draw_pt_front_end *frontend,
case PIPE_PRIM_TRIANGLE_STRIP:
case PIPE_PRIM_QUADS:
case PIPE_PRIM_QUAD_STRIP:
+ case PIPE_PRIM_LINES_ADJACENCY:
+ case PIPE_PRIM_LINE_STRIP_ADJACENCY:
+ case PIPE_PRIM_TRIANGLES_ADJACENCY:
+ case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
for (j = 0; j < count;) {
unsigned remaining = count - j;
unsigned nr = trim( MIN2(varray->driver_fetch_max, remaining), first, incr );
diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c
index 1a0527be63..757c487454 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vcache.c
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c
@@ -346,7 +346,8 @@ vcache_check_run( struct draw_pt_front_end *frontend,
vcache->fetch_max,
draw_count);
- if (max_index == 0xffffffff ||
+ if (max_index >= DRAW_PIPE_MAX_VERTICES ||
+ fetch_count >= UNDEFINED_VERTEX_ID ||
fetch_count > draw_count) {
if (0) debug_printf("fail\n");
goto fail;
@@ -394,6 +395,7 @@ vcache_check_run( struct draw_pt_front_end *frontend,
default:
assert(0);
+ FREE(storage);
return;
}
}
@@ -422,6 +424,7 @@ vcache_check_run( struct draw_pt_front_end *frontend,
default:
assert(0);
+ FREE(storage);
return;
}
}
diff --git a/src/gallium/auxiliary/draw/draw_vs.c b/src/gallium/auxiliary/draw/draw_vs.c
index 790e89ed82..3553689532 100644
--- a/src/gallium/auxiliary/draw/draw_vs.c
+++ b/src/gallium/auxiliary/draw/draw_vs.c
@@ -101,6 +101,9 @@ draw_create_vertex_shader(struct draw_context *draw,
if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_POSITION &&
vs->info.output_semantic_index[i] == 0)
vs->position_output = i;
+ else if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_EDGEFLAG &&
+ vs->info.output_semantic_index[i] == 0)
+ vs->edgeflag_output = i;
}
}
@@ -120,6 +123,7 @@ draw_bind_vertex_shader(struct draw_context *draw,
draw->vs.vertex_shader = dvs;
draw->vs.num_vs_outputs = dvs->info.num_outputs;
draw->vs.position_output = dvs->position_output;
+ draw->vs.edgeflag_output = dvs->edgeflag_output;
dvs->prepare( dvs, draw );
}
else {
diff --git a/src/gallium/auxiliary/draw/draw_vs.h b/src/gallium/auxiliary/draw/draw_vs.h
index 89ae158751..e3b807ebd0 100644
--- a/src/gallium/auxiliary/draw/draw_vs.h
+++ b/src/gallium/auxiliary/draw/draw_vs.h
@@ -107,6 +107,7 @@ struct draw_vertex_shader {
struct tgsi_shader_info info;
unsigned position_output;
+ unsigned edgeflag_output;
/* Extracted from shader:
*/
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c
index 645d7cccba..1aaae4ab7a 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos.c
+++ b/src/gallium/auxiliary/draw/draw_vs_aos.c
@@ -361,8 +361,8 @@ static struct x86_reg aos_get_shader_reg_ptr( struct aos_compilation *cp,
static struct x86_reg get_dst_ptr( struct aos_compilation *cp,
const struct tgsi_full_dst_register *dst )
{
- unsigned file = dst->DstRegister.File;
- unsigned idx = dst->DstRegister.Index;
+ unsigned file = dst->Register.File;
+ unsigned idx = dst->Register.Index;
unsigned i;
@@ -529,27 +529,18 @@ static struct x86_reg fetch_src( struct aos_compilation *cp,
const struct tgsi_full_src_register *src )
{
struct x86_reg arg0 = aos_get_shader_reg(cp,
- src->SrcRegister.File,
- src->SrcRegister.Index);
+ src->Register.File,
+ src->Register.Index);
unsigned i;
ubyte swz = 0;
unsigned negs = 0;
unsigned abs = 0;
for (i = 0; i < 4; i++) {
- unsigned swizzle = tgsi_util_get_full_src_register_extswizzle( src, i );
+ unsigned swizzle = tgsi_util_get_full_src_register_swizzle( src, i );
unsigned neg = tgsi_util_get_full_src_register_sign_mode( src, i );
- switch (swizzle) {
- case TGSI_EXTSWIZZLE_ZERO:
- case TGSI_EXTSWIZZLE_ONE:
- AOS_ERROR(cp, "not supporting full swizzles yet in tgsi_aos_sse2");
- break;
-
- default:
- swz |= (swizzle & 0x3) << (i * 2);
- break;
- }
+ swz |= (swizzle & 0x3) << (i * 2);
switch (neg) {
case TGSI_UTIL_SIGN_TOGGLE:
@@ -629,26 +620,13 @@ static void x87_fld_src( struct aos_compilation *cp,
unsigned channel )
{
struct x86_reg arg0 = aos_get_shader_reg_ptr(cp,
- src->SrcRegister.File,
- src->SrcRegister.Index);
+ src->Register.File,
+ src->Register.Index);
- unsigned swizzle = tgsi_util_get_full_src_register_extswizzle( src, channel );
+ unsigned swizzle = tgsi_util_get_full_src_register_swizzle( src, channel );
unsigned neg = tgsi_util_get_full_src_register_sign_mode( src, channel );
- switch (swizzle) {
- case TGSI_EXTSWIZZLE_ZERO:
- x87_fldz( cp->func );
- break;
-
- case TGSI_EXTSWIZZLE_ONE:
- x87_fld1( cp->func );
- break;
-
- default:
- x87_fld( cp->func, x86_make_disp(arg0, (swizzle & 3) * sizeof(float)) );
- break;
- }
-
+ x87_fld( cp->func, x86_make_disp(arg0, (swizzle & 3) * sizeof(float)) );
switch (neg) {
case TGSI_UTIL_SIGN_TOGGLE:
@@ -691,15 +669,15 @@ static void store_dest( struct aos_compilation *cp,
{
struct x86_reg dst;
- switch (reg->DstRegister.WriteMask) {
+ switch (reg->Register.WriteMask) {
case 0:
return;
case TGSI_WRITEMASK_XYZW:
aos_adopt_xmm_reg(cp,
get_xmm_writable(cp, result),
- reg->DstRegister.File,
- reg->DstRegister.Index,
+ reg->Register.File,
+ reg->Register.Index,
TRUE);
return;
default:
@@ -707,10 +685,10 @@ static void store_dest( struct aos_compilation *cp,
}
dst = aos_get_shader_reg_xmm(cp,
- reg->DstRegister.File,
- reg->DstRegister.Index);
+ reg->Register.File,
+ reg->Register.Index);
- switch (reg->DstRegister.WriteMask) {
+ switch (reg->Register.WriteMask) {
case TGSI_WRITEMASK_X:
sse_movss(cp->func, dst, get_xmm(cp, result));
break;
@@ -732,14 +710,14 @@ static void store_dest( struct aos_compilation *cp,
break;
default:
- mask_write(cp, dst, result, reg->DstRegister.WriteMask);
+ mask_write(cp, dst, result, reg->Register.WriteMask);
break;
}
aos_adopt_xmm_reg(cp,
dst,
- reg->DstRegister.File,
- reg->DstRegister.Index,
+ reg->Register.File,
+ reg->Register.Index,
TRUE);
}
@@ -759,7 +737,7 @@ static void store_scalar_dest( struct aos_compilation *cp,
const struct tgsi_full_dst_register *reg,
struct x86_reg result )
{
- unsigned writemask = reg->DstRegister.WriteMask;
+ unsigned writemask = reg->Register.WriteMask;
struct x86_reg dst;
if (writemask != TGSI_WRITEMASK_X &&
@@ -776,12 +754,12 @@ static void store_scalar_dest( struct aos_compilation *cp,
result = get_xmm(cp, result);
dst = aos_get_shader_reg_xmm(cp,
- reg->DstRegister.File,
- reg->DstRegister.Index);
+ reg->Register.File,
+ reg->Register.Index);
- switch (reg->DstRegister.WriteMask) {
+ switch (reg->Register.WriteMask) {
case TGSI_WRITEMASK_X:
sse_movss(cp->func, dst, result);
break;
@@ -804,8 +782,8 @@ static void store_scalar_dest( struct aos_compilation *cp,
aos_adopt_xmm_reg(cp,
dst,
- reg->DstRegister.File,
- reg->DstRegister.Index,
+ reg->Register.File,
+ reg->Register.Index,
TRUE);
}
@@ -841,7 +819,7 @@ static void x87_fstp_dest4( struct aos_compilation *cp,
const struct tgsi_full_dst_register *dst )
{
struct x86_reg ptr = get_dst_ptr(cp, dst);
- unsigned writemask = dst->DstRegister.WriteMask;
+ unsigned writemask = dst->Register.WriteMask;
x87_fst_or_nop(cp->func, writemask, 0, ptr);
x87_fst_or_nop(cp->func, writemask, 1, ptr);
@@ -978,7 +956,7 @@ static void emit_print( struct aos_compilation *cp,
static boolean emit_ABS( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
struct x86_reg neg = aos_get_internal(cp, IMM_NEGS);
struct x86_reg tmp = aos_get_xmm_reg(cp);
@@ -986,27 +964,27 @@ static boolean emit_ABS( struct aos_compilation *cp, const struct tgsi_full_inst
sse_mulps(cp->func, tmp, neg);
sse_maxps(cp->func, tmp, arg0);
- store_dest(cp, &op->FullDstRegisters[0], tmp);
+ store_dest(cp, &op->Dst[0], tmp);
return TRUE;
}
static boolean emit_ADD( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
- struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
+ struct x86_reg arg1 = fetch_src(cp, &op->Src[1]);
struct x86_reg dst = get_xmm_writable(cp, arg0);
sse_addps(cp->func, dst, arg1);
- store_dest(cp, &op->FullDstRegisters[0], dst);
+ store_dest(cp, &op->Dst[0], dst);
return TRUE;
}
static boolean emit_COS( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- x87_fld_src(cp, &op->FullSrcRegisters[0], 0);
+ x87_fld_src(cp, &op->Src[0], 0);
x87_fcos(cp->func);
- x87_fstp_dest4(cp, &op->FullDstRegisters[0]);
+ x87_fstp_dest4(cp, &op->Dst[0]);
return TRUE;
}
@@ -1015,8 +993,8 @@ static boolean emit_COS( struct aos_compilation *cp, const struct tgsi_full_inst
*/
static boolean emit_DP3( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
- struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
+ struct x86_reg arg1 = fetch_src(cp, &op->Src[1]);
struct x86_reg tmp = aos_get_xmm_reg(cp);
struct x86_reg dst = get_xmm_writable(cp, arg0);
@@ -1029,14 +1007,14 @@ static boolean emit_DP3( struct aos_compilation *cp, const struct tgsi_full_inst
sse_addss(cp->func, dst, tmp);
aos_release_xmm_reg(cp, tmp.idx);
- store_scalar_dest(cp, &op->FullDstRegisters[0], dst);
+ store_scalar_dest(cp, &op->Dst[0], dst);
return TRUE;
}
static boolean emit_DP4( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
- struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
+ struct x86_reg arg1 = fetch_src(cp, &op->Src[1]);
struct x86_reg tmp = aos_get_xmm_reg(cp);
struct x86_reg dst = get_xmm_writable(cp, arg0);
@@ -1050,14 +1028,14 @@ static boolean emit_DP4( struct aos_compilation *cp, const struct tgsi_full_inst
sse_addss(cp->func, dst, tmp);
aos_release_xmm_reg(cp, tmp.idx);
- store_scalar_dest(cp, &op->FullDstRegisters[0], dst);
+ store_scalar_dest(cp, &op->Dst[0], dst);
return TRUE;
}
static boolean emit_DPH( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
- struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
+ struct x86_reg arg1 = fetch_src(cp, &op->Src[1]);
struct x86_reg tmp = aos_get_xmm_reg(cp);
struct x86_reg dst = get_xmm_writable(cp, arg0);
@@ -1073,14 +1051,14 @@ static boolean emit_DPH( struct aos_compilation *cp, const struct tgsi_full_inst
sse_addss(cp->func, dst, tmp);
aos_release_xmm_reg(cp, tmp.idx);
- store_scalar_dest(cp, &op->FullDstRegisters[0], dst);
+ store_scalar_dest(cp, &op->Dst[0], dst);
return TRUE;
}
static boolean emit_DST( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
- struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
+ struct x86_reg arg1 = fetch_src(cp, &op->Src[1]);
struct x86_reg dst = aos_get_xmm_reg(cp);
struct x86_reg tmp = aos_get_xmm_reg(cp);
struct x86_reg ones = aos_get_internal(cp, IMM_ONES);
@@ -1095,25 +1073,25 @@ static boolean emit_DST( struct aos_compilation *cp, const struct tgsi_full_inst
sse_mulps(cp->func, dst, tmp);
aos_release_xmm_reg(cp, tmp.idx);
- store_dest(cp, &op->FullDstRegisters[0], dst);
+ store_dest(cp, &op->Dst[0], dst);
return TRUE;
}
static boolean emit_LG2( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
x87_fld1(cp->func); /* 1 */
- x87_fld_src(cp, &op->FullSrcRegisters[0], 0); /* a0 1 */
+ x87_fld_src(cp, &op->Src[0], 0); /* a0 1 */
x87_fyl2x(cp->func); /* log2(a0) */
- x87_fstp_dest4(cp, &op->FullDstRegisters[0]);
+ x87_fstp_dest4(cp, &op->Dst[0]);
return TRUE;
}
#if 0
static boolean emit_EX2( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- x87_fld_src(cp, &op->FullSrcRegisters[0], 0);
+ x87_fld_src(cp, &op->Src[0], 0);
x87_emit_ex2(cp);
- x87_fstp_dest4(cp, &op->FullDstRegisters[0]);
+ x87_fstp_dest4(cp, &op->Dst[0]);
return TRUE;
}
#endif
@@ -1121,8 +1099,8 @@ static boolean emit_EX2( struct aos_compilation *cp, const struct tgsi_full_inst
static boolean emit_FLR( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg dst = get_dst_ptr(cp, &op->FullDstRegisters[0]);
- unsigned writemask = op->FullDstRegisters[0].DstRegister.WriteMask;
+ struct x86_reg dst = get_dst_ptr(cp, &op->Dst[0]);
+ unsigned writemask = op->Dst[0].Register.WriteMask;
int i;
set_fpu_round_neg_inf( cp );
@@ -1131,7 +1109,7 @@ static boolean emit_FLR( struct aos_compilation *cp, const struct tgsi_full_inst
*/
for (i = 3; i >= 0; i--) {
if (writemask & (1<<i)) {
- x87_fld_src(cp, &op->FullSrcRegisters[0], i);
+ x87_fld_src(cp, &op->Src[0], i);
}
}
@@ -1148,8 +1126,8 @@ static boolean emit_FLR( struct aos_compilation *cp, const struct tgsi_full_inst
static boolean emit_RND( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg dst = get_dst_ptr(cp, &op->FullDstRegisters[0]);
- unsigned writemask = op->FullDstRegisters[0].DstRegister.WriteMask;
+ struct x86_reg dst = get_dst_ptr(cp, &op->Dst[0]);
+ unsigned writemask = op->Dst[0].Register.WriteMask;
int i;
set_fpu_round_nearest( cp );
@@ -1158,7 +1136,7 @@ static boolean emit_RND( struct aos_compilation *cp, const struct tgsi_full_inst
*/
for (i = 3; i >= 0; i--) {
if (writemask & (1<<i)) {
- x87_fld_src(cp, &op->FullSrcRegisters[0], i);
+ x87_fld_src(cp, &op->Src[0], i);
}
}
@@ -1175,10 +1153,10 @@ static boolean emit_RND( struct aos_compilation *cp, const struct tgsi_full_inst
static boolean emit_FRC( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg dst = get_dst_ptr(cp, &op->FullDstRegisters[0]);
+ struct x86_reg dst = get_dst_ptr(cp, &op->Dst[0]);
struct x86_reg st0 = x86_make_reg(file_x87, 0);
struct x86_reg st1 = x86_make_reg(file_x87, 1);
- unsigned writemask = op->FullDstRegisters[0].DstRegister.WriteMask;
+ unsigned writemask = op->Dst[0].Register.WriteMask;
int i;
set_fpu_round_neg_inf( cp );
@@ -1188,7 +1166,7 @@ static boolean emit_FRC( struct aos_compilation *cp, const struct tgsi_full_inst
*/
for (i = 3; i >= 0; i--) {
if (writemask & (1<<i)) {
- x87_fld_src(cp, &op->FullSrcRegisters[0], i);
+ x87_fld_src(cp, &op->Src[0], i);
}
}
@@ -1212,7 +1190,7 @@ static boolean emit_FRC( struct aos_compilation *cp, const struct tgsi_full_inst
static boolean emit_LIT( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
struct x86_reg ecx = x86_make_reg( file_REG32, reg_CX );
- unsigned writemask = op->FullDstRegisters[0].DstRegister.WriteMask;
+ unsigned writemask = op->Dst[0].Register.WriteMask;
unsigned lit_count = cp->lit_count++;
struct x86_reg result, arg0;
unsigned i;
@@ -1231,10 +1209,10 @@ static boolean emit_LIT( struct aos_compilation *cp, const struct tgsi_full_inst
if (writemask != TGSI_WRITEMASK_XYZW)
result = x86_make_disp(cp->machine_EDX, Offset(struct aos_machine, tmp[0]));
else
- result = get_dst_ptr(cp, &op->FullDstRegisters[0]);
+ result = get_dst_ptr(cp, &op->Dst[0]);
- arg0 = fetch_src( cp, &op->FullSrcRegisters[0] );
+ arg0 = fetch_src( cp, &op->Src[0] );
if (arg0.file == file_XMM) {
struct x86_reg tmp = x86_make_disp(cp->machine_EDX,
Offset(struct aos_machine, tmp[1]));
@@ -1281,7 +1259,7 @@ static boolean emit_LIT( struct aos_compilation *cp, const struct tgsi_full_inst
if (writemask != TGSI_WRITEMASK_XYZW) {
store_dest( cp,
- &op->FullDstRegisters[0],
+ &op->Dst[0],
get_xmm_writable( cp, result ) );
}
@@ -1291,8 +1269,8 @@ static boolean emit_LIT( struct aos_compilation *cp, const struct tgsi_full_inst
#if 0
static boolean emit_inline_LIT( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg dst = get_dst_ptr(cp, &op->FullDstRegisters[0]);
- unsigned writemask = op->FullDstRegisters[0].DstRegister.WriteMask;
+ struct x86_reg dst = get_dst_ptr(cp, &op->Dst[0]);
+ unsigned writemask = op->Dst[0].Register.WriteMask;
if (writemask & TGSI_WRITEMASK_YZ) {
struct x86_reg st1 = x86_make_reg(file_x87, 1);
@@ -1308,13 +1286,13 @@ static boolean emit_inline_LIT( struct aos_compilation *cp, const struct tgsi_fu
*/
x87_fldz(cp->func); /* 1 0 */
#endif
- x87_fld_src(cp, &op->FullSrcRegisters[0], 1); /* a1 1 0 */
+ x87_fld_src(cp, &op->Src[0], 1); /* a1 1 0 */
x87_fcomi(cp->func, st2); /* a1 1 0 */
x87_fcmovb(cp->func, st1); /* a1' 1 0 */
x87_fstp(cp->func, st1); /* a1' 0 */
x87_fstp(cp->func, st1); /* a1' */
- x87_fld_src(cp, &op->FullSrcRegisters[0], 3); /* a3 a1' */
+ x87_fld_src(cp, &op->Src[0], 3); /* a3 a1' */
x87_fxch(cp->func, st1); /* a1' a3 */
@@ -1327,7 +1305,7 @@ static boolean emit_inline_LIT( struct aos_compilation *cp, const struct tgsi_fu
/* a0' = max2(a0, 0):
*/
x87_fldz(cp->func); /* 0 r2 */
- x87_fld_src(cp, &op->FullSrcRegisters[0], 0); /* a0 0 r2 */
+ x87_fld_src(cp, &op->Src[0], 0); /* a0 0 r2 */
x87_fcomi(cp->func, st1);
x87_fcmovb(cp->func, st1); /* a0' 0 r2 */
@@ -1355,58 +1333,58 @@ static boolean emit_inline_LIT( struct aos_compilation *cp, const struct tgsi_fu
static boolean emit_MAX( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
- struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
+ struct x86_reg arg1 = fetch_src(cp, &op->Src[1]);
struct x86_reg dst = get_xmm_writable(cp, arg0);
sse_maxps(cp->func, dst, arg1);
- store_dest(cp, &op->FullDstRegisters[0], dst);
+ store_dest(cp, &op->Dst[0], dst);
return TRUE;
}
static boolean emit_MIN( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
- struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
+ struct x86_reg arg1 = fetch_src(cp, &op->Src[1]);
struct x86_reg dst = get_xmm_writable(cp, arg0);
sse_minps(cp->func, dst, arg1);
- store_dest(cp, &op->FullDstRegisters[0], dst);
+ store_dest(cp, &op->Dst[0], dst);
return TRUE;
}
static boolean emit_MOV( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
struct x86_reg dst = get_xmm_writable(cp, arg0);
/* potentially nothing to do */
- store_dest(cp, &op->FullDstRegisters[0], dst);
+ store_dest(cp, &op->Dst[0], dst);
return TRUE;
}
static boolean emit_MUL( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
- struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
+ struct x86_reg arg1 = fetch_src(cp, &op->Src[1]);
struct x86_reg dst = get_xmm_writable(cp, arg0);
sse_mulps(cp->func, dst, arg1);
- store_dest(cp, &op->FullDstRegisters[0], dst);
+ store_dest(cp, &op->Dst[0], dst);
return TRUE;
}
static boolean emit_MAD( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
- struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]);
- struct x86_reg arg2 = fetch_src(cp, &op->FullSrcRegisters[2]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
+ struct x86_reg arg1 = fetch_src(cp, &op->Src[1]);
+ struct x86_reg arg2 = fetch_src(cp, &op->Src[2]);
/* If we can't clobber old contents of arg0, get a temporary & copy
* it there, then clobber it...
@@ -1415,7 +1393,7 @@ static boolean emit_MAD( struct aos_compilation *cp, const struct tgsi_full_inst
sse_mulps(cp->func, arg0, arg1);
sse_addps(cp->func, arg0, arg2);
- store_dest(cp, &op->FullDstRegisters[0], arg0);
+ store_dest(cp, &op->Dst[0], arg0);
return TRUE;
}
@@ -1447,13 +1425,13 @@ static float PIPE_CDECL _exp2(float x)
static boolean emit_POW( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
#if 0
- x87_fld_src(cp, &op->FullSrcRegisters[1], 0); /* a1.x */
- x87_fld_src(cp, &op->FullSrcRegisters[0], 0); /* a0.x a1.x */
+ x87_fld_src(cp, &op->Src[1], 0); /* a1.x */
+ x87_fld_src(cp, &op->Src[0], 0); /* a0.x a1.x */
x87_fyl2x(cp->func); /* a1*log2(a0) */
x87_emit_ex2( cp ); /* 2^(a1*log2(a0)) */
- x87_fstp_dest4(cp, &op->FullDstRegisters[0]);
+ x87_fstp_dest4(cp, &op->Dst[0]);
#else
uint i;
@@ -1472,9 +1450,9 @@ static boolean emit_POW( struct aos_compilation *cp, const struct tgsi_full_inst
x86_lea( cp->func, cp->stack_ESP, x86_make_disp(cp->stack_ESP, -8) );
- x87_fld_src( cp, &op->FullSrcRegisters[1], 0 );
+ x87_fld_src( cp, &op->Src[1], 0 );
x87_fstp( cp->func, x86_make_disp( cp->stack_ESP, 4 ) );
- x87_fld_src( cp, &op->FullSrcRegisters[0], 0 );
+ x87_fld_src( cp, &op->Src[0], 0 );
x87_fstp( cp->func, x86_make_disp( cp->stack_ESP, 0 ) );
/* tmp_EAX has been pushed & will be restored below */
@@ -1489,7 +1467,7 @@ static boolean emit_POW( struct aos_compilation *cp, const struct tgsi_full_inst
*/
cp->func->x87_stack++;
- x87_fstp_dest4( cp, &op->FullDstRegisters[0] );
+ x87_fstp_dest4( cp, &op->Dst[0] );
#endif
return TRUE;
}
@@ -1515,7 +1493,7 @@ static boolean emit_EXPBASE2( struct aos_compilation *cp, const struct tgsi_full
x86_lea( cp->func, cp->stack_ESP, x86_make_disp(cp->stack_ESP, -4) );
- x87_fld_src( cp, &op->FullSrcRegisters[0], 0 );
+ x87_fld_src( cp, &op->Src[0], 0 );
x87_fstp( cp->func, x86_make_disp( cp->stack_ESP, 0 ) );
/* tmp_EAX has been pushed & will be restored below */
@@ -1530,7 +1508,7 @@ static boolean emit_EXPBASE2( struct aos_compilation *cp, const struct tgsi_full
*/
cp->func->x87_stack++;
- x87_fstp_dest4( cp, &op->FullDstRegisters[0] );
+ x87_fstp_dest4( cp, &op->Dst[0] );
return TRUE;
}
@@ -1539,7 +1517,7 @@ static boolean emit_EXPBASE2( struct aos_compilation *cp, const struct tgsi_full
static boolean emit_RCP( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
struct x86_reg dst = aos_get_xmm_reg(cp);
if (cp->have_sse2) {
@@ -1553,7 +1531,7 @@ static boolean emit_RCP( struct aos_compilation *cp, const struct tgsi_full_inst
sse_divss(cp->func, dst, arg0);
}
- store_scalar_dest(cp, &op->FullDstRegisters[0], dst);
+ store_scalar_dest(cp, &op->Dst[0], dst);
return TRUE;
}
@@ -1573,14 +1551,14 @@ static boolean emit_RCP( struct aos_compilation *cp, const struct tgsi_full_inst
static boolean emit_RSQ( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
if (0) {
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
struct x86_reg r = aos_get_xmm_reg(cp);
sse_rsqrtss(cp->func, r, arg0);
- store_scalar_dest(cp, &op->FullDstRegisters[0], r);
+ store_scalar_dest(cp, &op->Dst[0], r);
return TRUE;
}
else {
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
struct x86_reg r = aos_get_xmm_reg(cp);
struct x86_reg neg_half = get_reg_ptr( cp, AOS_FILE_INTERNAL, IMM_RSQ );
@@ -1600,7 +1578,7 @@ static boolean emit_RSQ( struct aos_compilation *cp, const struct tgsi_full_inst
sse_addss( cp->func, tmp, one_point_five ); /* 1.5 - .5 * a * r * r */
sse_mulss( cp->func, r, tmp ); /* r * (1.5 - .5 * a * r * r) */
- store_scalar_dest(cp, &op->FullDstRegisters[0], r);
+ store_scalar_dest(cp, &op->Dst[0], r);
aos_release_xmm_reg(cp, tmp.idx);
@@ -1611,23 +1589,23 @@ static boolean emit_RSQ( struct aos_compilation *cp, const struct tgsi_full_inst
static boolean emit_SGE( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
- struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
+ struct x86_reg arg1 = fetch_src(cp, &op->Src[1]);
struct x86_reg ones = aos_get_internal(cp, IMM_ONES);
struct x86_reg dst = get_xmm_writable(cp, arg0);
sse_cmpps(cp->func, dst, arg1, cc_NotLessThan);
sse_andps(cp->func, dst, ones);
- store_dest(cp, &op->FullDstRegisters[0], dst);
+ store_dest(cp, &op->Dst[0], dst);
return TRUE;
}
static boolean emit_SIN( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- x87_fld_src(cp, &op->FullSrcRegisters[0], 0);
+ x87_fld_src(cp, &op->Src[0], 0);
x87_fsin(cp->func);
- x87_fstp_dest4(cp, &op->FullDstRegisters[0]);
+ x87_fstp_dest4(cp, &op->Dst[0]);
return TRUE;
}
@@ -1635,46 +1613,46 @@ static boolean emit_SIN( struct aos_compilation *cp, const struct tgsi_full_inst
static boolean emit_SLT( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
- struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
+ struct x86_reg arg1 = fetch_src(cp, &op->Src[1]);
struct x86_reg ones = aos_get_internal(cp, IMM_ONES);
struct x86_reg dst = get_xmm_writable(cp, arg0);
sse_cmpps(cp->func, dst, arg1, cc_LessThan);
sse_andps(cp->func, dst, ones);
- store_dest(cp, &op->FullDstRegisters[0], dst);
+ store_dest(cp, &op->Dst[0], dst);
return TRUE;
}
static boolean emit_SUB( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
- struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
+ struct x86_reg arg1 = fetch_src(cp, &op->Src[1]);
struct x86_reg dst = get_xmm_writable(cp, arg0);
sse_subps(cp->func, dst, arg1);
- store_dest(cp, &op->FullDstRegisters[0], dst);
+ store_dest(cp, &op->Dst[0], dst);
return TRUE;
}
static boolean emit_TRUNC( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
struct x86_reg tmp0 = aos_get_xmm_reg(cp);
sse2_cvttps2dq(cp->func, tmp0, arg0);
sse2_cvtdq2ps(cp->func, tmp0, tmp0);
- store_dest(cp, &op->FullDstRegisters[0], tmp0);
+ store_dest(cp, &op->Dst[0], tmp0);
return TRUE;
}
static boolean emit_XPD( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
- struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
- struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]);
+ struct x86_reg arg0 = fetch_src(cp, &op->Src[0]);
+ struct x86_reg arg1 = fetch_src(cp, &op->Src[1]);
struct x86_reg tmp0 = aos_get_xmm_reg(cp);
struct x86_reg tmp1 = aos_get_xmm_reg(cp);
@@ -1692,7 +1670,7 @@ static boolean emit_XPD( struct aos_compilation *cp, const struct tgsi_full_inst
aos_release_xmm_reg(cp, tmp0.idx);
- store_dest(cp, &op->FullDstRegisters[0], tmp1);
+ store_dest(cp, &op->Dst[0], tmp1);
return TRUE;
}
@@ -1919,10 +1897,10 @@ static void find_last_write_outputs( struct aos_compilation *cp )
continue;
for (i = 0; i < TGSI_FULL_MAX_DST_REGISTERS; i++) {
- if (parse.FullToken.FullInstruction.FullDstRegisters[i].DstRegister.File ==
+ if (parse.FullToken.FullInstruction.Dst[i].Register.File ==
TGSI_FILE_OUTPUT)
{
- unsigned idx = parse.FullToken.FullInstruction.FullDstRegisters[i].DstRegister.Index;
+ unsigned idx = parse.FullToken.FullInstruction.Dst[i].Register.Index;
cp->output_last_write[idx] = this_instruction;
}
}
diff --git a/src/gallium/auxiliary/draw/draw_vs_varient.c b/src/gallium/auxiliary/draw/draw_vs_varient.c
index 7ee567d478..d16692584e 100644
--- a/src/gallium/auxiliary/draw/draw_vs_varient.c
+++ b/src/gallium/auxiliary/draw/draw_vs_varient.c
@@ -147,11 +147,12 @@ static void PIPE_CDECL vsvg_run_elts( struct draw_vs_varient *varient,
vsvg->base.vs->run_linear( vsvg->base.vs,
temp_buffer,
temp_buffer,
- (const float (*)[4])vsvg->base.vs->draw->pt.user.constants,
+ (const float (*)[4])vsvg->base.vs->draw->pt.user.vs_constants,
count,
temp_vertex_stride,
temp_vertex_stride);
+ /* FIXME: geometry shading? */
if (vsvg->base.key.clip) {
/* not really handling clipping, just do the rhw so we can
@@ -207,7 +208,7 @@ static void PIPE_CDECL vsvg_run_linear( struct draw_vs_varient *varient,
vsvg->base.vs->run_linear( vsvg->base.vs,
temp_buffer,
temp_buffer,
- (const float (*)[4])vsvg->base.vs->draw->pt.user.constants,
+ (const float (*)[4])vsvg->base.vs->draw->pt.user.vs_constants,
count,
temp_vertex_stride,
temp_vertex_stride);