Merge pull request #8463 from Themaister/master

Fix uniform override mistake in GLcore shader stack
This commit is contained in:
Twinaphex 2019-03-13 19:31:29 +01:00 committed by GitHub
commit b68764862d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 25 deletions

View File

@ -1898,10 +1898,23 @@ static uint32_t gfx_ctx_wl_get_flags(void *data)
{
case GFX_CTX_OPENGL_API:
case GFX_CTX_OPENGL_ES_API:
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
if (string_is_equal(video_driver_get_ident(), "glcore"))
{
#ifdef HAVE_SLANG
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
#endif
}
else if (string_is_equal(video_driver_get_ident(), "gl"))
{
#ifdef HAVE_GLSL
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
#endif
}
break;
case GFX_CTX_VULKAN_API:
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_VULKAN);
#ifdef HAVE_SLANG
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
#endif
break;
case GFX_CTX_NONE:
default:

View File

@ -1170,7 +1170,12 @@ static uint32_t gfx_ctx_x_get_flags(void *data)
BIT32_SET(flags, GFX_CTX_FLAGS_MULTISAMPLING);
}
if (string_is_equal(video_driver_get_ident(), "gl1")) { }
else if (string_is_equal(video_driver_get_ident(), "glcore")) { }
else if (string_is_equal(video_driver_get_ident(), "glcore"))
{
#ifdef HAVE_SLANG
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
#endif
}
else
{
#ifdef HAVE_CG

View File

@ -1111,17 +1111,24 @@ void Pass::reflect_parameter(const std::string &name, slang_semantic_meta &meta)
{
if (meta.uniform)
{
meta.location.ubo_vertex = glGetUniformLocation(pipeline, (std::string("RARCH_UBO_VERTEX_INSTANCE.") + name).c_str());
meta.location.ubo_fragment = glGetUniformLocation(pipeline,
(std::string("RARCH_UBO_FRAGMENT_INSTANCE.") + name).c_str());
int vert = glGetUniformLocation(pipeline, (std::string("RARCH_UBO_VERTEX_INSTANCE.") + name).c_str());
int frag = glGetUniformLocation(pipeline, (std::string("RARCH_UBO_FRAGMENT_INSTANCE.") + name).c_str());
if (vert >= 0)
meta.location.ubo_vertex = vert;
if (frag >= 0)
meta.location.ubo_fragment = frag;
}
if (meta.push_constant)
{
meta.location.push_vertex = glGetUniformLocation(pipeline,
(std::string("RARCH_PUSH_VERTEX_INSTANCE.") + name).c_str());
meta.location.push_fragment = glGetUniformLocation(pipeline,
(std::string("RARCH_PUSH_FRAGMENT_INSTANCE.") + name).c_str());
int vert = glGetUniformLocation(pipeline, (std::string("RARCH_PUSH_VERTEX_INSTANCE.") + name).c_str());
int frag = glGetUniformLocation(pipeline, (std::string("RARCH_PUSH_FRAGMENT_INSTANCE.") + name).c_str());
if (vert >= 0)
meta.location.push_vertex = vert;
if (frag >= 0)
meta.location.push_fragment = frag;
}
}
@ -1129,17 +1136,24 @@ void Pass::reflect_parameter(const std::string &name, slang_texture_semantic_met
{
if (meta.uniform)
{
meta.location.ubo_vertex = glGetUniformLocation(pipeline, (std::string("RARCH_UBO_VERTEX_INSTANCE.") + name).c_str());
meta.location.ubo_fragment = glGetUniformLocation(pipeline,
(std::string("RARCH_UBO_FRAGMENT_INSTANCE.") + name).c_str());
int vert = glGetUniformLocation(pipeline, (std::string("RARCH_UBO_VERTEX_INSTANCE.") + name).c_str());
int frag = glGetUniformLocation(pipeline, (std::string("RARCH_UBO_FRAGMENT_INSTANCE.") + name).c_str());
if (vert >= 0)
meta.location.ubo_vertex = vert;
if (frag >= 0)
meta.location.ubo_fragment = frag;
}
if (meta.push_constant)
{
meta.location.push_vertex = glGetUniformLocation(pipeline,
(std::string("RARCH_PUSH_VERTEX_INSTANCE.") + name).c_str());
meta.location.push_fragment = glGetUniformLocation(pipeline,
(std::string("RARCH_PUSH_FRAGMENT_INSTANCE.") + name).c_str());
int vert = glGetUniformLocation(pipeline, (std::string("RARCH_PUSH_VERTEX_INSTANCE.") + name).c_str());
int frag = glGetUniformLocation(pipeline, (std::string("RARCH_PUSH_FRAGMENT_INSTANCE.") + name).c_str());
if (vert >= 0)
meta.location.push_vertex = vert;
if (frag >= 0)
meta.location.push_fragment = frag;
}
}
@ -1152,18 +1166,24 @@ void Pass::reflect_parameter_array(const std::string &name, std::vector<slang_te
if (m.uniform)
{
m.location.ubo_vertex = glGetUniformLocation(pipeline,
(std::string("RARCH_UBO_VERTEX_INSTANCE.") + n).c_str());
m.location.ubo_fragment = glGetUniformLocation(pipeline,
(std::string("RARCH_UBO_FRAGMENT_INSTANCE.") + n).c_str());
int vert = glGetUniformLocation(pipeline, (std::string("RARCH_UBO_VERTEX_INSTANCE.") + n).c_str());
int frag = glGetUniformLocation(pipeline, (std::string("RARCH_UBO_FRAGMENT_INSTANCE.") + n).c_str());
if (vert >= 0)
m.location.ubo_vertex = vert;
if (frag >= 0)
m.location.ubo_fragment = frag;
}
if (m.push_constant)
{
m.location.push_vertex = glGetUniformLocation(pipeline,
(std::string("RARCH_PUSH_VERTEX_INSTANCE.") + n).c_str());
m.location.push_fragment = glGetUniformLocation(pipeline,
(std::string("RARCH_PUSH_FRAGMENT_INSTANCE.") + n).c_str());
int vert = glGetUniformLocation(pipeline, (std::string("RARCH_PUSH_VERTEX_INSTANCE.") + n).c_str());
int frag = glGetUniformLocation(pipeline, (std::string("RARCH_PUSH_FRAGMENT_INSTANCE.") + n).c_str());
if (vert >= 0)
m.location.push_vertex = vert;
if (frag >= 0)
m.location.push_fragment = frag;
}
}
}