zink: take a pipe_reference param in zink_batch_reference_program

this lets us reuse the function for gfx and compute programs without much
churn, since in C we can use a pointer to the first member of a struct and
a pointer to the struct interchangeably

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8781>
This commit is contained in:
Mike Blumenkrantz
2020-08-12 16:11:02 -04:00
committed by Marge Bot
parent f32891b159
commit dcab2ca6b1
3 changed files with 6 additions and 5 deletions
+2 -2
View File
@@ -179,12 +179,12 @@ zink_batch_reference_sampler_view(struct zink_batch *batch,
void
zink_batch_reference_program(struct zink_batch *batch,
struct zink_gfx_program *prog)
struct pipe_reference *prog)
{
struct set_entry *entry = _mesa_set_search(batch->programs, prog);
if (!entry) {
entry = _mesa_set_add(batch->programs, prog);
pipe_reference(NULL, &prog->reference);
pipe_reference(NULL, prog);
}
}
+3 -2
View File
@@ -29,10 +29,11 @@
#include "util/list.h"
#include "util/u_dynarray.h"
struct pipe_reference;
struct zink_context;
struct zink_fence;
struct zink_framebuffer;
struct zink_gfx_program;
struct zink_render_pass;
struct zink_resource;
struct zink_screen;
@@ -84,7 +85,7 @@ zink_batch_reference_sampler_view(struct zink_batch *batch,
void
zink_batch_reference_program(struct zink_batch *batch,
struct zink_gfx_program *prog);
struct pipe_reference *prog);
void
zink_batch_reference_surface(struct zink_batch *batch,
+1 -1
View File
@@ -525,7 +525,7 @@ zink_draw_vbo(struct pipe_context *pctx,
batch = zink_batch_rp(ctx);
assert(batch->descs_left >= gfx_program->num_descriptors);
}
zink_batch_reference_program(batch, ctx->curr_program);
zink_batch_reference_program(batch, &ctx->curr_program->reference);
VkDescriptorSet desc_set = allocate_descriptor_set(screen, batch,
gfx_program);