gsdx-ogl: wipeout of GL_ARB_bindless_texture

Code is completely broken. It doesn't help to improve speed.

Remove 200 lines ;)
This commit is contained in:
Gregory Hainaut 2015-08-07 14:46:57 +02:00
parent 99d81868fc
commit b17803bb34
18 changed files with 12 additions and 218 deletions

View File

@ -54,11 +54,7 @@ struct vertex_basic
vec2 t; vec2 t;
}; };
#ifdef ENABLE_BINDLESS_TEX
layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;
#else
layout(binding = 0) uniform sampler2D TextureSampler; layout(binding = 0) uniform sampler2D TextureSampler;
#endif
in SHADER in SHADER
{ {

View File

@ -112,12 +112,6 @@ PFNGLTEXSTORAGE2DPROC gl_TexStorage2D = NU
// GL4.4 // GL4.4
PFNGLCLEARTEXIMAGEPROC gl_ClearTexImage = NULL; PFNGLCLEARTEXIMAGEPROC gl_ClearTexImage = NULL;
PFNGLBUFFERSTORAGEPROC gl_BufferStorage = NULL; PFNGLBUFFERSTORAGEPROC gl_BufferStorage = NULL;
// GL_ARB_bindless_texture (GL5?)
PFNGLGETTEXTURESAMPLERHANDLEARBPROC gl_GetTextureSamplerHandleARB = NULL;
PFNGLMAKETEXTUREHANDLERESIDENTARBPROC gl_MakeTextureHandleResidentARB = NULL;
PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC gl_MakeTextureHandleNonResidentARB = NULL;
PFNGLUNIFORMHANDLEUI64VARBPROC gl_UniformHandleui64vARB = NULL;
PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC gl_ProgramUniformHandleui64vARB = NULL;
// GL4.5 // GL4.5
PFNGLCREATETEXTURESPROC gl_CreateTextures = NULL; PFNGLCREATETEXTURESPROC gl_CreateTextures = NULL;
@ -330,24 +324,19 @@ namespace GLLoader {
bool intel_buggy_driver = false; bool intel_buggy_driver = false;
bool in_replayer = false; bool in_replayer = false;
// Optional
// GL4 hardware (due to proprietary driver limitation)
bool found_GL_ARB_separate_shader_objects = false; // Issue with Mesa and Catalyst... bool found_GL_ARB_separate_shader_objects = false; // Issue with Mesa and Catalyst...
bool found_geometry_shader = true; // we require GL3.3 so geometry must be supported by default bool found_geometry_shader = true; // we require GL3.3 so geometry must be supported by default
bool found_GL_EXT_texture_filter_anisotropic = false; bool found_GL_EXT_texture_filter_anisotropic = false;
bool found_GL_ARB_clear_texture = false; // Don't know if GL3 GPU can support it bool found_GL_ARB_clear_texture = false; // Don't know if GL3 GPU can support it
bool found_GL_ARB_draw_buffers_blend = false; // DX10 GPU limited driver on windows!
// Note: except Apple, all drivers support explicit uniform location
bool found_GL_ARB_explicit_uniform_location = false; // need by bindless texture
// GL4 hardware
bool found_GL_ARB_buffer_storage = false; bool found_GL_ARB_buffer_storage = false;
bool found_GL_ARB_copy_image = false; // Not sure actually maybe GL3 GPU can do it bool found_GL_ARB_copy_image = false; // Not sure actually maybe GL3 GPU can do it
bool found_GL_ARB_gpu_shader5 = false; bool found_GL_ARB_gpu_shader5 = false;
bool found_GL_ARB_shader_image_load_store = false; // GLES3.1 bool found_GL_ARB_shader_image_load_store = false; // GLES3.1
bool found_GL_ARB_bindless_texture = false; // GL5 GPU?
bool found_GL_ARB_texture_barrier = false; // Well maybe supported by older hardware I don't know bool found_GL_ARB_texture_barrier = false; // Well maybe supported by older hardware I don't know
// DX10 GPU limited driver
// GL4.5 for the future (dx10/dx11 compatibility) bool found_GL_ARB_draw_buffers_blend = false;
bool found_GL_ARB_clip_control = false; bool found_GL_ARB_clip_control = false;
bool found_GL_ARB_direct_state_access = false; bool found_GL_ARB_direct_state_access = false;
@ -394,7 +383,7 @@ namespace GLLoader {
const char* vendor = (const char*)glGetString(GL_VENDOR); const char* vendor = (const char*)glGetString(GL_VENDOR);
fprintf(stderr, "OpenGL information. GPU: %s. Vendor: %s. Driver: %s\n", glGetString(GL_RENDERER), vendor, &s[v]); fprintf(stderr, "OpenGL information. GPU: %s. Vendor: %s. Driver: %s\n", glGetString(GL_RENDERER), vendor, &s[v]);
// Name change but driver is still bad! // Name changed but driver is still bad!
if (strstr(vendor, "ATI") || strstr(vendor, "Advanced Micro Devices")) if (strstr(vendor, "ATI") || strstr(vendor, "Advanced Micro Devices"))
fglrx_buggy_driver = true; fglrx_buggy_driver = true;
if (strstr(vendor, "NVIDIA Corporation")) if (strstr(vendor, "NVIDIA Corporation"))
@ -451,16 +440,12 @@ namespace GLLoader {
// GL4.2 // GL4.2
if (ext.compare("GL_ARB_shading_language_420pack") == 0) found_GL_ARB_shading_language_420pack = true; if (ext.compare("GL_ARB_shading_language_420pack") == 0) found_GL_ARB_shading_language_420pack = true;
if (ext.compare("GL_ARB_texture_storage") == 0) found_GL_ARB_texture_storage = true; if (ext.compare("GL_ARB_texture_storage") == 0) found_GL_ARB_texture_storage = true;
// (I'm not sure AMD supports correctly GL_ARB_shader_image_load_store
if (ext.compare("GL_ARB_shader_image_load_store") == 0) found_GL_ARB_shader_image_load_store = true; if (ext.compare("GL_ARB_shader_image_load_store") == 0) found_GL_ARB_shader_image_load_store = true;
// GL4.3 // GL4.3
if (ext.compare("GL_ARB_copy_image") == 0) found_GL_ARB_copy_image = true; if (ext.compare("GL_ARB_copy_image") == 0) found_GL_ARB_copy_image = true;
if (ext.compare("GL_ARB_explicit_uniform_location") == 0) found_GL_ARB_explicit_uniform_location = true;
// GL4.4 // GL4.4
if (ext.compare("GL_ARB_buffer_storage") == 0) found_GL_ARB_buffer_storage = true; if (ext.compare("GL_ARB_buffer_storage") == 0) found_GL_ARB_buffer_storage = true;
if (ext.compare("GL_ARB_clear_texture") == 0) found_GL_ARB_clear_texture = true; if (ext.compare("GL_ARB_clear_texture") == 0) found_GL_ARB_clear_texture = true;
// FIXME: I have a crash when I hit pause (debug build)
//if (ext.compare("GL_ARB_bindless_texture") == 0) found_GL_ARB_bindless_texture = true;
// GL4.5 // GL4.5
if (ext.compare("GL_ARB_direct_state_access") == 0) found_GL_ARB_direct_state_access = true; if (ext.compare("GL_ARB_direct_state_access") == 0) found_GL_ARB_direct_state_access = true;
if (ext.compare("GL_ARB_clip_control") == 0) found_GL_ARB_clip_control = true; if (ext.compare("GL_ARB_clip_control") == 0) found_GL_ARB_clip_control = true;
@ -485,11 +470,9 @@ namespace GLLoader {
status &= status_and_override(found_GL_ARB_shading_language_420pack, "GL_ARB_shading_language_420pack", true); status &= status_and_override(found_GL_ARB_shading_language_420pack, "GL_ARB_shading_language_420pack", true);
status &= status_and_override(found_GL_ARB_texture_storage, "GL_ARB_texture_storage", true); status &= status_and_override(found_GL_ARB_texture_storage, "GL_ARB_texture_storage", true);
// GL4.3 // GL4.3
status &= status_and_override(found_GL_ARB_explicit_uniform_location, "GL_ARB_explicit_uniform_location");
status &= status_and_override(found_GL_ARB_copy_image, "GL_ARB_copy_image"); status &= status_and_override(found_GL_ARB_copy_image, "GL_ARB_copy_image");
// GL4.4 // GL4.4
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_bindless_texture,"GL_ARB_bindless_texture");
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");

View File

@ -80,28 +80,6 @@ typedef void (APIENTRYP PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count
typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
#endif /* GL_VERSION_4_4 */ #endif /* GL_VERSION_4_4 */
#ifndef GL_ARB_bindless_texture
#define GL_ARB_bindless_texture 1
typedef uint64_t GLuint64EXT;
#define GL_UNSIGNED_INT64_ARB 0x140F
typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture);
typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler);
typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle);
typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle);
typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access);
typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle);
typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value);
typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle);
typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle);
typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x);
typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT *v);
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT *params);
#endif /* GL_ARB_bindless_texture */
// Note: trim it // Note: trim it
#ifndef GL_VERSION_4_5 #ifndef GL_VERSION_4_5
#define GL_VERSION_4_5 1 #define GL_VERSION_4_5 1
@ -295,12 +273,6 @@ extern PFNGLDEBUGMESSAGEINSERTPROC gl_DebugMessageInsert;
// GL4.4 // GL4.4
extern PFNGLCLEARTEXIMAGEPROC gl_ClearTexImage; extern PFNGLCLEARTEXIMAGEPROC gl_ClearTexImage;
extern PFNGLBUFFERSTORAGEPROC gl_BufferStorage; extern PFNGLBUFFERSTORAGEPROC gl_BufferStorage;
// GL_ARB_bindless_texture (GL5?)
extern PFNGLGETTEXTURESAMPLERHANDLEARBPROC gl_GetTextureSamplerHandleARB;
extern PFNGLMAKETEXTUREHANDLERESIDENTARBPROC gl_MakeTextureHandleResidentARB;
extern PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC gl_MakeTextureHandleNonResidentARB;
extern PFNGLUNIFORMHANDLEUI64VARBPROC gl_UniformHandleui64vARB;
extern PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC gl_ProgramUniformHandleui64vARB;
// GL4.5 // GL4.5
extern PFNGLCREATETEXTURESPROC gl_CreateTextures; extern PFNGLCREATETEXTURESPROC gl_CreateTextures;
@ -360,8 +332,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_bindless_texture;
extern bool found_GL_ARB_explicit_uniform_location;
extern bool found_GL_ARB_clip_control; 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_ARB_texture_barrier; extern bool found_GL_ARB_texture_barrier;

