Rework API graphique Vulkan - EnTT pour ECS + Chargement modèle 3D assimp + SDL3 pour events input et fenetre + mesh texture camera transform ok + attention tous les assets nouveaus ne sont pas commités et il y a du code test en dur dans scene addentity + restructuration globale

This commit is contained in:
Tom Ray
2026-03-14 20:24:17 +01:00
parent 7c352bc280
commit 6695d46bcd
672 changed files with 238656 additions and 1821 deletions

View File

@@ -0,0 +1,40 @@
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo -e "error: missing path to DXC"
echo -e "\nUsage:\n compile_shaders.sh <path to DXC>\n"
fi
DXC_EXE=$1
echo "Using DXC at $DXC_EXE"
function exec_dxc {
echo $1
eval $1
}
#exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T cs_6_5 -E CS -Fo rayquery_assign.cs.spv rayquery_assign.cs.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T cs_6_5 -E main -Fo rayquery_equal.cs.spv rayquery_equal.cs.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T ds_6_5 -E main -Fo rayquery_init_ds.spv rayquery_init_ds.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T gs_6_5 -E main -Fo rayquery_init_gs.spv rayquery_init_gs.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T hs_6_5 -E main -Fo rayquery_init_hs.spv rayquery_init_hs.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T ps_6_5 -E main -Fo rayquery_init_ps.spv rayquery_init_ps.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo rayquery_init_rahit.spv rayquery_init_rahit.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo rayquery_init_rcall.spv rayquery_init_rcall.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo rayquery_init_rchit.spv rayquery_init_rchit.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo rayquery_init_rgen.spv rayquery_init_rgen.hlsl"
#exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo rayquery_init_rint.spv rayquery_init_rint.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo rayquery_init_rmiss.spv rayquery_init_rmiss.hlsl"
#exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo rayquery_init_vs.spv rayquery_init_vs.hlsl"
#exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo rayquery_tryAllOps.cs.spv rayquery_tryAllOps.cs.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T cs_6_4 -E main -Fo raytracing.acceleration-structure.spv raytracing.acceleration-structure.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo raytracing.khr.closesthit.spv raytracing.khr.closesthit.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T cs_6_4 -E main -Fo raytracing.nv.acceleration-structure.spv raytracing.nv.acceleration-structure.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -fspv-extension=SPV_NV_ray_tracing -Fo raytracing.nv.anyhit.spv raytracing.nv.anyhit.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo raytracing.nv.callable.spv raytracing.nv.callable.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo raytracing.nv.closesthit.spv raytracing.nv.closesthit.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo raytracing.nv.enum.spv raytracing.nv.enum.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo raytracing.nv.intersection.spv raytracing.nv.intersection.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -fspv-extension=SPV_NV_ray_tracing -Fo raytracing.nv.library.spv raytracing.nv.library.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo raytracing.nv.miss.spv raytracing.nv.miss.hlsl"
exec_dxc "$DXC_EXE -spirv -fspv-target-env=vulkan1.2 -T lib_6_3 -Fo raytracing.nv.raygen.spv raytracing.nv.raygen.hlsl"

View File

@@ -0,0 +1,9 @@
// Run: %dxc -T cs_6_5 -E CS -fspv-target-env=vulkan1.2
// CHECK: error: store value of type 'RayQuery<RAY_FLAG_FORCE_OPAQUE | RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH>' is unsupported
[numThreads(1,1,1)]
void CS()
{
RayQuery<RAY_FLAG_FORCE_OPAQUE|RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH> q;
RayQuery<RAY_FLAG_FORCE_OPAQUE|RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH> b = q;
}

View File

@@ -0,0 +1,35 @@
// Run: %dxc -T cs_6_5 -E main -fspv-target-env=vulkan1.2
RaytracingAccelerationStructure g_topLevel : register(t0, space0);
RWTexture2D<float4> g_output : register(u1, space0);
[numthreads(64, 1, 1)]
void main(uint2 launchIndex: SV_DispatchThreadID)
{
float3 T = (float3)0;
float sampleCount = 0;
RayDesc ray;
ray.Origin = float3(0, 0, 0);
ray.Direction = float3(0, 1, 0);
ray.TMin = 0.0;
ray.TMax = 1000.0;
RayQuery<RAY_FLAG_FORCE_OPAQUE> q;
q.TraceRayInline(g_topLevel, 0, 0xff, ray);
// CHECK: [[rayquery:%\d+]] = OpVariable %_ptr_Function_rayQueryKHR Function
q.Proceed();
// CHECK: OpRayQueryProceedKHR %bool [[rayquery]]
if(q.CommittedStatus() == COMMITTED_TRIANGLE_HIT)
// CHECK: [[status:%\d+]] = OpRayQueryGetIntersectionTypeKHR %uint [[rayquery]] %uint_1
// CHECK: OpIEqual %bool [[status]] %uint_1
{
T += float3(1, 0, 1);
}
else
{
T += float3(0, 1, 0);
}
g_output[launchIndex] += float4(T, 1);
}

View File

@@ -0,0 +1,170 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 5
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 6
op: 25
type_name: "type.2d.image"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00010008 # EXTERNAL_IMAGE FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 1, depth: 2, arrayed: 0, ms: 0, sampled: 2, image_format: 1 } # dim=2D image_format=Rgba32f
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 21
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
- &bv1
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "g_topLevel"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 87, set: 83 }
- &db1
spirv_id: 3
name: "g_output"
binding: 1
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 3 # VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
resource_type: 8 # UAV
image: { dim: 1, depth: 2, arrayed: 0, ms: 0, sampled: 2, image_format: 1 } # dim=2D image_format=Rgba32f
block: *bv1 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td1
word_offset: { binding: 95, set: 91 }
all_interface_variables:
- &iv0
spirv_id: 4
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 28 # GlobalInvocationId
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td2
word_offset: { location: 0 }
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 650
spirv_execution_model: 5 # GLCompute
shader_stage: 0x00000020 # CS
descriptor_binding_count: 2
descriptor_bindings:
- *db0 # "g_topLevel"
- *db1 # "g_output"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 2
bindings:
- *db0 # "g_topLevel"
- *db1 # "g_output"
input_variable_count: 1,
input_variables:
- *iv0 #
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,63 @@
// RUN: %dxc -T ds_6_5 -E main -fspv-target-env=vulkan1.2
// CHECK: OpCapability RayQueryKHR
// CHECK: OpExtension "SPV_KHR_ray_query"
struct VSSceneIn {
float3 pos : POSITION;
};
struct PSSceneIn {
float4 pos : SV_Position;
};
//////////////////////////////////////////////////////////////////////////////////////////
// Simple forwarding Tessellation shaders
struct HSPerVertexData {
// This is just the original vertex verbatim. In many real life cases this would be a
// control point instead
PSSceneIn v;
};
struct HSPerPatchData {
// We at least have to specify tess factors per patch
// As we're tesselating triangles, there will be 4 tess factors
// In real life case this might contain face normal, for example
float edges[3] : SV_TessFactor;
float inside : SV_InsideTessFactor;
};
RaytracingAccelerationStructure AccelerationStructure : register(t0);
RayDesc MakeRayDesc()
{
RayDesc desc;
desc.Origin = float3(0,0,0);
desc.Direction = float3(1,0,0);
desc.TMin = 0.0f;
desc.TMax = 9999.0;
return desc;
}
void doInitialize(RayQuery<RAY_FLAG_FORCE_OPAQUE> query, RayDesc ray)
{
query.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_NON_OPAQUE,0xFF,ray);
}
// domain shader that actually outputs the triangle vertices
[domain("tri")] PSSceneIn main(const float3 bary
: SV_DomainLocation,
const OutputPatch<HSPerVertexData, 3> patch,
const HSPerPatchData perPatchData) {
PSSceneIn v;
v.pos = patch[0].v.pos * bary.x + patch[1].v.pos * bary.y + patch[2].v.pos * bary.z + perPatchData.edges[1];
RayQuery<RAY_FLAG_FORCE_OPAQUE> q;
RayDesc ray = MakeRayDesc();
// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray);
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
doInitialize(q, ray);
return v;
}

View File

@@ -0,0 +1,262 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 8
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 16
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 25
op: 28
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x20000108 # ARRAY VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [3,], stride: 0 }
member_count: 0
members:
- &td3
id: 28
op: 28
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [4,], stride: 0 }
member_count: 0
members:
- &td4
id: 30
op: 28
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 0 }
member_count: 0
members:
- &td5
id: 24
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "AccelerationStructure"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 104, set: 100 }
all_interface_variables:
- &iv0
spirv_id: 3
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000410 # BUILT_IN PATCH
built_in: 13 # TessCoord
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td1
word_offset: { location: 0 }
- &iv1
spirv_id: 4
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 0 # Position
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [3,], stride: 0 }
member_count: 0
members:
format: 109 # VK_FORMAT_R32G32B32A32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv2
spirv_id: 5
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000410 # BUILT_IN PATCH
built_in: 11 # TessLevelOuter
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [4,], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td3
word_offset: { location: 0 }
- &iv3
spirv_id: 6
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000410 # BUILT_IN PATCH
built_in: 12 # TessLevelInner
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [2,], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td4
word_offset: { location: 0 }
- &iv4
spirv_id: 7
name:
location: 4294967295
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 0 # Position
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 109 # VK_FORMAT_R32G32B32A32_SFLOAT
type_description: *td5
word_offset: { location: 0 }
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 650
spirv_execution_model: 2 # TessellationEvaluation
shader_stage: 0x00000004 # DS
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "AccelerationStructure"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "AccelerationStructure"
input_variable_count: 4,
input_variables:
- *iv0 #
- *iv1 #
- *iv2 #
- *iv3 #
output_variable_count: 1,
output_variables:
- *iv4 #
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,43 @@
// RUN: %dxc -T gs_6_5 -E main -fspv-target-env=vulkan1.2
// CHECK: OpCapability RayQueryKHR
// CHECK: OpExtension "SPV_KHR_ray_query
struct Out
{
float4 pos : SV_Position;
};
struct Empty{};
RaytracingAccelerationStructure AccelerationStructure : register(t0);
RayDesc MakeRayDesc()
{
RayDesc desc;
desc.Origin = float3(0,0,0);
desc.Direction = float3(1,0,0);
desc.TMin = 0.0f;
desc.TMax = 9999.0;
return desc;
}
void doInitialize(RayQuery<RAY_FLAG_FORCE_OPAQUE> query, RayDesc ray)
{
query.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_NON_OPAQUE,0xFF,ray);
}
[maxvertexcount(3)]
void main(line Empty e[4], inout PointStream<Out> OutputStream0)
{
RayQuery<RAY_FLAG_FORCE_OPAQUE> q;
RayDesc ray = MakeRayDesc();
// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray);
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
doInitialize(q, ray);
Out output = (Out)0;
OutputStream0.Append(output);
OutputStream0.RestartStrip();
}

