gl: (oit) Far plane is 0 in final depth test. minor gl cache reset fix

other misc changes
This commit is contained in:
Flyinghead 2019-12-25 13:05:42 +01:00
parent b975f5d4bd
commit be50fca2d6
6 changed files with 23 additions and 17 deletions

View File

@ -71,7 +71,7 @@ vec4 resolveAlphaBlend(ivec2 coords) {
vec4 finalColor = texture(tex, gl_FragCoord.xy / textureSize(tex, 0));
vec4 secondaryBuffer = vec4(0.0); // Secondary accumulation buffer
float depth = 1.0;
float depth = 0.0;
bool do_depth_test = false;
for (int i = 0; i < num_frag; i++)

View File

@ -159,7 +159,7 @@ template <u32 Type, bool SortingEnabled>
SetTileClip(gp->tileclip, CurrentShader->pp_ClipTest);
//This bit control which pixels are affected
//This bit controls which pixels are affected
//by modvols
const u32 stencil=(gp->pcw.Shadow!=0)?0x80:0x0;

View File

@ -9,10 +9,10 @@ GLuint gl4BindRTT(u32 addy, u32 fbw, u32 fbh, u32 channels, u32 fmt)
gl.rtt.TexAddr=addy>>3;
// Find the smallest power of two texture that fits the viewport
int fbh2 = 2;
int fbh2 = 8;
while (fbh2 < fbh)
fbh2 *= 2;
int fbw2 = 2;
int fbw2 = 8;
while (fbw2 < fbw)
fbw2 *= 2;
@ -23,8 +23,6 @@ GLuint gl4BindRTT(u32 addy, u32 fbw, u32 fbh, u32 channels, u32 fmt)
fbw2 *= settings.rend.RenderToTextureUpscale;
fbh2 *= settings.rend.RenderToTextureUpscale;
}
// Get the currently bound frame buffer object. On most platforms this just gives 0.
//glGetIntegerv(GL_FRAMEBUFFER_BINDING, &m_i32OriginalFbo);
// Create a texture for rendering to
gl.rtt.tex = glcache.GenTexture();

View File

@ -188,9 +188,18 @@ public:
_stencil_dpfail = 0xFFFFFFFFu;
_stencil_dppass = 0xFFFFFFFFu;
_stencil_mask = 0;
if (_texture_cache_size > 0)
{
glDeleteTextures(_texture_cache_size, _texture_ids);
_texture_cache_size = 0;
}
}
void DisableCache() { _disable_cache = true; }
void DisableCache()
{
_disable_cache = true;
Reset();
}
void EnableCache()
{
_disable_cache = false;

View File

@ -127,9 +127,7 @@ s32 SetTileClip(u32 val, GLint uniform)
void SetCull(u32 CulliMode)
{
if (CullMode[CulliMode]==GL_NONE)
{
glcache.Disable(GL_CULL_FACE);
}
else
{
glcache.Enable(GL_CULL_FACE);

View File

@ -25,7 +25,8 @@
float fb_scale_x, fb_scale_y; // FIXME
//Fragment and vertex shaders code
const char* VertexShaderSource = R"(%s
static const char* VertexShaderSource = R"(%s
#define TARGET_GL %s
#define pp_Gouraud %d
@ -290,7 +291,7 @@ void main()
}
)";
const char* ModifierVolumeShader =
static const char* ModifierVolumeShader =
R"(%s
#define TARGET_GL %s
@ -873,14 +874,14 @@ void UpdateFogTexture(u8 *fog_table, GLenum texture_slot, GLint fog_image_format
if (fogTextureId == 0)
{
fogTextureId = glcache.GenTexture();
glBindTexture(GL_TEXTURE_2D, fogTextureId);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glcache.BindTexture(GL_TEXTURE_2D, fogTextureId);
glcache.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glcache.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glcache.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glcache.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
else
glBindTexture(GL_TEXTURE_2D, fogTextureId);
glcache.BindTexture(GL_TEXTURE_2D, fogTextureId);
u8 temp_tex_buffer[256];
MakeFogTexture(temp_tex_buffer);