mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 10:50:16 +01:00
draw: asst. clean-ups in draw_pipe_pstipple.c
Signed-off-by: Brian Paul <brianp@vmware.com> Acked-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19024>
This commit is contained in:
parent
3c1cba7038
commit
aa2eabbc2d
1 changed files with 16 additions and 20 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
*
|
||||
* Copyright 2008 VMware, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
|
|
@ -10,11 +10,11 @@
|
|||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -183,7 +183,7 @@ bind_pstip_fragment_shader(struct pstip_stage *pstip)
|
|||
|
||||
|
||||
static inline struct pstip_stage *
|
||||
pstip_stage( struct draw_stage *stage )
|
||||
pstip_stage(struct draw_stage *stage)
|
||||
{
|
||||
return (struct pstip_stage *) stage;
|
||||
}
|
||||
|
|
@ -244,7 +244,7 @@ pstip_flush(struct draw_stage *stage, unsigned flags)
|
|||
struct pipe_context *pipe = pstip->pipe;
|
||||
|
||||
stage->tri = pstip_first_tri;
|
||||
stage->next->flush( stage->next, flags );
|
||||
stage->next->flush(stage->next, flags);
|
||||
|
||||
/* restore original frag shader, texture, sampler state */
|
||||
draw->suspend_flushing = TRUE;
|
||||
|
|
@ -265,7 +265,7 @@ pstip_flush(struct draw_stage *stage, unsigned flags)
|
|||
static void
|
||||
pstip_reset_stipple_counter(struct draw_stage *stage)
|
||||
{
|
||||
stage->next->reset_stipple_counter( stage->next );
|
||||
stage->next->reset_stipple_counter(stage->next);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -273,9 +273,8 @@ static void
|
|||
pstip_destroy(struct draw_stage *stage)
|
||||
{
|
||||
struct pstip_stage *pstip = pstip_stage(stage);
|
||||
uint i;
|
||||
|
||||
for (i = 0; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) {
|
||||
for (unsigned i = 0; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) {
|
||||
pipe_sampler_view_reference(&pstip->state.sampler_views[i], NULL);
|
||||
}
|
||||
|
||||
|
|
@ -287,8 +286,8 @@ pstip_destroy(struct draw_stage *stage)
|
|||
pipe_sampler_view_reference(&pstip->sampler_view, NULL);
|
||||
}
|
||||
|
||||
draw_free_temp_verts( stage );
|
||||
FREE( stage );
|
||||
draw_free_temp_verts(stage);
|
||||
FREE(stage);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -312,14 +311,14 @@ draw_pstip_stage(struct draw_context *draw, struct pipe_context *pipe)
|
|||
pstip->stage.reset_stipple_counter = pstip_reset_stipple_counter;
|
||||
pstip->stage.destroy = pstip_destroy;
|
||||
|
||||
if (!draw_alloc_temp_verts( &pstip->stage, 8 ))
|
||||
if (!draw_alloc_temp_verts(&pstip->stage, 8))
|
||||
goto fail;
|
||||
|
||||
return pstip;
|
||||
|
||||
fail:
|
||||
if (pstip)
|
||||
pstip->stage.destroy( &pstip->stage );
|
||||
pstip->stage.destroy(&pstip->stage);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -397,14 +396,13 @@ pstip_bind_sampler_states(struct pipe_context *pipe,
|
|||
unsigned start, unsigned num, void **sampler)
|
||||
{
|
||||
struct pstip_stage *pstip = pstip_stage_from_pipe(pipe);
|
||||
uint i;
|
||||
|
||||
assert(start == 0);
|
||||
|
||||
if (shader == PIPE_SHADER_FRAGMENT) {
|
||||
/* save current */
|
||||
memcpy(pstip->state.samplers, sampler, num * sizeof(void *));
|
||||
for (i = num; i < PIPE_MAX_SAMPLERS; i++) {
|
||||
for (unsigned i = num; i < PIPE_MAX_SAMPLERS; i++) {
|
||||
pstip->state.samplers[i] = NULL;
|
||||
}
|
||||
pstip->num_samplers = num;
|
||||
|
|
@ -424,10 +422,10 @@ pstip_set_sampler_views(struct pipe_context *pipe,
|
|||
struct pipe_sampler_view **views)
|
||||
{
|
||||
struct pstip_stage *pstip = pstip_stage_from_pipe(pipe);
|
||||
uint i;
|
||||
|
||||
if (shader == PIPE_SHADER_FRAGMENT) {
|
||||
/* save current */
|
||||
unsigned i;
|
||||
for (i = 0; i < num; i++) {
|
||||
pipe_sampler_view_reference(&pstip->state.sampler_views[start + i],
|
||||
views[i]);
|
||||
|
|
@ -471,14 +469,12 @@ boolean
|
|||
draw_install_pstipple_stage(struct draw_context *draw,
|
||||
struct pipe_context *pipe)
|
||||
{
|
||||
struct pstip_stage *pstip;
|
||||
|
||||
pipe->draw = (void *) draw;
|
||||
|
||||
/*
|
||||
* Create / install pgon stipple drawing / prim stage
|
||||
*/
|
||||
pstip = draw_pstip_stage( draw, pipe );
|
||||
struct pstip_stage *pstip = draw_pstip_stage(draw, pipe);
|
||||
if (!pstip)
|
||||
goto fail;
|
||||
|
||||
|
|
@ -520,7 +516,7 @@ draw_install_pstipple_stage(struct draw_context *draw,
|
|||
|
||||
fail:
|
||||
if (pstip)
|
||||
pstip->stage.destroy( &pstip->stage );
|
||||
pstip->stage.destroy(&pstip->stage);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue