From 63cb6f59eac91ba34cf80ff3736568e40b094fe1 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 22 Feb 2010 21:36:22 +0100 Subject: gallium: Remove bypass_vs_clip_and_viewport from rasteriser state. Needs testing. --- src/gallium/auxiliary/util/u_blitter.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/gallium/auxiliary/util/u_blitter.c') diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 18f8606818..50877f6b01 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -160,7 +160,6 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) memset(&rs_state, 0, sizeof(rs_state)); rs_state.front_winding = PIPE_WINDING_CW; rs_state.cull_mode = PIPE_WINDING_NONE; - rs_state.bypass_vs_clip_and_viewport = 1; rs_state.gl_rasterization_rules = 1; rs_state.flatshade = 1; ctx->rs_state = pipe->create_rasterizer_state(pipe, &rs_state); -- cgit v1.2.3 From 932e6f8d527d2147ecc4e75ce9ae2f71e23e61af Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 1 Mar 2010 17:06:20 +0100 Subject: util: Fix u_blitter setup code after bypass_vs_clip_and_viewport removal. Not tested. --- src/gallium/auxiliary/util/u_blitter.c | 46 ++++++++++++++++++++++++++-------- src/gallium/auxiliary/util/u_blitter.h | 16 ++++++++++++ 2 files changed, 51 insertions(+), 11 deletions(-) (limited to 'src/gallium/auxiliary/util/u_blitter.c') diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 50877f6b01..f93c69d193 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -93,6 +93,12 @@ struct blitter_context_priv /* Rasterizer state. */ void *rs_state; + + /* Viewport state. */ + struct pipe_viewport_state viewport; + + /* Clip state. */ + struct pipe_clip_state clip; }; struct blitter_context *util_blitter_create(struct pipe_context *pipe) @@ -262,6 +268,9 @@ static void blitter_restore_CSOs(struct blitter_context_priv *ctx) pipe->set_stencil_ref(pipe, &ctx->blitter.saved_stencil_ref); + pipe->set_viewport_state(pipe, &ctx->blitter.saved_viewport); + pipe->set_clip_state(pipe, &ctx->blitter.saved_clip); + /* restore the state objects which are required to be saved before copy/fill */ if (ctx->blitter.saved_fb_state.nr_cbufs != ~0) { @@ -287,25 +296,40 @@ static void blitter_restore_CSOs(struct blitter_context_priv *ctx) static void blitter_set_rectangle(struct blitter_context_priv *ctx, unsigned x1, unsigned y1, unsigned x2, unsigned y2, + unsigned width, unsigned height, float depth) { int i; /* set vertex positions */ - ctx->vertices[0][0][0] = x1; /*v0.x*/ - ctx->vertices[0][0][1] = y1; /*v0.y*/ + ctx->vertices[0][0][0] = (float)x1 / width * 2.0f - 1.0f; /*v0.x*/ + ctx->vertices[0][0][1] = (float)y1 / height * 2.0f - 1.0f; /*v0.y*/ - ctx->vertices[1][0][0] = x2; /*v1.x*/ - ctx->vertices[1][0][1] = y1; /*v1.y*/ + ctx->vertices[1][0][0] = (float)x2 / width * 2.0f - 1.0f; /*v1.x*/ + ctx->vertices[1][0][1] = (float)y1 / height * 2.0f - 1.0f; /*v1.y*/ - ctx->vertices[2][0][0] = x2; /*v2.x*/ - ctx->vertices[2][0][1] = y2; /*v2.y*/ + ctx->vertices[2][0][0] = (float)x2 / width * 2.0f - 1.0f; /*v2.x*/ + ctx->vertices[2][0][1] = (float)y2 / height * 2.0f - 1.0f; /*v2.y*/ - ctx->vertices[3][0][0] = x1; /*v3.x*/ - ctx->vertices[3][0][1] = y2; /*v3.y*/ + ctx->vertices[3][0][0] = (float)x1 / width * 2.0f - 1.0f; /*v3.x*/ + ctx->vertices[3][0][1] = (float)y2 / height * 2.0f - 1.0f; /*v3.y*/ for (i = 0; i < 4; i++) ctx->vertices[i][0][2] = depth; /*z*/ + + /* viewport */ + ctx->viewport.scale[0] = 0.5f * width; + ctx->viewport.scale[1] = 0.5f * height; + ctx->viewport.scale[2] = 0.5f; + ctx->viewport.scale[3] = 1.0f; + ctx->viewport.translate[0] = 0.5f * width; + ctx->viewport.translate[1] = 0.5f * height; + ctx->viewport.translate[2] = 0.5f; + ctx->viewport.translate[3] = 0.0f; + ctx->pipe->set_viewport_state(ctx->pipe, &ctx->viewport); + + /* clip */ + ctx->pipe->set_clip_state(ctx->pipe, &ctx->clip); } static void blitter_set_clear_color(struct blitter_context_priv *ctx, @@ -549,7 +573,7 @@ void util_blitter_clear(struct blitter_context *blitter, pipe->bind_vs_state(pipe, ctx->vs_col); blitter_set_clear_color(ctx, rgba); - blitter_set_rectangle(ctx, 0, 0, width, height, depth); + blitter_set_rectangle(ctx, 0, 0, width, height, width, height, depth); blitter_draw_quad(ctx); blitter_restore_CSOs(ctx); } @@ -632,7 +656,7 @@ static void util_blitter_do_copy(struct blitter_context *blitter, assert(0); } - blitter_set_rectangle(ctx, dstx, dsty, dstx+width, dsty+height, 0); + blitter_set_rectangle(ctx, dstx, dsty, dstx+width, dsty+height, dst->width, dst->height, 0); blitter_draw_quad(ctx); } @@ -793,7 +817,7 @@ void util_blitter_fill(struct blitter_context *blitter, pipe->set_framebuffer_state(pipe, &fb_state); blitter_set_clear_color(ctx, rgba); - blitter_set_rectangle(ctx, 0, 0, width, height, 0); + blitter_set_rectangle(ctx, 0, 0, width, height, dst->width, dst->height, 0); blitter_draw_quad(ctx); blitter_restore_CSOs(ctx); } diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index a2f17073ac..92008fce99 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -48,6 +48,8 @@ struct blitter_context struct pipe_framebuffer_state saved_fb_state; /**< framebuffer state */ struct pipe_stencil_ref saved_stencil_ref; /**< stencil ref */ + struct pipe_viewport_state saved_viewport; + struct pipe_clip_state saved_clip; int saved_num_sampler_states; void *saved_sampler_states[32]; @@ -205,6 +207,20 @@ void util_blitter_save_framebuffer(struct blitter_context *blitter, blitter->saved_fb_state = *state; } +static INLINE +void util_blitter_save_viewport(struct blitter_context *blitter, + struct pipe_viewport_state *state) +{ + blitter->saved_viewport = *state; +} + +static INLINE +void util_blitter_save_clip(struct blitter_context *blitter, + struct pipe_clip_state *state) +{ + blitter->saved_clip = *state; +} + static INLINE void util_blitter_save_fragment_sampler_states( struct blitter_context *blitter, -- cgit v1.2.3 From ac4abaecd5f52e416c89bfe19b34ed7f4e014b21 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 1 Mar 2010 18:40:22 +0100 Subject: util: adapt blitter code to new vertex element cso The interface of util_draw_vertex_buffer looks a bit odd (calling code has to set vertex elements but not vertex buffers) but due to the way cso state handling generally works (can't re-bind original vertex element state easily there) I guess that's ok for now. --- src/gallium/auxiliary/util/u_blit.c | 16 ++++++++++++++++ src/gallium/auxiliary/util/u_blitter.c | 23 ++++++++++++++++++++++- src/gallium/auxiliary/util/u_blitter.h | 8 ++++++++ src/gallium/auxiliary/util/u_draw_quad.c | 11 +---------- src/gallium/auxiliary/util/u_gen_mipmap.c | 13 +++++++++++++ 5 files changed, 60 insertions(+), 11 deletions(-) (limited to 'src/gallium/auxiliary/util/u_blitter.c') diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index f0bc58a558..0d93e23df8 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -62,6 +62,7 @@ struct blit_state struct pipe_rasterizer_state rasterizer; struct pipe_sampler_state sampler; struct pipe_viewport_state viewport; + struct pipe_vertex_element velem[2]; void *vs; void *fs[TGSI_WRITEMASK_XYZW + 1]; @@ -115,6 +116,15 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso) ctx->sampler.normalized_coords = 1; + /* vertex elements state */ + memset(&ctx->velem[0], 0, sizeof(ctx->velem[0]) * 2); + for (i = 0; i < 2; i++) { + ctx->velem[i].src_offset = i * 4 * sizeof(float); + ctx->velem[i].instance_divisor = 0; + ctx->velem[i].vertex_buffer_index = 0; + ctx->velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + } + /* vertex shader - still required to provide the linkage between * fragment shader input semantics and vertex_element/buffers. */ @@ -410,11 +420,13 @@ util_blit_pixels_writemask(struct blit_state *ctx, cso_save_framebuffer(ctx->cso); cso_save_fragment_shader(ctx->cso); cso_save_vertex_shader(ctx->cso); + cso_save_vertex_elements(ctx->cso); /* set misc state we care about */ cso_set_blend(ctx->cso, &ctx->blend); cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); + cso_set_vertex_elements(ctx->cso, 2, ctx->velem); /* sampler */ ctx->sampler.min_img_filter = filter; @@ -464,6 +476,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, cso_restore_framebuffer(ctx->cso); cso_restore_fragment_shader(ctx->cso); cso_restore_vertex_shader(ctx->cso); + cso_restore_vertex_elements(ctx->cso); pipe_texture_reference(&tex, NULL); } @@ -547,11 +560,13 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_save_framebuffer(ctx->cso); cso_save_fragment_shader(ctx->cso); cso_save_vertex_shader(ctx->cso); + cso_save_vertex_elements(ctx->cso); /* set misc state we care about */ cso_set_blend(ctx->cso, &ctx->blend); cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); + cso_set_vertex_elements(ctx->cso, 2, ctx->velem); /* sampler */ ctx->sampler.min_img_filter = filter; @@ -596,4 +611,5 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_restore_framebuffer(ctx->cso); cso_restore_fragment_shader(ctx->cso); cso_restore_vertex_shader(ctx->cso); + cso_restore_vertex_elements(ctx->cso); } diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 18f8606818..3542a2e444 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -88,6 +88,8 @@ struct blitter_context_priv void *dsa_write_depth_keep_stencil; void *dsa_keep_depth_stencil; + void *velem_state; + /* Sampler state for clamping to a miplevel. */ void *sampler_state[PIPE_MAX_TEXTURE_LEVELS]; @@ -102,6 +104,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) struct pipe_depth_stencil_alpha_state dsa = { { 0 } }; struct pipe_rasterizer_state rs_state = { 0 }; struct pipe_sampler_state *sampler_state; + struct pipe_vertex_element velem[2]; unsigned i; ctx = CALLOC_STRUCT(blitter_context_priv); @@ -116,6 +119,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) ctx->blitter.saved_rs_state = INVALID_PTR; ctx->blitter.saved_fs = INVALID_PTR; ctx->blitter.saved_vs = INVALID_PTR; + ctx->blitter.saved_velem_state = INVALID_PTR; ctx->blitter.saved_fb_state.nr_cbufs = ~0; ctx->blitter.saved_num_textures = ~0; ctx->blitter.saved_num_sampler_states = ~0; @@ -165,6 +169,16 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) rs_state.flatshade = 1; ctx->rs_state = pipe->create_rasterizer_state(pipe, &rs_state); + /* vertex elements state */ + memset(&velem[0], 0, sizeof(velem[0]) * 2); + for (i = 0; i < 2; i++) { + velem[i].src_offset = i * 4 * sizeof(float); + velem[i].instance_divisor = 0; + velem[i].vertex_buffer_index = 0; + velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + } + ctx->velem_state = pipe->create_vertex_elements_state(pipe, 2, &velem[0]); + /* fragment shaders are created on-demand */ /* vertex shaders */ @@ -214,6 +228,7 @@ void util_blitter_destroy(struct blitter_context *blitter) pipe->delete_rasterizer_state(pipe, ctx->rs_state); pipe->delete_vs_state(pipe, ctx->vs_col); pipe->delete_vs_state(pipe, ctx->vs_tex); + pipe->delete_vertex_elements_state(pipe, ctx->velem_state); for (i = 0; i < PIPE_MAX_TEXTURE_TYPES; i++) { if (ctx->fs_texfetch_col[i]) @@ -241,7 +256,8 @@ static void blitter_check_saved_CSOs(struct blitter_context_priv *ctx) ctx->blitter.saved_dsa_state != INVALID_PTR && ctx->blitter.saved_rs_state != INVALID_PTR && ctx->blitter.saved_fs != INVALID_PTR && - ctx->blitter.saved_vs != INVALID_PTR); + ctx->blitter.saved_vs != INVALID_PTR && + ctx->blitter.saved_velem_state != INVALID_PTR); } static void blitter_restore_CSOs(struct blitter_context_priv *ctx) @@ -254,12 +270,14 @@ static void blitter_restore_CSOs(struct blitter_context_priv *ctx) pipe->bind_rasterizer_state(pipe, ctx->blitter.saved_rs_state); pipe->bind_fs_state(pipe, ctx->blitter.saved_fs); pipe->bind_vs_state(pipe, ctx->blitter.saved_vs); + pipe->bind_vertex_elements_state(pipe, ctx->blitter.saved_velem_state); ctx->blitter.saved_blend_state = INVALID_PTR; ctx->blitter.saved_dsa_state = INVALID_PTR; ctx->blitter.saved_rs_state = INVALID_PTR; ctx->blitter.saved_fs = INVALID_PTR; ctx->blitter.saved_vs = INVALID_PTR; + ctx->blitter.saved_velem_state = INVALID_PTR; pipe->set_stencil_ref(pipe, &ctx->blitter.saved_stencil_ref); @@ -546,6 +564,7 @@ void util_blitter_clear(struct blitter_context *blitter, pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil); pipe->bind_rasterizer_state(pipe, ctx->rs_state); + pipe->bind_vertex_elements_state(pipe, ctx->velem_state); pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, num_cbufs)); pipe->bind_vs_state(pipe, ctx->vs_col); @@ -611,6 +630,7 @@ static void util_blitter_do_copy(struct blitter_context *blitter, pipe->bind_vs_state(pipe, ctx->vs_tex); pipe->bind_fragment_sampler_states(pipe, 1, blitter_get_sampler_state(ctx, src->level)); + pipe->bind_vertex_elements_state(pipe, ctx->velem_state); pipe->set_fragment_sampler_textures(pipe, 1, &src->texture); pipe->set_framebuffer_state(pipe, &fb_state); @@ -784,6 +804,7 @@ void util_blitter_fill(struct blitter_context *blitter, pipe->bind_rasterizer_state(pipe, ctx->rs_state); pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 1)); pipe->bind_vs_state(pipe, ctx->vs_col); + pipe->bind_vertex_elements_state(pipe, ctx->velem_state); /* set a framebuffer state */ fb_state.width = dst->width; diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index a2f17073ac..7d8a09edb5 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -43,6 +43,7 @@ struct blitter_context /* Private members, really. */ void *saved_blend_state; /**< blend state */ void *saved_dsa_state; /**< depth stencil alpha state */ + void *saved_velem_state; /**< vertex elements state */ void *saved_rs_state; /**< rasterizer state */ void *saved_fs, *saved_vs; /**< fragment shader, vertex shader */ @@ -170,6 +171,13 @@ void util_blitter_save_depth_stencil_alpha(struct blitter_context *blitter, blitter->saved_dsa_state = state; } +static INLINE +void util_blitter_save_vertex_elements(struct blitter_context *blitter, + void *state) +{ + blitter->saved_velem_state = state; +} + static INLINE void util_blitter_save_stencil_ref(struct blitter_context *blitter, const struct pipe_stencil_ref *state) diff --git a/src/gallium/auxiliary/util/u_draw_quad.c b/src/gallium/auxiliary/util/u_draw_quad.c index 36e9a4941f..8c194102bf 100644 --- a/src/gallium/auxiliary/util/u_draw_quad.c +++ b/src/gallium/auxiliary/util/u_draw_quad.c @@ -45,8 +45,6 @@ util_draw_vertex_buffer(struct pipe_context *pipe, uint num_attribs) { struct pipe_vertex_buffer vbuffer; - struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS]; - uint i; assert(num_attribs <= PIPE_MAX_ATTRIBS); @@ -58,14 +56,7 @@ util_draw_vertex_buffer(struct pipe_context *pipe, vbuffer.max_index = num_verts - 1; pipe->set_vertex_buffers(pipe, 1, &vbuffer); - /* tell pipe about the vertex attributes */ - for (i = 0; i < num_attribs; i++) { - velements[i].src_offset = i * 4 * sizeof(float); - velements[i].instance_divisor = 0; - velements[i].vertex_buffer_index = 0; - velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; - } - pipe->set_vertex_elements(pipe, num_attribs, velements); + /* note: vertex elements already set by caller */ /* draw */ pipe->draw_arrays(pipe, prim_type, 0, num_verts); diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 4e358d3938..db726df9c3 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -61,6 +61,7 @@ struct gen_mipmap_state struct pipe_depth_stencil_alpha_state depthstencil; struct pipe_rasterizer_state rasterizer; struct pipe_sampler_state sampler; + struct pipe_vertex_element velem[2]; void *vs; void *fs2d, *fsCube; @@ -1307,6 +1308,15 @@ util_create_gen_mipmap(struct pipe_context *pipe, ctx->sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; ctx->sampler.normalized_coords = 1; + /* vertex elements state */ + memset(&ctx->velem[0], 0, sizeof(ctx->velem[0]) * 2); + for (i = 0; i < 2; i++) { + ctx->velem[i].src_offset = i * 4 * sizeof(float); + ctx->velem[i].instance_divisor = 0; + ctx->velem[i].vertex_buffer_index = 0; + ctx->velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + } + /* vertex shader - still needed to specify mapping from fragment * shader input semantics to vertex elements */ @@ -1499,11 +1509,13 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, cso_save_framebuffer(ctx->cso); cso_save_fragment_shader(ctx->cso); cso_save_vertex_shader(ctx->cso); + cso_save_vertex_elements(ctx->cso); /* bind our state */ cso_set_blend(ctx->cso, &ctx->blend); cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); + cso_set_vertex_elements(ctx->cso, 2, ctx->velem); cso_set_fragment_shader_handle(ctx->cso, fs); cso_set_vertex_shader_handle(ctx->cso, ctx->vs); @@ -1578,4 +1590,5 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, cso_restore_framebuffer(ctx->cso); cso_restore_fragment_shader(ctx->cso); cso_restore_vertex_shader(ctx->cso); + cso_restore_vertex_elements(ctx->cso); } -- cgit v1.2.3 From ff9ddf4d39be9e36d3e1dd9e10e889efa40dfb1e Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 2 Mar 2010 02:37:45 +0100 Subject: util/blitter: Fix the viewport transformation for Z coordinates When clearing buffers, the depth is specified in the range [0, 1] and should be passed through blitter "as is". --- src/gallium/auxiliary/util/u_blitter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium/auxiliary/util/u_blitter.c') diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index f93c69d193..0ba09d33bf 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -320,11 +320,11 @@ static void blitter_set_rectangle(struct blitter_context_priv *ctx, /* viewport */ ctx->viewport.scale[0] = 0.5f * width; ctx->viewport.scale[1] = 0.5f * height; - ctx->viewport.scale[2] = 0.5f; + ctx->viewport.scale[2] = 1.0f; ctx->viewport.scale[3] = 1.0f; ctx->viewport.translate[0] = 0.5f * width; ctx->viewport.translate[1] = 0.5f * height; - ctx->viewport.translate[2] = 0.5f; + ctx->viewport.translate[2] = 0.0f; ctx->viewport.translate[3] = 0.0f; ctx->pipe->set_viewport_state(ctx->pipe, &ctx->viewport); -- cgit v1.2.3 From 0c92dfe7f37059d9dfc523c6bf660c15c9f079f5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 11 Mar 2010 08:51:18 -0700 Subject: gallium/util: use memset() to initialize vars to avoid warnings --- src/gallium/auxiliary/util/u_blitter.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/gallium/auxiliary/util/u_blitter.c') diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 33d09085f0..36d582491f 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -106,9 +106,9 @@ struct blitter_context_priv struct blitter_context *util_blitter_create(struct pipe_context *pipe) { struct blitter_context_priv *ctx; - struct pipe_blend_state blend = { 0 }; - struct pipe_depth_stencil_alpha_state dsa = { { 0 } }; - struct pipe_rasterizer_state rs_state = { 0 }; + struct pipe_blend_state blend; + struct pipe_depth_stencil_alpha_state dsa; + struct pipe_rasterizer_state rs_state; struct pipe_sampler_state *sampler_state; struct pipe_vertex_element velem[2]; unsigned i; @@ -131,12 +131,14 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) ctx->blitter.saved_num_sampler_states = ~0; /* blend state objects */ + memset(&blend, 0, sizeof(blend)); ctx->blend_keep_color = pipe->create_blend_state(pipe, &blend); blend.rt[0].colormask = PIPE_MASK_RGBA; ctx->blend_write_color = pipe->create_blend_state(pipe, &blend); /* depth stencil alpha state objects */ + memset(&dsa, 0, sizeof(dsa)); ctx->dsa_keep_depth_stencil = pipe->create_depth_stencil_alpha_state(pipe, &dsa); -- cgit v1.2.3