Add support for "shaderRecordNV" qualifier

This commit is contained in:
Patrick Mours 2019-06-03 15:25:21 +02:00
parent af40a212c2
commit 789178666f
3 changed files with 46 additions and 2 deletions

View File

@ -0,0 +1,17 @@
#version 460
#extension GL_NV_ray_tracing : require
layout(shaderRecordNV) buffer sbt
{
vec3 direction;
float tmax;
} _20;
layout(set = 0, binding = 0) uniform accelerationStructureNV as;
layout(location = 0) rayPayloadNV float payload;
void main()
{
traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, _20.direction, _20.tmax, 0);
}

View File

@ -0,0 +1,16 @@
#version 460
#extension GL_NV_ray_tracing : require
layout(shaderRecordNV) buffer sbt
{
vec3 direction;
float tmax;
};
layout(set = 0, binding = 0) uniform accelerationStructureNV as;
layout(location = 0) rayPayloadNV float payload;
void main()
{
traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, direction, tmax, 0);
}

View File

@ -1410,6 +1410,8 @@ string CompilerGLSL::layout_for_variable(const SPIRVariable &var)
if (options.vulkan_semantics && var.storage == StorageClassPushConstant)
attr.push_back("push_constant");
else if (var.storage == StorageClassShaderRecordBufferNV)
attr.push_back("shaderRecordNV");
if (flags.get(DecorationRowMajor))
attr.push_back("row_major");
@ -1745,7 +1747,7 @@ void CompilerGLSL::emit_buffer_block_native(const SPIRVariable &var)
auto &type = get<SPIRType>(var.basetype);
Bitset flags = ir.get_buffer_block_flags(var);
bool ssbo = var.storage == StorageClassStorageBuffer ||
bool ssbo = var.storage == StorageClassStorageBuffer || var.storage == StorageClassShaderRecordBufferNV ||
ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock);
bool is_restrict = ssbo && flags.get(DecorationRestrict);
bool is_writeonly = ssbo && flags.get(DecorationNonReadable);
@ -1862,6 +1864,14 @@ const char *CompilerGLSL::to_storage_qualifiers_glsl(const SPIRVariable &var)
{
return "hitAttributeNV ";
}
else if (var.storage == StorageClassCallableDataNV)
{
return "callableDataNV";
}
else if (var.storage == StorageClassIncomingCallableDataNV)
{
return "callableDataInNV";
}
return "";
}
@ -2563,7 +2573,8 @@ void CompilerGLSL::emit_resources()
ir.for_each_typed_id<SPIRVariable>([&](uint32_t, SPIRVariable &var) {
auto &type = this->get<SPIRType>(var.basetype);
bool is_block_storage = type.storage == StorageClassStorageBuffer || type.storage == StorageClassUniform;
bool is_block_storage = type.storage == StorageClassStorageBuffer || type.storage == StorageClassUniform ||
type.storage == StorageClassShaderRecordBufferNV;
bool has_block_flags = ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock) ||
ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock);