mirror of https://github.com/PCSX2/pcsx2.git
gsdx ogl: GL_ARB_clip_control is now mandatory
This commit is contained in:
parent
dfb4b5a339
commit
f751f70b1e
|
@ -495,7 +495,7 @@ namespace GLLoader {
|
||||||
status &= status_and_override(found_GL_ARB_buffer_storage,"GL_ARB_buffer_storage");
|
status &= status_and_override(found_GL_ARB_buffer_storage,"GL_ARB_buffer_storage");
|
||||||
status &= status_and_override(found_GL_ARB_clear_texture,"GL_ARB_clear_texture");
|
status &= status_and_override(found_GL_ARB_clear_texture,"GL_ARB_clear_texture");
|
||||||
// GL4.5
|
// GL4.5
|
||||||
status &= status_and_override(found_GL_ARB_clip_control, "GL_ARB_clip_control");
|
status &= status_and_override(found_GL_ARB_clip_control, "GL_ARB_clip_control", true);
|
||||||
status &= status_and_override(found_GL_ARB_direct_state_access, "GL_ARB_direct_state_access");
|
status &= status_and_override(found_GL_ARB_direct_state_access, "GL_ARB_direct_state_access");
|
||||||
status &= status_and_override(found_GL_ARB_texture_barrier, "GL_ARB_texture_barrier", true);
|
status &= status_and_override(found_GL_ARB_texture_barrier, "GL_ARB_texture_barrier", true);
|
||||||
|
|
||||||
|
|
|
@ -363,7 +363,6 @@ namespace GLLoader {
|
||||||
extern bool found_GL_ARB_shader_image_load_store;
|
extern bool found_GL_ARB_shader_image_load_store;
|
||||||
extern bool found_GL_ARB_clear_texture;
|
extern bool found_GL_ARB_clear_texture;
|
||||||
extern bool found_GL_ARB_buffer_storage;
|
extern bool found_GL_ARB_buffer_storage;
|
||||||
extern bool found_GL_ARB_clip_control;
|
|
||||||
extern bool found_GL_ARB_direct_state_access;
|
extern bool found_GL_ARB_direct_state_access;
|
||||||
extern bool found_GL_EXT_texture_filter_anisotropic;
|
extern bool found_GL_EXT_texture_filter_anisotropic;
|
||||||
}
|
}
|
||||||
|
|
|
@ -376,10 +376,8 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
|
||||||
// because of -1 we loose lot of precision for small GS value
|
// because of -1 we loose lot of precision for small GS value
|
||||||
// This extension allow FS depth to range from -1 to 1. So
|
// This extension allow FS depth to range from -1 to 1. So
|
||||||
// gl_position.z could range from [0, 1]
|
// gl_position.z could range from [0, 1]
|
||||||
if (GLLoader::found_GL_ARB_clip_control) {
|
|
||||||
// Change depth convention
|
// Change depth convention
|
||||||
glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
|
glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
|
||||||
}
|
|
||||||
|
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
// HW renderer shader
|
// HW renderer shader
|
||||||
|
@ -687,10 +685,9 @@ void GSDeviceOGL::Barrier(GLbitfield b)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note: must be here because tfx_glsl is static */
|
/* Note: must be here because tfx_glsl is static */
|
||||||
GLuint GSDeviceOGL::CompileVS(VSSelector sel, int logz)
|
GLuint GSDeviceOGL::CompileVS(VSSelector sel)
|
||||||
{
|
{
|
||||||
std::string macro = format("#define VS_BPPZ %d\n", sel.bppz)
|
std::string macro = format("#define VS_BPPZ %d\n", sel.bppz)
|
||||||
+ format("#define VS_LOGZ %d\n", logz)
|
|
||||||
+ format("#define VS_WILDHACK %d\n", sel.wildhack)
|
+ format("#define VS_WILDHACK %d\n", sel.wildhack)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -527,7 +527,7 @@ class GSDeviceOGL final : public GSDevice
|
||||||
|
|
||||||
|
|
||||||
void CreateTextureFX();
|
void CreateTextureFX();
|
||||||
GLuint CompileVS(VSSelector sel, int logz);
|
GLuint CompileVS(VSSelector sel);
|
||||||
GLuint CompileGS(GSSelector sel);
|
GLuint CompileGS(GSSelector sel);
|
||||||
GLuint CompilePS(PSSelector sel);
|
GLuint CompilePS(PSSelector sel);
|
||||||
GLuint CreateSampler(bool bilinear, bool tau, bool tav, bool aniso = false);
|
GLuint CreateSampler(bool bilinear, bool tau, bool tav, bool aniso = false);
|
||||||
|
|
|
@ -210,9 +210,6 @@ std::string GSShaderOGL::GenGlslHeader(const std::string& entry, GLenum type, co
|
||||||
} else {
|
} else {
|
||||||
header += "#define DISABLE_GL42_image\n";
|
header += "#define DISABLE_GL42_image\n";
|
||||||
}
|
}
|
||||||
if (GLLoader::found_GL_ARB_clip_control) {
|
|
||||||
header += "#define ZERO_TO_ONE_DEPTH\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stupid GL implementation (can't use GL_ES)
|
// Stupid GL implementation (can't use GL_ES)
|
||||||
// AMD/nvidia define it to 0
|
// AMD/nvidia define it to 0
|
||||||
|
|
|
@ -54,7 +54,7 @@ void GSDeviceOGL::CreateTextureFX()
|
||||||
|
|
||||||
for (uint32 key = 0; key < countof(m_vs); key++) {
|
for (uint32 key = 0; key < countof(m_vs); key++) {
|
||||||
VSSelector sel(key);
|
VSSelector sel(key);
|
||||||
m_vs[key] = CompileVS(sel, !GLLoader::found_GL_ARB_clip_control);
|
m_vs[key] = CompileVS(sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_POP();
|
GL_POP();
|
||||||
|
|
|
@ -168,7 +168,7 @@ void GSWndGL::PopulateGlFunction()
|
||||||
GL_EXT_LOAD_OPT(glCreateSamplers);
|
GL_EXT_LOAD_OPT(glCreateSamplers);
|
||||||
GL_EXT_LOAD_OPT(glCreateProgramPipelines);
|
GL_EXT_LOAD_OPT(glCreateProgramPipelines);
|
||||||
|
|
||||||
GL_EXT_LOAD_OPT(glClipControl);
|
GL_EXT_LOAD(glClipControl);
|
||||||
GL_EXT_LOAD(glTextureBarrier);
|
GL_EXT_LOAD(glTextureBarrier);
|
||||||
|
|
||||||
if (glCreateFramebuffers == NULL) {
|
if (glCreateFramebuffers == NULL) {
|
||||||
|
|
|
@ -60,11 +60,7 @@ out gl_PerVertex {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ZERO_TO_ONE_DEPTH
|
|
||||||
const float exp_min32 = exp2(-32.0f);
|
const float exp_min32 = exp2(-32.0f);
|
||||||
#else
|
|
||||||
const float exp_min31 = exp2(-31.0f);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void texture_coord()
|
void texture_coord()
|
||||||
{
|
{
|
||||||
|
@ -99,19 +95,7 @@ void vs_main()
|
||||||
p.xy = vec2(i_p) - vec2(0.05f, 0.05f);
|
p.xy = vec2(i_p) - vec2(0.05f, 0.05f);
|
||||||
p.xy = p.xy * VertexScale - VertexOffset;
|
p.xy = p.xy * VertexScale - VertexOffset;
|
||||||
p.w = 1.0f;
|
p.w = 1.0f;
|
||||||
#ifdef ZERO_TO_ONE_DEPTH
|
|
||||||
if(VS_LOGZ == 1) {
|
|
||||||
p.z = max(0.0f, log2(float(z))) / 32.0f;
|
|
||||||
} else {
|
|
||||||
p.z = float(z) * exp_min32;
|
p.z = float(z) * exp_min32;
|
||||||
}
|
|
||||||
#else
|
|
||||||
if(VS_LOGZ == 1) {
|
|
||||||
p.z = max(0.0f, log2(float(z))) / 31.0f - 1.0f;
|
|
||||||
} else {
|
|
||||||
p.z = float(z) * exp_min31 - 1.0f;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gl_Position = p;
|
gl_Position = p;
|
||||||
|
|
||||||
|
|
|
@ -685,11 +685,7 @@ static const char* tfx_vgs_glsl =
|
||||||
"#endif\n"
|
"#endif\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#ifdef ZERO_TO_ONE_DEPTH\n"
|
|
||||||
"const float exp_min32 = exp2(-32.0f);\n"
|
"const float exp_min32 = exp2(-32.0f);\n"
|
||||||
"#else\n"
|
|
||||||
"const float exp_min31 = exp2(-31.0f);\n"
|
|
||||||
"#endif\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"void texture_coord()\n"
|
"void texture_coord()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -724,19 +720,7 @@ static const char* tfx_vgs_glsl =
|
||||||
" p.xy = vec2(i_p) - vec2(0.05f, 0.05f);\n"
|
" p.xy = vec2(i_p) - vec2(0.05f, 0.05f);\n"
|
||||||
" p.xy = p.xy * VertexScale - VertexOffset;\n"
|
" p.xy = p.xy * VertexScale - VertexOffset;\n"
|
||||||
" p.w = 1.0f;\n"
|
" p.w = 1.0f;\n"
|
||||||
"#ifdef ZERO_TO_ONE_DEPTH\n"
|
|
||||||
" if(VS_LOGZ == 1) {\n"
|
|
||||||
" p.z = max(0.0f, log2(float(z))) / 32.0f;\n"
|
|
||||||
" } else {\n"
|
|
||||||
" p.z = float(z) * exp_min32;\n"
|
" p.z = float(z) * exp_min32;\n"
|
||||||
" }\n"
|
|
||||||
"#else\n"
|
|
||||||
" if(VS_LOGZ == 1) {\n"
|
|
||||||
" p.z = max(0.0f, log2(float(z))) / 31.0f - 1.0f;\n"
|
|
||||||
" } else {\n"
|
|
||||||
" p.z = float(z) * exp_min31 - 1.0f;\n"
|
|
||||||
" }\n"
|
|
||||||
"#endif\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
" gl_Position = p;\n"
|
" gl_Position = p;\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
Loading…
Reference in New Issue