Skip to content

Commit

Permalink
- pad out the StreamData buffer to 16 bytes and avoid any form of con…
Browse files Browse the repository at this point in the history
…ditional compilation here.

Vulkan does not manage to get the shader properly compiled without this.
  • Loading branch information
coelckers committed Apr 5, 2021
1 parent f2dd4ce commit 0017b5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
9 changes: 4 additions & 5 deletions source/common/rendering/hwrenderer/data/hw_renderstate.h
Expand Up @@ -200,9 +200,8 @@ struct StreamData
FVector4 uSplitBottomPlane;

FVector4 uDetailParms;
#ifdef NPOT_EMULATION
FVector2 uNpotEmulation;
#endif
FVector4 uNpotEmulation;
FVector4 padding1, padding2, padding3;
};

class FRenderState
Expand Down Expand Up @@ -295,7 +294,7 @@ class FRenderState
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();
Expand Down Expand Up @@ -490,7 +489,7 @@ class FRenderState
void SetNpotEmulation(float factor, float offset)
{
#ifdef NPOT_EMULATION
mStreamData.uNpotEmulation = { offset, factor };
mStreamData.uNpotEmulation = { offset, factor, 0, 0 };
#endif
}

Expand Down
5 changes: 2 additions & 3 deletions source/common/rendering/vulkan/shaders/vk_shader.cpp
Expand Up @@ -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 {
Expand Down

0 comments on commit 0017b5d

Please sign in to comment.