View File

@@ -0,0 +1,118 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 4
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 10
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "AccelerationStructure"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 86, set: 82 }
all_interface_variables:
- &iv0
spirv_id: 3
name:
location: 4294967295
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 0 # Position
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 109 # VK_FORMAT_R32G32B32A32_SFLOAT
type_description: *td1
word_offset: { location: 0 }
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 650
spirv_execution_model: 3 # Geometry
shader_stage: 0x00000008 # GS
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "AccelerationStructure"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "AccelerationStructure"
input_variable_count: 0,
input_variables:
output_variable_count: 1,
output_variables:
- *iv0 #
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,75 @@
// Run: %dxc -T hs_6_5 -E main -fspv-target-env=vulkan1.2
// CHECK: OpCapability RayQueryKHR
// CHECK: OpCapability RayTraversalPrimitiveCullingKHR
// CHECK: OpExtension "SPV_KHR_ray_query"
#define MAX_POINTS 3
// Input control point
struct VS_CONTROL_POINT_OUTPUT
{
float3 vPosition : WORLDPOS;
};
// Output control point
struct CONTROL_POINT
{
float3 vPosition : BEZIERPOS;
};
// Output patch constant data.
struct HS_CONSTANT_DATA_OUTPUT
{
float Edges[4] : SV_TessFactor;
float Inside[2] : SV_InsideTessFactor;
};
// Patch Constant Function
HS_CONSTANT_DATA_OUTPUT mainConstant(InputPatch<VS_CONTROL_POINT_OUTPUT, MAX_POINTS> ip) {
HS_CONSTANT_DATA_OUTPUT Output;
// Must initialize Edges and Inside; otherwise HLSL validation will fail.
Output.Edges[0] = 1.0;
Output.Edges[1] = 2.0;
Output.Edges[2] = 3.0;
Output.Edges[3] = 4.0;
Output.Inside[0] = 5.0;
Output.Inside[1] = 6.0;
return Output;
}
RaytracingAccelerationStructure AccelerationStructure : register(t0);
RayDesc MakeRayDesc()
{
RayDesc desc;
desc.Origin = float3(0,0,0);
desc.Direction = float3(1,0,0);
desc.TMin = 0.0f;
desc.TMax = 9999.0;
return desc;
}
void doInitialize(RayQuery<RAY_FLAG_FORCE_OPAQUE|RAY_FLAG_SKIP_TRIANGLES> query, RayDesc ray)
{
query.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_NON_OPAQUE,0xFF,ray);
}
[outputcontrolpoints(MAX_POINTS)]
[patchconstantfunc("mainConstant")]
CONTROL_POINT main(InputPatch<VS_CONTROL_POINT_OUTPUT, MAX_POINTS> ip, uint cpid : SV_OutputControlPointID) {
// CHECK: %rayQueryKHR = OpTypeRayQueryKHR
// CHECK: %_ptr_Function_rayQueryKHR = OpTypePointer Function %rayQueryKHR
// CHECK: [[rayquery:%\d+]] = OpVariable %_ptr_Function_rayQueryKHR Function
RayQuery<RAY_FLAG_FORCE_OPAQUE|RAY_FLAG_SKIP_TRIANGLES> q;
RayDesc ray = MakeRayDesc();
// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_517 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray);
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_259 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
doInitialize(q, ray);
CONTROL_POINT result;
return result;
}

View File

@@ -0,0 +1,245 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 8
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 30
op: 28
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x20000108 # ARRAY VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [3,], stride: 0 }
member_count: 0
members:
- &td2
id: 11
op: 21
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td3
id: 35
op: 28
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [4,], stride: 0 }
member_count: 0
members:
- &td4
id: 37
op: 28
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "AccelerationStructure"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 122, set: 118 }
all_interface_variables:
- &iv0
spirv_id: 3
name: "in.var.WORLDPOS"
location: 0
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [3,], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td1
word_offset: { location: 110 }
- &iv1
spirv_id: 4
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 8 # InvocationId
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td2
word_offset: { location: 0 }
- &iv2
spirv_id: 5
name: "out.var.BEZIERPOS"
location: 0
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [3,], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td1
word_offset: { location: 114 }
- &iv3
spirv_id: 6
name:
location: 4294967295
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000410 # BUILT_IN PATCH
built_in: 11 # TessLevelOuter
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [4,], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td3
word_offset: { location: 0 }
- &iv4
spirv_id: 7
name:
location: 4294967295
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000410 # BUILT_IN PATCH
built_in: 12 # TessLevelInner
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [2,], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td4
word_offset: { location: 0 }
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 650
spirv_execution_model: 1 # TessellationControl
shader_stage: 0x00000002 # HS
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "AccelerationStructure"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "AccelerationStructure"
input_variable_count: 2,
input_variables:
- *iv0 # "in.var.WORLDPOS"
- *iv1 #
output_variable_count: 3,
output_variables:
- *iv2 # "out.var.BEZIERPOS"
- *iv3 #
- *iv4 #
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,33 @@
// RUN: %dxc -E main -T ps_6_5 -fspv-target-env=vulkan1.2
// RUN: %dxc -T gs_6_5 -E main
// CHECK: OpCapability RayQueryKHR
// CHECK: OpExtension "SPV_KHR_ray_query
RaytracingAccelerationStructure AccelerationStructure : register(t0);
RayDesc MakeRayDesc()
{
RayDesc desc;
desc.Origin = float3(0,0,0);
desc.Direction = float3(1,0,0);
desc.TMin = 0.0f;
desc.TMax = 9999.0;
return desc;
}
void doInitialize(RayQuery<RAY_FLAG_FORCE_OPAQUE> query, RayDesc ray)
{
query.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_NON_OPAQUE,0xFF,ray);
}
uint4 main() : SV_Target
{
RayQuery<RAY_FLAG_FORCE_OPAQUE> q;
RayDesc ray = MakeRayDesc();
// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray);
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
doInitialize(q, ray);
return float4(1.0, 0.0, 0.0, 1.0);
}

View File

@@ -0,0 +1,118 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 4
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 10
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "AccelerationStructure"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 82, set: 78 }
all_interface_variables:
- &iv0
spirv_id: 3
name: "out.var.SV_Target"
location: 0
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 107 # VK_FORMAT_R32G32B32A32_UINT
type_description: *td1
word_offset: { location: 74 }
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 650
spirv_execution_model: 4 # Fragment
shader_stage: 0x00000010 # PS
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "AccelerationStructure"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "AccelerationStructure"
input_variable_count: 0,
input_variables:
output_variable_count: 1,
output_variables:
- *iv0 # "out.var.SV_Target"
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,42 @@
// Run: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2
// CHECK: OpCapability RayTracingKHR
// CHECK: OpCapability RayQueryKHR
// CHECK: OpExtension "SPV_KHR_ray_tracing"
// CHECK: OpExtension "SPV_KHR_ray_query"
RaytracingAccelerationStructure AccelerationStructure : register(t0);
RayDesc MakeRayDesc()
{
RayDesc desc;
desc.Origin = float3(0,0,0);
desc.Direction = float3(1,0,0);
desc.TMin = 0.0f;
desc.TMax = 9999.0;
return desc;
}
void doInitialize(RayQuery<RAY_FLAG_FORCE_OPAQUE> query, RayDesc ray)
{
query.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_NON_OPAQUE,0xFF,ray);
}
struct Payload
{
float4 color;
};
// CHECK: OpTypePointer HitAttributeNV %Attribute
struct Attribute
{
float2 bary;
};
[shader("anyhit")]
void main(inout Payload MyPayload, in Attribute MyAttr) {
Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) };
RayQuery<RAY_FLAG_FORCE_OPAQUE> q;
RayDesc ray = MakeRayDesc();
// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray);
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
doInitialize(q, ray);
}

View File

@@ -0,0 +1,82 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 4
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "AccelerationStructure"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 80, set: 76 }
all_interface_variables:
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5315 # AnyHitKHR
shader_stage: 0x00000200 # ANY_HIT
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "AccelerationStructure"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "AccelerationStructure"
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,37 @@
// Run: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2
// CHECK: OpCapability RayTracingKHR
// CHECK: OpCapability RayQueryKHR
// CHECK: OpExtension "SPV_KHR_ray_tracing"
// CHECK: OpExtension "SPV_KHR_ray_query"
RaytracingAccelerationStructure AccelerationStructure : register(t0);
RayDesc MakeRayDesc()
{
RayDesc desc;
desc.Origin = float3(0,0,0);
desc.Direction = float3(1,0,0);
desc.TMin = 0.0f;
desc.TMax = 9999.0;
return desc;
}
void doInitialize(RayQuery<RAY_FLAG_FORCE_OPAQUE> query, RayDesc ray)
{
query.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_NON_OPAQUE,0xFF,ray);
}
struct Payload
{
float4 color;
};
[shader("miss")]
void main(inout Payload MyPayload) {
Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) };
RayQuery<RAY_FLAG_FORCE_OPAQUE> q;
RayDesc ray = MakeRayDesc();
// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray);
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
doInitialize(q, ray);
}

View File

@@ -0,0 +1,82 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 4
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "AccelerationStructure"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 80, set: 76 }
all_interface_variables:
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5317 # MissKHR
shader_stage: 0x00000800 # MISS
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "AccelerationStructure"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "AccelerationStructure"
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,42 @@
// Run: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2
// CHECK: OpCapability RayTracingKHR
// CHECK: OpCapability RayQueryKHR
// CHECK: OpExtension "SPV_KHR_ray_tracing"
// CHECK: OpExtension "SPV_KHR_ray_query"
RaytracingAccelerationStructure AccelerationStructure : register(t0);
RayDesc MakeRayDesc()
{
RayDesc desc;
desc.Origin = float3(0,0,0);
desc.Direction = float3(1,0,0);
desc.TMin = 0.0f;
desc.TMax = 9999.0;
return desc;
}
void doInitialize(RayQuery<RAY_FLAG_FORCE_OPAQUE> query, RayDesc ray)
{
query.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_NON_OPAQUE,0xFF,ray);
}
struct Payload
{
float4 color;
};
// CHECK: OpTypePointer HitAttributeNV %Attribute
struct Attribute
{
float2 bary;
};
[shader("closesthit")]
void main(inout Payload MyPayload, in Attribute MyAttr) {
Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) };
RayQuery<RAY_FLAG_FORCE_OPAQUE> q;
RayDesc ray = MakeRayDesc();
// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray);
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
doInitialize(q, ray);
}

