[Mesa-dev] [PATCH 2/7] st/mesa: use new cso_save/restore_state() functions
Brian Paul
brianp at vmware.com
Sun Feb 14 14:54:33 UTC 2016
On 02/14/2016 07:27 AM, Brian Paul wrote:
> On 02/13/2016 03:01 PM, Jose Fonseca wrote:
>> On 12/02/16 15:44, Brian Paul wrote:
>>> ---
>>> src/mesa/state_tracker/st_cb_bitmap.c | 36
>>> ++++++++----------------
>>> src/mesa/state_tracker/st_cb_clear.c | 46
>>> +++++++++++--------------------
>>> src/mesa/state_tracker/st_cb_drawpixels.c | 46
>>> +++++++++++--------------------
>>> src/mesa/state_tracker/st_cb_drawtex.c | 26 ++++++-----------
>>> 4 files changed, 53 insertions(+), 101 deletions(-)
>>>
>>> diff --git a/src/mesa/state_tracker/st_cb_bitmap.c
>>> b/src/mesa/state_tracker/st_cb_bitmap.c
>>> index 5a11c0d..6af9ade 100644
>>> --- a/src/mesa/state_tracker/st_cb_bitmap.c
>>> +++ b/src/mesa/state_tracker/st_cb_bitmap.c
>>> @@ -213,18 +213,17 @@ setup_render_state(struct gl_context *ctx,
>>> COPY_4V(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], colorSave);
>>> }
>>>
>>> - cso_save_rasterizer(cso);
>>> - cso_save_fragment_samplers(cso);
>>> - cso_save_fragment_sampler_views(cso);
>>> - cso_save_viewport(cso);
>>> - cso_save_fragment_shader(cso);
>>> - cso_save_stream_outputs(cso);
>>> - cso_save_vertex_shader(cso);
>>> - cso_save_tessctrl_shader(cso);
>>> - cso_save_tesseval_shader(cso);
>>> - cso_save_geometry_shader(cso);
>>> - cso_save_vertex_elements(cso);
>>> - cso_save_aux_vertex_buffer_slot(cso);
>>> + cso_save_state(cso, (CSO_BIT_RASTERIZER |
>>> + CSO_BIT_FRAGMENT_SAMPLERS |
>>> + CSO_BIT_FRAGMENT_SAMPLER_VIEWS |
>>> + CSO_BIT_VIEWPORT |
>>> + CSO_BIT_FRAGMENT_SHADER |
>>> + CSO_BIT_STREAM_OUTPUTS |
>>> + CSO_BIT_TESSCTRL_SHADER |
>>> + CSO_BIT_TESSEVAL_SHADER |
>>> + CSO_BIT_GEOMETRY_SHADER |
>>> + CSO_BIT_VERTEX_ELEMENTS |
>>> + CSO_BIT_AUX_VERTEX_BUFFER_SLOT));
>>>
>>> /* rasterizer state: just scissor */
>>> st->bitmap.rasterizer.scissor = ctx->Scissor.EnableFlags & 1;
>>> @@ -286,18 +285,7 @@ restore_render_state(struct gl_context *ctx)
>>> struct st_context *st = st_context(ctx);
>>> struct cso_context *cso = st->cso_context;
>>>
>>> - cso_restore_rasterizer(cso);
>>> - cso_restore_fragment_samplers(cso);
>>> - cso_restore_fragment_sampler_views(cso);
>>> - cso_restore_viewport(cso);
>>> - cso_restore_fragment_shader(cso);
>>> - cso_restore_vertex_shader(cso);
>>> - cso_restore_tessctrl_shader(cso);
>>> - cso_restore_tesseval_shader(cso);
>>> - cso_restore_geometry_shader(cso);
>>> - cso_restore_vertex_elements(cso);
>>> - cso_restore_aux_vertex_buffer_slot(cso);
>>> - cso_restore_stream_outputs(cso);
>>> + cso_restore_state(cso);
>>> }
>>>
>>>
>>> diff --git a/src/mesa/state_tracker/st_cb_clear.c
>>> b/src/mesa/state_tracker/st_cb_clear.c
>>> index 27925f9..1adaa5e 100644
>>> --- a/src/mesa/state_tracker/st_cb_clear.c
>>> +++ b/src/mesa/state_tracker/st_cb_clear.c
>>> @@ -196,21 +196,21 @@ clear_with_quad(struct gl_context *ctx, unsigned
>>> clear_buffers)
>>> x1, y1);
>>> */
>>>
>>> - cso_save_blend(cso);
>>> - cso_save_stencil_ref(cso);
>>> - cso_save_depth_stencil_alpha(cso);
>>> - cso_save_rasterizer(cso);
>>> - cso_save_sample_mask(cso);
>>> - cso_save_min_samples(cso);
>>> - cso_save_viewport(cso);
>>> - cso_save_fragment_shader(cso);
>>> - cso_save_stream_outputs(cso);
>>> - cso_save_vertex_shader(cso);
>>> - cso_save_tessctrl_shader(cso);
>>> - cso_save_tesseval_shader(cso);
>>> - cso_save_geometry_shader(cso);
>>> - cso_save_vertex_elements(cso);
>>> - cso_save_aux_vertex_buffer_slot(cso);
>>> + cso_save_state(cso, (CSO_BIT_BLEND |
>>> + CSO_BIT_STENCIL_REF |
>>> + CSO_BIT_DEPTH_STENCIL_ALPHA |
>>> + CSO_BIT_RASTERIZER |
>>> + CSO_BIT_SAMPLE_MASK |
>>> + CSO_BIT_MIN_SAMPLES |
>>> + CSO_BIT_VIEWPORT |
>>> + CSO_BIT_FRAGMENT_SHADER |
>>> + CSO_BIT_STREAM_OUTPUTS |
>>> + CSO_BIT_VERTEX_SHADER |
>>> + CSO_BIT_TESSCTRL_SHADER |
>>> + CSO_BIT_TESSEVAL_SHADER |
>>> + CSO_BIT_GEOMETRY_SHADER |
>>> + CSO_BIT_VERTEX_ELEMENTS |
>>> + CSO_BIT_AUX_VERTEX_BUFFER_SLOT));
>>>
>>> /* blend state: RGBA masking */
>>> {
>>> @@ -306,21 +306,7 @@ clear_with_quad(struct gl_context *ctx, unsigned
>>> clear_buffers)
>>> }
>>>
>>> /* Restore pipe state */
>>> - cso_restore_blend(cso);
>>> - cso_restore_stencil_ref(cso);
>>> - cso_restore_depth_stencil_alpha(cso);
>>> - cso_restore_rasterizer(cso);
>>> - cso_restore_sample_mask(cso);
>>> - cso_restore_min_samples(cso);
>>> - cso_restore_viewport(cso);
>>> - cso_restore_fragment_shader(cso);
>>> - cso_restore_vertex_shader(cso);
>>> - cso_restore_tessctrl_shader(cso);
>>> - cso_restore_tesseval_shader(cso);
>>> - cso_restore_geometry_shader(cso);
>>> - cso_restore_vertex_elements(cso);
>>> - cso_restore_aux_vertex_buffer_slot(cso);
>>> - cso_restore_stream_outputs(cso);
>>> + cso_restore_state(cso);
>>> }
>>>
>>>
>>> diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c
>>> b/src/mesa/state_tracker/st_cb_drawpixels.c
>>> index b1b61c8..ee172a0 100644
>>> --- a/src/mesa/state_tracker/st_cb_drawpixels.c
>>> +++ b/src/mesa/state_tracker/st_cb_drawpixels.c
>>> @@ -459,6 +459,7 @@ draw_textured_quad(struct gl_context *ctx, GLint
>>> x, GLint y, GLfloat z,
>>> GLfloat x0, y0, x1, y1;
>>> GLsizei maxSize;
>>> boolean normalized = sv[0]->texture->target == PIPE_TEXTURE_2D;
>>> + unsigned cso_state_mask;
>>>
>>> assert(sv[0]->texture->target == st->internal_target);
>>>
>>> @@ -471,22 +472,22 @@ draw_textured_quad(struct gl_context *ctx, GLint
>>> x, GLint y, GLfloat z,
>>> assert(width <= maxSize);
>>> assert(height <= maxSize);
>>>
>>> - cso_save_rasterizer(cso);
>>> - cso_save_viewport(cso);
>>> - cso_save_fragment_samplers(cso);
>>> - cso_save_fragment_sampler_views(cso);
>>> - cso_save_fragment_shader(cso);
>>> - cso_save_stream_outputs(cso);
>>> - cso_save_vertex_shader(cso);
>>> - cso_save_tessctrl_shader(cso);
>>> - cso_save_tesseval_shader(cso);
>>> - cso_save_geometry_shader(cso);
>>> - cso_save_vertex_elements(cso);
>>> - cso_save_aux_vertex_buffer_slot(cso);
>>> + cso_state_mask = (CSO_BIT_RASTERIZER |
>>> + CSO_BIT_VIEWPORT |
>>> + CSO_BIT_FRAGMENT_SAMPLERS |
>>> + CSO_BIT_FRAGMENT_SAMPLER_VIEWS |
>>
>> CSO_BIT_FRAGMENT_SHADER here
>
>
> Thanks for catching that! Fixed.
I also missed CSO_BIT_VERTEX_SHADER for the bitmap code. Fixed that too.
-Brian
More information about the mesa-dev
mailing list