File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Tutorials/Tutorial19_RenderPasses/src Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2019-2023 Diligent Graphics LLC
2
+ * Copyright 2019-2024 Diligent Graphics LLC
3
3
* Copyright 2015-2019 Egor Yusov
4
4
*
5
5
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -355,7 +355,20 @@ void Tutorial19_RenderPasses::CreateRenderPass()
355
355
Attachments[0 ].LoadOp = ATTACHMENT_LOAD_OP_CLEAR;
356
356
Attachments[0 ].StoreOp = ATTACHMENT_STORE_OP_DISCARD; // We will not need the result after the end of the render pass
357
357
358
- Attachments[1 ].Format = TEX_FORMAT_R32_FLOAT;
358
+ for (TEXTURE_FORMAT Fmt : {TEX_FORMAT_R32_FLOAT, TEX_FORMAT_R16_UNORM, TEX_FORMAT_R16_FLOAT})
359
+ {
360
+ if (m_pDevice->GetTextureFormatInfoExt (Fmt).BindFlags & BIND_RENDER_TARGET)
361
+ {
362
+ Attachments[1 ].Format = Fmt;
363
+ break ;
364
+ }
365
+ }
366
+ if (Attachments[1 ].Format == TEX_FORMAT_UNKNOWN)
367
+ {
368
+ LOG_WARNING_MESSAGE (" This device does not support rendering to any of R32_FLOAT, R16_UNORM or R16_FLOAT formats. Using R8 as fallback." );
369
+ Attachments[1 ].Format = TEX_FORMAT_R8_UNORM;
370
+ }
371
+
359
372
Attachments[1 ].InitialState = RESOURCE_STATE_RENDER_TARGET;
360
373
Attachments[1 ].FinalState = RESOURCE_STATE_INPUT_ATTACHMENT;
361
374
Attachments[1 ].LoadOp = ATTACHMENT_LOAD_OP_CLEAR;
You can’t perform that action at this time.
0 commit comments