View File

@@ -0,0 +1,82 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 4
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "AccelerationStructure"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 80, set: 76 }
all_interface_variables:
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5316 # ClosestHitKHR
shader_stage: 0x00000400 # CLOSEST_HIT
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "AccelerationStructure"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "AccelerationStructure"
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,42 @@
// Run: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2
// CHECK: OpCapability RayTracingKHR
// CHECK: OpCapability RayQueryKHR
// CHECK: OpExtension "SPV_KHR_ray_tracing"
// CHECK: OpExtension "SPV_KHR_ray_query"
// CHECK-COUNT-1: [[rs:%\d+]] = OpTypeAccelerationStructureNV
RaytracingAccelerationStructure AccelerationStructure : register(t0);
RayDesc MakeRayDesc()
{
RayDesc desc;
desc.Origin = float3(0,0,0);
desc.Direction = float3(1,0,0);
desc.TMin = 0.0f;
desc.TMax = 9999.0;
return desc;
}
void doInitialize(RayQuery<RAY_FLAG_FORCE_OPAQUE> query, RayDesc ray)
{
query.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_NON_OPAQUE,0xFF,ray);
}
struct Payload
{
float4 color;
};
[shader("raygeneration")]
void main() {
Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) };
RayQuery<RAY_FLAG_FORCE_OPAQUE> q;
RayDesc ray = MakeRayDesc();
// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray);
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
doInitialize(q, ray);
// CHECK: OpTraceNV {{%\d+}} %uint_0 %uint_255 %uint_0 %uint_1 %uint_0 {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %uint_0
TraceRay(AccelerationStructure, 0x0, 0xff, 0, 1, 0, ray, myPayload);
}

View File

@@ -0,0 +1,82 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 4
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "AccelerationStructure"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 84, set: 80 }
all_interface_variables:
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5313 # RayGenerationKHR
shader_stage: 0x00000100 # RAYGEN
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "AccelerationStructure"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "AccelerationStructure"
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,41 @@
// Run: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2
// CHECK: OpCapability RayTracingKHR
// CHECK: OpCapability RayQueryKHR
// CHECK: OpExtension "SPV_KHR_ray_tracing"
// CHECK: OpExtension "SPV_KHR_ray_query"
RaytracingAccelerationStructure AccelerationStructure : register(t0);
RayDesc MakeRayDesc()
{
RayDesc desc;
desc.Origin = float3(0,0,0);
desc.Direction = float3(1,0,0);
desc.TMin = 0.0f;
desc.TMax = 9999.0;
return desc;
}
void doInitialize(RayQuery<RAY_FLAG_FORCE_OPAQUE> query, RayDesc ray)
{
query.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_NON_OPAQUE,0xFF,ray);
}
struct CallData
{
float4 data;
};
[shader("callable")]
void main() {
RayQuery<RAY_FLAG_FORCE_OPAQUE> q;
RayDesc ray = MakeRayDesc();
// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray);
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
doInitialize(q, ray);
Attribute myHitAttribute = { float2(0.0f,0.0f) };
// CHECK: OpReportIntersectionKHR %bool %float_0 %uint_0
ReportHit(0.0f, 0U, myHitAttribute);
}

View File

@@ -0,0 +1,37 @@
// Run: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2
// CHECK: OpCapability RayTracingKHR
// CHECK: OpCapability RayQueryKHR
// CHECK: OpExtension "SPV_KHR_ray_tracing"
// CHECK: OpExtension "SPV_KHR_ray_query"
RaytracingAccelerationStructure AccelerationStructure : register(t0);
RayDesc MakeRayDesc()
{
RayDesc desc;
desc.Origin = float3(0,0,0);
desc.Direction = float3(1,0,0);
desc.TMin = 0.0f;
desc.TMax = 9999.0;
return desc;
}
void doInitialize(RayQuery<RAY_FLAG_FORCE_OPAQUE> query, RayDesc ray)
{
query.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_NON_OPAQUE,0xFF,ray);
}
struct Payload
{
float4 color;
};
[shader("miss")]
void main(inout Payload MyPayload) {
Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) };
RayQuery<RAY_FLAG_FORCE_OPAQUE> q;
RayDesc ray = MakeRayDesc();
// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray);
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
doInitialize(q, ray);
}

View File

@@ -0,0 +1,82 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 4
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "AccelerationStructure"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 80, set: 76 }
all_interface_variables:
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5317 # MissKHR
shader_stage: 0x00000800 # MISS
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "AccelerationStructure"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "AccelerationStructure"
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,45 @@
// Run: %dxc -T vs_6_5 -E main -fspv-target-env=vulkan1.2
// CHECK: OpCapability RayQueryKHR
// CHECK: OpCapability RayTraversalPrimitiveCullingKHR
// CHECK: OpExtension "SPV_KHR_ray_query"
RaytracingAccelerationStructure AccelerationStructure : register(t0);
RWByteAddressBuffer log : register(u0);
RayDesc MakeRayDesc()
{
RayDesc desc;
desc.Origin = float3(0,0,0);
desc.Direction = float3(1,0,0);
desc.TMin = 0.0f;
desc.TMax = 9999.0;
return desc;
}
void DoSomething()
{
log.Store(0,1);
}
void doInitialize(RayQuery<RAY_FLAG_FORCE_OPAQUE|RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH> query, RayDesc ray)
{
query.TraceRayInline(AccelerationStructure,RAY_FLAG_NONE,0xFF,ray);
}
void main()
{
// CHECK: %rayQueryKHR = OpTypeRayQueryKHR
// CHECK: %_ptr_Function_rayQueryKHR = OpTypePointer Function %rayQueryKHR
// CHECK: [[rayquery:%\d+]] = OpVariable %_ptr_Function_rayQueryKHR Function
RayQuery<RAY_FLAG_FORCE_OPAQUE|RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH> q;
RayDesc ray = MakeRayDesc();
// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_517 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
q.TraceRayInline(AccelerationStructure,RAY_FLAG_SKIP_PROCEDURAL_PRIMITIVES, 0xFF, ray);
// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_5 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999
doInitialize(q, ray);
}

View File

@@ -0,0 +1,206 @@
// Run: dxc -T cs_6_5 -E CS -fspv-target-env=vulkan1.2
// CHECK: OpCapability RayQueryKHR
// CHECK: OpExtension "SPV_KHR_ray_query"
RaytracingAccelerationStructure AccelerationStructure : register(t0);
RWByteAddressBuffer log : register(u0);
RayDesc MakeRayDesc()
{
RayDesc desc;
desc.Origin = float3(0,0,0);
desc.Direction = float3(1,0,0);
desc.TMin = 0.0f;
desc.TMax = 9999.0;
return desc;
}
void DoSomething()
{
log.Store(0,1);
}
[numThreads(1,1,1)]
void CS()
{
RayQuery<RAY_FLAG_FORCE_OPAQUE|RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH> q;
RayDesc ray = MakeRayDesc();
q.TraceRayInline(AccelerationStructure,RAY_FLAG_NONE,0xFF,ray);
float4x3 mat4x3;
float3x4 mat3x4;
// CHECK: [[rayquery:%\d+]] = OpVariable %_ptr_Function_rayQueryKHR Function
// CHECK: OpRayQueryProceedKHR %bool [[rayquery]]
while(q.Proceed())
{
// CHECK: OpRayQueryGetIntersectionTypeKHR %uint [[rayquery]] %uint_0
switch(q.CandidateType())
{
case CANDIDATE_NON_OPAQUE_TRIANGLE:
q.Abort();
// CHECK: OpRayQueryGetIntersectionObjectToWorldKHR %mat4v3float [[rayquery]] %uint_0
mat3x4 = q.CandidateObjectToWorld3x4();
mat4x3 = q.CandidateObjectToWorld4x3();
// CHECK: OpRayQueryConfirmIntersectionKHR [[rayquery]]
q.CommitNonOpaqueTriangleHit();
// CHECK: OpRayQueryGetIntersectionFrontFaceKHR %bool [[rayquery]] %uint_0
if(q.CandidateTriangleFrontFace())
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionBarycentricsKHR %v2float [[rayquery]] %uint_0
if(q.CandidateTriangleBarycentrics().x == 0)
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionGeometryIndexKHR %uint [[rayquery]] %uint_0
if(q.CandidateGeometryIndex())
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionInstanceCustomIndexKHR %uint [[rayquery]] %uint_0
if(q.CandidateInstanceID())
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionInstanceIdKHR %uint [[rayquery]] %uint_0
if(q.CandidateInstanceIndex())
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionObjectRayDirectionKHR %v3float [[rayquery]] %uint_0
if(q.CandidateObjectRayDirection().x)
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionObjectRayOriginKHR %v3float [[rayquery]] %uint_0
if(q.CandidateObjectRayOrigin().y)
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionPrimitiveIndexKHR %uint [[rayquery]] %uint_0
if(q.CandidatePrimitiveIndex())
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionTKHR %float [[rayquery]] %uint_0
if(q.CandidateTriangleRayT())
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR %uint [[rayquery]] %uint_0
if(q.CandidateInstanceContributionToHitGroupIndex())
{
DoSomething();
}
break;
case CANDIDATE_PROCEDURAL_PRIMITIVE:
{
// CHECK: OpRayQueryGetIntersectionWorldToObjectKHR %mat4v3float [[rayquery]] %uint_0
mat3x4 = q.CandidateWorldToObject3x4();
mat4x3 = q.CandidateWorldToObject4x3();
// CHECK: OpRayQueryGetIntersectionCandidateAABBOpaqueKHR %bool
if(q.CandidateProceduralPrimitiveNonOpaque())
{
DoSomething();
}
float t = 0.5;
// CHECK: OpRayQueryGenerateIntersectionKHR [[rayquery]] %float_0_5
q.CommitProceduralPrimitiveHit(t);
q.Abort();
break;
}
}
}
if(mat3x4[0][0] == mat4x3[0][0])
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionTypeKHR %uint [[rayquery]] %uint_1
switch(q.CommittedStatus())
{
case COMMITTED_NOTHING:
// CHECK: OpRayQueryGetIntersectionObjectToWorldKHR %mat4v3float [[rayquery]] %uint_1
mat3x4 = q.CommittedObjectToWorld3x4();
mat4x3 = q.CommittedObjectToWorld4x3();
break;
case COMMITTED_TRIANGLE_HIT:
// CHECK: OpRayQueryGetIntersectionWorldToObjectKHR %mat4v3float [[rayquery]] %uint_1
mat3x4 = q.CommittedWorldToObject3x4();
mat4x3 = q.CommittedWorldToObject4x3();
// CHECK: OpRayQueryGetIntersectionFrontFaceKHR %bool [[rayquery]] %uint_1
if(q.CommittedTriangleFrontFace())
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionBarycentricsKHR %v2float [[rayquery]] %uint_1
if(q.CommittedTriangleBarycentrics().y == 0)
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR %uint [[rayquery]] %uint_1
if(q.CommittedInstanceContributionToHitGroupIndex())
{
DoSomething();
}
break;
case COMMITTED_PROCEDURAL_PRIMITIVE_HIT:
// CHECK: OpRayQueryGetIntersectionGeometryIndexKHR %uint [[rayquery]] %uint_1
if(q.CommittedGeometryIndex())
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionInstanceCustomIndexKHR %uint [[rayquery]] %uint_1
if(q.CommittedInstanceID())
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionInstanceIdKHR %uint [[rayquery]] %uint_1
if(q.CommittedInstanceIndex())
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionObjectRayDirectionKHR %v3float [[rayquery]] %uint_1
if(q.CommittedObjectRayDirection().z)
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionObjectRayOriginKHR %v3float [[rayquery]] %uint_1
if(q.CommittedObjectRayOrigin().x)
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionPrimitiveIndexKHR %uint [[rayquery]] %uint_1
if(q.CommittedPrimitiveIndex())
{
DoSomething();
}
// CHECK: OpRayQueryGetIntersectionTKHR %float [[rayquery]] %uint_1
if(q.CommittedRayT())
{
DoSomething();
}
break;
}
if(mat3x4[0][0] == mat4x3[0][0])
{
DoSomething();
}
// CHECK: OpRayQueryGetRayFlagsKHR %uint [[rayquery]]
if(q.RayFlags())
{
DoSomething();
}
// CHECK: OpRayQueryGetRayTMinKHR %float [[rayquery]]
if(q.RayTMin())
{
DoSomething();
}
// CHECK: OpRayQueryGetWorldRayDirectionKHR %v3float [[rayquery]]
float3 o = q.WorldRayDirection();
// CHECK: OpRayQueryGetWorldRayOriginKHR %v3float [[rayquery]]
float3 d = q.WorldRayOrigin();
if(o.x == d.z)
{
DoSomething();
}
}

