summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-09-15 21:15:48 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-09-15 21:15:48 +0000
commitde357f5cc08b3bff0cadd7c67a8dc8bd622e45c3 (patch)
tree505977e088e84f3177c08d6eb4b01af54b1b74cd /Graphics/GraphicsEngine
parentFixed DXC1.5 compiler warning (diff)
downloadDiligentCore-de357f5cc08b3bff0cadd7c67a8dc8bd622e45c3.tar.gz
DiligentCore-de357f5cc08b3bff0cadd7c67a8dc8bd622e45c3.zip
Fixed validation of Texture1D/Texture1DArray parameters for compressed formats
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/src/TextureBase.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/Graphics/GraphicsEngine/src/TextureBase.cpp b/Graphics/GraphicsEngine/src/TextureBase.cpp
index c4e5e999..93050ff1 100644
--- a/Graphics/GraphicsEngine/src/TextureBase.cpp
+++ b/Graphics/GraphicsEngine/src/TextureBase.cpp
@@ -36,6 +36,8 @@ void ValidateTextureDesc(const TextureDesc& Desc)
{
#define LOG_TEXTURE_ERROR_AND_THROW(...) LOG_ERROR_AND_THROW("Texture '", (Desc.Name ? Desc.Name : ""), "': ", ##__VA_ARGS__)
+ const auto& FmtAttribs = GetTextureFormatAttribs(Desc.Format);
+
if (Desc.Type == RESOURCE_DIM_UNDEFINED)
{
LOG_TEXTURE_ERROR_AND_THROW("Resource dimension is undefined");
@@ -54,8 +56,19 @@ void ValidateTextureDesc(const TextureDesc& Desc)
// Perform some parameter correctness check
if (Desc.Type == RESOURCE_DIM_TEX_1D || Desc.Type == RESOURCE_DIM_TEX_1D_ARRAY)
{
- if (Desc.Height != 1)
- LOG_TEXTURE_ERROR_AND_THROW("Height (", Desc.Height, ") of Texture 1D/Texture 1D Array must be 1");
+ if (Desc.Height != FmtAttribs.BlockHeight)
+ {
+ if (FmtAttribs.BlockHeight == 1)
+ {
+ LOG_TEXTURE_ERROR_AND_THROW("Height (", Desc.Height, ") of a Texture 1D/Texture 1D Array must be 1");
+ }
+ else
+ {
+ LOG_TEXTURE_ERROR_AND_THROW("For block-compressed formats, the height (", Desc.Height,
+ ") of a Texture 1D/Texture 1D Array must be equal to the compressed block height (",
+ Uint32{FmtAttribs.BlockHeight}, ")");
+ }
+ }
}
else
{