1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-07 03:13:49 +00:00

Add GLSL_ClearDepthBuffer()

This commit is contained in:
Sergey Lipskiy 2013-10-30 16:26:40 +07:00
parent cd81074c9e
commit 1fc111a5c1
2 changed files with 23 additions and 0 deletions

View File

@ -611,3 +611,22 @@ void GLSLCombiner::UpdateFBInfo() {
int fbFixedAlpha_location = glGetUniformLocationARB(m_programObject, "fb_fixed_alpha");
glUniform1iARB(fbFixedAlpha_location, nFbFixedAlpha);
}
void GLSL_ClearDepthBuffer() {
if (frameBuffer.top == NULL || frameBuffer.top->depth_texture == NULL)
return;
const u32 numTexels = frameBuffer.top->depth_texture->width*frameBuffer.top->depth_texture->height;
u16 * pDepth = (u16*)malloc(numTexels * 2);
for (int i = 0; i < numTexels; i++)
pDepth[i] = 0xfffc;
// glActiveTextureARB( GL_TEXTURE0_ARB );
glBindTexture(GL_TEXTURE_2D, frameBuffer.top->depth_texture->glName);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
frameBuffer.top->depth_texture->width, frameBuffer.top->depth_texture->height,
GL_RED, GL_UNSIGNED_SHORT, pDepth);
free(pDepth);
gSP.changed |= CHANGED_TEXTURE | CHANGED_VIEWPORT;
gDP.changed |= CHANGED_COMBINE;
}

View File

@ -1137,6 +1137,10 @@ void OGL_ClearDepthBuffer()
{
if (OGL.frameBufferTextures && frameBuffer.top == NULL)
return;
void GLSL_ClearDepthBuffer();
GLSL_ClearDepthBuffer();
glDisable( GL_SCISSOR_TEST );
OGL_UpdateStates();