View File

@ -951,10 +951,6 @@ void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture
GSVector2i ds = dTex->GetSize(); GSVector2i ds = dTex->GetSize();
// WARNING: setup of the program must be done first. So you can setup
// 1/ subroutine uniform
// 2/ bindless texture uniform
// 3/ others uniform?
m_shader->VS(m_convert.vs); m_shader->VS(m_convert.vs);
m_shader->GS(0); m_shader->GS(0);
m_shader->PS(ps); m_shader->PS(ps);
@ -1020,13 +1016,8 @@ void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture
// Texture // Texture
// ************************************ // ************************************
if (GLLoader::found_GL_ARB_bindless_texture) {
GLuint64 handle[2] = {static_cast<GSTextureOGL*>(sTex)->GetHandle(linear ? m_convert.ln : m_convert.pt) , 0};
m_shader->PS_ressources(handle);
} else {
PSSetShaderResource(0, sTex); PSSetShaderResource(0, sTex);
PSSetSamplerState(linear ? m_convert.ln : m_convert.pt); PSSetSamplerState(linear ? m_convert.ln : m_convert.pt);
}
// ************************************ // ************************************
// Draw // Draw
@ -1200,10 +1191,6 @@ void GSDeviceOGL::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* ver
ClearStencil(ds, 0); ClearStencil(ds, 0);
// WARNING: setup of the program must be done first. So you can setup
// 1/ subroutine uniform
// 2/ bindless texture uniform
// 3/ others uniform?
m_shader->VS(m_convert.vs); m_shader->VS(m_convert.vs);
m_shader->GS(0); m_shader->GS(0);
m_shader->PS(m_convert.ps[datm ? 2 : 3]); m_shader->PS(m_convert.ps[datm ? 2 : 3]);
@ -1226,13 +1213,8 @@ void GSDeviceOGL::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* ver
// Texture // Texture
if (GLLoader::found_GL_ARB_bindless_texture) {
GLuint64 handle[2] = {static_cast<GSTextureOGL*>(rt)->GetHandle(m_convert.pt) , 0};
m_shader->PS_ressources(handle);
} else {
PSSetShaderResource(0, rt); PSSetShaderResource(0, rt);
PSSetSamplerState(m_convert.pt); PSSetSamplerState(m_convert.pt);
}
DrawPrimitive(); DrawPrimitive();

