Skip to content

Commit

Permalink
Merge pull request #16816 from unknownbrackets/metal-align-verts
Browse files Browse the repository at this point in the history
Vulkan: Force align verts to 4 on Apple devices
  • Loading branch information
hrydgard committed Jan 20, 2023
2 parents c75a7e0 + 1c8bedb commit 03f64a0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion GPU/Common/VertexDecoderCommon.cpp
Expand Up @@ -1254,7 +1254,7 @@ void VertexDecoder::SetVertexType(u32 fmt, const VertexDecoderOptions &options,
decOff += DecFmtSize(decFmt.posfmt);
}

decFmt.stride = decOff;
decFmt.stride = options.alignOutputToWord ? align(decOff, 4) : decOff;

decFmt.ComputeID();

Expand Down
1 change: 1 addition & 0 deletions GPU/Common/VertexDecoderCommon.h
Expand Up @@ -324,6 +324,7 @@ struct VertexDecoderOptions {
bool expandAllWeightsToFloat;
bool expand8BitNormalsToFloat;
bool applySkinInDecode;
bool alignOutputToWord;
};

class VertexDecoder {
Expand Down
4 changes: 4 additions & 0 deletions GPU/Vulkan/DrawEngineVulkan.cpp
Expand Up @@ -15,6 +15,7 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.

#include "ppsspp_config.h"
#include <algorithm>
#include <functional>

Expand Down Expand Up @@ -70,6 +71,9 @@ DrawEngineVulkan::DrawEngineVulkan(Draw::DrawContext *draw)
: draw_(draw), vai_(1024) {
decOptions_.expandAllWeightsToFloat = false;
decOptions_.expand8BitNormalsToFloat = false;
#if PPSSPP_PLATFORM(MAC) || PPSSPP_PLATFORM(IOS)
decOptions_.alignOutputToWord = true;
#endif

// Allocate nicely aligned memory. Maybe graphics drivers will appreciate it.
// All this is a LOT of memory, need to see if we can cut down somehow.
Expand Down

0 comments on commit 03f64a0

Please sign in to comment.