View File

@@ -0,0 +1,10 @@
// Run: %dxc -E main -T cs_6_4 -fspv-target-env=vulkan1.2
// CHECK: OpCapability RayTracingKHR
// CHECK: %accelerationStructureNV = OpTypeAccelerationStructureKHR
RaytracingAccelerationStructure test_bvh;
[numthreads(1, 1, 1)]
void main() {}

View File

@@ -0,0 +1,27 @@
%YAML 1.1
---
all_type_descriptions:
all_block_variables:
all_descriptor_bindings:
all_interface_variables:
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 640
spirv_execution_model: 5 # GLCompute
shader_stage: 0x00000020 # CS
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,91 @@
// Run: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2
// CHECK: OpCapability RayTracingKHR
// CHECK: OpExtension "SPV_KHR_ray_tracing"
// CHECK: OpDecorate [[a:%\d+]] BuiltIn LaunchIdNV
// CHECK: OpDecorate [[b:%\d+]] BuiltIn LaunchSizeNV
// CHECK: OpDecorate [[c:%\d+]] BuiltIn WorldRayOriginNV
// CHECK: OpDecorate [[d:%\d+]] BuiltIn WorldRayDirectionNV
// CHECK: OpDecorate [[e:%\d+]] BuiltIn RayTminNV
// CHECK: OpDecorate [[f:%\d+]] BuiltIn IncomingRayFlagsNV
// CHECK: OpDecorate %gl_InstanceID BuiltIn InstanceId
// CHECK: OpDecorate [[g:%\d+]] BuiltIn InstanceCustomIndexNV
// CHECK: OpDecorate %gl_PrimitiveID BuiltIn PrimitiveId
// CHECK: OpDecorate [[h:%\d+]] BuiltIn ObjectRayOriginNV
// CHECK: OpDecorate [[i:%\d+]] BuiltIn ObjectRayDirectionNV
// CHECK: OpDecorate [[j:%\d+]] BuiltIn ObjectToWorldNV
// CHECK: OpDecorate [[k:%\d+]] BuiltIn WorldToObjectNV
// CHECK: OpDecorate [[l:%\d+]] BuiltIn HitKindNV
// CHECK: OpDecorate [[m:%\d+]] BuiltIn RayGeometryIndexKHR
// CHECK: OpTypePointer IncomingRayPayloadNV %Payload
struct Payload
{
float4 color;
};
struct CallData
{
float4 data;
};
// CHECK: OpTypePointer HitAttributeNV %Attribute
struct Attribute
{
float2 bary;
};
// CHECK-COUNT-1: [[rstype:%\d+]] = OpTypeAccelerationStructureNV
RaytracingAccelerationStructure rs;
[shader("closesthit")]
void main(inout Payload MyPayload, in Attribute MyAttr) {
// CHECK: OpLoad %v3uint [[a]]
uint3 _1 = DispatchRaysIndex();
// CHECK: OpLoad %v3uint [[b]]
uint3 _2 = DispatchRaysDimensions();
// CHECK: OpLoad %v3float [[c]]
float3 _3 = WorldRayOrigin();
// CHECK: OpLoad %v3float [[d]]
float3 _4 = WorldRayDirection();
// CHECK: OpLoad %float [[e]]
float _5 = RayTMin();
// CHECK: OpLoad %uint [[f]]
uint _6 = RayFlags();
// CHECK: OpLoad %uint %gl_InstanceID
uint _7 = InstanceIndex();
// CHECK: OpLoad %uint [[g]]
uint _8 = InstanceID();
// CHECK: OpLoad %uint %gl_PrimitiveID
uint _9 = PrimitiveIndex();
// CHECK: OpLoad %v3float [[h]]
float3 _10 = ObjectRayOrigin();
// CHECK: OpLoad %v3float [[i]]
float3 _11 = ObjectRayDirection();
// CHECK: [[matotw:%\d+]] = OpLoad %mat4v3float [[j]]
// CHECK-NEXT: OpTranspose %mat3v4float [[matotw]]
float3x4 _12 = ObjectToWorld3x4();
// CHECK: OpLoad %mat4v3float [[j]]
float4x3 _13 = ObjectToWorld4x3();
// CHECK: [[matwto:%\d+]] = OpLoad %mat4v3float [[k]]
// CHECK-NEXT: OpTranspose %mat3v4float [[matwto]]
float3x4 _14 = WorldToObject3x4();
// CHECK: OpLoad %mat4v3float [[k]]
float4x3 _15 = WorldToObject4x3();
// CHECK: OpLoad %uint [[l]]
uint _16 = HitKind();
// CHECK: OpLoad %uint [[m]]
uint _17 = GeometryIndex();
Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) };
CallData myCallData = { float4(0.0f,0.0f,0.0f,0.0f) };
// CHECK: OpStore %myPayload {{%\d+}}
RayDesc rayDesc;
rayDesc.Origin = float3(0.0f, 0.0f, 0.0f);
rayDesc.Direction = float3(0.0f, 0.0f, -1.0f);
rayDesc.TMin = 0.0f;
rayDesc.TMax = 1000.0f;
// CHECK: OpTraceRayKHR {{%\d+}} %uint_0 %uint_255 %uint_0 %uint_1 %uint_0 {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %myPayload
TraceRay(rs, 0x0, 0xff, 0, 1, 0, rayDesc, myPayload);
// CHECK: OpExecuteCallableKHR %uint_0 %myCallData
CallShader(0, myCallData);
}

View File

@@ -0,0 +1,452 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 21
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 38
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 26
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td3
id: 24
op: 22
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td4
id: 31
op: 21
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td5
id: 43
op: 24
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000308 # MATRIX VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "rs"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 167, set: 163 }
all_interface_variables:
- &iv0
spirv_id: 4
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5319 # InLaunchIdKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td1
word_offset: { location: 0 }
- &iv1
spirv_id: 5
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5320 # InLaunchSizeKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td1
word_offset: { location: 0 }
- &iv2
spirv_id: 6
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5321 # InWorldRayOriginKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv3
spirv_id: 7
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5322 # InWorldRayDirectionKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv4
spirv_id: 8
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5325 # InRayTminKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td3
word_offset: { location: 0 }
- &iv5
spirv_id: 9
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5351 # InIncomingRayFlagsKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
- &iv6
spirv_id: 10
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 6 # InstanceId
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
- &iv7
spirv_id: 11
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5327 # InInstanceCustomIndexKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
- &iv8
spirv_id: 12
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 7 # PrimitiveId
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
- &iv9
spirv_id: 13
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5323 # InObjectRayOriginKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv10
spirv_id: 14
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5324 # InObjectRayDirectionKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv11
spirv_id: 15
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5330 # InObjectToWorldKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td5
word_offset: { location: 0 }
- &iv12
spirv_id: 16
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5331 # InWorldToObjectKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td5
word_offset: { location: 0 }
- &iv13
spirv_id: 17
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5333 # InHitKindKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
- &iv14
spirv_id: 18
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5352 # InRayGeometryIndexKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5316 # ClosestHitKHR
shader_stage: 0x00000400 # CLOSEST_HIT
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "rs"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "rs"
input_variable_count: 15,
input_variables:
- *iv0 #
- *iv1 #
- *iv2 #
- *iv3 #
- *iv4 #
- *iv5 #
- *iv6 #
- *iv7 #
- *iv8 #
- *iv9 #
- *iv10 #
- *iv11 #
- *iv12 #
- *iv13 #
- *iv14 #
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,11 @@
// Run: %dxc -E main -T cs_6_4 -fspv-target-env=vulkan1.2 -fspv-extension=SPV_NV_ray_tracing
// CHECK: OpCapability RayTracingNV
// CHECK: OpExtension "SPV_NV_ray_tracing"
// CHECK: %accelerationStructureNV = OpTypeAccelerationStructureKHR
RaytracingAccelerationStructure test_bvh;
[numthreads(1, 1, 1)]
void main() {}

View File

