mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-07 22:55:40 +12:00
GLES: Add support for GL_ARM_shader_framebuffer_fetch
This commit is contained in:
parent
001ebec631
commit
2460050e8d
3 changed files with 22 additions and 5 deletions
|
@ -4,6 +4,9 @@
|
||||||
// Stuff like whether specific extensions are supported, and potentially things like OpenGL context information
|
// Stuff like whether specific extensions are supported, and potentially things like OpenGL context information
|
||||||
namespace OpenGL {
|
namespace OpenGL {
|
||||||
struct Driver {
|
struct Driver {
|
||||||
bool supportsFbFetch = false;
|
bool supportsExtFbFetch = false;
|
||||||
|
bool supportsArmFbFetch = false;
|
||||||
|
|
||||||
|
bool supportFbFetch() const { return supportsExtFbFetch || supportsArmFbFetch; }
|
||||||
};
|
};
|
||||||
} // namespace OpenGL
|
} // namespace OpenGL
|
|
@ -108,11 +108,24 @@ std::string FragmentGenerator::generate(const FragmentConfig& config, void* driv
|
||||||
}
|
}
|
||||||
|
|
||||||
// For GLES we need to enable & use the framebuffer fetch extension in order to emulate logic ops
|
// For GLES we need to enable & use the framebuffer fetch extension in order to emulate logic ops
|
||||||
const bool emitLogicOps = api == API::GLES && config.outConfig.logicOpMode != PICA::LogicOpMode::Copy && driverInfo != nullptr &&
|
bool emitLogicOps = api == API::GLES && config.outConfig.logicOpMode != PICA::LogicOpMode::Copy && driverInfo != nullptr;
|
||||||
static_cast<OpenGL::Driver*>(driverInfo)->supportsFbFetch;
|
|
||||||
|
|
||||||
if (emitLogicOps) {
|
if (emitLogicOps) {
|
||||||
|
auto driver = static_cast<OpenGL::Driver*>(driverInfo);
|
||||||
|
|
||||||
|
// If the driver does not support framebuffer fetch at all, don't emit logic op code
|
||||||
|
if (!driver->supportFbFetch()) {
|
||||||
|
emitLogicOps = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Figure out which fb fetch extension we have and enable it
|
||||||
|
else {
|
||||||
|
if (driver->supportsExtFbFetch) {
|
||||||
ret += "\n#extension GL_EXT_shader_framebuffer_fetch : enable\n";
|
ret += "\n#extension GL_EXT_shader_framebuffer_fetch : enable\n";
|
||||||
|
} else if (driver->supportsArmFbFetch) {
|
||||||
|
ret += "\n#extension GL_ARM_shader_framebuffer_fetch : enable\n#define gl_LastFragData gl_LastFragColorARM\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool unimplementedFlag = false;
|
bool unimplementedFlag = false;
|
||||||
|
|
|
@ -168,7 +168,8 @@ void RendererGL::initGraphicsContextInternal() {
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
// Populate our driver info structure
|
// Populate our driver info structure
|
||||||
driverInfo.supportsFbFetch = GLAD_GL_EXT_shader_framebuffer_fetch != 0;
|
driverInfo.supportsExtFbFetch = GLAD_GL_EXT_shader_framebuffer_fetch != 0;
|
||||||
|
driverInfo.supportsArmFbFetch = GLAD_GL_ARM_shader_framebuffer_fetch != 0;
|
||||||
|
|
||||||
// Initialize the default vertex shader used with shadergen
|
// Initialize the default vertex shader used with shadergen
|
||||||
std::string defaultShadergenVSSource = fragShaderGen.getDefaultVertexShader();
|
std::string defaultShadergenVSSource = fragShaderGen.getDefaultVertexShader();
|
||||||
|
|
Loading…
Add table
Reference in a new issue