summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2010-06-16 05:25:20 -0400
committerZack Rusin <zackr@vmware.com>2010-06-16 05:33:46 -0400
commit9829ec2ad8cf74c6dbc7d8afbf36ddd5c5210d74 (patch)
tree2d8bd899db2e768e64f42694271c11117854f919 /src
parent88308ea1730df07beadd81cbce942a3aecb5d873 (diff)
graw: add a gs test for non-sequential inputs
Diffstat (limited to 'src')
-rw-r--r--src/gallium/tests/graw/geometry-shader/mov-non-seq.txt23
-rw-r--r--src/gallium/tests/graw/gs-test.c39
2 files changed, 52 insertions, 10 deletions
diff --git a/src/gallium/tests/graw/geometry-shader/mov-non-seq.txt b/src/gallium/tests/graw/geometry-shader/mov-non-seq.txt
new file mode 100644
index 0000000000..e0f65748ec
--- /dev/null
+++ b/src/gallium/tests/graw/geometry-shader/mov-non-seq.txt
@@ -0,0 +1,23 @@
+GEOM
+PROPERTY GS_INPUT_PRIMITIVE TRIANGLES
+PROPERTY GS_OUTPUT_PRIMITIVE TRIANGLE_STRIP
+DCL IN[][0], POSITION, CONSTANT
+DCL IN[][3], GENERIC[1], CONSTANT
+DCL OUT[0], POSITION, CONSTANT
+DCL OUT[1], COLOR, CONSTANT
+
+MOV OUT[0], IN[0][0]
+MOV OUT[1], IN[0][3]
+EMIT
+
+MOV OUT[0], IN[1][0]
+MOV OUT[1], IN[1][3]
+EMIT
+
+MOV OUT[0], IN[2][0]
+MOV OUT[1], IN[2][3]
+EMIT
+
+ENDPRIM
+
+END
diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c
index 94d6fed7f4..3087d446fc 100644
--- a/src/gallium/tests/graw/gs-test.c
+++ b/src/gallium/tests/graw/gs-test.c
@@ -56,6 +56,7 @@ struct vertex {
float position[4];
float color[4];
float texcoord[4];
+ float generic[4];
};
/* Vertex data matches progs/fp/fp-tri.c, but flipped in Y dimension
@@ -65,34 +66,48 @@ static struct vertex vertices[] =
{
{ { 0.9, 0.9, 0.0, 1.0 },
{ 0, 0, 1, 1 },
- { 1, 1, 0, 1 } },
+ { 1, 1, 0, 1 },
+ { 1, 0, 1, 0 }
+ },
{ { 0.9, -0.9, 0.0, 1.0 },
{ 1, 0, 0, 1 },
- { 1, -1, 0, 1 } },
+ { 1, -1, 0, 1 },
+ { 0, 1, 0, 1 }
+ },
{ {-0.9, 0.0, 0.0, 1.0 },
{ 0, 1, 0, 1 },
- { -1, 0, 0, 1 } },
+ { -1, 0, 0, 1 },
+ { 0, 0, 1, 1 }
+ },
};
static struct vertex vertices_strip[] =
{
{ { 0.9, 0.9, 0.0, 1.0 },
{ 0, 0, 1, 1 },
- { 1, 1, 0, 1 } },
+ { 1, 1, 0, 1 },
+ { 1, 0, 0, 1 }
+ },
{ { 0.9, -0.9, 0.0, 1.0 },
{ 1, 0, 0, 1 },
- { 1, -1, 0, 1 } },
+ { 1, -1, 0, 1 },
+ { 0, 1, 0, 1 }
+ },
{ {-0.9, 0.9, 0.0, 1.0 },
{ 0, 1, 0, 1 },
- { -1, 1, 0, 1 } },
+ { -1, 1, 0, 1 },
+ { 0, 0, 1, 1 }
+ },
{ {-0.9, -0.9, 0.0, 1.0 },
{ 1, 1, 0, 1 },
- { -1, -1, 0, 1 } },
+ { -1, -1, 0, 1 },
+ { 1, 1, 0, 1 }
+ },
};
static float constants1[] =
@@ -214,7 +229,7 @@ static void set_viewport( float x, float y,
static void set_vertices( void )
{
- struct pipe_vertex_element ve[3];
+ struct pipe_vertex_element ve[4];
struct pipe_vertex_buffer vbuf;
void *handle;
@@ -226,11 +241,12 @@ static void set_vertices( void )
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
ve[2].src_offset = Offset(struct vertex, texcoord);
ve[2].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ ve[3].src_offset = Offset(struct vertex, generic);
+ ve[3].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
- handle = ctx->create_vertex_elements_state(ctx, 3, ve);
+ handle = ctx->create_vertex_elements_state(ctx, 4, ve);
ctx->bind_vertex_elements_state(ctx, handle);
-
vbuf.stride = sizeof( struct vertex );
vbuf.buffer_offset = 0;
if (draw_strip) {
@@ -258,12 +274,15 @@ static void set_vertex_shader( void )
"DCL IN[0]\n"
"DCL IN[1]\n"
"DCL IN[2]\n"
+ "DCL IN[3]\n"
"DCL OUT[0], POSITION\n"
"DCL OUT[1], COLOR[0]\n"
"DCL OUT[2], GENERIC[0]\n"
+ "DCL OUT[3], GENERIC[1]\n"
" MOV OUT[0], IN[0]\n"
" MOV OUT[1], IN[1]\n"
" MOV OUT[2], IN[2]\n"
+ " MOV OUT[3], IN[3]\n"
" END\n";
handle = graw_parse_vertex_shader(ctx, text);