diff options
| author | donkopunchstania <donkopunchstania@gmail.com> | 2009-05-15 02:39:55 +0000 |
|---|---|---|
| committer | donkopunchstania <donkopunchstania@gmail.com> | 2009-05-15 02:39:55 +0000 |
| commit | 14a67bc8bc5d663b5cd2d1d324d76444be3602d7 (patch) | |
| tree | 19511fe94b78527c1b35317821fedc4229c860ea /Source/Plugins/Plugin_VideoOGL/Src/BPFunctions.cpp | |
| parent | 034e3c72a22601e2bfe2d43f72d2a16c8f2c6e96 (diff) | |
Changing where depth is read. Trying to use the same depth buffer GL uses when copying depth to a texture. This eliminates some quirky code and gets depth copies working in AA, but may not work on older graphics cards.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3234 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Plugins/Plugin_VideoOGL/Src/BPFunctions.cpp')
| -rw-r--r-- | Source/Plugins/Plugin_VideoOGL/Src/BPFunctions.cpp | 85 |
1 files changed, 26 insertions, 59 deletions
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/BPFunctions.cpp b/Source/Plugins/Plugin_VideoOGL/Src/BPFunctions.cpp index b3b05635fd..92ac70602e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/BPFunctions.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/BPFunctions.cpp @@ -88,9 +88,6 @@ void SetDepthMode(const Bypass &bp) glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
}
-
- if (!bpmem.zmode.updateenable)
- Renderer::SetRenderMode(Renderer::RM_Normal);
}
void SetBlendMode(const Bypass &bp)
{
@@ -160,68 +157,38 @@ void RenderToXFB(const Bypass &bp, const TRectangle &multirc, const float &yScal }
void ClearScreen(const Bypass &bp, const TRectangle &multirc)
{
-
- // Clear color
- Renderer::SetRenderMode(Renderer::RM_Normal);
- // Clear Z-Buffer target
- bool bRestoreZBufferTarget = Renderer::UseFakeZTarget();
-
- // Update the view port for clearing the picture
- glViewport(0, 0, Renderer::GetTargetWidth(), Renderer::GetTargetHeight());
-
- // Always set the scissor in case it was set by the game and has not been reset
- glScissor(multirc.left, (Renderer::GetTargetHeight() - multirc.bottom),
- (multirc.right - multirc.left), (multirc.bottom - multirc.top));
- // ---------------------------
+ // Update the view port for clearing the picture
+ glViewport(0, 0, Renderer::GetTargetWidth(), Renderer::GetTargetHeight());
- VertexShaderManager::SetViewportChanged();
+ // Always set the scissor in case it was set by the game and has not been reset
+ glScissor(multirc.left, (Renderer::GetTargetHeight() - multirc.bottom),
+ (multirc.right - multirc.left), (multirc.bottom - multirc.top));
+ // ---------------------------
- // Since clear operations use the source rectangle, we have to do
- // regular renders (glClear clears the entire buffer)
- if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate || bpmem.zmode.updateenable)
- {
- GLbitfield bits = 0;
- if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate)
- {
- u32 clearColor = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB;
- glClearColor(((clearColor>>16) & 0xff)*(1/255.0f),
- ((clearColor>>8 ) & 0xff)*(1/255.0f),
- ((clearColor>>0 ) & 0xff)*(1/255.0f),
- ((clearColor>>24) & 0xff)*(1/255.0f));
- bits |= GL_COLOR_BUFFER_BIT;
- }
- if (bpmem.zmode.updateenable)
- {
- glClearDepth((float)(bpmem.clearZValue & 0xFFFFFF) / float(0xFFFFFF));
- bits |= GL_DEPTH_BUFFER_BIT;
- }
- if (bRestoreZBufferTarget)
- glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); // don't clear ztarget here
- glClear(bits);
- }
+ VertexShaderManager::SetViewportChanged();
- // Have to clear the target zbuffer
- if (bpmem.zmode.updateenable && bRestoreZBufferTarget)
+ // Since clear operations use the source rectangle, we have to do
+ // regular renders (glClear clears the entire buffer)
+ if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate || bpmem.zmode.updateenable)
+ {
+ GLbitfield bits = 0;
+ if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate)
{
- glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
- GL_REPORT_ERRORD();
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-
- // red should probably be the LSB
- glClearColor(((bpmem.clearZValue>>0)&0xff)*(1/255.0f),
- ((bpmem.clearZValue>>8)&0xff)*(1/255.0f),
- ((bpmem.clearZValue>>16)&0xff)*(1/255.0f), 0);
- glClear(GL_COLOR_BUFFER_BIT);
- Renderer::SetColorMask();
- GL_REPORT_ERRORD();
+ u32 clearColor = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB;
+ glClearColor(((clearColor>>16) & 0xff)*(1/255.0f),
+ ((clearColor>>8 ) & 0xff)*(1/255.0f),
+ ((clearColor>>0 ) & 0xff)*(1/255.0f),
+ ((clearColor>>24) & 0xff)*(1/255.0f));
+ bits |= GL_COLOR_BUFFER_BIT;
}
-
- if (bRestoreZBufferTarget)
+ if (bpmem.zmode.updateenable)
{
- // restore target
- GLenum s_drawbuffers[2] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT};
- glDrawBuffers(2, s_drawbuffers);
+ glClearDepth((float)(bpmem.clearZValue & 0xFFFFFF) / float(0xFFFFFF));
+ bits |= GL_DEPTH_BUFFER_BIT;
}
+ glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
+ glClear(bits);
+ }
}
void RestoreRenderState(const Bypass &bp)
@@ -256,4 +223,4 @@ void SetInterlacingMode(const Bypass &bp) {
// TODO
}
-};
\ No newline at end of file +};
|
