mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-11 08:39:28 +01:00
Run the depal stuff, seems a bit broken. Add some state filtering.
This commit is contained in:
1 parent
970458a0c2
commit
f99fa02ba7
12 files changed
+105
-112
No files matched your search
@@ -82,11 +82,9 @@ void GLQueueRunner::RunInitSteps(const std::vector<GLRInitStep> &steps) {
|
||||
glBindFragDataLocation(program->program, 0, "fragColor0");
|
||||
}
|
||||
#elif !defined(IOS)
|
||||
if (gl_extensions.GLES3) {
|
||||
if (gstate_c.featureFlags & GPU_SUPPORTS_DUALSOURCE_BLEND) {
|
||||
glBindFragDataLocationIndexedEXT(program->program, 0, 0, "fragColor0");
|
||||
glBindFragDataLocationIndexedEXT(program->program, 0, 1, "fragColor1");
|
||||
}
|
||||
if (gl_extensions.GLES3 && step.create_program.support_dual_source) {
|
||||
glBindFragDataLocationIndexedEXT(program->program, 0, 0, "fragColor0");
|
||||
glBindFragDataLocationIndexedEXT(program->program, 0, 1, "fragColor1");
|
||||
}
|
||||
#endif
|
||||
glLinkProgram(program->program);
|
||||
@@ -413,7 +411,9 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
|
||||
glActiveTexture(GL_TEXTURE0 + activeTexture);
|
||||
|
||||
int attrMask = 0;
|
||||
|
||||
int colorMask = -1;
|
||||
int depthMask = -1;
|
||||
int depthFunc = -1;
|
||||
// State filtering tracking.
|
||||
GLuint curArrayBuffer = (GLuint)-1;
|
||||
GLuint curElemArrayBuffer = (GLuint)-1;
|
||||
@@ -424,8 +424,14 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
|
||||
case GLRRenderCommand::DEPTH:
|
||||
if (c.depth.enabled) {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(c.depth.write);
|
||||
glDepthFunc(c.depth.func);
|
||||
if (c.depth.write != depthMask) {
|
||||
glDepthMask(c.depth.write);
|
||||
depthMask = c.depth.write;
|
||||
}
|
||||
if (c.depth.func != depthFunc) {
|
||||
glDepthFunc(c.depth.func);
|
||||
depthFunc = c.depth.func;
|
||||
}
|
||||
} else {
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
@@ -438,11 +444,15 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
|
||||
} else {
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
glColorMask(c.blend.mask & 1, (c.blend.mask >> 1) & 1, (c.blend.mask >> 2) & 1, (c.blend.mask >> 3) & 1);
|
||||
if (c.blend.mask != colorMask) {
|
||||
glColorMask(c.blend.mask & 1, (c.blend.mask >> 1) & 1, (c.blend.mask >> 2) & 1, (c.blend.mask >> 3) & 1);
|
||||
colorMask = c.blend.mask;
|
||||
}
|
||||
break;
|
||||
case GLRRenderCommand::CLEAR:
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
colorMask = 0xF;
|
||||
if (c.clear.clearMask & GL_COLOR_BUFFER_BIT) {
|
||||
float color[4];
|
||||
Uint8x4ToFloat4(color, c.clear.clearColor);
|
||||
@@ -485,7 +495,11 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
|
||||
|
||||
// TODO: Support FP viewports through glViewportArrays
|
||||
glViewport((GLint)c.viewport.vp.x, (GLint)y, (GLsizei)c.viewport.vp.w, (GLsizei)c.viewport.vp.h);
|
||||
#if !defined(USING_GLES2)
|
||||
glDepthRange(c.viewport.vp.minZ, c.viewport.vp.maxZ);
|
||||
#else
|
||||
glDepthRangef(c.viewport.vp.minZ, c.viewport.vp.maxZ);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case GLRRenderCommand::SCISSOR:
|
||||
@@ -597,8 +611,10 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
|
||||
}
|
||||
case GLRRenderCommand::BINDPROGRAM:
|
||||
{
|
||||
glUseProgram(c.program.program->program);
|
||||
curProgram = c.program.program;
|
||||
if (curProgram != c.program.program) {
|
||||
glUseProgram(c.program.program->program);
|
||||
curProgram = c.program.program;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GLRRenderCommand::BIND_INPUT_LAYOUT:
|
||||
|
||||
Reference in new issue
Block a user