llvmpipe: asst. clean-ups in lp_state_so.c

Signed-off-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19289>
This commit is contained in:
Brian Paul
2022-09-21 11:30:13 -06:00
committed by Marge Bot
parent c2271fb787
commit 47fa82d48e

View File

@@ -32,15 +32,14 @@
#include "util/u_memory.h"
#include "draw/draw_context.h"
static struct pipe_stream_output_target *
llvmpipe_create_so_target(struct pipe_context *pipe,
struct pipe_resource *buffer,
unsigned buffer_offset,
unsigned buffer_size)
{
struct draw_so_target *t;
t = CALLOC_STRUCT(draw_so_target);
struct draw_so_target *t = CALLOC_STRUCT(draw_so_target);
if (!t)
return NULL;
@@ -51,7 +50,8 @@ llvmpipe_create_so_target(struct pipe_context *pipe,
t->target.buffer_size = buffer_size;
return &t->target;
}
static void
llvmpipe_so_target_destroy(struct pipe_context *pipe,
struct pipe_stream_output_target *target)
@@ -60,6 +60,7 @@ llvmpipe_so_target_destroy(struct pipe_context *pipe,
FREE(target);
}
static uint32_t
llvmpipe_so_offset(struct pipe_stream_output_target *so_target)
{
@@ -67,6 +68,7 @@ llvmpipe_so_offset(struct pipe_stream_output_target *so_target)
return target->internal_offset;
}
static void
llvmpipe_set_so_targets(struct pipe_context *pipe,
unsigned num_targets,
@@ -74,7 +76,7 @@ llvmpipe_set_so_targets(struct pipe_context *pipe,
const unsigned *offsets)
{
struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
int i;
unsigned i;
for (i = 0; i < num_targets; i++) {
const boolean append = (offsets[i] == (unsigned)-1);
/*
@@ -83,10 +85,11 @@ llvmpipe_set_so_targets(struct pipe_context *pipe,
* Otherwise should just assert.
*/
if (targets[i] && targets[i]->context != pipe) {
debug_printf("Illegal setting of so target with target %d created in "
"another context\n", i);
debug_printf("Illegal setting of so target with target %d created "
"in another context\n", i);
}
pipe_so_target_reference((struct pipe_stream_output_target **)&llvmpipe->so_targets[i], targets[i]);
pipe_so_target_reference((struct pipe_stream_output_target **)
&llvmpipe->so_targets[i], targets[i]);
/* If we're not appending then lets set the internal
offset to what was requested */
if (!append && llvmpipe->so_targets[i]) {
@@ -100,7 +103,8 @@ llvmpipe_set_so_targets(struct pipe_context *pipe,
}
for (; i < llvmpipe->num_so_targets; i++) {
pipe_so_target_reference((struct pipe_stream_output_target **)&llvmpipe->so_targets[i], NULL);
pipe_so_target_reference((struct pipe_stream_output_target **)
&llvmpipe->so_targets[i], NULL);
}
llvmpipe->num_so_targets = num_targets;
@@ -108,6 +112,7 @@ llvmpipe_set_so_targets(struct pipe_context *pipe,
llvmpipe->so_targets);
}
void
llvmpipe_init_so_funcs(struct llvmpipe_context *pipe)
{