mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 23:26:24 +00:00
Make binding expose the preferred format
This commit is contained in:
committed by
Corentin Wallez
parent
405dcd636a
commit
2e31e8f0bf
@@ -116,6 +116,10 @@ uint64_t GetSwapChainImplementation() {
|
||||
return binding->GetSwapChainImplementation();
|
||||
}
|
||||
|
||||
nxt::TextureFormat GetPreferredSwapChainTextureFormat() {
|
||||
return static_cast<nxt::TextureFormat>(binding->GetPreferredSwapChainTextureFormat());
|
||||
}
|
||||
|
||||
nxt::SwapChain GetSwapChain(const nxt::Device &device) {
|
||||
return device.CreateSwapChainBuilder()
|
||||
.SetImplementation(GetSwapChainImplementation())
|
||||
@@ -125,7 +129,7 @@ nxt::SwapChain GetSwapChain(const nxt::Device &device) {
|
||||
nxt::RenderPass CreateDefaultRenderPass(const nxt::Device& device) {
|
||||
return device.CreateRenderPassBuilder()
|
||||
.SetAttachmentCount(2)
|
||||
.AttachmentSetFormat(0, nxt::TextureFormat::R8G8B8A8Unorm)
|
||||
.AttachmentSetFormat(0, GetPreferredSwapChainTextureFormat())
|
||||
.AttachmentSetColorLoadOp(0, nxt::LoadOp::Clear)
|
||||
.AttachmentSetFormat(1, nxt::TextureFormat::D32FloatS8Uint)
|
||||
.AttachmentSetDepthStencilLoadOps(1, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
|
||||
Reference in New Issue
Block a user