Skip to content

Commit

Permalink
llvmpipe: asst. clean-ups in lp_state_so.c
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19289>
  • Loading branch information
brianpaul authored and Marge Bot committed Oct 25, 2022
1 parent c2271fb commit 47fa82d
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/gallium/drivers/llvmpipe/lp_state_so.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand All @@ -60,21 +60,23 @@ llvmpipe_so_target_destroy(struct pipe_context *pipe,
FREE(target);
}


static uint32_t
llvmpipe_so_offset(struct pipe_stream_output_target *so_target)
{
struct draw_so_target *target = (struct draw_so_target *)so_target;
return target->internal_offset;
}


static void
llvmpipe_set_so_targets(struct pipe_context *pipe,
unsigned num_targets,
struct pipe_stream_output_target **targets,
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);
/*
Expand All @@ -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]) {
Expand All @@ -100,14 +103,16 @@ 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;

draw_set_mapped_so_targets(llvmpipe->draw, llvmpipe->num_so_targets,
llvmpipe->so_targets);
}


void
llvmpipe_init_so_funcs(struct llvmpipe_context *pipe)
{
Expand Down

0 comments on commit 47fa82d

Please sign in to comment.