Add reflection support for ray tracing acceleration structures

This commit is contained in:
Patrick Mours 2019-03-26 15:02:00 +01:00
parent 524bd43deb
commit b2a667520d
4 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_NV_ray_tracing : require
layout(set = 0, binding = 1) uniform accelerationStructureNV as;
void main()
{
traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, vec3(1.0), 1000.0, 0);
}

View File

@ -820,6 +820,11 @@ ShaderResources Compiler::get_shader_resources(const unordered_set<uint32_t> *ac
{ {
res.atomic_counters.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); 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)
{
res.acceleration_structures.push_back({ var.self, var.basetype, type.self, get_name(var.self) });
}
}); });
return res; return res;

View File

@ -62,6 +62,7 @@ struct ShaderResources
std::vector<Resource> storage_images; std::vector<Resource> storage_images;
std::vector<Resource> sampled_images; std::vector<Resource> sampled_images;
std::vector<Resource> atomic_counters; std::vector<Resource> atomic_counters;
std::vector<Resource> acceleration_structures;
// There can only be one push constant block, // There can only be one push constant block,
// but keep the vector in case this restriction is lifted in the future. // but keep the vector in case this restriction is lifted in the future.

View File

@ -436,6 +436,7 @@ void CompilerReflection::emit_resources()
emit_resources("ubos", res.uniform_buffers); emit_resources("ubos", res.uniform_buffers);
emit_resources("push_constants", res.push_constant_buffers); emit_resources("push_constants", res.push_constant_buffers);
emit_resources("counters", res.atomic_counters); emit_resources("counters", res.atomic_counters);
emit_resources("acceleration_structures", res.acceleration_structures);
} }
void CompilerReflection::emit_resources(const char *tag, const vector<Resource> &resources) void CompilerReflection::emit_resources(const char *tag, const vector<Resource> &resources)