mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 17:58:26 +02:00
zink: move create_pipeline_lib to zink_program.c
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18868>
This commit is contained in:
parent
2136047624
commit
3d4c8b55e8
3 changed files with 32 additions and 29 deletions
|
|
@ -1525,6 +1525,17 @@ zink_create_cached_shader_state(struct pipe_context *pctx, const struct pipe_sha
|
|||
return util_live_shader_cache_get(pctx, &screen->shaders, shader, &cache_hit);
|
||||
}
|
||||
|
||||
void
|
||||
zink_create_pipeline_lib(struct zink_screen *screen, struct zink_gfx_program *prog, struct zink_gfx_pipeline_state *state, enum pipe_prim_type mode)
|
||||
{
|
||||
struct zink_gfx_library_key *gkey = rzalloc(prog, struct zink_gfx_library_key);
|
||||
gkey->hw_rast_state = state->rast_state;
|
||||
memcpy(gkey->modules, state->modules, sizeof(gkey->modules));
|
||||
bool line = u_reduced_prim(mode) == PIPE_PRIM_LINES;
|
||||
gkey->pipeline = zink_create_gfx_pipeline_library(screen, prog, (struct zink_rasterizer_hw_state*)state, line);
|
||||
_mesa_set_add(&prog->libs[get_primtype_idx(mode)], gkey);
|
||||
}
|
||||
|
||||
void
|
||||
zink_program_init(struct zink_context *ctx)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "util/u_prim.h"
|
||||
|
||||
struct gfx_pipeline_cache_entry {
|
||||
struct zink_gfx_pipeline_state state;
|
||||
|
|
@ -123,10 +123,29 @@ zink_gfx_program_update(struct zink_context *ctx);
|
|||
void
|
||||
zink_gfx_program_update_optimal(struct zink_context *ctx);
|
||||
|
||||
|
||||
void
|
||||
zink_create_pipeline_lib(struct zink_screen *screen, struct zink_gfx_program *prog, struct zink_gfx_pipeline_state *state, enum pipe_prim_type mode);
|
||||
uint32_t hash_gfx_output(const void *key);
|
||||
uint32_t hash_gfx_input(const void *key);
|
||||
uint32_t hash_gfx_input_dynamic(const void *key);
|
||||
|
||||
|
||||
static inline unsigned
|
||||
get_primtype_idx(enum pipe_prim_type mode)
|
||||
{
|
||||
if (mode == PIPE_PRIM_PATCHES)
|
||||
return 3;
|
||||
switch (u_reduced_prim(mode)) {
|
||||
case PIPE_PRIM_POINTS:
|
||||
return 0;
|
||||
case PIPE_PRIM_LINES:
|
||||
return 1;
|
||||
default:
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
struct zink_gfx_program *
|
||||
zink_create_gfx_program(struct zink_context *ctx,
|
||||
struct zink_shader **stages,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include "zink_pipeline.h"
|
||||
#include "zink_program.h"
|
||||
#include "zink_screen.h"
|
||||
#include "util/u_prim.h"
|
||||
|
||||
|
||||
template <zink_dynamic_state DYNAMIC_STATE>
|
||||
|
|
@ -44,32 +43,6 @@ hash_gfx_pipeline_state(const void *key)
|
|||
return XXH32(&state->dyn_state1, sizeof(state->dyn_state1), hash);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
get_primtype_idx(enum pipe_prim_type mode)
|
||||
{
|
||||
if (mode == PIPE_PRIM_PATCHES)
|
||||
return 3;
|
||||
switch (u_reduced_prim(mode)) {
|
||||
case PIPE_PRIM_POINTS:
|
||||
return 0;
|
||||
case PIPE_PRIM_LINES:
|
||||
return 1;
|
||||
default:
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
create_pipeline_lib(struct zink_screen *screen, struct zink_gfx_program *prog, struct zink_gfx_pipeline_state *state, enum pipe_prim_type mode)
|
||||
{
|
||||
struct zink_gfx_library_key *gkey = rzalloc(prog, struct zink_gfx_library_key);
|
||||
gkey->hw_rast_state = state->rast_state;
|
||||
memcpy(gkey->modules, state->modules, sizeof(gkey->modules));
|
||||
bool line = u_reduced_prim(mode) == PIPE_PRIM_LINES;
|
||||
gkey->pipeline = zink_create_gfx_pipeline_library(screen, prog, (struct zink_rasterizer_hw_state*)state, line);
|
||||
_mesa_set_add(&prog->libs[get_primtype_idx(mode)], gkey);
|
||||
}
|
||||
|
||||
template <bool HAS_DYNAMIC>
|
||||
static unsigned
|
||||
get_pipeline_idx(enum pipe_prim_type mode, VkPrimitiveTopology vkmode)
|
||||
|
|
@ -240,7 +213,7 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
|
|||
/* TODO: this will eventually be pre-populated by async shader compile */
|
||||
//struct set_entry *he = _mesa_set_search(&prog->libs[idx], &ctx->gfx_pipeline_state.gkey);
|
||||
if (!he && (zink_debug & ZINK_DEBUG_GPL)) {
|
||||
create_pipeline_lib(screen, prog, &ctx->gfx_pipeline_state, mode);
|
||||
zink_create_pipeline_lib(screen, prog, &ctx->gfx_pipeline_state, mode);
|
||||
he = _mesa_set_search(&prog->libs[idx], &ctx->gfx_pipeline_state.gkey);
|
||||
assert(he);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue