Handle RayQueryKHR type.

Do not error out in parsing in shaders which use ray queries.
This commit is contained in:
Hans-Kristian Arntzen 2020-04-21 14:25:18 +02:00
parent 78b4d9379b
commit 6b0e558169
6 changed files with 17 additions and 7 deletions

View File

@ -323,7 +323,7 @@ if (SPIRV_CROSS_STATIC)
endif()
set(spirv-cross-abi-major 0)
set(spirv-cross-abi-minor 32)
set(spirv-cross-abi-minor 33)
set(spirv-cross-abi-patch 0)
if (SPIRV_CROSS_SHARED)

View File

@ -530,7 +530,8 @@ struct SPIRType : IVariant
Image,
SampledImage,
Sampler,
AccelerationStructureNV,
AccelerationStructure,
RayQuery,
// Keep internal types at the end.
ControlPointArray,

View File

@ -871,7 +871,7 @@ ShaderResources Compiler::get_shader_resources(const unordered_set<VariableID> *
res.atomic_counters.push_back({ var.self, var.basetype, type.self, get_name(var.self) });
}
// Acceleration structures
else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::AccelerationStructureNV)
else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::AccelerationStructure)
{
res.acceleration_structures.push_back({ var.self, var.basetype, type.self, get_name(var.self) });
}

View File

@ -33,7 +33,7 @@ extern "C" {
/* Bumped if ABI or API breaks backwards compatibility. */
#define SPVC_C_API_VERSION_MAJOR 0
/* Bumped if APIs or enumerations are added in a backwards compatible way. */
#define SPVC_C_API_VERSION_MINOR 32
#define SPVC_C_API_VERSION_MINOR 33
/* Bumped if internal implementation details change. */
#define SPVC_C_API_VERSION_PATCH 0
@ -210,6 +210,7 @@ typedef enum spvc_resource_type
SPVC_RESOURCE_TYPE_SEPARATE_IMAGE = 10,
SPVC_RESOURCE_TYPE_SEPARATE_SAMPLERS = 11,
SPVC_RESOURCE_TYPE_ACCELERATION_STRUCTURE = 12,
SPVC_RESOURCE_TYPE_RAY_QUERY = 13,
SPVC_RESOURCE_TYPE_INT_MAX = 0x7fffffff
} spvc_resource_type;

View File

@ -11498,7 +11498,7 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id)
// this distinction into the type system.
return comparison_ids.count(id) ? "samplerShadow" : "sampler";
case SPIRType::AccelerationStructureNV:
case SPIRType::AccelerationStructure:
return "accelerationStructureNV";
case SPIRType::Void:

View File

@ -683,11 +683,19 @@ void Parser::parse(const Instruction &instruction)
break;
}
case OpTypeAccelerationStructureNV:
case OpTypeAccelerationStructureKHR:
{
uint32_t id = ops[0];
auto &type = set<SPIRType>(id);
type.basetype = SPIRType::AccelerationStructureNV;
type.basetype = SPIRType::AccelerationStructure;
break;
}
case OpTypeRayQueryProvisionalKHR:
{
uint32_t id = ops[0];
auto &type = set<SPIRType>(id);
type.basetype = SPIRType::RayQuery;
break;
}