gl4: fix invisible framebuffer direct writes with hle bios
Fixes hidden & dangerous black screens in hle bios mode
This commit is contained in:
parent
8b949e1dca
commit
2bdfdf96c1
|
@ -45,7 +45,7 @@ static GLuint texSamplers[2];
|
|||
static GLuint depth_fbo;
|
||||
GLuint depthSaveTexId;
|
||||
|
||||
static gl4PipelineShader *gl4GetProgram(u32 cp_AlphaTest, u32 pp_ClipTestMode,
|
||||
static gl4PipelineShader *gl4GetProgram(u32 cp_AlphaTest, s32 pp_ClipTestMode,
|
||||
u32 pp_Texture, u32 pp_UseAlpha, u32 pp_IgnoreTexA, u32 pp_ShadInstr, u32 pp_Offset,
|
||||
u32 pp_FogCtrl, bool pp_TwoVolumes, u32 pp_DepthFunc, bool pp_Gouraud, bool pp_BumpMap, bool fog_clamping, int pass)
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ static gl4PipelineShader *gl4GetProgram(u32 cp_AlphaTest, u32 pp_ClipTestMode,
|
|||
}
|
||||
u32 rv=0;
|
||||
|
||||
rv|=pp_ClipTestMode;
|
||||
rv |= (pp_ClipTestMode + 1);
|
||||
rv<<=1; rv|=cp_AlphaTest;
|
||||
rv<<=1; rv|=pp_Texture;
|
||||
rv<<=1; rv|=pp_UseAlpha;
|
||||
|
@ -692,7 +692,7 @@ static void gl4_draw_quad_texture(GLuint texture, float w, float h)
|
|||
glcache.Disable(GL_CULL_FACE);
|
||||
glcache.Disable(GL_BLEND);
|
||||
|
||||
ShaderUniforms.trilinear_alpha = 1.0;
|
||||
gl4ShaderUniforms.trilinear_alpha = 1.0;
|
||||
|
||||
CurrentShader = gl4GetProgram(0,
|
||||
0,
|
||||
|
@ -722,11 +722,14 @@ static void gl4_draw_quad_texture(GLuint texture, float w, float h)
|
|||
};
|
||||
GLushort indices[] = { 0, 1, 2, 1, 3 };
|
||||
|
||||
gl4SetupMainVBO();
|
||||
glBindVertexArray(gl4.vbo.main_vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, gl4.vbo.geometry);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, gl4.vbo.idxs);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STREAM_DRAW);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STREAM_DRAW);
|
||||
|
||||
glDrawElements(GL_TRIANGLE_STRIP, 5, GL_UNSIGNED_SHORT, (void *)0);
|
||||
glCheck();
|
||||
}
|
||||
|
||||
void gl4DrawFramebuffer(float w, float h)
|
||||
|
|
|
@ -857,24 +857,15 @@ static bool RenderFrame()
|
|||
}
|
||||
}
|
||||
|
||||
bool wide_screen_on = !is_rtt && settings.rend.WideScreen
|
||||
&& pvrrc.fb_X_CLIP.min == 0
|
||||
&& lroundf((pvrrc.fb_X_CLIP.max + 1) / scale_x) == 640L
|
||||
&& pvrrc.fb_Y_CLIP.min == 0
|
||||
&& lroundf((pvrrc.fb_Y_CLIP.max + 1) / scale_y) == 480L;
|
||||
|
||||
//Color is cleared by the background plane
|
||||
|
||||
glcache.Disable(GL_SCISSOR_TEST);
|
||||
|
||||
//move vertex to gpu
|
||||
|
||||
if (!pvrrc.isRenderFramebuffer)
|
||||
{
|
||||
//Main VBO
|
||||
glBindBuffer(GL_ARRAY_BUFFER, gl4.vbo.geometry); glCheck();
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, gl4.vbo.idxs); glCheck();
|
||||
|
||||
//move vertex to gpu
|
||||
glBufferData(GL_ARRAY_BUFFER,pvrrc.verts.bytes(),pvrrc.verts.head(),GL_STREAM_DRAW); glCheck();
|
||||
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER,pvrrc.idx.bytes(),pvrrc.idx.head(),GL_STREAM_DRAW);
|
||||
|
@ -901,6 +892,12 @@ static bool RenderFrame()
|
|||
DEBUG_LOG(RENDERER, "SCI: %f, %f, %f, %f", offs_x+pvrrc.fb_X_CLIP.min/scale_x,(pvrrc.fb_Y_CLIP.min/scale_y)*dc2s_scale_h,(pvrrc.fb_X_CLIP.max-pvrrc.fb_X_CLIP.min+1)/scale_x*dc2s_scale_h,(pvrrc.fb_Y_CLIP.max-pvrrc.fb_Y_CLIP.min+1)/scale_y*dc2s_scale_h);
|
||||
#endif
|
||||
|
||||
bool wide_screen_on = !is_rtt && settings.rend.WideScreen
|
||||
&& pvrrc.fb_X_CLIP.min == 0
|
||||
&& lroundf((pvrrc.fb_X_CLIP.max + 1) / scale_x) == 640L
|
||||
&& pvrrc.fb_Y_CLIP.min == 0
|
||||
&& lroundf((pvrrc.fb_Y_CLIP.max + 1) / scale_y) == 480L;
|
||||
|
||||
if (!wide_screen_on)
|
||||
{
|
||||
float width = (pvrrc.fb_X_CLIP.max - pvrrc.fb_X_CLIP.min + 1) / scale_x;
|
||||
|
@ -963,6 +960,7 @@ static bool RenderFrame()
|
|||
{
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, output_fbo);
|
||||
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
glcache.ClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
|
|
|
@ -2052,8 +2052,6 @@ bool RenderFrame()
|
|||
glcache.ClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
DrawFramebuffer(dc_width, dc_height);
|
||||
glBufferData(GL_ARRAY_BUFFER, pvrrc.verts.bytes(), pvrrc.verts.head(), GL_STREAM_DRAW);
|
||||
upload_vertex_indices();
|
||||
}
|
||||
#ifdef _WIN32
|
||||
//Sleep(40); //to test MT stability
|
||||
|
|
Loading…
Reference in New Issue