gl: Alias register binding points a bit

- While aliasing is easy to break, it allows outdated hw to run
This commit is contained in:
kd-11 2021-10-09 15:12:05 +03:00 committed by kd-11
parent 877dd1f98d
commit e1d1d16227
2 changed files with 16 additions and 13 deletions

View File

@ -168,13 +168,13 @@ void GLFragmentDecompilerThread::insertConstants(std::stringstream & OS)
if (!constants_block.empty())
{
OS << "layout(std140, binding = 3) uniform FragmentConstantsBuffer\n";
OS << "layout(std140, binding = " << GL_FRAGMENT_CONSTANT_BUFFERS_BIND_SLOT << ") uniform FragmentConstantsBuffer\n";
OS << "{\n";
OS << constants_block;
OS << "};\n\n";
}
OS << "layout(std140, binding = 4) uniform FragmentStateBuffer\n";
OS << "layout(std140, binding = " << GL_FRAGMENT_STATE_BIND_SLOT << ") uniform FragmentStateBuffer\n";
OS << "{\n";
OS << " float fog_param0;\n";
OS << " float fog_param1;\n";
@ -186,7 +186,7 @@ void GLFragmentDecompilerThread::insertConstants(std::stringstream & OS)
OS << " float wpos_bias;\n";
OS << "};\n\n";
OS << "layout(std140, binding = 5) uniform TextureParametersBuffer\n";
OS << "layout(std140, binding = " << GL_FRAGMENT_TEXTURE_PARAMS_BIND_SLOT << ") uniform TextureParametersBuffer\n";
OS << "{\n";
OS << " sampler_info texture_parameters[16];\n";
OS << "};\n\n";

View File

@ -24,16 +24,19 @@
#define GL_STENCIL_MIRRORS_START (GL_VERTEX_TEXTURES_START + 4)
#define GL_STREAM_BUFFER_START (GL_STENCIL_MIRRORS_START + 16)
#define GL_VERTEX_PARAMS_BIND_SLOT 0
#define GL_VERTEX_LAYOUT_BIND_SLOT 1
#define GL_VERTEX_CONSTANT_BUFFERS_BIND_SLOT 2
#define GL_FRAGMENT_CONSTANT_BUFFERS_BIND_SLOT 3
#define GL_FRAGMENT_STATE_BIND_SLOT 4
#define GL_FRAGMENT_TEXTURE_PARAMS_BIND_SLOT 5
#define GL_RASTERIZER_STATE_BIND_SLOT 6
#define GL_INTERPRETER_VERTEX_BLOCK 7
#define GL_INTERPRETER_FRAGMENT_BLOCK 8
#define GL_COMPUTE_BUFFER_SLOT(index) (index + 9)
#define UBO_SLOT(x) (x)
#define SSBO_SLOT(x) (x)
#define GL_VERTEX_PARAMS_BIND_SLOT UBO_SLOT(0)
#define GL_VERTEX_LAYOUT_BIND_SLOT UBO_SLOT(1)
#define GL_VERTEX_CONSTANT_BUFFERS_BIND_SLOT UBO_SLOT(2)
#define GL_FRAGMENT_CONSTANT_BUFFERS_BIND_SLOT UBO_SLOT(3)
#define GL_FRAGMENT_STATE_BIND_SLOT UBO_SLOT(4)
#define GL_FRAGMENT_TEXTURE_PARAMS_BIND_SLOT UBO_SLOT(5)
#define GL_RASTERIZER_STATE_BIND_SLOT UBO_SLOT(6)
#define GL_INTERPRETER_VERTEX_BLOCK SSBO_SLOT(0)
#define GL_INTERPRETER_FRAGMENT_BLOCK SSBO_SLOT(1)
#define GL_COMPUTE_BUFFER_SLOT(index) SSBO_SLOT(2 + index)
// Noop keyword outside of Windows (used in log_debug)
#if !defined(_WIN32) && !defined(APIENTRY)