summaryrefslogtreecommitdiff
path: root/tools/gfx/resource-desc-utils.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-02-11 12:56:17 -0800
committerGitHub <noreply@github.com>2022-02-11 12:56:17 -0800
commit167300eef147f3008876516a6464196458518ccc (patch)
tree12071fa666c58f5f8510501227a7df286ef18f96 /tools/gfx/resource-desc-utils.cpp
parent7d296ba93ff9f01d381dd573160386958457fc18 (diff)
gfx: Various Vulkan fixes. (#2129)
* gfx: Various Vulkan fixes. * Fix test case. * Fix vulkan crash. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/gfx/resource-desc-utils.cpp')
-rw-r--r--tools/gfx/resource-desc-utils.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/gfx/resource-desc-utils.cpp b/tools/gfx/resource-desc-utils.cpp
index 93609cd0e..b36e765e5 100644
--- a/tools/gfx/resource-desc-utils.cpp
+++ b/tools/gfx/resource-desc-utils.cpp
@@ -17,4 +17,27 @@ ITextureResource::Desc fixupTextureDesc(const ITextureResource::Desc& desc)
rs.allowedStates.add(rs.defaultState);
return rs;
}
+
+Format srgbToLinearFormat(Format format)
+{
+ switch (format)
+ {
+ case Format::BC1_UNORM_SRGB:
+ return Format::BC1_UNORM;
+ case Format::BC2_UNORM_SRGB:
+ return Format::BC2_UNORM;
+ case Format::BC3_UNORM_SRGB:
+ return Format::BC3_UNORM;
+ case Format::BC7_UNORM_SRGB:
+ return Format::BC7_UNORM;
+ case Format::B8G8R8A8_UNORM_SRGB:
+ return Format::B8G8R8A8_UNORM;
+ case Format::B8G8R8X8_UNORM_SRGB:
+ return Format::B8G8R8X8_UNORM;
+ case Format::R8G8B8A8_UNORM_SRGB:
+ return Format::R8G8B8A8_UNORM;
+ default:
+ return format;
+ }
+}
}