@@ -1630,6 +1630,13 @@ impl Shader {
1630
1630
}
1631
1631
}
1632
1632
1633
+ pub struct ShaderTable {
1634
+ }
1635
+
1636
+ impl super :: ShaderTable < Device > for ShaderTable {
1637
+
1638
+ }
1639
+
1633
1640
impl super :: Device for Device {
1634
1641
type SwapChain = SwapChain ;
1635
1642
type CmdBuf = CmdBuf ;
@@ -1644,6 +1651,7 @@ impl super::Device for Device {
1644
1651
type Heap = Heap ;
1645
1652
type QueryHeap = QueryHeap ;
1646
1653
type CommandSignature = CommandSignature ;
1654
+ type ShaderTable = ShaderTable ;
1647
1655
fn create ( info : & super :: DeviceInfo ) -> Device {
1648
1656
unsafe {
1649
1657
// enable debug layer
@@ -2149,6 +2157,9 @@ impl super::Device for Device {
2149
2157
Flags : to_d3d12_buffer_usage_flags ( info. usage ) ,
2150
2158
..Default :: default ( )
2151
2159
} ,
2160
+ D3D12_RESOURCE_STATE_COMMON ,
2161
+
2162
+ /*
2152
2163
// initial state
2153
2164
if info.cpu_access.contains(super::CpuAccessFlags::WRITE) {
2154
2165
D3D12_RESOURCE_STATE_GENERIC_READ
@@ -2159,6 +2170,8 @@ impl super::Device for Device {
2159
2170
else {
2160
2171
to_d3d12_resource_state(info.initial_state)
2161
2172
},
2173
+ */
2174
+
2162
2175
None ,
2163
2176
& mut buf,
2164
2177
) ?;
@@ -3078,9 +3091,45 @@ impl super::Device for Device {
3078
3091
3079
3092
unsafe {
3080
3093
let device5 = self . device . cast :: < ID3D12Device5 > ( ) . expect ( "hotline_rs::gfx::d3d12: expected ID3D12Device5 availability to create_raytracing_pipeline" ) ;
3081
- let state_object = device5. CreateStateObject (
3094
+ let state_object : ID3D12StateObject = device5. CreateStateObject (
3082
3095
& state_object_desc,
3083
3096
) ?;
3097
+
3098
+ // get shader identifiers
3099
+ let props = state_object. cast :: < ID3D12StateObjectProperties > ( ) . expect ( "hotline_rs::gfx::d3d12: expected ID3D12StateObjectProperties" ) ;
3100
+ let ident = props. GetShaderIdentifier ( windows_core:: PCWSTR ( wide_entry_points[ 0 ] . as_ptr ( ) ) ) ;
3101
+ println ! ( "ident: {:?}" , ident) ;
3102
+
3103
+ // create a resource ray gen, miss and hitgroup (maybe arrays)
3104
+
3105
+ // create a table resource
3106
+ let mut table_buffer: Option < ID3D12Resource > = None ;
3107
+ self . device . CreateCommittedResource (
3108
+ & D3D12_HEAP_PROPERTIES {
3109
+ Type : D3D12_HEAP_TYPE_DEFAULT ,
3110
+ ..Default :: default ( )
3111
+ } ,
3112
+ D3D12_HEAP_FLAG_NONE ,
3113
+ & D3D12_RESOURCE_DESC {
3114
+ Dimension : D3D12_RESOURCE_DIMENSION_BUFFER ,
3115
+ Alignment : 0 , //D3D12_RAYTRACING_SHADER_RECORD_BYTE_ALIGNMENT as u64,
3116
+ Width : D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES as u64 ,
3117
+ Height : 1 ,
3118
+ DepthOrArraySize : 1 ,
3119
+ MipLevels : 1 ,
3120
+ Format : DXGI_FORMAT_UNKNOWN ,
3121
+ SampleDesc : DXGI_SAMPLE_DESC {
3122
+ Count : 1 ,
3123
+ Quality : 0 ,
3124
+ } ,
3125
+ Layout : D3D12_TEXTURE_LAYOUT_ROW_MAJOR ,
3126
+ Flags : D3D12_RESOURCE_FLAG_NONE ,
3127
+ } ,
3128
+ D3D12_RESOURCE_STATE_COMMON ,
3129
+ None ,
3130
+ & mut table_buffer,
3131
+ ) ?;
3132
+
3084
3133
Ok ( RaytracingPipeline {
3085
3134
state_object : state_object
3086
3135
} )
0 commit comments