- specify vertex attributes in the shader source for Vulkan compatibility.

This commit is contained in:
Christoph Oelckers 2018-06-13 08:40:04 +02:00
parent ad7aaa8f2a
commit d2dea17e81
16 changed files with 9 additions and 46 deletions

View file

@ -40,7 +40,6 @@ void FLinearDepthShader::Bind()
mShader->Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
mShader->Compile(FShaderProgram::Fragment, "shaders/glsl/lineardepth.fp", prolog, 330);
mShader->Link("shaders/glsl/lineardepth");
mShader->SetAttribLocation(0, "PositionInProjection");
mShader->SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
DepthTexture.Init(*mShader, "DepthTexture");
ColorTexture.Init(*mShader, "ColorTexture");
@ -65,7 +64,6 @@ void FSSAOShader::Bind()
mShader->Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
mShader->Compile(FShaderProgram::Fragment, "shaders/glsl/ssao.fp", prolog, 330);
mShader->Link("shaders/glsl/ssao");
mShader->SetAttribLocation(0, "PositionInProjection");
mShader->SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
DepthTexture.Init(*mShader, "DepthTexture");
NormalTexture.Init(*mShader, "NormalTexture");
@ -115,7 +113,6 @@ void FDepthBlurShader::Bind(bool vertical)
shader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
shader.Compile(FShaderProgram::Fragment, "shaders/glsl/depthblur.fp", prolog, 330);
shader.Link("shaders/glsl/depthblur");
shader.SetAttribLocation(0, "PositionInProjection");
shader.SetUniformBufferLocation(Uniforms[vertical].BindingPoint(), "Uniforms");
AODepthTexture[vertical].Init(shader, "AODepthTexture");
Uniforms[vertical].Init();
@ -139,7 +136,6 @@ void FSSAOCombineShader::Bind()
mShader->Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
mShader->Compile(FShaderProgram::Fragment, "shaders/glsl/ssaocombine.fp", prolog, 330);
mShader->Link("shaders/glsl/ssaocombine");
mShader->SetAttribLocation(0, "PositionInProjection");
mShader->SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
AODepthTexture.Init(*mShader, "AODepthTexture");
SceneFogTexture.Init(*mShader, "SceneFogTexture");

View file

@ -38,7 +38,6 @@ void FBloomExtractShader::Bind()
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/bloomextract.fp", prolog, 330);
mShader.Link("shaders/glsl/bloomextract");
mShader.SetAttribLocation(0, "PositionInProjection");
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
SceneTexture.Init(mShader, "SceneTexture");
ExposureTexture.Init(mShader, "ExposureTexture");
@ -54,7 +53,6 @@ void FBloomCombineShader::Bind()
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/bloomcombine.fp", "", 330);
mShader.Link("shaders/glsl/bloomcombine");
mShader.SetAttribLocation(0, "PositionInProjection");
BloomTexture.Init(mShader, "Bloom");
}
mShader.Bind();

View file

@ -45,7 +45,6 @@ void FBlurShader::Bind(bool vertical)
mShader[vertical].Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
mShader[vertical].Compile(FShaderProgram::Fragment, "shaders/glsl/blur.fp", prolog, 330);
mShader[vertical].Link("shaders/glsl/blur");
mShader[vertical].SetAttribLocation(0, "PositionInProjection");
mShader[vertical].SetUniformBufferLocation(POSTPROCESS_BINDINGPOINT, "Uniforms");
SourceTexture[vertical].Init(mShader[vertical], "SourceTexture");
Uniforms[vertical].Init();

View file

@ -39,7 +39,6 @@ void FColormapShader::Bind()
shader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
shader.Compile(FShaderProgram::Fragment, "shaders/glsl/colormap.fp", prolog, 330);
shader.Link("shaders/glsl/colormap");
shader.SetAttribLocation(0, "PositionInProjection");
shader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
Uniforms.Init();
}

View file

@ -36,7 +36,6 @@ void FFXAALumaShader::Bind()
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/fxaa.fp", "#define FXAA_LUMA_PASS\n", 330);
mShader.Link("shaders/glsl/fxaa");
mShader.SetAttribLocation(0, "PositionInProjection");
InputTexture.Init(mShader, "InputTexture");
}
@ -88,7 +87,6 @@ void FFXAAShader::Bind()
shader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
shader.Compile(FShaderProgram::Fragment, "shaders/glsl/fxaa.fp", prolog, maxVersion);
shader.Link("shaders/glsl/fxaa");
shader.SetAttribLocation(0, "PositionInProjection");
shader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
InputTexture.Init(shader, "InputTexture");
Uniforms.Init();

View file

@ -38,7 +38,6 @@ void FLensShader::Bind()
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/lensdistortion.fp", prolog, 330);
mShader.Link("shaders/glsl/lensdistortion");
mShader.SetAttribLocation(0, "PositionInProjection");
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
InputTexture.Init(mShader, "InputTexture");
Uniforms.Init();

View file

