-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Switch to pipeline stream desc for dx12 pipeline creation #8377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Switch to pipeline stream desc for dx12 pipeline creation #8377
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We likely can't use stream descriptors unconditionally unless we can prove that support for it goes back far enough
| struct RenderPipelineStateStreamDesc { | ||
| root_signature: *mut Direct3D12::ID3D12RootSignature, | ||
| task_shader: Direct3D12::D3D12_SHADER_BYTECODE, | ||
| mesh_shader: Direct3D12::D3D12_SHADER_BYTECODE, | ||
| pixel_shader: Direct3D12::D3D12_SHADER_BYTECODE, | ||
| blend_state: Direct3D12::D3D12_BLEND_DESC, | ||
| sample_mask: u32, | ||
| rasterizer_state: Direct3D12::D3D12_RASTERIZER_DESC, | ||
| depth_stencil_state: Direct3D12::D3D12_DEPTH_STENCIL_DESC, | ||
| primitive_topology_type: Direct3D12::D3D12_PRIMITIVE_TOPOLOGY_TYPE, | ||
| rtv_formats: Direct3D12::D3D12_RT_FORMAT_ARRAY, | ||
| dsv_format: Dxgi::Common::DXGI_FORMAT, | ||
| sample_desc: Dxgi::Common::DXGI_SAMPLE_DESC, | ||
| node_mask: u32, | ||
| cached_pso: Direct3D12::D3D12_CACHED_PIPELINE_STATE, | ||
| flags: Direct3D12::D3D12_PIPELINE_STATE_FLAGS, | ||
|
|
||
| // Vertex pipeline specific | ||
| vertex_shader: Direct3D12::D3D12_SHADER_BYTECODE, | ||
| input_layout: Direct3D12::D3D12_INPUT_LAYOUT_DESC, | ||
| index_buffer_strip_cut_value: Direct3D12::D3D12_INDEX_BUFFER_STRIP_CUT_VALUE, | ||
| stream_output: Direct3D12::D3D12_STREAM_OUTPUT_DESC, | ||
|
|
||
| // Mesh pipeline specific | ||
| task_shader: Direct3D12::D3D12_SHADER_BYTECODE, | ||
| mesh_shader: Direct3D12::D3D12_SHADER_BYTECODE, | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should definitely isolate this to its own file so that we can consider its unsafety isolation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm honestly kind of surprised that this kind of code actually got accepted without much fuss in the mesh shaders PR lmao
|
Alright, so it was the Creators Update (1703) that introduced it, we'd need to hear from mozilla if that's too new. |
|
I can probably switch this so that the pipeline descriptor gets converted into a graphics pipeline descriptor on platforms where this wouldn't work. That probably will be the best for compatibility regardless of what Mozilla wants. |
|
Discussed at today's wgpu matainers meeting. Resolution: lets use this conditionally. mapping from a single struct works fine. Discussion
|
Connections
Closes #8341
Required for #8376
Description
The
CreateGraphicsPipelineStatefunction works great for basic render pipelines, but for more advanced features such as mesh shaders (#8110) or multiview/view instancing (#8206), you must use a streaming descriptor. The streaming descriptor corresponds more or less to a vulkan pipeline descriptor with the state described in apNextchain, allowing you to use all sorts of extensions.This PR switches all pipeline creation to use this function. Mesh shaders already used it but there was no reason to use different code paths for mesh shader pipelines vs standard pipelines when 99% of the descriptor is the same.
One thing to note: if it is ever possible in some esoteric system to use the DX12 backend on a 32-bit system, this code might not function properly. It probably still would, but it might not. Not that this is a setup that any real person has of course.
Testing
Existing testing (pretty much all tests use render pipelines)
Squash or Rebase?
Squash
Checklist
cargo fmt.taplo format.cargo clippy --tests. If applicable, add:--target wasm32-unknown-unknowncargo xtask testto run tests.CHANGELOG.mdentry.