diff options
author | Karol Herbst <[email protected]> | 2019-05-10 09:28:15 +0200 |
---|---|---|
committer | Karol Herbst <[email protected]> | 2019-09-21 08:28:32 +0000 |
commit | 7955fabcf89c7265f7f4244e46c5bcb83b9687fa (patch) | |
tree | b803fb6496b9b371a33c3cfce1835c9c84740f73 /src/gallium/drivers/nouveau/nvc0 | |
parent | deb04adf2ae605a017d7ce4e81f57db679567dfa (diff) |
nvc0: expose spirv support
required for OpenCL
v2: adjust to changes in previous commits
v3: properly convert to NIR in nvc0_cp_state_create
Signed-off-by: Karol Herbst <[email protected]>
Reviewed-by: Pierre Moreau <[email protected]> (v1)
Diffstat (limited to 'src/gallium/drivers/nouveau/nvc0')
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_state.c | 10 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index b1e12432e14..a78b6222c6b 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -418,9 +418,13 @@ nvc0_screen_get_shader_param(struct pipe_screen *pscreen, switch (param) { case PIPE_SHADER_CAP_PREFERRED_IR: return screen->prefer_nir ? PIPE_SHADER_IR_NIR : PIPE_SHADER_IR_TGSI; - case PIPE_SHADER_CAP_SUPPORTED_IRS: - return 1 << PIPE_SHADER_IR_TGSI | - 1 << PIPE_SHADER_IR_NIR; + case PIPE_SHADER_CAP_SUPPORTED_IRS: { + uint32_t irs = 1 << PIPE_SHADER_IR_TGSI | + 1 << PIPE_SHADER_IR_NIR; + if (screen->force_enable_cl) + irs |= 1 << PIPE_SHADER_IR_NIR_SERIALIZED; + return irs; + } case PIPE_SHADER_CAP_MAX_INSTRUCTIONS: case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS: case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS: diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c index 60dcbe3ec39..6fde2de9469 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c @@ -28,6 +28,7 @@ #include "tgsi/tgsi_parse.h" #include "compiler/nir/nir.h" +#include "compiler/nir/nir_serialize.h" #include "nvc0/nvc0_stateobj.h" #include "nvc0/nvc0_context.h" @@ -740,6 +741,15 @@ nvc0_cp_state_create(struct pipe_context *pipe, case PIPE_SHADER_IR_NIR: prog->pipe.ir.nir = (nir_shader *)cso->prog; break; + case PIPE_SHADER_IR_NIR_SERIALIZED: { + struct blob_reader reader; + const struct pipe_binary_program_header *hdr = cso->prog; + + blob_reader_init(&reader, hdr->blob, hdr->num_bytes); + prog->pipe.ir.nir = nir_deserialize(NULL, pipe->screen->get_compiler_options(pipe->screen, PIPE_SHADER_IR_NIR, PIPE_SHADER_COMPUTE), &reader); + prog->pipe.type = PIPE_SHADER_IR_NIR; + break; + } default: assert(!"unsupported IR!"); free(prog); |