@ -169,7 +169,6 @@ void PostProcessShaderInstance::CompileShader()
mProgram.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", Desc->ShaderVersion);
mProgram.Compile(FShaderProgram::Fragment, lumpName, code, prolog.GetChars(), Desc->ShaderVersion);
mProgram.Link(Desc->ShaderLumpName.GetChars());
mProgram.SetAttribLocation(0, "PositionInProjection");
mInputTexture.Init(mProgram, "InputTexture");
}

View file

@ -36,8 +36,6 @@ void FPresentShaderBase::Init(const char * vtx_shader_name, const char * program
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquadscale.vp", prolog, 330);
mShader.Compile(FShaderProgram::Fragment, vtx_shader_name, prolog, 330);
mShader.Link(program_name);
mShader.SetAttribLocation(0, "PositionInProjection");
mShader.SetAttribLocation(1, "UV");
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
Uniforms.Init();
}

View file

@ -370,12 +370,6 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
glAttachShader(hShader, hVertProg);
glAttachShader(hShader, hFragProg);
glBindAttribLocation(hShader, VATTR_VERTEX, "aPosition");
glBindAttribLocation(hShader, VATTR_TEXCOORD, "aTexCoord");
glBindAttribLocation(hShader, VATTR_COLOR, "aColor");
glBindAttribLocation(hShader, VATTR_VERTEX2, "aVertex2");
glBindAttribLocation(hShader, VATTR_NORMAL, "aNormal");
glLinkProgram(hShader);
glGetShaderInfoLog(hVertProg, 10000, NULL, buffer);

View file

@ -137,17 +137,6 @@ void FShaderProgram::Link(const char *name)
}
}
//==========================================================================
//
// Set vertex attribute location
//
//==========================================================================
void FShaderProgram::SetAttribLocation(int index, const char *name)
{
glBindAttribLocation(mProgram, index, name);
}
//==========================================================================
//
// Set uniform buffer location

View file

@ -21,7 +21,6 @@ public:
void Compile(ShaderType type, const char *lumpName, const char *defines, int maxGlslVersion);
void Compile(ShaderType type, const char *name, const FString &code, const char *defines, int maxGlslVersion);
void Link(const char *name);
void SetAttribLocation(int index, const char *name);
void SetUniformBufferLocation(int index, const char *name);
void Bind();

View file

@ -33,7 +33,6 @@ void FShadowMapShader::Bind()
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 430);
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/shadowmap.fp", prolog, 430);
mShader.Link("shaders/glsl/shadowmap");
mShader.SetAttribLocation(0, "PositionInProjection");
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
Uniforms.Init();
}

View file

@ -38,7 +38,6 @@ void FTonemapShader::Bind()
shader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
shader.Compile(FShaderProgram::Fragment, "shaders/glsl/tonemap.fp", GetDefines(gl_tonemap), 330);
shader.Link("shaders/glsl/tonemap");
shader.SetAttribLocation(0, "PositionInProjection");
SceneTexture.Init(shader, "InputTexture");
ExposureTexture.Init(shader, "ExposureTexture");
PaletteLUT.Init(shader, "PaletteLUT");
@ -73,7 +72,6 @@ void FExposureExtractShader::Bind()
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/exposureextract.fp", prolog, 330);
mShader.Link("shaders/glsl/exposureextract");
mShader.SetAttribLocation(0, "PositionInProjection");
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
SceneTexture.Init(mShader, "SceneTexture");
Uniforms.Init();
@ -88,7 +86,6 @@ void FExposureAverageShader::Bind()
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 400);
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/exposureaverage.fp", "", 400);
mShader.Link("shaders/glsl/exposureaverage");
mShader.SetAttribLocation(0, "PositionInProjection");
ExposureTexture.Init(mShader, "ExposureTexture");
}
mShader.Bind();
@ -103,7 +100,6 @@ void FExposureCombineShader::Bind()
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/exposurecombine.fp", prolog, 330);
mShader.Link("shaders/glsl/exposurecombine");
mShader.SetAttribLocation(0, "PositionInProjection");
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
ExposureTexture.Init(mShader, "ExposureTexture");
Uniforms.Init();

View file

@ -1,10 +1,10 @@
in vec4 aPosition;
in vec2 aTexCoord;
in vec4 aColor;
layout(location = 0) in vec4 aPosition;
layout(location = 1) in vec2 aTexCoord;
layout(location = 2) in vec4 aColor;
#ifndef SIMPLE // we do not need these for simple shaders
in vec4 aVertex2;
in vec4 aNormal;
layout(location = 3) in vec4 aVertex2;
layout(location = 4) in vec4 aNormal;
out vec4 pixelpos;
out vec3 glowdist;

View file

@ -1,6 +1,6 @@
in vec4 PositionInProjection;
in vec2 UV;
layout (location = 0) in vec4 PositionInProjection;
layout (location = 1) in vec2 UV;
out vec2 TexCoord;
void main()

View file

@ -1,6 +1,6 @@
in vec4 PositionInProjection;
in vec2 UV;
layout (location = 0) in vec4 PositionInProjection;
layout (location = 1) in vec2 UV;
out vec2 TexCoord;
void main()