@@ -0,0 +1,27 @@
%YAML 1.1
---
all_type_descriptions:
all_block_variables:
all_descriptor_bindings:
all_interface_variables:
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 640
spirv_execution_model: 5 # GLCompute
shader_stage: 0x00000020 # CS
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,82 @@
// Run: %dxc -T lib_6_3 -fspv-extension=SPV_NV_ray_tracing
// CHECK: OpCapability RayTracingNV
// CHECK: OpExtension "SPV_NV_ray_tracing"
// CHECK: OpDecorate [[a:%\d+]] BuiltIn LaunchIdNV
// CHECK: OpDecorate [[b:%\d+]] BuiltIn LaunchSizeNV
// CHECK: OpDecorate [[c:%\d+]] BuiltIn WorldRayOriginNV
// CHECK: OpDecorate [[d:%\d+]] BuiltIn WorldRayDirectionNV
// CHECK: OpDecorate [[e:%\d+]] BuiltIn RayTminNV
// CHECK: OpDecorate [[f:%\d+]] BuiltIn IncomingRayFlagsNV
// CHECK: OpDecorate %gl_InstanceID BuiltIn InstanceId
// CHECK: OpDecorate [[g:%\d+]] BuiltIn InstanceCustomIndexNV
// CHECK: OpDecorate %gl_PrimitiveID BuiltIn PrimitiveId
// CHECK: OpDecorate [[h:%\d+]] BuiltIn ObjectRayOriginNV
// CHECK: OpDecorate [[i:%\d+]] BuiltIn ObjectRayDirectionNV
// CHECK: OpDecorate [[j:%\d+]] BuiltIn ObjectToWorldNV
// CHECK: OpDecorate [[k:%\d+]] BuiltIn WorldToObjectNV
// CHECK: OpDecorate [[l:%\d+]] BuiltIn HitKindNV
// CHECK: OpTypePointer IncomingRayPayloadNV %Payload
struct Payload
{
float4 color;
};
// CHECK: OpTypePointer HitAttributeNV %Attribute
struct Attribute
{
float2 bary;
};
// CHECK-COUNT-1: [[rstype:%\d+]] = OpTypeAccelerationStructureNV
RaytracingAccelerationStructure rs;
[shader("anyhit")]
void main(inout Payload MyPayload, in Attribute MyAttr) {
// CHECK: OpLoad %v3uint [[a]]
uint3 _1 = DispatchRaysIndex();
// CHECK: OpLoad %v3uint [[b]]
uint3 _2 = DispatchRaysDimensions();
// CHECK: OpLoad %v3float [[c]]
float3 _3 = WorldRayOrigin();
// CHECK: OpLoad %v3float [[d]]
float3 _4 = WorldRayDirection();
// CHECK: OpLoad %float [[e]]
float _5 = RayTMin();
// CHECK: OpLoad %uint [[f]]
uint _6 = RayFlags();
// CHECK: OpLoad %uint %gl_InstanceID
uint _7 = InstanceIndex();
// CHECK: OpLoad %uint [[g]]
uint _8 = InstanceID();
// CHECK: OpLoad %uint %gl_PrimitiveID
uint _9 = PrimitiveIndex();
// CHECK: OpLoad %v3float [[h]]
float3 _10 = ObjectRayOrigin();
// CHECK: OpLoad %v3float [[i]]
float3 _11 = ObjectRayDirection();
// CHECK: [[matotw:%\d+]] = OpLoad %mat4v3float [[j]]
// CHECK-NEXT: OpTranspose %mat3v4float [[matotw]]
float3x4 _12 = ObjectToWorld3x4();
// CHECK: OpLoad %mat4v3float [[j]]
float4x3 _13 = ObjectToWorld4x3();
// CHECK: [[matwto:%\d+]] = OpLoad %mat4v3float [[k]]
// CHECK-NEXT: OpTranspose %mat3v4float [[matwto]]
float3x4 _14 = WorldToObject3x4();
// CHECK: OpLoad %mat4v3float [[k]]
float4x3 _15 = WorldToObject4x3();
// CHECK: OpLoad %uint [[l]]
uint _16 = HitKind();
if (_16 == 1U) {
// CHECK: [[payloadread0:%\d+]] = OpLoad %Payload %MyPayload_0
// CHECK-NEXT : OpStore %MyPayload [[payloadread0]]
// CHECK-NEXT : OpIgnoreIntersectionNV
IgnoreHit();
} else {
// CHECK: [[payloadread1:%\d+]] = OpLoad %Payload %MyPayload_0
// CHECK-NEXT : OpStore %MyPayload [[payloadread1]]
// CHECK-NEXT : OpTerminateRayNV
AcceptHitAndEndSearch();
}
}

View File

@@ -0,0 +1,378 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 23
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 25
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 20
op: 22
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td3
id: 18
op: 21
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td4
id: 29
op: 24
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000308 # MATRIX VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
all_descriptor_bindings:
all_interface_variables:
- &iv0
spirv_id: 3
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5319 # InLaunchIdKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td0
word_offset: { location: 0 }
- &iv1
spirv_id: 4
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5320 # InLaunchSizeKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td0
word_offset: { location: 0 }
- &iv2
spirv_id: 5
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5321 # InWorldRayOriginKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td1
word_offset: { location: 0 }
- &iv3
spirv_id: 6
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5322 # InWorldRayDirectionKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td1
word_offset: { location: 0 }
- &iv4
spirv_id: 7
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5325 # InRayTminKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv5
spirv_id: 8
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5351 # InIncomingRayFlagsKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td3
word_offset: { location: 0 }
- &iv6
spirv_id: 9
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 6 # InstanceId
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td3
word_offset: { location: 0 }
- &iv7
spirv_id: 10
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5327 # InInstanceCustomIndexKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td3
word_offset: { location: 0 }
- &iv8
spirv_id: 11
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 7 # PrimitiveId
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td3
word_offset: { location: 0 }
- &iv9
spirv_id: 12
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5323 # InObjectRayOriginKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td1
word_offset: { location: 0 }
- &iv10
spirv_id: 13
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5324 # InObjectRayDirectionKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td1
word_offset: { location: 0 }
- &iv11
spirv_id: 14
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5330 # InObjectToWorldKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td4
word_offset: { location: 0 }
- &iv12
spirv_id: 15
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5331 # InWorldToObjectKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td4
word_offset: { location: 0 }
- &iv13
spirv_id: 16
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5333 # InHitKindKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td3
word_offset: { location: 0 }
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5315 # AnyHitKHR
shader_stage: 0x00000200 # ANY_HIT
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 14,
input_variables:
- *iv0 #
- *iv1 #
- *iv2 #
- *iv3 #
- *iv4 #
- *iv5 #
- *iv6 #
- *iv7 #
- *iv8 #
- *iv9 #
- *iv10 #
- *iv11 #
- *iv12 #
- *iv13 #
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,20 @@
// Run: %dxc -T lib_6_3 -fspv-extension=SPV_NV_ray_tracing
// CHECK: OpCapability RayTracingNV
// CHECK: OpExtension "SPV_NV_ray_tracing"
// CHECK: OpDecorate [[a:%\d+]] BuiltIn LaunchIdNV
// CHECK: OpDecorate [[b:%\d+]] BuiltIn LaunchSizeNV
// CHECK: OpTypePointer IncomingCallableDataNV %CallData
struct CallData
{
float4 data;
};
[shader("callable")]
void main(inout CallData myCallData) {
// CHECK: OpLoad %v3uint [[a]]
uint3 a = DispatchRaysIndex();
// CHECK: OpLoad %v3uint [[b]]
uint3 b = DispatchRaysDimensions();
}

View File

@@ -0,0 +1,82 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 10
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
all_descriptor_bindings:
all_interface_variables:
- &iv0
spirv_id: 3
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5319 # InLaunchIdKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td0
word_offset: { location: 0 }
- &iv1
spirv_id: 4
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5320 # InLaunchSizeKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td0
word_offset: { location: 0 }
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5318 # CallableKHR
shader_stage: 0x00002000 # CALLABLE
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 2,
input_variables:
- *iv0 #
- *iv1 #
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,79 @@
// Run: %dxc -T lib_6_3 -fspv-extension=SPV_NV_ray_tracing
// CHECK: OpCapability RayTracingNV
// CHECK: OpExtension "SPV_NV_ray_tracing"
// CHECK: OpDecorate [[a:%\d+]] BuiltIn LaunchIdNV
// CHECK: OpDecorate [[b:%\d+]] BuiltIn LaunchSizeNV
// CHECK: OpDecorate [[c:%\d+]] BuiltIn WorldRayOriginNV
// CHECK: OpDecorate [[d:%\d+]] BuiltIn WorldRayDirectionNV
// CHECK: OpDecorate [[e:%\d+]] BuiltIn RayTminNV
// CHECK: OpDecorate [[f:%\d+]] BuiltIn IncomingRayFlagsNV
// CHECK: OpDecorate %gl_InstanceID BuiltIn InstanceId
// CHECK: OpDecorate [[g:%\d+]] BuiltIn InstanceCustomIndexNV
// CHECK: OpDecorate %gl_PrimitiveID BuiltIn PrimitiveId
// CHECK: OpDecorate [[h:%\d+]] BuiltIn ObjectRayOriginNV
// CHECK: OpDecorate [[i:%\d+]] BuiltIn ObjectRayDirectionNV
// CHECK: OpDecorate [[j:%\d+]] BuiltIn ObjectToWorldNV
// CHECK: OpDecorate [[k:%\d+]] BuiltIn WorldToObjectNV
// CHECK: OpDecorate [[l:%\d+]] BuiltIn HitKindNV
// CHECK: OpTypePointer IncomingRayPayloadNV %Payload
struct Payload
{
float4 color;
};
// CHECK: OpTypePointer HitAttributeNV %Attribute
struct Attribute
{
float2 bary;
};
// CHECK-COUNT-1: [[rstype:%\d+]] = OpTypeAccelerationStructureNV
RaytracingAccelerationStructure rs;
[shader("closesthit")]
void main(inout Payload MyPayload, in Attribute MyAttr) {
// CHECK: OpLoad %v3uint [[a]]
uint3 _1 = DispatchRaysIndex();
// CHECK: OpLoad %v3uint [[b]]
uint3 _2 = DispatchRaysDimensions();
// CHECK: OpLoad %v3float [[c]]
float3 _3 = WorldRayOrigin();
// CHECK: OpLoad %v3float [[d]]
float3 _4 = WorldRayDirection();
// CHECK: OpLoad %float [[e]]
float _5 = RayTMin();
// CHECK: OpLoad %uint [[f]]
uint _6 = RayFlags();
// CHECK: OpLoad %uint %gl_InstanceID
uint _7 = InstanceIndex();
// CHECK: OpLoad %uint [[g]]
uint _8 = InstanceID();
// CHECK: OpLoad %uint %gl_PrimitiveID
uint _9 = PrimitiveIndex();
// CHECK: OpLoad %v3float [[h]]
float3 _10 = ObjectRayOrigin();
// CHECK: OpLoad %v3float [[i]]
float3 _11 = ObjectRayDirection();
// CHECK: [[matotw:%\d+]] = OpLoad %mat4v3float [[j]]
// CHECK-NEXT: OpTranspose %mat3v4float [[matotw]]
float3x4 _12 = ObjectToWorld3x4();
// CHECK: OpLoad %mat4v3float [[j]]
float4x3 _13 = ObjectToWorld4x3();
// CHECK: [[matwto:%\d+]] = OpLoad %mat4v3float [[k]]
// CHECK-NEXT: OpTranspose %mat3v4float [[matwto]]
float3x4 _14 = WorldToObject3x4();
// CHECK: OpLoad %mat4v3float [[k]]
float4x3 _15 = WorldToObject4x3();
// CHECK: OpLoad %uint [[l]]
uint _16 = HitKind();
Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) };
RayDesc rayDesc;
rayDesc.Origin = float3(0.0f, 0.0f, 0.0f);
rayDesc.Direction = float3(0.0f, 0.0f, -1.0f);
rayDesc.TMin = 0.0f;
rayDesc.TMax = 1000.0f;
// CHECK: OpTraceNV {{%\d+}} %uint_0 %uint_255 %uint_0 %uint_1 %uint_0 {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %uint_0
TraceRay(rs, 0x0, 0xff, 0, 1, 0, rayDesc, myPayload);
}

