aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/tests
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2020-01-20 22:59:49 -0500
committerMarge Bot <[email protected]>2020-02-28 00:53:45 +0000
commitc9e4dc8d5e8f5e860f93eb3555a507402506b59a (patch)
tree60fe237f31934f94d67728e7d2940221b514faef /src/gallium/tests
parent6c90e39a5b854595e3bbbf30f01aaf7dc798158e (diff)
gallium: pass cso_velems_state into cso_context instead of pipe_vertex_element
This removes one memcpy from the CSO hashing code. Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3990>
Diffstat (limited to 'src/gallium/tests')
-rw-r--r--src/gallium/tests/trivial/quad-tex.c24
-rw-r--r--src/gallium/tests/trivial/tri.c24
2 files changed, 26 insertions, 22 deletions
diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c
index 9a9d7012249..271dee648d6 100644
--- a/src/gallium/tests/trivial/quad-tex.c
+++ b/src/gallium/tests/trivial/quad-tex.c
@@ -73,7 +73,7 @@ struct program
struct pipe_sampler_state sampler;
struct pipe_viewport_state viewport;
struct pipe_framebuffer_state framebuffer;
- struct pipe_vertex_element velem[2];
+ struct cso_velems_state velem;
void *vs;
void *fs;
@@ -252,16 +252,18 @@ static void init_prog(struct program *p)
}
/* vertex elements state */
- memset(p->velem, 0, sizeof(p->velem));
- p->velem[0].src_offset = 0 * 4 * sizeof(float); /* offset 0, first element */
- p->velem[0].instance_divisor = 0;
- p->velem[0].vertex_buffer_index = 0;
- p->velem[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ memset(&p->velem, 0, sizeof(p->velem));
+ p->velem.count = 2;
- p->velem[1].src_offset = 1 * 4 * sizeof(float); /* offset 16, second element */
- p->velem[1].instance_divisor = 0;
- p->velem[1].vertex_buffer_index = 0;
- p->velem[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ p->velem.velems[0].src_offset = 0 * 4 * sizeof(float); /* offset 0, first element */
+ p->velem.velems[0].instance_divisor = 0;
+ p->velem.velems[0].vertex_buffer_index = 0;
+ p->velem.velems[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+
+ p->velem.velems[1].src_offset = 1 * 4 * sizeof(float); /* offset 16, second element */
+ p->velem.velems[1].instance_divisor = 0;
+ p->velem.velems[1].vertex_buffer_index = 0;
+ p->velem.velems[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
/* vertex shader */
{
@@ -326,7 +328,7 @@ static void draw(struct program *p)
cso_set_vertex_shader_handle(p->cso, p->vs);
/* vertex element data */
- cso_set_vertex_elements(p->cso, 2, p->velem);
+ cso_set_vertex_elements(p->cso, &p->velem);
util_draw_vertex_buffer(p->pipe, p->cso,
p->vbuf, 0, 0,
diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c
index 3827edc0da3..1e773cb28f9 100644
--- a/src/gallium/tests/trivial/tri.c
+++ b/src/gallium/tests/trivial/tri.c
@@ -70,7 +70,7 @@ struct program
struct pipe_rasterizer_state rasterizer;
struct pipe_viewport_state viewport;
struct pipe_framebuffer_state framebuffer;
- struct pipe_vertex_element velem[2];
+ struct cso_velems_state velem;
void *vs;
void *fs;
@@ -196,16 +196,18 @@ static void init_prog(struct program *p)
}
/* vertex elements state */
- memset(p->velem, 0, sizeof(p->velem));
- p->velem[0].src_offset = 0 * 4 * sizeof(float); /* offset 0, first element */
- p->velem[0].instance_divisor = 0;
- p->velem[0].vertex_buffer_index = 0;
- p->velem[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ memset(&p->velem, 0, sizeof(p->velem));
+ p->velem.count = 2;
- p->velem[1].src_offset = 1 * 4 * sizeof(float); /* offset 16, second element */
- p->velem[1].instance_divisor = 0;
- p->velem[1].vertex_buffer_index = 0;
- p->velem[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ p->velem.velems[0].src_offset = 0 * 4 * sizeof(float); /* offset 0, first element */
+ p->velem.velems[0].instance_divisor = 0;
+ p->velem.velems[0].vertex_buffer_index = 0;
+ p->velem.velems[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+
+ p->velem.velems[1].src_offset = 1 * 4 * sizeof(float); /* offset 16, second element */
+ p->velem.velems[1].instance_divisor = 0;
+ p->velem.velems[1].vertex_buffer_index = 0;
+ p->velem.velems[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
/* vertex shader */
{
@@ -257,7 +259,7 @@ static void draw(struct program *p)
cso_set_vertex_shader_handle(p->cso, p->vs);
/* vertex element data */
- cso_set_vertex_elements(p->cso, 2, p->velem);
+ cso_set_vertex_elements(p->cso, &p->velem);
util_draw_vertex_buffer(p->pipe, p->cso,
p->vbuf, 0, 0,