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

Guard image texture code since GLES2 does not support it.

This commit is contained in:
Sergey Lipskiy 2014-04-05 23:44:53 +07:00
parent ee57f6ef47
commit 7ad0c8d05a
3 changed files with 13 additions and 0 deletions

View File

@ -216,6 +216,7 @@ DepthBuffer *DepthBuffer_FindBuffer( u32 address )
} }
void DepthBuffer_ClearBuffer() { void DepthBuffer_ClearBuffer() {
#ifndef GLES2
if (!OGL.bImageTexture) if (!OGL.bImageTexture)
return; return;
DepthBuffer *current = depthBuffer.top; DepthBuffer *current = depthBuffer.top;
@ -227,4 +228,5 @@ void DepthBuffer_ClearBuffer() {
OGL_DrawRect(0,0,VI.width, VI.height, color); OGL_DrawRect(0,0,VI.width, VI.height, color);
glBindImageTexture(depthImageUnit, current->depth_texture->glName, 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F); glBindImageTexture(depthImageUnit, current->depth_texture->glName, 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBuffer.top->fbo); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBuffer.top->fbo);
#endif // GLES2
} }

View File

@ -75,6 +75,7 @@ bool check_program_link_status(GLuint obj)
return true; return true;
} }
#ifndef GLES2
static static
void InitZlutTexture() void InitZlutTexture()
{ {
@ -163,6 +164,7 @@ void DestroyShadowMapShader()
glDeleteShader(g_shadow_map_fragment_shader_object); glDeleteShader(g_shadow_map_fragment_shader_object);
glDeleteProgram(g_draw_shadow_map_program); glDeleteProgram(g_draw_shadow_map_program);
} }
#endif // GLES2
void InitGLSLCombiner() void InitGLSLCombiner()
{ {
@ -203,14 +205,19 @@ void InitGLSLCombiner()
assert(check_shader_compile_status(g_calc_depth_shader_object)); assert(check_shader_compile_status(g_calc_depth_shader_object));
} }
#ifndef GLES2
InitZlutTexture(); InitZlutTexture();
InitShadowMapShader(); InitShadowMapShader();
#endif
} }
void DestroyGLSLCombiner() { void DestroyGLSLCombiner() {
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
#ifndef GLES2
DestroyZlutTexture(); DestroyZlutTexture();
DestroyShadowMapShader(); DestroyShadowMapShader();
#endif
} }
const char *ColorInput_1cycle[] = { const char *ColorInput_1cycle[] = {
@ -686,6 +693,7 @@ void GLSLCombiner::UpdateAlphaTestInfo(bool _bForce) {
} }
} }
#ifndef GLES2
void GLSL_RenderDepth() { void GLSL_RenderDepth() {
if (!OGL.bImageTexture) if (!OGL.bImageTexture)
return; return;
@ -789,3 +797,4 @@ void GLS_SetShadowMapCombiner() {
gDP.changed |= CHANGED_COMBINE; gDP.changed |= CHANGED_COMBINE;
} }
#endif // GLES2

View File

@ -905,9 +905,11 @@ void OGL_DrawTexturedRect( float ulx, float uly, float lrx, float lry, float uls
combiner.current->compiled->UpdateRenderState(); combiner.current->compiled->UpdateRenderState();
} }
#ifndef GLES2
// if ((gDP.otherMode.l >> 16) == 0x3c18 && gDP.combine.muxs0 == 0x00ffffff && gDP.combine.muxs1 == 0xfffff238) //depth image based fog // if ((gDP.otherMode.l >> 16) == 0x3c18 && gDP.combine.muxs0 == 0x00ffffff && gDP.combine.muxs1 == 0xfffff238) //depth image based fog
if (gSP.textureTile[0]->frameBuffer == NULL && gSP.textureTile[1]->frameBuffer == NULL && gDP.textureImage.address >= gDP.depthImageAddress && gDP.textureImage.address < (gDP.depthImageAddress + gDP.colorImage.width*gDP.colorImage.width*6/4)) if (gSP.textureTile[0]->frameBuffer == NULL && gSP.textureTile[1]->frameBuffer == NULL && gDP.textureImage.address >= gDP.depthImageAddress && gDP.textureImage.address < (gDP.depthImageAddress + gDP.colorImage.width*gDP.colorImage.width*6/4))
GLS_SetShadowMapCombiner(); GLS_SetShadowMapCombiner();
#endif // GLES2
if (frameBuffer.drawBuffer != GL_FRAMEBUFFER) if (frameBuffer.drawBuffer != GL_FRAMEBUFFER)
glViewport( 0, (frameBuffer.drawBuffer == GL_BACK ? OGL.heightOffset : 0), OGL.width, OGL.height ); glViewport( 0, (frameBuffer.drawBuffer == GL_BACK ? OGL.heightOffset : 0), OGL.width, OGL.height );