summaryrefslogtreecommitdiff
path: root/src/gallium/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/tests')
-rw-r--r--src/gallium/tests/graw/fs-test.c81
-rw-r--r--src/gallium/tests/graw/geometry-shader/mov-cb-2d.txt24
-rw-r--r--src/gallium/tests/graw/geometry-shader/mov.txt2
-rw-r--r--src/gallium/tests/graw/gs-test.c119
-rw-r--r--src/gallium/tests/python/tests/regress/fragment-shader/frag-cb-2d.sh4
-rw-r--r--src/gallium/tests/python/tests/regress/fragment-shader/frag-mad-immx.sh10
-rw-r--r--src/gallium/tests/python/tests/regress/fragment-shader/frag-tempx.sh14
7 files changed, 202 insertions, 52 deletions
diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c
index 3389efb7ca..dea087357d 100644
--- a/src/gallium/tests/graw/fs-test.c
+++ b/src/gallium/tests/graw/fs-test.c
@@ -42,7 +42,8 @@ static const int HEIGHT = 250;
static struct pipe_screen *screen = NULL;
static struct pipe_context *ctx = NULL;
static struct pipe_resource *rttex = NULL;
-static struct pipe_resource *constbuf = NULL;
+static struct pipe_resource *constbuf1 = NULL;
+static struct pipe_resource *constbuf2 = NULL;
static struct pipe_surface *surf = NULL;
static struct pipe_sampler_view *sv = NULL;
static void *sampler = NULL;
@@ -73,7 +74,7 @@ static struct vertex vertices[] =
{ -1, 0, 0, 1 } },
};
-static float constants[] =
+static float constants1[] =
{ 0.4, 0, 0, 1,
1, 1, 1, 1,
2, 2, 2, 2,
@@ -81,7 +82,25 @@ static float constants[] =
3, 0, 0, 0,
0, .5, 0, 0,
- 0, 0, 1, 0,
+ 1, 0, 0, 1,
+ 0, 0, 0, 1,
+
+ 1, 0, 0, 0.5,
+ 0, 1, 0, 0.5,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1,
+};
+
+
+static float constants2[] =
+{ 1, 0, 0, 1,
+ 0, 1, 0, 1,
+ 0, 0, 1, 1,
+ 0, 0, 0, 0,
+
+ 1, 1, 0, 1,
+ 1, .5, 0, 1,
+ 1, 0, 0, 1,
0, 0, 0, 1,
1, 0, 0, 0.5,
@@ -97,34 +116,58 @@ static void init_fs_constbuf( void )
templat.target = PIPE_BUFFER;
templat.format = PIPE_FORMAT_R8_UNORM;
- templat.width0 = sizeof(constants);
+ templat.width0 = sizeof(constants1);
templat.height0 = 1;
templat.depth0 = 1;
templat.last_level = 0;
templat.nr_samples = 1;
templat.bind = PIPE_BIND_CONSTANT_BUFFER;
- constbuf = screen->resource_create(screen,
- &templat);
- if (constbuf == NULL)
+ constbuf1 = screen->resource_create(screen,
+ &templat);
+ if (constbuf1 == NULL)
exit(4);
+ constbuf2 = screen->resource_create(screen,
+ &templat);
+ if (constbuf2 == NULL)
+ exit(4);
- u_box_2d(0,0,sizeof(constants),1, &box);
- ctx->transfer_inline_write(ctx,
- constbuf,
- u_subresource(0,0),
- PIPE_TRANSFER_WRITE,
- &box,
- constants,
- sizeof constants,
- sizeof constants);
+ {
+ u_box_2d(0,0,sizeof(constants1),1, &box);
+
+ ctx->transfer_inline_write(ctx,
+ constbuf1,
+ u_subresource(0,0),
+ PIPE_TRANSFER_WRITE,
+ &box,
+ constants1,
+ sizeof constants1,
+ sizeof constants1);
- ctx->set_constant_buffer(ctx,
- PIPE_SHADER_FRAGMENT, 0,
- constbuf);
+ ctx->set_constant_buffer(ctx,
+ PIPE_SHADER_FRAGMENT, 0,
+ constbuf1);
+ }
+ {
+ u_box_2d(0,0,sizeof(constants2),1, &box);
+
+ ctx->transfer_inline_write(ctx,
+ constbuf2,
+ u_subresource(0,0),
+ PIPE_TRANSFER_WRITE,
+ &box,
+ constants2,
+ sizeof constants2,
+ sizeof constants2);
+
+
+ ctx->set_constant_buffer(ctx,
+ PIPE_SHADER_FRAGMENT, 1,
+ constbuf2);
+ }
}
diff --git a/src/gallium/tests/graw/geometry-shader/mov-cb-2d.txt b/src/gallium/tests/graw/geometry-shader/mov-cb-2d.txt
new file mode 100644
index 0000000000..058acfbcb5
--- /dev/null
+++ b/src/gallium/tests/graw/geometry-shader/mov-cb-2d.txt
@@ -0,0 +1,24 @@
+GEOM
+PROPERTY GS_INPUT_PRIMITIVE TRIANGLES
+PROPERTY GS_OUTPUT_PRIMITIVE TRIANGLE_STRIP
+DCL IN[][0], POSITION, CONSTANT
+DCL IN[][1], COLOR, CONSTANT
+DCL OUT[0], POSITION, CONSTANT
+DCL OUT[1], COLOR, CONSTANT
+DCL CONST[1][0..6]
+
+MOV OUT[0], IN[0][0]
+MOV OUT[1], CONST[1][0]
+EMIT
+
+MOV OUT[0], IN[1][0]
+MOV OUT[1], CONST[1][1]
+EMIT
+
+MOV OUT[0], IN[2][0]
+MOV OUT[1], CONST[1][4]
+EMIT
+
+ENDPRIM
+
+END
diff --git a/src/gallium/tests/graw/geometry-shader/mov.txt b/src/gallium/tests/graw/geometry-shader/mov.txt
index c37051de8a..97150a5da4 100644
--- a/src/gallium/tests/graw/geometry-shader/mov.txt
+++ b/src/gallium/tests/graw/geometry-shader/mov.txt
@@ -11,7 +11,7 @@ MOV OUT[1], IN[0][1]
EMIT
MOV OUT[0], IN[1][0]
-MOV OUT[1], IN[0][1]
+MOV OUT[1], IN[1][1]
EMIT
MOV OUT[0], IN[2][0]
diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c
index e8c82baaaf..3087d446fc 100644
--- a/src/gallium/tests/graw/gs-test.c
+++ b/src/gallium/tests/graw/gs-test.c
@@ -44,7 +44,8 @@ static const int HEIGHT = 250;
static struct pipe_screen *screen = NULL;
static struct pipe_context *ctx = NULL;
static struct pipe_resource *rttex = NULL;
-static struct pipe_resource *constbuf = NULL;
+static struct pipe_resource *constbuf1 = NULL;
+static struct pipe_resource *constbuf2 = NULL;
static struct pipe_surface *surf = NULL;
static struct pipe_sampler_view *sv = NULL;
static void *sampler = NULL;
@@ -55,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
@@ -64,37 +66,51 @@ 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.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 },
+ { {-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 constants[] =
+static float constants1[] =
{ 0.4, 0, 0, 1,
1, 1, 1, 1,
2, 2, 2, 2,
@@ -111,6 +127,25 @@ static float constants[] =
0, 0, 0, 1,
};
+
+static float constants2[] =
+{ 1, 0, 0, 1,
+ 0, 1, 0, 1,
+ 0, 0, 1, 1,
+ 0, 0, 0, 1,
+
+ 1, 1, 0, 1,
+ 1, .5, 0, 1,
+ 0, 1, 1, 1,
+ 1, 0, 1, 1,
+
+ 1, 0, 0, 0.5,
+ 0, 1, 0, 0.5,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1,
+};
+
+
static void init_fs_constbuf( void )
{
struct pipe_resource templat;
@@ -118,34 +153,54 @@ static void init_fs_constbuf( void )
templat.target = PIPE_BUFFER;
templat.format = PIPE_FORMAT_R8_UNORM;
- templat.width0 = sizeof(constants);
+ templat.width0 = sizeof(constants1);
templat.height0 = 1;
templat.depth0 = 1;
templat.last_level = 0;
templat.nr_samples = 1;
templat.bind = PIPE_BIND_CONSTANT_BUFFER;
- constbuf = screen->resource_create(screen,
- &templat);
- if (constbuf == NULL)
+ constbuf1 = screen->resource_create(screen, &templat);
+ if (constbuf1 == NULL)
+ exit(4);
+ constbuf2 = screen->resource_create(screen, &templat);
+ if (constbuf2 == NULL)
exit(4);
+ {
+ u_box_2d(0,0,sizeof(constants1),1, &box);
- u_box_2d(0,0,sizeof(constants),1, &box);
+ ctx->transfer_inline_write(ctx,
+ constbuf1,
+ u_subresource(0,0),
+ PIPE_TRANSFER_WRITE,
+ &box,
+ constants1,
+ sizeof constants1,
+ sizeof constants1);
- ctx->transfer_inline_write(ctx,
- constbuf,
- u_subresource(0,0),
- PIPE_TRANSFER_WRITE,
- &box,
- constants,
- sizeof constants,
- sizeof constants);
+ ctx->set_constant_buffer(ctx,
+ PIPE_SHADER_GEOMETRY, 0,
+ constbuf1);
+ }
+ {
+ u_box_2d(0,0,sizeof(constants2),1, &box);
+
+ ctx->transfer_inline_write(ctx,
+ constbuf2,
+ u_subresource(0,0),
+ PIPE_TRANSFER_WRITE,
+ &box,
+ constants2,
+ sizeof constants2,
+ sizeof constants2);
- ctx->set_constant_buffer(ctx,
- PIPE_SHADER_FRAGMENT, 0,
- constbuf);
+
+ ctx->set_constant_buffer(ctx,
+ PIPE_SHADER_GEOMETRY, 1,
+ constbuf2);
+ }
}
@@ -174,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;
@@ -186,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) {
@@ -218,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);
diff --git a/src/gallium/tests/python/tests/regress/fragment-shader/frag-cb-2d.sh b/src/gallium/tests/python/tests/regress/fragment-shader/frag-cb-2d.sh
index f70a5146f4..bbc3a10f9b 100644
--- a/src/gallium/tests/python/tests/regress/fragment-shader/frag-cb-2d.sh
+++ b/src/gallium/tests/python/tests/regress/fragment-shader/frag-cb-2d.sh
@@ -2,8 +2,8 @@ FRAG
DCL IN[0], COLOR, LINEAR
DCL OUT[0], COLOR
-DCL CONST[1][1..2]
+DCL CONST[1][6]
-MAD OUT[0], IN[0], CONST[1][2], CONST[1][1]
+MOV OUT[0], CONST[1][6]
END
diff --git a/src/gallium/tests/python/tests/regress/fragment-shader/frag-mad-immx.sh b/src/gallium/tests/python/tests/regress/fragment-shader/frag-mad-immx.sh
new file mode 100644
index 0000000000..6b03491576
--- /dev/null
+++ b/src/gallium/tests/python/tests/regress/fragment-shader/frag-mad-immx.sh
@@ -0,0 +1,10 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+DCL IMMX[0..1] {{ 0.5, 0.4, 0.6, 1.0 },
+ { 0.5, 0.4, 0.6, 0.0 }}
+
+MAD OUT[0], IN[0], IMMX[0], IMMX[1]
+
+END
diff --git a/src/gallium/tests/python/tests/regress/fragment-shader/frag-tempx.sh b/src/gallium/tests/python/tests/regress/fragment-shader/frag-tempx.sh
new file mode 100644
index 0000000000..81bcad2d65
--- /dev/null
+++ b/src/gallium/tests/python/tests/regress/fragment-shader/frag-tempx.sh
@@ -0,0 +1,14 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMPX[0][0..1]
+
+IMM FLT32 { -0.5, -0.4, -0.6, 0.0 }
+
+ADD TEMPX[0][0], IN[0], IMM[0]
+ADD TEMPX[0][1], IN[0], IMM[0]
+ABS OUT[0], TEMPX[0][1]
+
+END