Skip to content

Commit

Permalink
gpu : little fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishan09811 authored Feb 19, 2024
1 parent ca8d654 commit 30b2d0c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/PICA/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ void GPU::drawArrays(bool indexed) {
}

static std::array<PICA::Vertex, Renderer::vertexBufferSize> vertices;
static std::optional<u64> cachedVertexCfg;

template <bool indexed, bool useShaderJIT>
void GPU::drawArrays() {
Expand Down Expand Up @@ -155,8 +156,12 @@ void GPU::drawArrays() {
bool shortIndex = Helpers::getBit<31>(indexBufferConfig); // Indicates whether vert indices are 16-bit or 8-bit

// Stuff the global attribute config registers in one u64 to make attr parsing easier
// TODO: Cache this when the vertex attribute format registers are written to
u64 vertexCfg = u64(regs[PICA::InternalRegs::AttribFormatLow]) | (u64(regs[PICA::InternalRegs::AttribFormatHigh]) << 32);
// Cache this when the vertex attribute format registers are written to
static std::optional<u64> cachedVertexCfg; // Cached vertex configuration
if (!cachedVertexCfg.has_value()) {
cachedVertexCfg = u64(regs[PICA::InternalRegs::AttribFormatLow]) | (u64(regs[PICA::InternalRegs::AttribFormatHigh]) << 32);
}
u64 vertexCfg = *cachedVertexCfg;

if constexpr (!indexed) {
u32 offset = regs[PICA::InternalRegs::VertexOffsetReg];
Expand Down

0 comments on commit 30b2d0c

Please sign in to comment.