break;
case SpvOpMemoryModel:
- vtn_assert(w[1] == SpvAddressingModelLogical ||
- (b->options &&
- b->options->caps.physical_storage_buffer_address &&
- w[1] == SpvAddressingModelPhysicalStorageBuffer64EXT));
+ switch (w[1]) {
+ case SpvAddressingModelPhysical32:
+ vtn_fail_if(b->shader->info.stage != MESA_SHADER_KERNEL,
+ "AddressingModelPhysical32 only supported for kernels");
+ b->shader->info.cs.ptr_size = 32;
+ b->physical_ptrs = true;
+ break;
+ case SpvAddressingModelPhysical64:
+ vtn_fail_if(b->shader->info.stage != MESA_SHADER_KERNEL,
+ "AddressingModelPhysical64 only supported for kernels");
+ b->shader->info.cs.ptr_size = 64;
+ b->physical_ptrs = true;
+ break;
+ case SpvAddressingModelLogical:
+ vtn_fail_if(b->shader->info.stage >= MESA_SHADER_STAGES,
+ "AddressingModelLogical only supported for shaders");
+ b->shader->info.cs.ptr_size = 0;
+ b->physical_ptrs = false;
+ break;
+ case SpvAddressingModelPhysicalStorageBuffer64EXT:
+ vtn_fail_if(!b->options ||
+ !b->options->caps.physical_storage_buffer_address,
+ "AddressingModelPhysicalStorageBuffer64EXT not supported");
+ break;
+ default:
+ vtn_fail("Unknown addressing model");
+ break;
+ }
+
vtn_assert(w[2] == SpvMemoryModelSimple ||
- w[2] == SpvMemoryModelGLSL450);
+ w[2] == SpvMemoryModelGLSL450 ||
+ w[2] == SpvMemoryModelOpenCL);
break;
case SpvOpEntryPoint:
/* Skip the SPIR-V header, handled at vtn_create_builder */
words+= 5;
+ b->shader = nir_shader_create(b, stage, nir_options, NULL);
+
/* Handle all the preamble instructions */
words = vtn_foreach_instruction(b, words, word_end,
vtn_handle_preamble_instruction);
return NULL;
}
- b->shader = nir_shader_create(b, stage, nir_options, NULL);
-
/* Set shader info defaults */
b->shader->info.gs.invocations = 1;