Browse Source

llvmpipe: handle serialized nir as a shader type.

Acked-by: Roland Scheidegger <sroland@vmware.com>
master
Dave Airlie 7 years ago
parent
commit
22d631e235

+ 4
- 0
src/gallium/drivers/llvmpipe/lp_screen.c View File

if(winsys->destroy) if(winsys->destroy)
winsys->destroy(winsys); winsys->destroy(winsys);


glsl_type_singleton_decref();

mtx_destroy(&screen->rast_mutex); mtx_destroy(&screen->rast_mutex);
mtx_destroy(&screen->cs_mutex); mtx_destroy(&screen->cs_mutex);
FREE(screen); FREE(screen);


util_cpu_detect(); util_cpu_detect();


glsl_type_singleton_init_or_ref();

#ifdef DEBUG #ifdef DEBUG
LP_DEBUG = debug_get_flags_option("LP_DEBUG", lp_debug_flags, 0 ); LP_DEBUG = debug_get_flags_option("LP_DEBUG", lp_debug_flags, 0 );
#endif #endif

+ 15
- 4
src/gallium/drivers/llvmpipe/lp_state_cs.c View File

#include "lp_cs_tpool.h" #include "lp_cs_tpool.h"
#include "state_tracker/sw_winsys.h" #include "state_tracker/sw_winsys.h"
#include "nir/nir_to_tgsi_info.h" #include "nir/nir_to_tgsi_info.h"
#include "nir_serialize.h"
struct lp_cs_job_info { struct lp_cs_job_info {
unsigned grid_size[3]; unsigned grid_size[3];
unsigned block_size[3]; unsigned block_size[3];
return NULL; return NULL;


shader->base.type = templ->ir_type; shader->base.type = templ->ir_type;
if (templ->ir_type == PIPE_SHADER_IR_TGSI) {
if (templ->ir_type == PIPE_SHADER_IR_NIR_SERIALIZED) {
struct blob_reader reader;
const struct pipe_binary_program_header *hdr = templ->prog;

blob_reader_init(&reader, hdr->blob, hdr->num_bytes);
shader->base.ir.nir = nir_deserialize(NULL, pipe->screen->get_compiler_options(pipe->screen, PIPE_SHADER_IR_NIR, PIPE_SHADER_COMPUTE), &reader);
shader->base.type = PIPE_SHADER_IR_NIR;

pipe->screen->finalize_nir(pipe->screen, shader->base.ir.nir, false);
} else if (templ->ir_type == PIPE_SHADER_IR_NIR)
shader->base.ir.nir = (struct nir_shader *)templ->prog;

if (shader->base.type == PIPE_SHADER_IR_TGSI) {
/* get/save the summary info for this shader */ /* get/save the summary info for this shader */
lp_build_tgsi_info(templ->prog, &shader->info); lp_build_tgsi_info(templ->prog, &shader->info);


/* we need to keep a local copy of the tokens */ /* we need to keep a local copy of the tokens */
shader->base.tokens = tgsi_dup_tokens(templ->prog); shader->base.tokens = tgsi_dup_tokens(templ->prog);
} else { } else {
shader->base.ir.nir = (struct nir_shader *)templ->prog;
nir_tgsi_scan_shader(templ->prog, &shader->info.base, false);
nir_tgsi_scan_shader(shader->base.ir.nir, &shader->info.base, false);
} }


shader->req_local_mem = templ->req_local_mem; shader->req_local_mem = templ->req_local_mem;

Loading…
Cancel
Save