More shader JIT groundwork

This commit is contained in:
wheremyfoodat 2023-06-07 17:44:46 +03:00
parent bf0436a85b
commit cf9ed3d460
7 changed files with 46 additions and 7 deletions

View file

@ -0,0 +1,21 @@
#pragma once
#include "PICA/shader.hpp"
class ShaderJIT {
void compileShader(PICAShader& shaderUnit);
public:
#if defined(PANDA3DS_DYNAPICA_SUPPORTED) && defined(PANDA3DS_X64_HOST)
#define PANDA3DS_SHADER_JIT_SUPPORTED
// Call this before starting to process a batch of vertices
// This will read the PICA config (uploaded shader and shader operand descriptors) and search if we've already compiled this shader
// If yes, it sets it as the active shader. if not, then it compiles it, adds it to the cache, and sets it as active,
void prepare(PICAShader& shaderUnit);
#else
void prepare(PICAShader& shaderUnit) {
Helpers::panic("Vertex Loader JIT: Tried to load vertices with JIT on platform that does not support vertex loader jit");
}
#endif
};

View file

@ -12,11 +12,15 @@ class VertexLoaderJIT {
Callback compileConfig(PICARegs regs);
public:
#ifndef PANDA3DS_DYNAPICA_SUPPORTED
#if defined(PANDA3DS_DYNAPICA_SUPPORTED) && defined(PANDA3DS_X64_HOST)
void loadVertices(Vertex* output, size_t count, PICARegs regs);
static constexpr bool isAvailable() { return true; }
#else
void loadVertices(Vertex* output, size_t count, PICARegs regs) {
Helpers::panic("Vertex Loader JIT: Tried to load vertices with JIT on platform that does not support vertex loader jit");
}
#else
void loadVertices(Vertex* output, size_t count, PICARegs regs);
static constexpr bool isAvailable() { return false; }
#endif
};