freedreno: Add PIPE_SHADER_IR_NIR_SERIALIZED support
Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12500>
This commit is contained in:
@@ -666,7 +666,10 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen,
|
||||
case PIPE_SHADER_CAP_PREFERRED_IR:
|
||||
return PIPE_SHADER_IR_NIR;
|
||||
case PIPE_SHADER_CAP_SUPPORTED_IRS:
|
||||
return (1 << PIPE_SHADER_IR_NIR) | (1 << PIPE_SHADER_IR_TGSI);
|
||||
return (1 << PIPE_SHADER_IR_NIR) |
|
||||
COND(has_compute(screen) && (shader == PIPE_SHADER_COMPUTE),
|
||||
(1 << PIPE_SHADER_IR_NIR_SERIALIZED)) |
|
||||
(1 << PIPE_SHADER_IR_TGSI);
|
||||
case PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT:
|
||||
return 32;
|
||||
case PIPE_SHADER_CAP_MAX_SHADER_BUFFERS:
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "util/u_string.h"
|
||||
|
||||
#include "nir/tgsi_to_nir.h"
|
||||
#include "nir_serialize.h"
|
||||
|
||||
#include "freedreno_context.h"
|
||||
#include "freedreno_util.h"
|
||||
@@ -288,6 +289,16 @@ ir3_shader_compute_state_create(struct pipe_context *pctx,
|
||||
if (cso->ir_type == PIPE_SHADER_IR_NIR) {
|
||||
/* we take ownership of the reference: */
|
||||
nir = (nir_shader *)cso->prog;
|
||||
} else if (cso->ir_type == PIPE_SHADER_IR_NIR_SERIALIZED) {
|
||||
const nir_shader_compiler_options *options =
|
||||
ir3_get_compiler_options(compiler);
|
||||
const struct pipe_binary_program_header *hdr = cso->prog;
|
||||
struct blob_reader reader;
|
||||
|
||||
blob_reader_init(&reader, hdr->blob, hdr->num_bytes);
|
||||
nir = nir_deserialize(NULL, options, &reader);
|
||||
|
||||
ir3_finalize_nir(compiler, nir);
|
||||
} else {
|
||||
debug_assert(cso->ir_type == PIPE_SHADER_IR_TGSI);
|
||||
if (ir3_shader_debug & IR3_DBG_DISASM) {
|
||||
|
||||
Reference in New Issue
Block a user