mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 11:30:21 +01:00
gallium: Set all state via cso_context in blit/gen_mipmap utils.
cso_restore_* functions are implemented on top of cso_set_*, therefore they require full knowledge of the current pipe state to work correctly. Directly calling pipe's set_*_state functions will lead to undefined state. Also save and restore shaders.
This commit is contained in:
parent
08717d9461
commit
13d8b1b211
2 changed files with 15 additions and 7 deletions
|
|
@ -300,6 +300,8 @@ util_blit_pixels(struct blit_state *ctx,
|
|||
cso_save_samplers(ctx->cso);
|
||||
cso_save_sampler_textures(ctx->cso);
|
||||
cso_save_framebuffer(ctx->cso);
|
||||
cso_save_fragment_shader(ctx->cso);
|
||||
cso_save_vertex_shader(ctx->cso);
|
||||
|
||||
/* set misc state we care about */
|
||||
cso_set_blend(ctx->cso, &ctx->blend);
|
||||
|
|
@ -313,11 +315,11 @@ util_blit_pixels(struct blit_state *ctx,
|
|||
cso_single_sampler_done(ctx->cso);
|
||||
|
||||
/* texture */
|
||||
pipe->set_sampler_textures(pipe, 1, &tex);
|
||||
cso_set_sampler_textures(ctx->cso, 1, &tex);
|
||||
|
||||
/* shaders */
|
||||
pipe->bind_fs_state(pipe, ctx->fs);
|
||||
pipe->bind_vs_state(pipe, ctx->vs);
|
||||
cso_set_fragment_shader(ctx->cso, ctx->fs);
|
||||
cso_set_vertex_shader(ctx->cso, ctx->vs);
|
||||
|
||||
/* drawing dest */
|
||||
memset(&fb, 0, sizeof(fb));
|
||||
|
|
@ -344,6 +346,8 @@ util_blit_pixels(struct blit_state *ctx,
|
|||
cso_restore_samplers(ctx->cso);
|
||||
cso_restore_sampler_textures(ctx->cso);
|
||||
cso_restore_framebuffer(ctx->cso);
|
||||
cso_restore_fragment_shader(ctx->cso);
|
||||
cso_restore_vertex_shader(ctx->cso);
|
||||
|
||||
/* free the texture */
|
||||
pipe_surface_reference(&texSurf, NULL);
|
||||
|
|
|
|||
|
|
@ -880,16 +880,18 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
|
|||
cso_save_samplers(ctx->cso);
|
||||
cso_save_sampler_textures(ctx->cso);
|
||||
cso_save_framebuffer(ctx->cso);
|
||||
cso_save_fragment_shader(ctx->cso);
|
||||
cso_save_vertex_shader(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);
|
||||
|
||||
pipe->bind_vs_state(pipe, ctx->vs);
|
||||
pipe->bind_fs_state(pipe, ctx->fs);
|
||||
cso_set_fragment_shader(ctx->cso, ctx->fs);
|
||||
cso_set_vertex_shader(ctx->cso, ctx->vs);
|
||||
#if 0
|
||||
pipe->set_viewport_state(pipe, &ctx->viewport);
|
||||
cso_set_viewport(ctx->cso, &ctx->viewport);
|
||||
#endif
|
||||
|
||||
/* init framebuffer state */
|
||||
|
|
@ -930,7 +932,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
|
|||
simple_viewport(pipe, pt->width[dstLevel], pt->height[dstLevel]);
|
||||
#endif
|
||||
|
||||
pipe->set_sampler_textures(pipe, 1, &pt);
|
||||
cso_set_sampler_textures(ctx->cso, 1, &pt);
|
||||
|
||||
/* quad coords in window coords (bypassing clipping, viewport mapping) */
|
||||
set_vertex_data(ctx,
|
||||
|
|
@ -954,4 +956,6 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
|
|||
cso_restore_samplers(ctx->cso);
|
||||
cso_restore_sampler_textures(ctx->cso);
|
||||
cso_restore_framebuffer(ctx->cso);
|
||||
cso_restore_fragment_shader(ctx->cso);
|
||||
cso_restore_vertex_shader(ctx->cso);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue