mirror of
https://github.com/blawar/GLideN64.git
synced 2024-06-30 08:24:05 +00:00
Workaround for PowerVR issues
PowerVR needs depth to be cleared every frame, otherwise most geometry is rendered behind the background. It also needs fragment based depth to be disabled, otherwise geometry has various depth glitches.
This commit is contained in:
parent
30e4d3416b
commit
df2d4debbb
|
@ -93,6 +93,7 @@ PFNGLACTIVETEXTUREPROC ptrActiveTexture;
|
|||
PFNGLBLENDCOLORPROC ptrBlendColor;
|
||||
PFNGLREADBUFFERPROC ptrReadBuffer;
|
||||
PFNGLFINISHPROC ptrFinish;
|
||||
PFNGLFLUSHPROC ptrFlush;
|
||||
#if defined(OS_ANDROID)
|
||||
PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC ptrGetNativeClientBufferANDROID;
|
||||
#endif
|
||||
|
@ -243,6 +244,7 @@ void initGLFunctions()
|
|||
GL_GET_PROC_ADR(PFNGLBLENDCOLORPROC, BlendColor);
|
||||
GL_GET_PROC_ADR(PFNGLREADBUFFERPROC, ReadBuffer);
|
||||
GL_GET_PROC_ADR(PFNGLFINISHPROC, Finish);
|
||||
GL_GET_PROC_ADR(PFNGLFLUSHPROC, Flush);
|
||||
#if defined(OS_ANDROID)
|
||||
GL_GET_PROC_ADR_EGL(PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC, GetNativeClientBufferANDROID);
|
||||
#endif
|
||||
|
|
|
@ -84,6 +84,8 @@ extern PFNGLACTIVETEXTUREPROC ptrActiveTexture;
|
|||
extern PFNGLBLENDCOLORPROC ptrBlendColor;
|
||||
extern PFNGLREADBUFFERPROC ptrReadBuffer;
|
||||
extern PFNGLFINISHPROC ptrFinish;
|
||||
extern PFNGLFLUSHPROC ptrFlush;
|
||||
|
||||
#if defined(OS_ANDROID)
|
||||
extern PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC ptrGetNativeClientBufferANDROID;
|
||||
#endif
|
||||
|
@ -235,6 +237,7 @@ void initGLFunctions();
|
|||
#define glBlendColor(...) opengl::FunctionWrapper::wrBlendColor(__VA_ARGS__)
|
||||
#define glReadBuffer(...) opengl::FunctionWrapper::wrReadBuffer(__VA_ARGS__)
|
||||
#define glFinish(...) opengl::FunctionWrapper::wrFinish(__VA_ARGS__)
|
||||
#define glFlush(...) opengl::FunctionWrapper::wrFlush(__VA_ARGS__)
|
||||
#if defined(OS_ANDROID)
|
||||
#define eglGetNativeClientBufferANDROID(...) opengl::FunctionWrapper::ewrGetNativeClientBufferANDROID(__VA_ARGS__)
|
||||
#endif
|
||||
|
|
|
@ -4750,6 +4750,34 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
class GlFlushCommand : public OpenGlCommand
|
||||
{
|
||||
public:
|
||||
GlFlushCommand() :
|
||||
OpenGlCommand(true, true, "glFlush")
|
||||
{
|
||||
}
|
||||
|
||||
static std::shared_ptr<OpenGlCommand> get()
|
||||
{
|
||||
static int poolId = OpenGlCommandPool::get().getNextAvailablePool();
|
||||
auto ptr = getFromPool<GlFlushCommand>(poolId);
|
||||
ptr->set();
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void commandToExecute() override
|
||||
{
|
||||
ptrFlush();
|
||||
}
|
||||
|
||||
private:
|
||||
void set()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
class GlCopyTexImage2DCommand : public OpenGlCommand
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -1371,6 +1371,14 @@ namespace opengl {
|
|||
ptrFinish();
|
||||
}
|
||||
|
||||
void FunctionWrapper::wrFlush()
|
||||
{
|
||||
if (m_threaded_wrapper)
|
||||
executeCommand(GlFlushCommand::get());
|
||||
else
|
||||
ptrFlush();
|
||||
}
|
||||
|
||||
void FunctionWrapper::wrCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
|
||||
{
|
||||
if (m_threaded_wrapper)
|
||||
|
|
|
@ -191,6 +191,7 @@ namespace opengl {
|
|||
static void wrDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const u16* indices, GLint basevertex);
|
||||
static void wrFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
|
||||
static void wrFinish();
|
||||
static void wrFlush();
|
||||
static void wrCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
static void wrDebugMessageCallback(GLDEBUGPROC callback, const void *userParam);
|
||||
static void wrDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
|
||||
|
|
|
@ -204,11 +204,6 @@ void ContextImpl::clearDepthBuffer()
|
|||
CachedDepthMask * depthMask = m_cachedFunctions->getCachedDepthMask();
|
||||
enableScissor->enable(false);
|
||||
|
||||
if (m_glInfo.renderer == Renderer::PowerVR) {
|
||||
depthMask->setDepthMask(false);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
depthMask->setDepthMask(true);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
|
|
|
@ -167,6 +167,11 @@ void GLInfo::init() {
|
|||
}
|
||||
}
|
||||
|
||||
if (renderer == Renderer::PowerVR) {
|
||||
config.frameBufferEmulation.forceDepthBufferClear = 1;
|
||||
config.generalEmulation.enableFragmentDepthWrite = 0;
|
||||
}
|
||||
|
||||
depthTexture = !isGLES2 || Utils::isExtensionSupported(*this, "GL_OES_depth_texture");
|
||||
noPerspective = Utils::isExtensionSupported(*this, "GL_NV_shader_noperspective_interpolation");
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user