View File

@@ -0,0 +1,433 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 19
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 35
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 23
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td3
id: 21
op: 22
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td4
id: 28
op: 21
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td5
id: 40
op: 24
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000308 # MATRIX VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "rs"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 142, set: 138 }
all_interface_variables:
- &iv0
spirv_id: 4
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5319 # InLaunchIdKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td1
word_offset: { location: 0 }
- &iv1
spirv_id: 5
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5320 # InLaunchSizeKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td1
word_offset: { location: 0 }
- &iv2
spirv_id: 6
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5321 # InWorldRayOriginKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv3
spirv_id: 7
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5322 # InWorldRayDirectionKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv4
spirv_id: 8
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5325 # InRayTminKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td3
word_offset: { location: 0 }
- &iv5
spirv_id: 9
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5351 # InIncomingRayFlagsKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
- &iv6
spirv_id: 10
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 6 # InstanceId
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
- &iv7
spirv_id: 11
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5327 # InInstanceCustomIndexKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
- &iv8
spirv_id: 12
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 7 # PrimitiveId
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
- &iv9
spirv_id: 13
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5323 # InObjectRayOriginKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv10
spirv_id: 14
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5324 # InObjectRayDirectionKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv11
spirv_id: 15
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5330 # InObjectToWorldKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td5
word_offset: { location: 0 }
- &iv12
spirv_id: 16
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5331 # InWorldToObjectKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td5
word_offset: { location: 0 }
- &iv13
spirv_id: 17
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5333 # InHitKindKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5316 # ClosestHitKHR
shader_stage: 0x00000400 # CLOSEST_HIT
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "rs"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "rs"
input_variable_count: 14,
input_variables:
- *iv0 #
- *iv1 #
- *iv2 #
- *iv3 #
- *iv4 #
- *iv5 #
- *iv6 #
- *iv7 #
- *iv8 #
- *iv9 #
- *iv10 #
- *iv11 #
- *iv12 #
- *iv13 #
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,48 @@
// Run: %dxc -T lib_6_3 -fspv-extension=SPV_NV_ray_tracing
// CHECK: OpCapability RayTracingNV
// CHECK: OpExtension "SPV_NV_ray_tracing"
// CHECK: OpDecorate [[a:%\d+]] BuiltIn LaunchIdNV
// CHECK: OpDecorate [[b:%\d+]] BuiltIn LaunchSizeNV
// CHECK-COUNT-1: [[rstype:%\d+]] = OpTypeAccelerationStructureNV
RaytracingAccelerationStructure rs;
struct Payload
{
float4 color;
};
struct CallData
{
float4 data;
};
//CHECK: %First = OpVariable %_ptr_Private_int Private %int_0
//CHECK-NEXT: %Second = OpVariable %_ptr_Private_int Private %int_1
enum Number {
First,
Second,
};
//CHECK: [[first:%\d+]] = OpLoad %int %First
//CHECK-NEXT: OpStore %foo [[first]]
static ::Number foo = First;
[shader("raygeneration")]
void main() {
//CHECK: [[second:%\d+]] = OpLoad %int %Second
//CHECK-NEXT: OpStore %bar [[second]]
static ::Number bar = Second;
uint3 a = DispatchRaysIndex();
uint3 b = DispatchRaysDimensions();
Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) };
CallData myCallData = { float4(0.0f,0.0f,0.0f,0.0f) };
RayDesc rayDesc;
rayDesc.Origin = float3(0.0f, 0.0f, 0.0f);
rayDesc.Direction = float3(0.0f, 0.0f, -1.0f);
rayDesc.TMin = 0.0f;
rayDesc.TMax = 1000.0f;
TraceRay(rs, 0x0, 0xff, 0, 1, 0, rayDesc, myPayload);
CallShader(0, myCallData);
}

View File

@@ -0,0 +1,137 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 7
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 22
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "rs"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 96, set: 92 }
all_interface_variables:
- &iv0
spirv_id: 3
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5319 # InLaunchIdKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td1
word_offset: { location: 0 }
- &iv1
spirv_id: 4
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5320 # InLaunchSizeKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td1
word_offset: { location: 0 }
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5313 # RayGenerationKHR
shader_stage: 0x00000100 # RAYGEN
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "rs"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "rs"
input_variable_count: 2,
input_variables:
- *iv0 #
- *iv1 #
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,62 @@
// Run: %dxc -T lib_6_3 -fspv-extension=SPV_NV_ray_tracing
// CHECK: OpCapability RayTracingNV
// CHECK: OpExtension "SPV_NV_ray_tracing"
// CHECK: OpDecorate [[a:%\d+]] BuiltIn LaunchIdNV
// CHECK: OpDecorate [[b:%\d+]] BuiltIn LaunchSizeNV
// CHECK: OpDecorate [[c:%\d+]] BuiltIn WorldRayOriginNV
// CHECK: OpDecorate [[d:%\d+]] BuiltIn WorldRayDirectionNV
// CHECK: OpDecorate [[e:%\d+]] BuiltIn RayTminNV
// CHECK: OpDecorate [[f:%\d+]] BuiltIn IncomingRayFlagsNV
// CHECK: OpDecorate %gl_InstanceID BuiltIn InstanceId
// CHECK: OpDecorate [[g:%\d+]] BuiltIn InstanceCustomIndexNV
// CHECK: OpDecorate %gl_PrimitiveID BuiltIn PrimitiveId
// CHECK: OpDecorate [[h:%\d+]] BuiltIn ObjectRayOriginNV
// CHECK: OpDecorate [[i:%\d+]] BuiltIn ObjectRayDirectionNV
// CHECK: OpDecorate [[j:%\d+]] BuiltIn ObjectToWorldNV
// CHECK: OpDecorate [[k:%\d+]] BuiltIn WorldToObjectNV
struct Attribute
{
float2 bary;
};
[shader("intersection")]
void main() {
// CHECK: OpLoad %v3uint [[a]]
uint3 _1 = DispatchRaysIndex();
// CHECK: OpLoad %v3uint [[b]]
uint3 _2 = DispatchRaysDimensions();
// CHECK: OpLoad %v3float [[c]]
float3 _3 = WorldRayOrigin();
// CHECK: OpLoad %v3float [[d]]
float3 _4 = WorldRayDirection();
// CHECK: OpLoad %float [[e]]
float _5 = RayTMin();
// CHECK: OpLoad %uint [[f]]
uint _6 = RayFlags();
// CHECK: OpLoad %uint %gl_InstanceID
uint _7 = InstanceIndex();
// CHECK: OpLoad %uint [[g]]
uint _8 = InstanceID();
// CHECK: OpLoad %uint %gl_PrimitiveID
uint _9 = PrimitiveIndex();
// CHECK: OpLoad %v3float [[h]]
float3 _10 = ObjectRayOrigin();
// CHECK: OpLoad %v3float [[i]]
float3 _11 = ObjectRayDirection();
// CHECK: [[matotw:%\d+]] = OpLoad %mat4v3float [[j]]
// CHECK-NEXT: OpTranspose %mat3v4float [[matotw]]
float3x4 _12 = ObjectToWorld3x4();
// CHECK: OpLoad %mat4v3float [[j]]
float4x3 _13 = ObjectToWorld4x3();
// CHECK: [[matwto:%\d+]] = OpLoad %mat4v3float [[k]]
// CHECK-NEXT: OpTranspose %mat3v4float [[matwto]]
float3x4 _14 = WorldToObject3x4();
// CHECK: OpLoad %mat4v3float [[k]]
float4x3 _15 = WorldToObject4x3();
Attribute myHitAttribute = { float2(0.0f,0.0f) };
// CHECK: OpReportIntersectionKHR %bool %float_0 %uint_0
ReportHit(0.0f, 0U, myHitAttribute);
}

View File