View File

@ -328,8 +328,6 @@ void populate_gl_table(GtkWidget* gl_table)
{ {
GtkWidget* gl_bs_label = gtk_label_new("Buffer Storage:"); GtkWidget* gl_bs_label = gtk_label_new("Buffer Storage:");
GtkWidget* gl_bs_combo = CreateComboBoxFromVector(theApp.m_gs_gl_ext, "override_GL_ARB_buffer_storage", -1); GtkWidget* gl_bs_combo = CreateComboBoxFromVector(theApp.m_gs_gl_ext, "override_GL_ARB_buffer_storage", -1);
GtkWidget* gl_bt_label = gtk_label_new("Bindless Texture:");
GtkWidget* gl_bt_combo = CreateComboBoxFromVector(theApp.m_gs_gl_ext, "override_GL_ARB_bindless_texture", -1);
GtkWidget* gl_sso_label = gtk_label_new("Separate Shader:"); GtkWidget* gl_sso_label = gtk_label_new("Separate Shader:");
GtkWidget* gl_sso_combo = CreateComboBoxFromVector(theApp.m_gs_gl_ext, "override_GL_ARB_separate_shader_objects", -1); GtkWidget* gl_sso_combo = CreateComboBoxFromVector(theApp.m_gs_gl_ext, "override_GL_ARB_separate_shader_objects", -1);
GtkWidget* gl_gs_label = gtk_label_new("Geometry Shader:"); GtkWidget* gl_gs_label = gtk_label_new("Geometry Shader:");
@ -344,7 +342,6 @@ void populate_gl_table(GtkWidget* gl_table)
s_table_line = 0; s_table_line = 0;
InsertWidgetInTable(gl_table , gl_gs_label , gl_gs_combo); InsertWidgetInTable(gl_table , gl_gs_label , gl_gs_combo);
InsertWidgetInTable(gl_table , gl_bs_label , gl_bs_combo); InsertWidgetInTable(gl_table , gl_bs_label , gl_bs_combo);
InsertWidgetInTable(gl_table , gl_bt_label , gl_bt_combo);
InsertWidgetInTable(gl_table , gl_sso_label , gl_sso_combo); InsertWidgetInTable(gl_table , gl_sso_label , gl_sso_combo);
InsertWidgetInTable(gl_table , gl_ils_label , gl_ils_combo); InsertWidgetInTable(gl_table , gl_ils_label , gl_ils_combo);
InsertWidgetInTable(gl_table , gl_cc_label , gl_cc_combo); InsertWidgetInTable(gl_table , gl_cc_label , gl_cc_combo);

View File

@ -868,25 +868,8 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
ps_ssel.ltf = bilinear && simple_sample; ps_ssel.ltf = bilinear && simple_sample;
// Setup Texture ressources // Setup Texture ressources
if (GLLoader::found_GL_ARB_bindless_texture) {
GLuint64 handle[2];
handle[0] = tex->m_texture ? static_cast<GSTextureOGL*>(tex->m_texture)->GetHandle(dev->GetSamplerID(ps_ssel)): 0;
handle[1] = tex->m_palette ? static_cast<GSTextureOGL*>(tex->m_palette)->GetHandle(dev->GetPaletteSamplerID()): 0;
dev->m_shader->PS_ressources(handle);
} else {
dev->SetupSampler(ps_ssel); dev->SetupSampler(ps_ssel);
if (tex->m_palette) {
dev->PSSetShaderResources(tex->m_texture, tex->m_palette); dev->PSSetShaderResources(tex->m_texture, tex->m_palette);
} else if (tex->m_texture) {
dev->PSSetShaderResource(0, tex->m_texture);
#ifdef ENABLE_OGL_DEBUG
// Unattach texture to avoid noise in debugger
dev->PSSetShaderResource(1, NULL);
#endif
}
}
if (spritehack && (ps_sel.atst == 2)) { if (spritehack && (ps_sel.atst == 2)) {
ps_sel.atst = 1; ps_sel.atst = 1;
@ -894,8 +877,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
} else { } else {
#ifdef ENABLE_OGL_DEBUG #ifdef ENABLE_OGL_DEBUG
// Unattach texture to avoid noise in debugger // Unattach texture to avoid noise in debugger
dev->PSSetShaderResource(0, NULL); dev->PSSetShaderResources(NULL, NULL);
dev->PSSetShaderResource(1, NULL);
#endif #endif
} }
// Always bind the RT. This way special effect can use it. // Always bind the RT. This way special effect can use it.
@ -917,10 +899,6 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
#endif #endif
gs_sel.sprite = m_vt.m_primclass == GS_SPRITE_CLASS; gs_sel.sprite = m_vt.m_primclass == GS_SPRITE_CLASS;
// WARNING: setup of the program must be done first. So you can setup
// 1/ subroutine uniform
// 2/ bindless texture uniform
// 3/ others uniform?
dev->SetupVS(vs_sel); dev->SetupVS(vs_sel);
dev->SetupGS(gs_sel); dev->SetupGS(gs_sel);
dev->SetupPS(ps_sel); dev->SetupPS(ps_sel);

View File

@ -53,15 +53,6 @@ void GSShaderOGL::VS(GLuint s)
} }
} }
void GSShaderOGL::PS_ressources(GLuint64 handle[2])
{
if (handle[0] != GLState::tex_handle[0] || handle[1] != GLState::tex_handle[1]) {
GLState::tex_handle[0] = handle[0];
GLState::tex_handle[1] = handle[1];
GLState::dirty_ressources = true;
}
}
void GSShaderOGL::PS(GLuint s) void GSShaderOGL::PS(GLuint s)
{ {
#ifdef _DEBUG #ifdef _DEBUG
@ -91,24 +82,6 @@ void GSShaderOGL::GS(GLuint s)
} }
} }
void GSShaderOGL::SetupRessources()
{
if (!GLLoader::found_GL_ARB_bindless_texture) return;
if (GLState::dirty_ressources) {
GLState::dirty_ressources = false;
if (GLLoader::found_GL_ARB_separate_shader_objects) {
gl_ProgramUniformHandleui64vARB(GLState::ps, 0, 1, &GLState::tex_handle[0]);
if (GLState::tex_handle[1])
gl_ProgramUniformHandleui64vARB(GLState::ps, 1, 1, &GLState::tex_handle[1]);
} else {
gl_UniformHandleui64vARB(0, 1, &GLState::tex_handle[0]);
if (GLState::tex_handle[1])
gl_UniformHandleui64vARB(1, 1, &GLState::tex_handle[1]);
}
}
}
bool GSShaderOGL::ValidateShader(GLuint s) bool GSShaderOGL::ValidateShader(GLuint s)
{ {
if (!m_debug_shader) return true; if (!m_debug_shader) return true;
@ -220,8 +193,6 @@ void GSShaderOGL::UseProgram()
} }
} }
SetupRessources();
GLState::dirty_prog = false; GLState::dirty_prog = false;
} }
@ -235,21 +206,12 @@ std::string GSShaderOGL::GenGlslHeader(const std::string& entry, GLenum type, co
// Need GL version 410 // Need GL version 410
header += "#extension GL_ARB_separate_shader_objects: require\n"; header += "#extension GL_ARB_separate_shader_objects: require\n";
} }
if (GLLoader::found_GL_ARB_explicit_uniform_location) {
// Need GL version 430
header += "#extension GL_ARB_explicit_uniform_location: require\n";
}
if (GLLoader::found_GL_ARB_shader_image_load_store) { if (GLLoader::found_GL_ARB_shader_image_load_store) {
// Need GL version 420 // Need GL version 420
header += "#extension GL_ARB_shader_image_load_store: require\n"; header += "#extension GL_ARB_shader_image_load_store: require\n";
} else { } else {
header += "#define DISABLE_GL42_image\n"; header += "#define DISABLE_GL42_image\n";
} }
if (GLLoader::found_GL_ARB_bindless_texture && GLLoader::found_GL_ARB_explicit_uniform_location) {
// ARB extension (4.4)
header += "#extension GL_ARB_bindless_texture: require\n";
header += "#define ENABLE_BINDLESS_TEX\n";
}
if (GLLoader::found_GL_ARB_clip_control) { if (GLLoader::found_GL_ARB_clip_control) {
header += "#define ZERO_TO_ONE_DEPTH\n"; header += "#define ZERO_TO_ONE_DEPTH\n";
} }

