anv/pipeline: Remove support for direct-from-nir shaders

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Jason Ekstrand
2016-10-07 21:50:31 -07:00
parent 6d557ae403
commit 7df46b7533
2 changed files with 57 additions and 80 deletions

View File

@@ -57,7 +57,6 @@ VkResult anv_CreateShaderModule(
if (module == NULL) if (module == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
module->nir = NULL;
module->size = pCreateInfo->codeSize; module->size = pCreateInfo->codeSize;
memcpy(module->data, pCreateInfo->pCode, module->size); memcpy(module->data, pCreateInfo->pCode, module->size);
@@ -100,20 +99,6 @@ anv_shader_compile_to_nir(struct anv_device *device,
const nir_shader_compiler_options *nir_options = const nir_shader_compiler_options *nir_options =
compiler->glsl_compiler_options[stage].NirOptions; compiler->glsl_compiler_options[stage].NirOptions;
nir_shader *nir;
nir_function *entry_point;
if (module->nir) {
/* Some things such as our meta clear/blit code will give us a NIR
* shader directly. In that case, we just ignore the SPIR-V entirely
* and just use the NIR shader */
nir = module->nir;
nir->options = nir_options;
nir_validate_shader(nir);
assert(exec_list_length(&nir->functions) == 1);
struct exec_node *node = exec_list_get_head(&nir->functions);
entry_point = exec_node_data(nir_function, node, node);
} else {
uint32_t *spirv = (uint32_t *) module->data; uint32_t *spirv = (uint32_t *) module->data;
assert(spirv[0] == SPIR_V_MAGIC_NUMBER); assert(spirv[0] == SPIR_V_MAGIC_NUMBER);
assert(module->size % 4 == 0); assert(module->size % 4 == 0);
@@ -133,10 +118,11 @@ anv_shader_compile_to_nir(struct anv_device *device,
} }
} }
entry_point = spirv_to_nir(spirv, module->size / 4, nir_function *entry_point =
spirv_to_nir(spirv, module->size / 4,
spec_entries, num_spec_entries, spec_entries, num_spec_entries,
stage, entrypoint_name, nir_options); stage, entrypoint_name, nir_options);
nir = entry_point->shader; nir_shader *nir = entry_point->shader;
assert(nir->stage == stage); assert(nir->stage == stage);
nir_validate_shader(nir); nir_validate_shader(nir);
@@ -174,7 +160,6 @@ anv_shader_compile_to_nir(struct anv_device *device,
nir_lower_system_values(nir); nir_lower_system_values(nir);
nir_validate_shader(nir); nir_validate_shader(nir);
}
/* Vulkan uses the separate-shader linking model */ /* Vulkan uses the separate-shader linking model */
nir->info.separate_shader = true; nir->info.separate_shader = true;
@@ -471,7 +456,6 @@ anv_pipeline_compile_vs(struct anv_pipeline *pipeline,
void *mem_ctx = ralloc_context(NULL); void *mem_ctx = ralloc_context(NULL);
if (module->nir == NULL)
ralloc_steal(mem_ctx, nir); ralloc_steal(mem_ctx, nir);
prog_data.inputs_read = nir->info.inputs_read; prog_data.inputs_read = nir->info.inputs_read;
@@ -560,7 +544,6 @@ anv_pipeline_compile_gs(struct anv_pipeline *pipeline,
void *mem_ctx = ralloc_context(NULL); void *mem_ctx = ralloc_context(NULL);
if (module->nir == NULL)
ralloc_steal(mem_ctx, nir); ralloc_steal(mem_ctx, nir);
brw_compute_vue_map(&pipeline->device->info, brw_compute_vue_map(&pipeline->device->info,
@@ -690,7 +673,6 @@ anv_pipeline_compile_fs(struct anv_pipeline *pipeline,
void *mem_ctx = ralloc_context(NULL); void *mem_ctx = ralloc_context(NULL);
if (module->nir == NULL)
ralloc_steal(mem_ctx, nir); ralloc_steal(mem_ctx, nir);
unsigned code_size; unsigned code_size;
@@ -763,7 +745,6 @@ anv_pipeline_compile_cs(struct anv_pipeline *pipeline,
void *mem_ctx = ralloc_context(NULL); void *mem_ctx = ralloc_context(NULL);
if (module->nir == NULL)
ralloc_steal(mem_ctx, nir); ralloc_steal(mem_ctx, nir);
unsigned code_size; unsigned code_size;

View File

@@ -1346,11 +1346,7 @@ struct anv_event {
struct anv_state state; struct anv_state state;
}; };
struct nir_shader;
struct anv_shader_module { struct anv_shader_module {
struct nir_shader * nir;
unsigned char sha1[20]; unsigned char sha1[20];
uint32_t size; uint32_t size;
char data[0]; char data[0];