@@ -0,0 +1,359 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 21
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 23
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 17
op: 22
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td3
id: 19
op: 21
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td4
id: 27
op: 24
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000308 # MATRIX VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
all_descriptor_bindings:
all_interface_variables:
- &iv0
spirv_id: 2
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5319 # InLaunchIdKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td0
word_offset: { location: 0 }
- &iv1
spirv_id: 3
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5320 # InLaunchSizeKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td0
word_offset: { location: 0 }
- &iv2
spirv_id: 4
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5321 # InWorldRayOriginKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td1
word_offset: { location: 0 }
- &iv3
spirv_id: 5
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5322 # InWorldRayDirectionKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td1
word_offset: { location: 0 }
- &iv4
spirv_id: 6
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5325 # InRayTminKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv5
spirv_id: 7
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5351 # InIncomingRayFlagsKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td3
word_offset: { location: 0 }
- &iv6
spirv_id: 8
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 6 # InstanceId
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td3
word_offset: { location: 0 }
- &iv7
spirv_id: 9
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5327 # InInstanceCustomIndexKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td3
word_offset: { location: 0 }
- &iv8
spirv_id: 10
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 7 # PrimitiveId
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td3
word_offset: { location: 0 }
- &iv9
spirv_id: 11
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5323 # InObjectRayOriginKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td1
word_offset: { location: 0 }
- &iv10
spirv_id: 12
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5324 # InObjectRayDirectionKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td1
word_offset: { location: 0 }
- &iv11
spirv_id: 13
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5330 # InObjectToWorldKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td4
word_offset: { location: 0 }
- &iv12
spirv_id: 14
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5331 # InWorldToObjectKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td4
word_offset: { location: 0 }
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5314 # IntersectionKHR
shader_stage: 0x00001000 # INTERSECTION
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 13,
input_variables:
- *iv0 #
- *iv1 #
- *iv2 #
- *iv3 #
- *iv4 #
- *iv5 #
- *iv6 #
- *iv7 #
- *iv8 #
- *iv9 #
- *iv10 #
- *iv11 #
- *iv12 #
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,260 @@
// Run: %dxc -T lib_6_3 -fspv-extension=SPV_NV_ray_tracing
// CHECK: OpCapability RayTracingNV
// CHECK: OpExtension "SPV_NV_ray_tracing"
// CHECK: OpEntryPoint RayGenerationNV %MyRayGenMain "MyRayGenMain" {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %gl_InstanceID {{%\d+}} %gl_PrimitiveID {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}}
// CHECK: OpEntryPoint RayGenerationNV %MyRayGenMain2 "MyRayGenMain2" {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %gl_InstanceID {{%\d+}} %gl_PrimitiveID {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}}
// CHECK: OpEntryPoint MissNV %MyMissMain "MyMissMain" {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %gl_InstanceID {{%\d+}} %gl_PrimitiveID {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}}
// CHECK: OpEntryPoint MissNV %MyMissMain2 "MyMissMain2" {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %gl_InstanceID {{%\d+}} %gl_PrimitiveID {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}}
// CHECK: OpEntryPoint IntersectionNV %MyISecMain "MyISecMain" {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %gl_InstanceID {{%\d+}} %gl_PrimitiveID {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}}
// CHECK: OpEntryPoint IntersectionNV %MyISecMain2 "MyISecMain2" {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %gl_InstanceID {{%\d+}} %gl_PrimitiveID {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}}
// CHECK: OpEntryPoint AnyHitNV %MyAHitMain "MyAHitMain" {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %gl_InstanceID {{%\d+}} %gl_PrimitiveID {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}}
// CHECK: OpEntryPoint AnyHitNV %MyAHitMain2 "MyAHitMain2" {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %gl_InstanceID {{%\d+}} %gl_PrimitiveID {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}}
// CHECK: OpEntryPoint ClosestHitNV %MyCHitMain "MyCHitMain" {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %gl_InstanceID {{%\d+}} %gl_PrimitiveID {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}}
// CHECK: OpEntryPoint ClosestHitNV %MyCHitMain2 "MyCHitMain2" {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %gl_InstanceID {{%\d+}} %gl_PrimitiveID {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}}
// CHECK: OpEntryPoint CallableNV %MyCallMain "MyCallMain" {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %gl_InstanceID {{%\d+}} %gl_PrimitiveID {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}}
// CHECK: OpEntryPoint CallableNV %MyCallMain2 "MyCallMain2" {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %gl_InstanceID {{%\d+}} %gl_PrimitiveID {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}}
// CHECK: OpDecorate [[a:%\d+]] BuiltIn LaunchIdNV
// CHECK: OpDecorate [[b:%\d+]] BuiltIn LaunchSizeNV
// CHECK: OpDecorate [[c:%\d+]] BuiltIn WorldRayOriginNV
// CHECK: OpDecorate [[d:%\d+]] BuiltIn WorldRayDirectionNV
// CHECK: OpDecorate [[e:%\d+]] BuiltIn RayTminNV
// CHECK: OpDecorate [[f:%\d+]] BuiltIn IncomingRayFlagsNV
// CHECK: OpDecorate %gl_InstanceID BuiltIn InstanceId
// CHECK: OpDecorate [[g:%\d+]] BuiltIn InstanceCustomIndexNV
// CHECK: OpDecorate %gl_PrimitiveID BuiltIn PrimitiveId
// CHECK: OpDecorate [[h:%\d+]] BuiltIn ObjectRayOriginNV
// CHECK: OpDecorate [[i:%\d+]] BuiltIn ObjectRayDirectionNV
// CHECK: OpDecorate [[j:%\d+]] BuiltIn ObjectToWorldNV
// CHECK: OpDecorate [[k:%\d+]] BuiltIn WorldToObjectNV
// CHECK: OpDecorate [[l:%\d+]] BuiltIn HitKindNV
// CHECK: OpTypePointer CallableDataNV %CallData
struct CallData
{
float4 data;
};
// CHECK: OpTypePointer IncomingRayPayloadNV %Payload
struct Payload
{
float4 color;
};
// CHECK: OpTypePointer HitAttributeNV %Attribute
struct Attribute
{
float2 bary;
};
// CHECK-COUNT-1: [[rstype:%\d+]] = OpTypeAccelerationStructureNV
RaytracingAccelerationStructure rs;
[shader("raygeneration")]
void MyRayGenMain() {
// CHECK: OpLoad %v3uint [[a]]
uint3 a = DispatchRaysIndex();
// CHECK: OpLoad %v3uint [[b]]
uint3 b = DispatchRaysDimensions();
Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) };
CallData myCallData = { float4(0.0f,0.0f,0.0f,0.0f) };
RayDesc rayDesc;
rayDesc.Origin = float3(0.0f, 0.0f, 0.0f);
rayDesc.Direction = float3(0.0f, 0.0f, -1.0f);
rayDesc.TMin = 0.0f;
rayDesc.TMax = 1000.0f;
// CHECK: OpTraceNV {{%\d+}} %uint_0 %uint_255 %uint_0 %uint_1 %uint_0 {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %uint_0
TraceRay(rs, 0x0, 0xff, 0, 1, 0, rayDesc, myPayload);
// CHECK: OpExecuteCallableNV %uint_0 %uint_0
CallShader(0, myCallData);
}
[shader("raygeneration")]
void MyRayGenMain2() {
CallData myCallData = { float4(0.0f,0.0f,0.0f,0.0f) };
CallShader(0, myCallData);
}
[shader("miss")]
void MyMissMain(inout Payload MyPayload) {
// CHECK: OpLoad %v3uint [[a]]
uint3 _1 = DispatchRaysIndex();
// CHECK: OpLoad %v3uint [[b]]
uint3 _2 = DispatchRaysDimensions();
// CHECK: OpLoad %v3float [[c]]
float3 _3 = WorldRayOrigin();
// CHECK: OpLoad %v3float [[d]]
float3 _4 = WorldRayDirection();
// CHECK: OpLoad %float [[e]]
float _5 = RayTMin();
// CHECK: OpLoad %uint [[f]]
uint _6 = RayFlags();
}
[shader("miss")]
void MyMissMain2(inout Payload MyPayload) {
MyPayload.color = float4(0.0f,1.0f,0.0f,1.0f);
}
[shader("intersection")]
void MyISecMain() {
// CHECK: OpLoad %v3uint [[a]]
uint3 _1 = DispatchRaysIndex();
// CHECK: OpLoad %v3uint [[b]]
uint3 _2 = DispatchRaysDimensions();
// CHECK: OpLoad %v3float [[c]]
float3 _3 = WorldRayOrigin();
// CHECK: OpLoad %v3float [[d]]
float3 _4 = WorldRayDirection();
// CHECK: OpLoad %float [[e]]
float _5 = RayTMin();
// CHECK: OpLoad %uint [[f]]
uint _6 = RayFlags();
// CHECK: OpLoad %uint %gl_InstanceID
uint _7 = InstanceIndex();
// CHECK: OpLoad %uint [[g]]
uint _8 = InstanceID();
// CHECK: OpLoad %uint %gl_PrimitiveID
uint _9 = PrimitiveIndex();
// CHECK: OpLoad %v3float [[h]]
float3 _10 = ObjectRayOrigin();
// CHECK: OpLoad %v3float [[i]]
float3 _11 = ObjectRayDirection();
// CHECK: OpLoad %mat4v3float [[j]]
float3x4 _12 = ObjectToWorld3x4();
// CHECK: OpLoad %mat4v3float [[j]]
float4x3 _13 = ObjectToWorld4x3();
// CHECK: OpLoad %mat4v3float [[k]]
float3x4 _14 = WorldToObject3x4();
// CHECK: OpLoad %mat4v3float [[k]]
float4x3 _15 = WorldToObject4x3();
Attribute myHitAttribute = { float2(0.0f,0.0f) };
// CHECK: OpReportIntersectionKHR %bool %float_0 %uint_0
ReportHit(0.0f, 0U, myHitAttribute);
}
[shader("intersection")]
void MyISecMain2() {
Attribute myHitAttribute = { float2(0.0f,1.0f) };
// CHECK: OpReportIntersectionKHR %bool %float_0 %uint_0
ReportHit(0.0f, 0U, myHitAttribute);
}
[shader("anyhit")]
void MyAHitMain(inout Payload MyPayload, in Attribute MyAttr) {
// CHECK: OpLoad %v3uint [[a]]
uint3 _1 = DispatchRaysIndex();
// CHECK: OpLoad %v3uint [[b]]
uint3 _2 = DispatchRaysDimensions();
// CHECK: OpLoad %v3float [[c]]
float3 _3 = WorldRayOrigin();
// CHECK: OpLoad %v3float [[d]]
float3 _4 = WorldRayDirection();
// CHECK: OpLoad %float [[e]]
float _5 = RayTMin();
// CHECK: OpLoad %uint [[f]]
uint _6 = RayFlags();
// CHECK: OpLoad %uint %gl_InstanceID
uint _7 = InstanceIndex();
// CHECK: OpLoad %uint [[g]]
uint _8 = InstanceID();
// CHECK: OpLoad %uint %gl_PrimitiveID
uint _9 = PrimitiveIndex();
// CHECK: OpLoad %v3float [[h]]
float3 _10 = ObjectRayOrigin();
// CHECK: OpLoad %v3float [[i]]
float3 _11 = ObjectRayDirection();
// CHECK: OpLoad %mat4v3float [[j]]
float3x4 _12 = ObjectToWorld3x4();
// CHECK: OpLoad %mat4v3float [[j]]
float4x3 _13 = ObjectToWorld4x3();
// CHECK: OpLoad %mat4v3float [[k]]
float3x4 _14 = WorldToObject3x4();
// CHECK: OpLoad %mat4v3float [[k]]
float4x3 _15 = WorldToObject4x3();
// CHECK: OpLoad %uint [[l]]
uint _16 = HitKind();
if (_16 == 1U) {
// CHECK: OpIgnoreIntersectionNV
IgnoreHit();
} else {
// CHECK: OpTerminateRayNV
AcceptHitAndEndSearch();
}
}
[shader("anyhit")]
void MyAHitMain2(inout Payload MyPayload, in Attribute MyAttr) {
// CHECK: OpTerminateRayNV
AcceptHitAndEndSearch();
}
[shader("closesthit")]
void MyCHitMain(inout Payload MyPayload, in Attribute MyAttr) {
// CHECK: OpLoad %v3uint [[a]]
uint3 _1 = DispatchRaysIndex();
// CHECK: OpLoad %v3uint [[b]]
uint3 _2 = DispatchRaysDimensions();
// CHECK: OpLoad %v3float [[c]]
float3 _3 = WorldRayOrigin();
// CHECK: OpLoad %v3float [[d]]
float3 _4 = WorldRayDirection();
// CHECK: OpLoad %float [[e]]
float _5 = RayTMin();
// CHECK: OpLoad %uint [[f]]
uint _6 = RayFlags();
// CHECK: OpLoad %uint %gl_InstanceID
uint _7 = InstanceIndex();
// CHECK: OpLoad %uint [[g]]
uint _8 = InstanceID();
// CHECK: OpLoad %uint %gl_PrimitiveID
uint _9 = PrimitiveIndex();
// CHECK: OpLoad %v3float [[h]]
float3 _10 = ObjectRayOrigin();
// CHECK: OpLoad %v3float [[i]]
float3 _11 = ObjectRayDirection();
// CHECK: OpLoad %mat4v3float [[j]]
float3x4 _12 = ObjectToWorld3x4();
// CHECK: OpLoad %mat4v3float [[j]]
float4x3 _13 = ObjectToWorld4x3();
// CHECK: OpLoad %mat4v3float [[k]]
float3x4 _14 = WorldToObject3x4();
// CHECK: OpLoad %mat4v3float [[k]]
float4x3 _15 = WorldToObject4x3();
// CHECK: OpLoad %uint [[l]]
uint _16 = HitKind();
Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) };
RayDesc rayDesc;
rayDesc.Origin = float3(0.0f, 0.0f, 0.0f);
rayDesc.Direction = float3(0.0f, 0.0f, -1.0f);
rayDesc.TMin = 0.0f;
rayDesc.TMax = 1000.0f;
// CHECK: OpTraceNV {{%\d+}} %uint_0 %uint_255 %uint_0 %uint_1 %uint_0 {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %uint_0
TraceRay(rs, 0x0, 0xff, 0, 1, 0, rayDesc, myPayload);
}
[shader("closesthit")]
void MyCHitMain2(inout Payload MyPayload, in Attribute MyAttr) {
MyPayload.color = float4(0.0f,1.0f,0.0f,1.0f);
}
[shader("callable")]
void MyCallMain(inout CallData myCallData) {
// CHECK: OpLoad %v3uint [[a]]
uint3 a = DispatchRaysIndex();
// CHECK: OpLoad %v3uint [[b]]
uint3 b = DispatchRaysDimensions();
}
[shader("callable")]
void MyCallMain2(inout CallData myCallData) {
myCallData.data = float4(0.0f,1.0f,0.0f,1.0f);
}

