[DX12] Add support for Samplers in DX12.#1331
Conversation
d082a3c to
0609be6
Compare
0609be6 to
273e4a5
Compare
273e4a5 to
909509e
Compare
14ea640 to
99062f2
Compare
| enum class RootParameterType : uint32_t { | ||
| DescriptorTable = 0, | ||
| SamplerTable, | ||
| Constant, | ||
| CBV, | ||
| SRV, | ||
| UAV, | ||
| }; | ||
|
|
||
| struct RoogtSignatureLayout { | ||
| RootParameterType ParameterType : 3; | ||
| uint32_t Count : 29; | ||
|
|
||
| RoogtSignatureLayout(RootParameterType ParameterType, uint32_t Count) | ||
| : ParameterType(ParameterType), Count(Count) {} | ||
| RoogtSignatureLayout() = delete; | ||
| }; | ||
|
|
There was a problem hiding this comment.
Could've probably been two PRs, but at least this way it doesn't only introduces new API but it also shows how it's used
8095bff to
3c20e02
Compare
| // Depth formats require DepthStencil usage; non-depth formats forbid it. | ||
| if (IsDepth && !IsDS) | ||
| return llvm::createStringError( | ||
| std::errc::invalid_argument, | ||
| "Depth format '%s' requires DepthStencil usage.", | ||
| getFormatName(Desc.Fmt).data()); |
There was a problem hiding this comment.
Out of scope / unrelated?
There was a problem hiding this comment.
Some of the sampler tests failed on textures with a depth format, but without a depth stencil format being created. While this is unusual, it's not incorrect.
MarijnS95
left a comment
There was a problem hiding this comment.
A few more, on top of the inline notes:
Texture.h— dropping the "depth format requires DepthStencil usage" check is unrelated to samplers, and the depth-as-SRV path it enables still isn't correct (typedD32_FLOATcan't back an SRV withoutTYPELESS; those tests stayXFAIL). Maybe split out.- Implicit fallback now hard-errors on shader-embedded inline descriptors / root constants when no explicit
RootParametersare given (previously bound each set as a table). No test hits it, but it's a behavior change. assert(... "Manon expected this to be 1.")silently caps sampler arrays at 1 — prefer a realcreateStringErrorstating the invariant.RoogtSignatureLayout(and the error stringRootParamters) is misspelled.
Cleared on inspection: SamplerCreateDesc brace-init order matches the struct, the filter/comparison/address enum mappings are correct, and the 256-cap SamplerAllocator matches the existing allocator pattern.
| break; | ||
| case DescriptorKind::SAMPLER: | ||
| llvm_unreachable("Not implemented yet."); // Requires a separate heap | ||
| llvm_unreachable("Sampler should have been filtered out."); |
There was a problem hiding this comment.
I would think this is dead code because of the continue on line 1425
There was a problem hiding this comment.
Yes, which is why I put the unreachable statement there. I want all cases to be handled instead of relying on the default case label.
3c20e02 to
e4f4978
Compare
|
Tagging @alsepkow for awareness. |
Adds support for samplers in DX12.
This change is a lot larger than you would expect from adding samplers.
This is because samplers need to live in a separate DescriptorHeap which cascaded into a couple of issues:
Adding this feature does allow more tests to succeed on DX12.