mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-23 20:52:26 +00:00
- specify fragment output locations in the shader source.
OpenGL has been supporting this since version 3.3 and Vulkan requires it so it's the way to go.
This commit is contained in:
parent
832e7818c8
commit
ad7aaa8f2a
38 changed files with 28 additions and 65 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -55,3 +55,4 @@
|
|||
/src/gl/unused
|
||||
/mapfiles_release/*.map
|
||||
.DS_Store
|
||||
/build_vc2017-32
|
||||
|
|
|
@ -39,7 +39,6 @@ void FLinearDepthShader::Bind()
|
|||
mShader.reset(new FShaderProgram());
|
||||
mShader->Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
|
||||
mShader->Compile(FShaderProgram::Fragment, "shaders/glsl/lineardepth.fp", prolog, 330);
|
||||
mShader->SetFragDataLocation(0, "FragColor");
|
||||
mShader->Link("shaders/glsl/lineardepth");
|
||||
mShader->SetAttribLocation(0, "PositionInProjection");
|
||||
mShader->SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
|
@ -65,7 +64,6 @@ void FSSAOShader::Bind()
|
|||
mShader.reset(new FShaderProgram());
|
||||
mShader->Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
|
||||
mShader->Compile(FShaderProgram::Fragment, "shaders/glsl/ssao.fp", prolog, 330);
|
||||
mShader->SetFragDataLocation(0, "FragColor");
|
||||
mShader->Link("shaders/glsl/ssao");
|
||||
mShader->SetAttribLocation(0, "PositionInProjection");
|
||||
mShader->SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
|
@ -116,7 +114,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.SetFragDataLocation(0, "FragColor");
|
||||
shader.Link("shaders/glsl/depthblur");
|
||||
shader.SetAttribLocation(0, "PositionInProjection");
|
||||
shader.SetUniformBufferLocation(Uniforms[vertical].BindingPoint(), "Uniforms");
|
||||
|
@ -141,7 +138,6 @@ void FSSAOCombineShader::Bind()
|
|||
mShader.reset(new FShaderProgram());
|
||||
mShader->Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
|
||||
mShader->Compile(FShaderProgram::Fragment, "shaders/glsl/ssaocombine.fp", prolog, 330);
|
||||
mShader->SetFragDataLocation(0, "FragColor");
|
||||
mShader->Link("shaders/glsl/ssaocombine");
|
||||
mShader->SetAttribLocation(0, "PositionInProjection");
|
||||
mShader->SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
|
|
|
@ -37,7 +37,6 @@ void FBloomExtractShader::Bind()
|
|||
|
||||
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
|
||||
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/bloomextract.fp", prolog, 330);
|
||||
mShader.SetFragDataLocation(0, "FragColor");
|
||||
mShader.Link("shaders/glsl/bloomextract");
|
||||
mShader.SetAttribLocation(0, "PositionInProjection");
|
||||
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
|
@ -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.SetFragDataLocation(0, "FragColor");
|
||||
mShader.Link("shaders/glsl/bloomcombine");
|
||||
mShader.SetAttribLocation(0, "PositionInProjection");
|
||||
BloomTexture.Init(mShader, "Bloom");
|
||||
|
|
|
@ -44,7 +44,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].SetFragDataLocation(0, "FragColor");
|
||||
mShader[vertical].Link("shaders/glsl/blur");
|
||||
mShader[vertical].SetAttribLocation(0, "PositionInProjection");
|
||||
mShader[vertical].SetUniformBufferLocation(POSTPROCESS_BINDINGPOINT, "Uniforms");
|
||||
|
|
|
@ -38,7 +38,6 @@ void FColormapShader::Bind()
|
|||
|
||||
shader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
|
||||
shader.Compile(FShaderProgram::Fragment, "shaders/glsl/colormap.fp", prolog, 330);
|
||||
shader.SetFragDataLocation(0, "FragColor");
|
||||
shader.Link("shaders/glsl/colormap");
|
||||
shader.SetAttribLocation(0, "PositionInProjection");
|
||||
shader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
|
|
|
@ -35,7 +35,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.SetFragDataLocation(0, "FragColor");
|
||||
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.SetFragDataLocation(0, "FragColor");
|
||||
shader.Link("shaders/glsl/fxaa");
|
||||
shader.SetAttribLocation(0, "PositionInProjection");
|
||||
shader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
|
|
|
@ -37,7 +37,6 @@ void FLensShader::Bind()
|
|||
|
||||
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
|
||||
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/lensdistortion.fp", prolog, 330);
|
||||
mShader.SetFragDataLocation(0, "FragColor");
|
||||
mShader.Link("shaders/glsl/lensdistortion");
|
||||
mShader.SetAttribLocation(0, "PositionInProjection");
|
||||
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
|
|
|
@ -168,7 +168,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.SetFragDataLocation(0, "FragColor");
|
||||
mProgram.Link(Desc->ShaderLumpName.GetChars());
|
||||
mProgram.SetAttribLocation(0, "PositionInProjection");
|
||||
mInputTexture.Init(mProgram, "InputTexture");
|
||||
|
|
|
@ -35,7 +35,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.SetFragDataLocation(0, "FragColor");
|
||||
mShader.Link(program_name);
|
||||
mShader.SetAttribLocation(0, "PositionInProjection");
|
||||
mShader.SetAttribLocation(1, "UV");
|
||||
|
|
|
@ -263,13 +263,9 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
{
|
||||
vp_comb.Format("#version 300 es\n#define NUM_UBO_LIGHTS %d\n", lightbuffersize);
|
||||
}
|
||||
else if (gl.glslversion < 1.4f) // This differentiation is for some Intel drivers which fail on #extension, so use of #version 140 is necessary
|
||||
{
|
||||
vp_comb.Format("#version 130\n#extension GL_ARB_uniform_buffer_object : require\n#define NUM_UBO_LIGHTS %d\n", lightbuffersize);
|
||||
}
|
||||
else
|
||||
{
|
||||
vp_comb.Format("#version 140\n#define NUM_UBO_LIGHTS %d\n", lightbuffersize);
|
||||
vp_comb.Format("#version 330 core\n#define NUM_UBO_LIGHTS %d\n", lightbuffersize);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -380,10 +376,6 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
glBindAttribLocation(hShader, VATTR_VERTEX2, "aVertex2");
|
||||
glBindAttribLocation(hShader, VATTR_NORMAL, "aNormal");
|
||||
|
||||
glBindFragDataLocation(hShader, 0, "FragColor");
|
||||
glBindFragDataLocation(hShader, 1, "FragFog");
|
||||
glBindFragDataLocation(hShader, 2, "FragNormal");
|
||||
|
||||
glLinkProgram(hShader);
|
||||
|
||||
glGetShaderInfoLog(hVertProg, 10000, NULL, buffer);
|
||||
|
|
|
@ -118,17 +118,6 @@ void FShaderProgram::Compile(ShaderType type, const char *name, const FString &c
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Binds a fragment output variable to a frame buffer render target
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FShaderProgram::SetFragDataLocation(int index, const char *name)
|
||||
{
|
||||
glBindFragDataLocation(mProgram, index, name);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Links a program with the compiled shaders
|
||||
|
|
|
@ -20,7 +20,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 SetFragDataLocation(int index, const char *name);
|
||||
void Link(const char *name);
|
||||
void SetAttribLocation(int index, const char *name);
|
||||
void SetUniformBufferLocation(int index, const char *name);
|
||||
|
|
|
@ -32,7 +32,6 @@ void FShadowMapShader::Bind()
|
|||
|
||||
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 430);
|
||||
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/shadowmap.fp", prolog, 430);
|
||||
mShader.SetFragDataLocation(0, "FragColor");
|
||||
mShader.Link("shaders/glsl/shadowmap");
|
||||
mShader.SetAttribLocation(0, "PositionInProjection");
|
||||
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
|
|
|
@ -37,7 +37,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.SetFragDataLocation(0, "FragColor");
|
||||
shader.Link("shaders/glsl/tonemap");
|
||||
shader.SetAttribLocation(0, "PositionInProjection");
|
||||
SceneTexture.Init(shader, "InputTexture");
|
||||
|
@ -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.SetFragDataLocation(0, "FragColor");
|
||||
mShader.Link("shaders/glsl/exposureextract");
|
||||
mShader.SetAttribLocation(0, "PositionInProjection");
|
||||
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
|
@ -89,7 +87,6 @@ void FExposureAverageShader::Bind()
|
|||
{
|
||||
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 400);
|
||||
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/exposureaverage.fp", "", 400);
|
||||
mShader.SetFragDataLocation(0, "FragColor");
|
||||
mShader.Link("shaders/glsl/exposureaverage");
|
||||
mShader.SetAttribLocation(0, "PositionInProjection");
|
||||
ExposureTexture.Init(mShader, "ExposureTexture");
|
||||
|
@ -105,7 +102,6 @@ void FExposureCombineShader::Bind()
|
|||
|
||||
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
|
||||
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/exposurecombine.fp", prolog, 330);
|
||||
mShader.SetFragDataLocation(0, "FragColor");
|
||||
mShader.Link("shaders/glsl/exposurecombine");
|
||||
mShader.SetAttribLocation(0, "PositionInProjection");
|
||||
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D Bloom;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D SceneTexture;
|
||||
uniform sampler2D ExposureTexture;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D SourceTexture;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
in vec4 vTexCoord;
|
||||
in vec4 vColor;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D AODepthTexture;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D ExposureTexture;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D ExposureTexture;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D SceneTexture;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
in vec4 pixelpos;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
//----------------------------------------------------------------------------------
|
||||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D InputTexture;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D InputTexture;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
#if defined(MULTISAMPLE)
|
||||
uniform sampler2DMS DepthTexture;
|
||||
|
|
|
@ -6,10 +6,10 @@ in vec4 vEyeNormal;
|
|||
in vec4 vTexCoord;
|
||||
in vec4 vColor;
|
||||
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
#ifdef GBUFFER_PASS
|
||||
out vec4 FragFog;
|
||||
out vec4 FragNormal;
|
||||
layout(location=1) out vec4 FragFog;
|
||||
layout(location=2) out vec4 FragNormal;
|
||||
#endif
|
||||
|
||||
vec4 Process(vec4 color);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D InputTexture;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D LeftEyeTexture;
|
||||
uniform sampler2D RightEyeTexture;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D LeftEyeTexture;
|
||||
uniform sampler2D RightEyeTexture;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D LeftEyeTexture;
|
||||
uniform sampler2D RightEyeTexture;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
struct GPUNode
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D DepthTexture;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D AODepthTexture;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
in vec4 pixelpos;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
in vec4 vTexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
vec4 TextureLookup(vec2 tex_coord)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
uniform sampler2D InputTexture;
|
||||
uniform sampler2D ExposureTexture;
|
||||
|
|
Loading…
Reference in a new issue