shader: add BVH8 intersections and instance transforms

This commit is contained in:
nmzik committed 2026-10-29 18:37:29 +01:00
1 parent bfd4c34b88
commit 5eab0ec738
21 files changed
+964 -15

No files matched your search

@@ -155,7 +155,7 @@ KYTY_IO_FIELDS(SampledResourcePair, a, b, c)
KYTY_IO_FIELDS(StageInput, a, b, c, d, e)
KYTY_IO_FIELDS(StageOutput, a, b, c, d)
KYTY_IO_FIELDS(ShaderInfo, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z,
A, B, C, D, E, F, G, H, I, J, K, L)
A, B, C, D, E, F, G, H, I, J, K, L, M)
KYTY_IO_FIELDS(DescriptorSource::IndirectDescriptor::SelectorRead::CountedRows, a, b)
KYTY_IO_FIELDS(DescriptorSource::IndirectDescriptor::SelectorRead::MaskRanks, a, b, c)
KYTY_IO_FIELDS(DescriptorSource::IndirectDescriptor::SelectorRead, a, b, c, d, e, f, g, h, i, j, k,
@@ -543,6 +543,7 @@ struct ShaderInfo {
bool uses_image_heap = false;
bool uses_dispatch_threads = false;
bool bvh = false;
bool bvh8 = false;
bool bvh_stack = false;
bool subgroup_ballot = false;
bool subgroup_vote = false;
@@ -31,6 +31,7 @@ std::string TypeName(Type type) {
"SamplerResource",
"ImageAddress",
"F64",
"Bvh8Result",
};
const auto bits = static_cast<uint32_t>(type);
if (bits == 0) {
+1
View File
@@ -28,6 +28,7 @@ enum class Type : uint32_t {
SamplerResource = 1u << 18u,
ImageAddress = 1u << 19u,
F64 = 1u << 20u,
Bvh8Result = 1u << 21u,
};
constexpr Type operator|(Type lhs, Type rhs) {
@@ -44,6 +44,7 @@ constexpr Type AddressResource = Type::AddressResource;
constexpr Type ImageResource = Type::ImageResource;
constexpr Type SamplerResource = Type::SamplerResource;
constexpr Type ImageAddress = Type::ImageAddress;
constexpr Type Bvh8Result = Type::Bvh8Result;
constexpr std::array<OpcodeMeta, static_cast<size_t>(ValueOpcode::Count)> MetaTable = {{
#define VALUE_OPCODE(name, ...) MakeMeta(#name __VA_OPT__(, ) __VA_ARGS__),
@@ -318,6 +318,8 @@ VALUE_OPCODE(SwizzleU32, U32, U32, U32, U1)
VALUE_OPCODE(ImageQueryDimensions, U32x4, ImageResource, ImageAddress)
VALUE_OPCODE(BvhIntersect, U32x4, U32x4, ImageAddress, U1)
VALUE_OPCODE(Bvh8Intersect, Bvh8Result, U32x4, ImageAddress, U1)
VALUE_OPCODE(Bvh8Extract, U32, Bvh8Result, U32)
VALUE_OPCODE(BvhStack, U32x2, U32, U32, U32x4, U32x4, U1)
VALUE_OPCODE(ImageQueryLod, U32x4, ImageResource, SamplerResource, ImageAddress)
VALUE_OPCODE(ImageRead, U32x4, ImageResource, ImageAddress, U1)
@@ -4182,7 +4182,7 @@ private:
void Collect(Inst& inst) {
const auto op = inst.GetOpcode();
if (op == ValueOpcode::BvhIntersect) {
if (op == ValueOpcode::BvhIntersect || op == ValueOpcode::Bvh8Intersect) {
m_info.uses_dma = true;
return;
}
@@ -515,6 +515,7 @@ void Visit(Program& program, ShaderStageInputInfo input_info, InputUsage& inputs
case ValueOpcode::StoreCompletion: info.subgroup_barrier = true; break;
case ValueOpcode::DataCacheInvalidate: info.coherent_buffers = true; break;
case ValueOpcode::BvhIntersect: info.bvh = true; break;
case ValueOpcode::Bvh8Intersect: info.bvh8 = true; break;
case ValueOpcode::BvhStack: info.bvh_stack = true; break;
case ValueOpcode::ConditionRef:
info.subgroup_vote |=