diff options
Diffstat (limited to 'lib/mesa/src/gallium/tests/trivial/tri.c')
-rw-r--r-- | lib/mesa/src/gallium/tests/trivial/tri.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/lib/mesa/src/gallium/tests/trivial/tri.c b/lib/mesa/src/gallium/tests/trivial/tri.c index 3827edc0d..0bc09a983 100644 --- a/lib/mesa/src/gallium/tests/trivial/tri.c +++ b/lib/mesa/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; @@ -84,7 +84,7 @@ struct program static void init_prog(struct program *p) { struct pipe_surface surf_tmpl; - int ret; + ASSERTED int ret; /* find a hardware device */ ret = pipe_loader_probe(&p->dev, 1); @@ -193,19 +193,26 @@ static void init_prog(struct program *p) p->viewport.translate[0] = half_width + x; p->viewport.translate[1] = (half_height + y) * scale + bias; p->viewport.translate[2] = half_depth + z; + + p->viewport.swizzle_x = PIPE_VIEWPORT_SWIZZLE_POSITIVE_X; + p->viewport.swizzle_y = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Y; + p->viewport.swizzle_z = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Z; + p->viewport.swizzle_w = PIPE_VIEWPORT_SWIZZLE_POSITIVE_W; } /* 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.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[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[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 */ { @@ -244,7 +251,7 @@ static void draw(struct program *p) cso_set_framebuffer(p->cso, &p->framebuffer); /* clear the render target */ - p->pipe->clear(p->pipe, PIPE_CLEAR_COLOR, &p->clear_color, 0, 0); + p->pipe->clear(p->pipe, PIPE_CLEAR_COLOR, NULL, &p->clear_color, 0, 0); /* set misc state we care about */ cso_set_blend(p->cso, &p->blend); @@ -257,7 +264,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, |