From 0017b5d9c5d00f4546017e829250251ff2194a25 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 5 Apr 2021 17:58:59 +0200 Subject: [PATCH] - pad out the StreamData buffer to 16 bytes and avoid any form of conditional compilation here. Vulkan does not manage to get the shader properly compiled without this. --- source/common/rendering/hwrenderer/data/hw_renderstate.h | 9 ++++----- source/common/rendering/vulkan/shaders/vk_shader.cpp | 5 ++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/source/common/rendering/hwrenderer/data/hw_renderstate.h b/source/common/rendering/hwrenderer/data/hw_renderstate.h index 9cf1015d2..54aab25f8 100644 --- a/source/common/rendering/hwrenderer/data/hw_renderstate.h +++ b/source/common/rendering/hwrenderer/data/hw_renderstate.h @@ -200,9 +200,8 @@ struct StreamData FVector4 uSplitBottomPlane; FVector4 uDetailParms; -#ifdef NPOT_EMULATION - FVector2 uNpotEmulation; -#endif + FVector4 uNpotEmulation; + FVector4 padding1, padding2, padding3; }; class FRenderState @@ -295,7 +294,7 @@ public: mStreamData.uDynLightColor = { 0.0f, 0.0f, 0.0f, 1.0f }; mStreamData.uDetailParms = { 0.0f, 0.0f, 0.0f, 0.0f }; #ifdef NPOT_EMULATION - mStreamData.uNpotEmulation = { 0,0 }; + mStreamData.uNpotEmulation = { 0,0,0,0 }; #endif mModelMatrix.loadIdentity(); mTextureMatrix.loadIdentity(); @@ -490,7 +489,7 @@ public: void SetNpotEmulation(float factor, float offset) { #ifdef NPOT_EMULATION - mStreamData.uNpotEmulation = { offset, factor }; + mStreamData.uNpotEmulation = { offset, factor, 0, 0 }; #endif } diff --git a/source/common/rendering/vulkan/shaders/vk_shader.cpp b/source/common/rendering/vulkan/shaders/vk_shader.cpp index 0456061fb..acb15dd47 100644 --- a/source/common/rendering/vulkan/shaders/vk_shader.cpp +++ b/source/common/rendering/vulkan/shaders/vk_shader.cpp @@ -163,9 +163,8 @@ static const char *shaderBindings = R"( vec4 uSplitBottomPlane; vec4 uDetailParms; - #ifdef NPOT_EMULATION - vec2 uNpotEmulation; - #endif + vec4 uNpotEmulation; + vec4 padding1, padding2, padding3; }; layout(set = 0, binding = 3, std140) uniform StreamUBO {