[GLSL] Fix the regression of legacy GLSL compatibility due to the changes in SPIRV-Cross

Related work item: Github #42
This commit is contained in:
Minmin Gong 2020-09-25 16:35:10 -07:00
Родитель e82b303f9a
Коммит 9f4dbeb643
8 изменённых файлов: 20 добавлений и 20 удалений

Просмотреть файл

@ -749,18 +749,18 @@ namespace
if ((source.stage == ShaderStage::VertexShader) && (varClass == spv::StorageClass::StorageClassOutput))
{
auto name = compiler->get_name(var);
if (name.find("out_var") == 0)
if ((name.find("out_var_") == 0) || (name.find("out.var.") == 0))
{
name.replace(0, 7, "varying");
name.replace(0, 8, "varying_");
compiler->set_name(var, name);
}
}
else if ((source.stage == ShaderStage::PixelShader) && (varClass == spv::StorageClass::StorageClassInput))
{
auto name = compiler->get_name(var);
if (name.find("in_var") == 0)
if ((name.find("in_var_") == 0) || (name.find("in.var.") == 0))
{
name.replace(0, 6, "varying");
name.replace(0, 7, "varying_");
compiler->set_name(var, name);
}
}

Просмотреть файл

@ -4,10 +4,10 @@
uniform sampler2D SPIRV_Cross_CombinedcolorTexpointSampler;
uniform sampler2D SPIRV_Cross_CombinedcolorTexlinearSampler;
varying vec2 in_var_TEXCOORD0;
varying vec2 varying_TEXCOORD0;
void main()
{
gl_FragData[0] = texture2D(SPIRV_Cross_CombinedcolorTexpointSampler, in_var_TEXCOORD0) + texture2D(SPIRV_Cross_CombinedcolorTexlinearSampler, in_var_TEXCOORD0);
gl_FragData[0] = texture2D(SPIRV_Cross_CombinedcolorTexpointSampler, varying_TEXCOORD0) + texture2D(SPIRV_Cross_CombinedcolorTexlinearSampler, varying_TEXCOORD0);
}

Просмотреть файл

@ -2,11 +2,11 @@
precision mediump float;
precision highp int;
in highp vec4 in_var_COLOR;
in highp vec4 varying_COLOR;
layout(location = 0) out highp vec4 out_var_SV_Target;
void main()
{
out_var_SV_Target = in_var_COLOR;
out_var_SV_Target = varying_COLOR;
}

Просмотреть файл

@ -1,11 +1,11 @@
#version 300
#extension GL_ARB_separate_shader_objects : require
layout(location = 0) in vec4 in_var_COLOR;
layout(location = 0) in vec4 varying_COLOR;
out vec4 out_var_SV_Target;
void main()
{
out_var_SV_Target = in_var_COLOR;
out_var_SV_Target = varying_COLOR;
}

Просмотреть файл

@ -2,11 +2,11 @@
layout(location = 0) in vec4 in_var_POSITION;
layout(location = 1) in vec2 in_var_TEXCOORD0;
out vec2 out_var_TEXCOORD0;
out vec2 varying_TEXCOORD0;
void main()
{
out_var_TEXCOORD0 = in_var_TEXCOORD0;
varying_TEXCOORD0 = in_var_TEXCOORD0;
gl_Position = in_var_POSITION;
}

Просмотреть файл

@ -8,11 +8,11 @@ out gl_PerVertex
in vec4 in_var_POSITION;
in vec2 in_var_TEXCOORD0;
layout(location = 0) out vec2 out_var_TEXCOORD0;
layout(location = 0) out vec2 varying_TEXCOORD0;
void main()
{
out_var_TEXCOORD0 = in_var_TEXCOORD0;
varying_TEXCOORD0 = in_var_TEXCOORD0;
gl_Position = in_var_POSITION;
}

Просмотреть файл

@ -11,15 +11,15 @@ uniform highp sampler2D SPIRV_Cross_CombinedcolorTexpointSampler;
uniform highp sampler2D SPIRV_Cross_CombinedbloomTexlinearSampler;
uniform highp sampler2D SPIRV_Cross_CombinedlumTexpointSampler;
in highp vec2 in_var_TEXCOORD0;
in highp vec2 varying_TEXCOORD0;
layout(location = 0) out highp vec4 out_var_SV_Target;
void main()
{
highp vec4 _45 = texture(SPIRV_Cross_CombinedcolorTexpointSampler, in_var_TEXCOORD0);
highp vec4 _45 = texture(SPIRV_Cross_CombinedcolorTexpointSampler, varying_TEXCOORD0);
highp vec3 _62 = (_45.xyz * (0.7200000286102294921875 / ((texture(SPIRV_Cross_CombinedlumTexpointSampler, vec2(0.5)).x * cbPS.lumStrength) + 0.001000000047497451305389404296875))).xyz;
highp vec3 _66 = (_62 * (vec3(1.0) + (_62 * vec3(0.666666686534881591796875)))).xyz;
highp vec3 _71 = (_66 / (vec3(1.0) + _66)).xyz + (texture(SPIRV_Cross_CombinedbloomTexlinearSampler, in_var_TEXCOORD0).xyz * 0.60000002384185791015625);
highp vec3 _71 = (_66 / (vec3(1.0) + _66)).xyz + (texture(SPIRV_Cross_CombinedbloomTexlinearSampler, varying_TEXCOORD0).xyz * 0.60000002384185791015625);
highp vec4 _73 = vec4(_71.x, _71.y, _71.z, _45.w);
_73.w = 1.0;
out_var_SV_Target = _73;

Просмотреть файл

@ -10,15 +10,15 @@ uniform sampler2D SPIRV_Cross_CombinedcolorTexpointSampler;
uniform sampler2D SPIRV_Cross_CombinedbloomTexlinearSampler;
uniform sampler2D SPIRV_Cross_CombinedlumTexpointSampler;
layout(location = 0) in vec2 in_var_TEXCOORD0;
layout(location = 0) in vec2 varying_TEXCOORD0;
out vec4 out_var_SV_Target;
void main()
{
vec4 _45 = texture(SPIRV_Cross_CombinedcolorTexpointSampler, in_var_TEXCOORD0);
vec4 _45 = texture(SPIRV_Cross_CombinedcolorTexpointSampler, varying_TEXCOORD0);
vec3 _62 = (_45.xyz * (0.7200000286102294921875 / ((texture(SPIRV_Cross_CombinedlumTexpointSampler, vec2(0.5)).x * cbPS.lumStrength) + 0.001000000047497451305389404296875))).xyz;
vec3 _66 = (_62 * (vec3(1.0) + (_62 * vec3(0.666666686534881591796875)))).xyz;
vec3 _71 = (_66 / (vec3(1.0) + _66)).xyz + (texture(SPIRV_Cross_CombinedbloomTexlinearSampler, in_var_TEXCOORD0).xyz * 0.60000002384185791015625);
vec3 _71 = (_66 / (vec3(1.0) + _66)).xyz + (texture(SPIRV_Cross_CombinedbloomTexlinearSampler, varying_TEXCOORD0).xyz * 0.60000002384185791015625);
vec4 _73 = vec4(_71.x, _71.y, _71.z, _45.w);
_73.w = 1.0;
out_var_SV_Target = _73;