mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 23:25:40 +12:00
Moar
This commit is contained in:
parent
cf9ed3d460
commit
364443d66f
4 changed files with 19 additions and 6 deletions
|
@ -12,10 +12,12 @@ public:
|
||||||
// This will read the PICA config (uploaded shader and shader operand descriptors) and search if we've already compiled this shader
|
// 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,
|
// 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);
|
void prepare(PICAShader& shaderUnit);
|
||||||
|
static constexpr bool isAvailable() { return true; }
|
||||||
#else
|
#else
|
||||||
void prepare(PICAShader& shaderUnit) {
|
void prepare(PICAShader& shaderUnit) {
|
||||||
Helpers::panic("Vertex Loader JIT: Tried to load vertices with JIT on platform that does not support vertex loader jit");
|
Helpers::panic("Vertex Loader JIT: Tried to load vertices with JIT on platform that does not support vertex loader jit");
|
||||||
}
|
}
|
||||||
|
static constexpr bool isAvailable() { return false; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
|
@ -13,6 +13,8 @@ class VertexLoaderJIT {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#if defined(PANDA3DS_DYNAPICA_SUPPORTED) && defined(PANDA3DS_X64_HOST)
|
#if defined(PANDA3DS_DYNAPICA_SUPPORTED) && defined(PANDA3DS_X64_HOST)
|
||||||
|
#define PANDA3DS_VERTEX_LOADER_JIT_SUPPORTED
|
||||||
|
|
||||||
void loadVertices(Vertex* output, size_t count, PICARegs regs);
|
void loadVertices(Vertex* output, size_t count, PICARegs regs);
|
||||||
static constexpr bool isAvailable() { return true; }
|
static constexpr bool isAvailable() { return true; }
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class GPU {
|
||||||
uint immediateModeVertIndex;
|
uint immediateModeVertIndex;
|
||||||
uint immediateModeAttrIndex; // Index of the immediate mode attribute we're uploading
|
uint immediateModeAttrIndex; // Index of the immediate mode attribute we're uploading
|
||||||
|
|
||||||
template <bool indexed>
|
template <bool indexed, bool useShaderJIT>
|
||||||
void drawArrays();
|
void drawArrays();
|
||||||
|
|
||||||
// Silly method of avoiding linking problems. TODO: Change to something less silly
|
// Silly method of avoiding linking problems. TODO: Change to something less silly
|
||||||
|
|
|
@ -33,16 +33,25 @@ void GPU::reset() {
|
||||||
renderer.reset();
|
renderer.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call the correct version of drawArrays based on whether this is an indexed draw (first template parameter)
|
||||||
|
// And whether we are going to use the shader JIT (second template parameter)
|
||||||
void GPU::drawArrays(bool indexed) {
|
void GPU::drawArrays(bool indexed) {
|
||||||
if (indexed)
|
if (indexed) {
|
||||||
drawArrays<true>();
|
if constexpr (ShaderJIT::isAvailable())
|
||||||
else
|
drawArrays<true, true>();
|
||||||
drawArrays<false>();
|
else
|
||||||
|
drawArrays<true, false>();
|
||||||
|
} else {
|
||||||
|
if constexpr (ShaderJIT::isAvailable())
|
||||||
|
drawArrays<false, true>();
|
||||||
|
else
|
||||||
|
drawArrays<false, false>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vertex* vertices = new Vertex[Renderer::vertexBufferSize];
|
Vertex* vertices = new Vertex[Renderer::vertexBufferSize];
|
||||||
|
|
||||||
template <bool indexed>
|
template <bool indexed, bool useShaderJIT>
|
||||||
void GPU::drawArrays() {
|
void GPU::drawArrays() {
|
||||||
// Base address for vertex attributes
|
// Base address for vertex attributes
|
||||||
// The vertex base is always on a quadword boundary because the PICA does weird alignment shit any time possible
|
// The vertex base is always on a quadword boundary because the PICA does weird alignment shit any time possible
|
||||||
|
|
Loading…
Add table
Reference in a new issue