View File

@@ -0,0 +1,433 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 39
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 58
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 45
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td3
id: 43
op: 22
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td4
id: 50
op: 21
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td5
id: 66
op: 24
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000308 # MATRIX VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "rs"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 634, set: 630 }
all_interface_variables:
- &iv0
spirv_id: 3
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5319 # InLaunchIdKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td1
word_offset: { location: 0 }
- &iv1
spirv_id: 4
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5320 # InLaunchSizeKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td1
word_offset: { location: 0 }
- &iv2
spirv_id: 8
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5321 # InWorldRayOriginKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv3
spirv_id: 9
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5322 # InWorldRayDirectionKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv4
spirv_id: 10
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5325 # InRayTminKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td3
word_offset: { location: 0 }
- &iv5
spirv_id: 11
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5351 # InIncomingRayFlagsKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
- &iv6
spirv_id: 13
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 6 # InstanceId
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
- &iv7
spirv_id: 14
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5327 # InInstanceCustomIndexKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
- &iv8
spirv_id: 15
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 7 # PrimitiveId
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
- &iv9
spirv_id: 16
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5323 # InObjectRayOriginKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv10
spirv_id: 17
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5324 # InObjectRayDirectionKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv11
spirv_id: 18
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5330 # InObjectToWorldKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td5
word_offset: { location: 0 }
- &iv12
spirv_id: 19
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5331 # InWorldToObjectKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 4, row_count: 3, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td5
word_offset: { location: 0 }
- &iv13
spirv_id: 22
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5333 # InHitKindKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td4
word_offset: { location: 0 }
module:
generator: 14 # Google spiregg
entry_point_name: "MyRayGenMain"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5313 # RayGenerationKHR
shader_stage: 0x00000100 # RAYGEN
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "rs"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "rs"
input_variable_count: 14,
input_variables:
- *iv0 #
- *iv1 #
- *iv2 #
- *iv3 #
- *iv4 #
- *iv5 #
- *iv6 #
- *iv7 #
- *iv8 #
- *iv9 #
- *iv10 #
- *iv11 #
- *iv12 #
- *iv13 #
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,32 @@
// Run: %dxc -T lib_6_3 -fspv-extension=SPV_NV_ray_tracing
// CHECK: OpCapability RayTracingNV
// CHECK: OpExtension "SPV_NV_ray_tracing"
// CHECK: OpDecorate [[a:%\d+]] BuiltIn LaunchIdNV
// CHECK: OpDecorate [[b:%\d+]] BuiltIn LaunchSizeNV
// CHECK: OpDecorate [[c:%\d+]] BuiltIn WorldRayOriginNV
// CHECK: OpDecorate [[d:%\d+]] BuiltIn WorldRayDirectionNV
// CHECK: OpDecorate [[e:%\d+]] BuiltIn RayTminNV
// CHECK: OpDecorate [[f:%\d+]] BuiltIn IncomingRayFlagsNV
// CHECK: OpTypePointer IncomingRayPayloadNV %Payload
struct Payload
{
float4 color;
};
[shader("miss")]
void main(inout Payload MyPayload) {
// CHECK: OpLoad %v3uint [[a]]
uint3 _1 = DispatchRaysIndex();
// CHECK: OpLoad %v3uint [[b]]
uint3 _2 = DispatchRaysDimensions();
// CHECK: OpLoad %v3float [[c]]
float3 _3 = WorldRayOrigin();
// CHECK: OpLoad %v3float [[d]]
float3 _4 = WorldRayDirection();
// CHECK: OpLoad %float [[e]]
float _5 = RayTMin();
// CHECK: OpLoad %uint [[f]]
uint _6 = RayFlags();
}

View File

@@ -0,0 +1,209 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 14
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 16
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 10
op: 22
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td3
id: 13
op: 21
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
all_descriptor_bindings:
all_interface_variables:
- &iv0
spirv_id: 3
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5319 # InLaunchIdKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td0
word_offset: { location: 0 }
- &iv1
spirv_id: 4
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5320 # InLaunchSizeKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td0
word_offset: { location: 0 }
- &iv2
spirv_id: 5
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5321 # InWorldRayOriginKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td1
word_offset: { location: 0 }
- &iv3
spirv_id: 6
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5322 # InWorldRayDirectionKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 106 # VK_FORMAT_R32G32B32_SFLOAT
type_description: *td1
word_offset: { location: 0 }
- &iv4
spirv_id: 7
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5325 # InRayTminKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td2
word_offset: { location: 0 }
- &iv5
spirv_id: 8
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5351 # InIncomingRayFlagsKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 98 # VK_FORMAT_R32_UINT
type_description: *td3
word_offset: { location: 0 }
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5317 # MissKHR
shader_stage: 0x00000800 # MISS
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 6,
input_variables:
- *iv0 #
- *iv1 #
- *iv2 #
- *iv3 #
- *iv4 #
- *iv5 #
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,38 @@
// Run: %dxc -T lib_6_3 -fspv-extension=SPV_NV_ray_tracing
// CHECK: OpCapability RayTracingNV
// CHECK: OpExtension "SPV_NV_ray_tracing"
// CHECK: OpDecorate [[a:%\d+]] BuiltIn LaunchIdNV
// CHECK: OpDecorate [[b:%\d+]] BuiltIn LaunchSizeNV
// CHECK-COUNT-1: [[rstype:%\d+]] = OpTypeAccelerationStructureNV
RaytracingAccelerationStructure rs;
struct Payload
{
float4 color;
};
struct CallData
{
float4 data;
};
[shader("raygeneration")]
void main() {
// CHECK: OpLoad %v3uint [[a]]
uint3 a = DispatchRaysIndex();
// CHECK: OpLoad %v3uint [[b]]
uint3 b = DispatchRaysDimensions();
Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) };
CallData myCallData = { float4(0.0f,0.0f,0.0f,0.0f) };
RayDesc rayDesc;
rayDesc.Origin = float3(0.0f, 0.0f, 0.0f);
rayDesc.Direction = float3(0.0f, 0.0f, -1.0f);
rayDesc.TMin = 0.0f;
rayDesc.TMax = 1000.0f;
// CHECK: OpTraceNV {{%\d+}} %uint_0 %uint_255 %uint_0 %uint_1 %uint_0 {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %uint_0
TraceRay(rs, 0x0, 0xff, 0, 1, 0, rayDesc, myPayload);
// CHECK: OpExecuteCallableNV %uint_0 %uint_0
CallShader(0, myCallData);
}

View File

@@ -0,0 +1,137 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 7
op: 5341
type_name: "accelerationStructureNV"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00100000 # ???
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 22
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
all_descriptor_bindings:
- &db0
spirv_id: 2
name: "rs"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 1000150000 # VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 96, set: 92 }
all_interface_variables:
- &iv0
spirv_id: 3
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5319 # InLaunchIdKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td1
word_offset: { location: 0 }
- &iv1
spirv_id: 4
name:
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 5320 # InLaunchSizeKHR
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td1
word_offset: { location: 0 }
module:
generator: 14 # Google spiregg
entry_point_name: "main"
entry_point_id: 1
source_language: 5 # HLSL
source_language_version: 630
spirv_execution_model: 5313 # RayGenerationKHR
shader_stage: 0x00000100 # RAYGEN
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "rs"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "rs"
input_variable_count: 2,
input_variables:
- *iv0 #
- *iv1 #
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...