From 5f69470fe8597d811df06deb940cc5b54529fb4e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jarkko=20P=C3=B6yry?= Date: Mon, 11 May 2015 16:42:02 -0700 Subject: [PATCH] Fix issues with non-tightly packed images. - Add logging fast-path pixel pitch check. - Fix MultisamplePixelBufferAccess with non-tightly packed images. - Add estimatePixelValueRange() fast-paths for all normalized formats. Change-Id: If5b334de2658b7c714fe56bb561892b5a736e3b0 --- framework/common/tcuTestLog.cpp | 7 +++--- framework/common/tcuTextureUtil.cpp | 8 +++---- .../rrMultisamplePixelBufferAccess.cpp | 28 +++++++--------------- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/framework/common/tcuTestLog.cpp b/framework/common/tcuTestLog.cpp index fc1ea0f..5870f10 100644 --- a/framework/common/tcuTestLog.cpp +++ b/framework/common/tcuTestLog.cpp @@ -174,9 +174,10 @@ void TestLog::writeImage (const char* name, const char* description, const Const if ((qpTestLog_getLogFlags(m_log) & QP_TEST_LOG_EXCLUDE_IMAGES) != 0) return; - if (depth == 1 && format.type == TextureFormat::UNORM_INT8 && - width <= MAX_IMAGE_SIZE_2D && height <= MAX_IMAGE_SIZE_2D && - (format.order == TextureFormat::RGB || format.order == TextureFormat::RGBA) + if (depth == 1 && format.type == TextureFormat::UNORM_INT8 + && width <= MAX_IMAGE_SIZE_2D && height <= MAX_IMAGE_SIZE_2D + && (format.order == TextureFormat::RGB || format.order == TextureFormat::RGBA) + && access.getPixelPitch() == access.getFormat().getPixelSize() && pixelBias[0] == 0.0f && pixelBias[1] == 0.0f && pixelBias[2] == 0.0f && pixelBias[3] == 0.0f && pixelScale[0] == 1.0f && pixelScale[1] == 1.0f && pixelScale[2] == 1.0f && pixelScale[3] == 1.0f) { diff --git a/framework/common/tcuTextureUtil.cpp b/framework/common/tcuTextureUtil.cpp index 0de34c6..99f8dbd 100644 --- a/framework/common/tcuTextureUtil.cpp +++ b/framework/common/tcuTextureUtil.cpp @@ -916,17 +916,15 @@ void estimatePixelValueRange (const ConstPixelBufferAccess& access, Vec4& minVal { const TextureFormat& format = access.getFormat(); - switch (format.type) + switch (getTextureChannelClass(format.type)) { - case TextureFormat::UNORM_INT8: - case TextureFormat::UNORM_INT16: + case TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT: // Normalized unsigned formats. minVal = Vec4(0.0f); maxVal = Vec4(1.0f); break; - case TextureFormat::SNORM_INT8: - case TextureFormat::SNORM_INT16: + case TEXTURECHANNELCLASS_SIGNED_FIXED_POINT: // Normalized signed formats. minVal = Vec4(-1.0f); maxVal = Vec4(+1.0f); diff --git a/framework/referencerenderer/rrMultisamplePixelBufferAccess.cpp b/framework/referencerenderer/rrMultisamplePixelBufferAccess.cpp index f7effbd..e7ab014 100644 --- a/framework/referencerenderer/rrMultisamplePixelBufferAccess.cpp +++ b/framework/referencerenderer/rrMultisamplePixelBufferAccess.cpp @@ -42,11 +42,8 @@ const tcu::PixelBufferAccess MultisamplePixelBufferAccess::toSinglesampleAccess DE_ASSERT(getNumSamples() == 1); return tcu::PixelBufferAccess(m_access.getFormat(), - m_access.getHeight(), - m_access.getDepth(), - 1, - m_access.getSlicePitch(), - m_access.getSlicePitch() * m_access.getDepth(), + tcu::IVec3(m_access.getHeight(), m_access.getDepth(), 1), + tcu::IVec3(m_access.getRowPitch(), m_access.getSlicePitch(), m_access.getSlicePitch() * m_access.getDepth()), m_access.getDataPtr()); } @@ -55,11 +52,8 @@ MultisamplePixelBufferAccess MultisamplePixelBufferAccess::fromSinglesampleAcces return MultisamplePixelBufferAccess( tcu::PixelBufferAccess( original.getFormat(), - 1, - original.getWidth(), - original.getHeight(), - original.getFormat().getPixelSize(), - original.getRowPitch(), + tcu::IVec3(1, original.getWidth(), original.getHeight()), + tcu::IVec3(original.getPixelPitch(), original.getPixelPitch(), original.getRowPitch()), original.getDataPtr())); } @@ -88,11 +82,8 @@ const tcu::ConstPixelBufferAccess MultisampleConstPixelBufferAccess::toSinglesam DE_ASSERT(getNumSamples() == 1); return tcu::ConstPixelBufferAccess(m_access.getFormat(), - m_access.getHeight(), - m_access.getDepth(), - 1, - m_access.getSlicePitch(), - m_access.getSlicePitch() * m_access.getDepth(), + tcu::IVec3(m_access.getHeight(), m_access.getDepth(), 1), + tcu::IVec3(m_access.getRowPitch(), m_access.getSlicePitch(), m_access.getSlicePitch() * m_access.getDepth()), m_access.getDataPtr()); } @@ -101,11 +92,8 @@ MultisampleConstPixelBufferAccess MultisampleConstPixelBufferAccess::fromSingles return MultisampleConstPixelBufferAccess( tcu::ConstPixelBufferAccess( original.getFormat(), - 1, - original.getWidth(), - original.getHeight(), - original.getFormat().getPixelSize(), - original.getRowPitch(), + tcu::IVec3(1, original.getWidth(), original.getHeight()), + tcu::IVec3(original.getPixelPitch(), original.getPixelPitch(), original.getRowPitch()), original.getDataPtr())); } -- 2.7.4