View File

@ -26,8 +26,6 @@ class GSShaderOGL {
hash_map<uint64, GLuint > m_single_prog; hash_map<uint64, GLuint > m_single_prog;
const bool m_debug_shader; const bool m_debug_shader;
void SetupRessources();
bool ValidateShader(GLuint p); bool ValidateShader(GLuint p);
bool ValidateProgram(GLuint p); bool ValidateProgram(GLuint p);
bool ValidatePipeline(GLuint p); bool ValidatePipeline(GLuint p);
@ -41,7 +39,6 @@ class GSShaderOGL {
void GS(GLuint s); void GS(GLuint s);
void PS(GLuint s); void PS(GLuint s);
void PS_ressources(GLuint64 handle[2]);
void VS(GLuint s); void VS(GLuint s);
void UseProgram(); void UseProgram();

View File

@ -206,7 +206,6 @@ GSTextureOGL::GSTextureOGL(int type, int w, int h, int format, GLuint fbo_read)
m_type = type; m_type = type;
m_fbo_read = fbo_read; m_fbo_read = fbo_read;
m_texture_id = 0; m_texture_id = 0;
memset(&m_handles, 0, countof(m_handles) * sizeof(m_handles[0]) );
// Bunch of constant parameter // Bunch of constant parameter
switch (m_format) { switch (m_format) {
@ -385,17 +384,6 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
#endif #endif
} }
GLuint64 GSTextureOGL::GetHandle(GLuint sampler_id)
{
ASSERT(sampler_id < 12);
if (!m_handles[sampler_id]) {
m_handles[sampler_id] = gl_GetTextureSamplerHandleARB(m_texture_id, sampler_id);
gl_MakeTextureHandleResidentARB(m_handles[sampler_id]);
}
return m_handles[sampler_id];
}
bool GSTextureOGL::Map(GSMap& m, const GSVector4i* r) bool GSTextureOGL::Map(GSMap& m, const GSVector4i* r)
{ {
// LOTS OF CRAP CODE!!!! PLEASE FIX ME !!! // LOTS OF CRAP CODE!!!! PLEASE FIX ME !!!

View File

@ -55,8 +55,6 @@ class GSTextureOGL : public GSTexture
uint32 m_int_alignment; uint32 m_int_alignment;
uint32 m_int_shift; uint32 m_int_shift;
GLuint64 m_handles[12];
public: public:
explicit GSTextureOGL(int type, int w, int h, int format, GLuint fbo_read); explicit GSTextureOGL(int type, int w, int h, int format, GLuint fbo_read);
virtual ~GSTextureOGL(); virtual ~GSTextureOGL();
@ -72,7 +70,6 @@ class GSTextureOGL : public GSTexture
bool IsDss() { return (m_type == GSTexture::DepthStencil); } bool IsDss() { return (m_type == GSTexture::DepthStencil); }
uint32 GetID() { return m_texture_id; } uint32 GetID() { return m_texture_id; }
GLuint64 GetHandle(GLuint sampler_id);
bool HasBeenCleaned() { return m_clean; } bool HasBeenCleaned() { return m_clean; }
void WasAttached() { m_clean = false; m_dirty = true; } void WasAttached() { m_clean = false; m_dirty = true; }
void WasCleaned() { m_clean = true; } void WasCleaned() { m_clean = true; }

View File

@ -115,12 +115,6 @@ void GSWndGL::PopulateGlFunction()
// GL4.4 // GL4.4
*(void**)&(gl_ClearTexImage) = GetProcAddress("glClearTexImage", true); *(void**)&(gl_ClearTexImage) = GetProcAddress("glClearTexImage", true);
*(void**)&(gl_BufferStorage) = GetProcAddress("glBufferStorage", true); *(void**)&(gl_BufferStorage) = GetProcAddress("glBufferStorage", true);
// GL_ARB_bindless_texture (GL5?)
*(void**)&(gl_GetTextureSamplerHandleARB) = GetProcAddress("glGetTextureSamplerHandleARB", true);
*(void**)&(gl_MakeTextureHandleResidentARB) = GetProcAddress("glMakeTextureHandleResidentARB", true);
*(void**)&(gl_MakeTextureHandleNonResidentARB) = GetProcAddress("glMakeTextureHandleNonResidentARB", true);
*(void**)&(gl_UniformHandleui64vARB) = GetProcAddress("glUniformHandleui64vARB", true);
*(void**)&(gl_ProgramUniformHandleui64vARB) = GetProcAddress("glProgramUniformHandleui64vARB", true);
// GL4.5 // GL4.5
*(void**)&(gl_CreateTextures) = GetProcAddress("glCreateTextures", true); *(void**)&(gl_CreateTextures) = GetProcAddress("glCreateTextures", true);

View File

@ -19,11 +19,7 @@ struct vertex_basic
vec2 t; vec2 t;
}; };
#ifdef ENABLE_BINDLESS_TEX
layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;
#else
layout(binding = 0) uniform sampler2D TextureSampler; layout(binding = 0) uniform sampler2D TextureSampler;
#endif
in SHADER in SHADER
{ {

View File

@ -64,11 +64,7 @@ layout(location = 0) out uint SV_Target1;
layout(location = 0) out vec4 SV_Target0; layout(location = 0) out vec4 SV_Target0;
#endif #endif
#ifdef ENABLE_BINDLESS_TEX
layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;
#else
layout(binding = 0) uniform sampler2D TextureSampler; layout(binding = 0) uniform sampler2D TextureSampler;
#endif
layout(std140, binding = 15) uniform cb15 layout(std140, binding = 15) uniform cb15
{ {

View File

@ -25,11 +25,7 @@ layout(std140, binding = 11) uniform cb11
float hH; float hH;
}; };
#ifdef ENABLE_BINDLESS_TEX
layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;
#else
layout(binding = 0) uniform sampler2D TextureSampler; layout(binding = 0) uniform sampler2D TextureSampler;
#endif
// TODO ensure that clip (discard) is < 0 and not <= 0 ??? // TODO ensure that clip (discard) is < 0 and not <= 0 ???
void ps_main0() void ps_main0()

View File

@ -24,11 +24,7 @@ layout(std140, binding = 10) uniform cb10
vec4 BGColor; vec4 BGColor;
}; };
#ifdef ENABLE_BINDLESS_TEX
layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;
#else
layout(binding = 0) uniform sampler2D TextureSampler; layout(binding = 0) uniform sampler2D TextureSampler;
#endif
void ps_main0() void ps_main0()
{ {

View File

@ -33,11 +33,7 @@ layout(std140, binding = 12) uniform cb12
vec4 BGColor; vec4 BGColor;
}; };
#ifdef ENABLE_BINDLESS_TEX
layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;
#else
layout(binding = 0) uniform sampler2D TextureSampler; layout(binding = 0) uniform sampler2D TextureSampler;
#endif
// For all settings: 1.0 = 100% 0.5=50% 1.5 = 150% // For all settings: 1.0 = 100% 0.5=50% 1.5 = 150%
vec4 ContrastSaturationBrightness(vec4 color) vec4 ContrastSaturationBrightness(vec4 color)

View File

@ -43,14 +43,9 @@ in SHADER
layout(location = 0, index = 0) out vec4 SV_Target0; layout(location = 0, index = 0) out vec4 SV_Target0;
layout(location = 0, index = 1) out vec4 SV_Target1; layout(location = 0, index = 1) out vec4 SV_Target1;
#ifdef ENABLE_BINDLESS_TEX
layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;
layout(bindless_sampler, location = 1) uniform sampler2D PaletteSampler;
#else
layout(binding = 0) uniform sampler2D TextureSampler; layout(binding = 0) uniform sampler2D TextureSampler;
layout(binding = 1) uniform sampler2D PaletteSampler; layout(binding = 1) uniform sampler2D PaletteSampler;
layout(binding = 3) uniform sampler2D RtSampler; // note 2 already use by the image below layout(binding = 3) uniform sampler2D RtSampler; // note 2 already use by the image below
#endif
#ifndef DISABLE_GL42_image #ifndef DISABLE_GL42_image
#if PS_DATE > 0 #if PS_DATE > 0

View File

@ -89,11 +89,7 @@ static const char* convert_glsl =
"layout(location = 0) out vec4 SV_Target0;\n" "layout(location = 0) out vec4 SV_Target0;\n"
"#endif\n" "#endif\n"
"\n" "\n"
"#ifdef ENABLE_BINDLESS_TEX\n"
"layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;\n"
"#else\n"
"layout(binding = 0) uniform sampler2D TextureSampler;\n" "layout(binding = 0) uniform sampler2D TextureSampler;\n"
"#endif\n"
"\n" "\n"
"layout(std140, binding = 15) uniform cb15\n" "layout(std140, binding = 15) uniform cb15\n"
"{\n" "{\n"
@ -445,11 +441,7 @@ static const char* interlace_glsl =
" float hH;\n" " float hH;\n"
"};\n" "};\n"
"\n" "\n"
"#ifdef ENABLE_BINDLESS_TEX\n"
"layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;\n"
"#else\n"
"layout(binding = 0) uniform sampler2D TextureSampler;\n" "layout(binding = 0) uniform sampler2D TextureSampler;\n"
"#endif\n"
"\n" "\n"
"// TODO ensure that clip (discard) is < 0 and not <= 0 ???\n" "// TODO ensure that clip (discard) is < 0 and not <= 0 ???\n"
"void ps_main0()\n" "void ps_main0()\n"
@ -518,11 +510,7 @@ static const char* merge_glsl =
" vec4 BGColor;\n" " vec4 BGColor;\n"
"};\n" "};\n"
"\n" "\n"
"#ifdef ENABLE_BINDLESS_TEX\n"
"layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;\n"
"#else\n"
"layout(binding = 0) uniform sampler2D TextureSampler;\n" "layout(binding = 0) uniform sampler2D TextureSampler;\n"
"#endif\n"
"\n" "\n"
"void ps_main0()\n" "void ps_main0()\n"
"{\n" "{\n"
@ -577,11 +565,7 @@ static const char* shadeboost_glsl =
" vec4 BGColor;\n" " vec4 BGColor;\n"
"};\n" "};\n"
"\n" "\n"
"#ifdef ENABLE_BINDLESS_TEX\n"
"layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;\n"
"#else\n"
"layout(binding = 0) uniform sampler2D TextureSampler;\n" "layout(binding = 0) uniform sampler2D TextureSampler;\n"
"#endif\n"
"\n" "\n"
"// For all settings: 1.0 = 100% 0.5=50% 1.5 = 150% \n" "// For all settings: 1.0 = 100% 0.5=50% 1.5 = 150% \n"
"vec4 ContrastSaturationBrightness(vec4 color)\n" "vec4 ContrastSaturationBrightness(vec4 color)\n"
@ -918,14 +902,9 @@ static const char* tfx_fs_all_glsl =
"layout(location = 0, index = 0) out vec4 SV_Target0;\n" "layout(location = 0, index = 0) out vec4 SV_Target0;\n"
"layout(location = 0, index = 1) out vec4 SV_Target1;\n" "layout(location = 0, index = 1) out vec4 SV_Target1;\n"
"\n" "\n"
"#ifdef ENABLE_BINDLESS_TEX\n"
"layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;\n"
"layout(bindless_sampler, location = 1) uniform sampler2D PaletteSampler;\n"
"#else\n"
"layout(binding = 0) uniform sampler2D TextureSampler;\n" "layout(binding = 0) uniform sampler2D TextureSampler;\n"
"layout(binding = 1) uniform sampler2D PaletteSampler;\n" "layout(binding = 1) uniform sampler2D PaletteSampler;\n"
"layout(binding = 3) uniform sampler2D RtSampler; // note 2 already use by the image below\n" "layout(binding = 3) uniform sampler2D RtSampler; // note 2 already use by the image below\n"
"#endif\n"
"\n" "\n"
"#ifndef DISABLE_GL42_image\n" "#ifndef DISABLE_GL42_image\n"
"#if PS_DATE > 0\n" "#if PS_DATE > 0\n"
@ -1511,11 +1490,7 @@ static const char* fxaa_fx =
" vec2 t;\n" " vec2 t;\n"
"};\n" "};\n"
"\n" "\n"
"#ifdef ENABLE_BINDLESS_TEX\n"
"layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;\n"
"#else\n"
"layout(binding = 0) uniform sampler2D TextureSampler;\n" "layout(binding = 0) uniform sampler2D TextureSampler;\n"
"#endif\n"
"\n" "\n"
"in SHADER\n" "in SHADER\n"
"{\n" "{\n"