Merge pull request #16816 from unknownbrackets/metal-align-verts

Vulkan: Force align verts to 4 on Apple devices
This commit is contained in:
Henrik Rydgård 2023-01-20 21:23:00 +01:00 committed by GitHub
commit 03f64a0216
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -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();

View File

@ -324,6 +324,7 @@ struct VertexDecoderOptions {
bool expandAllWeightsToFloat;
bool expand8BitNormalsToFloat;
bool applySkinInDecode;
bool alignOutputToWord;
};
class VertexDecoder {

View File

@ -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>
@ -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.