summaryrefslogtreecommitdiff
path: root/indra/llrender/llshadermgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llshadermgr.cpp')
-rw-r--r--indra/llrender/llshadermgr.cpp42
1 files changed, 30 insertions, 12 deletions
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 512ef340f9..47f1032c34 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -223,6 +223,14 @@ bool LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
}
}
+ if (features->hasFullGBuffer)
+ {
+ if (!shader->attachFragmentObject("deferred/gbufferUtil.glsl"))
+ {
+ return false;
+ }
+ }
+
if (features->hasScreenSpaceReflections || features->hasReflectionProbes)
{
if (!shader->attachFragmentObject("deferred/screenSpaceReflUtil.glsl"))
@@ -559,17 +567,11 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
}
else if (major_version == 3)
{
- if (minor_version < 10)
- {
- shader_code_text[shader_code_count++] = strdup("#version 300\n");
- }
- else if (minor_version <= 19)
- {
- shader_code_text[shader_code_count++] = strdup("#version 310\n");
- }
- else if (minor_version <= 29)
+ if (minor_version <= 29)
{
- shader_code_text[shader_code_count++] = strdup("#version 320\n");
+ // OpenGL 3.2 had GLSL version 1.50. anything after that the version numbers match.
+ // https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)#OpenGL_and_GLSL_versions
+ shader_code_text[shader_code_count++] = strdup("#version 150\n");
}
else
{
@@ -595,8 +597,15 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
extra_code_text[extra_code_count++] = strdup("precision highp float;\n");
}
}
+ }
- extra_code_text[extra_code_count++] = strdup("#define FXAA_GLSL_130 1\n");
+ if (type == GL_FRAGMENT_SHADER)
+ {
+ extra_code_text[extra_code_count++] = strdup("#define FRAGMENT_SHADER 1\n");
+ }
+ else
+ {
+ extra_code_text[extra_code_count++] = strdup("#define VERTEX_SHADER 1\n");
}
// Use alpha float to store bit flags
@@ -605,7 +614,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_ATMOS 0.34\n"); // bit 0
extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_PBR 0.67\n"); // bit 1
extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_HDRI 1.0\n"); // bit 2
- extra_code_text[extra_code_count++] = strdup("#define GET_GBUFFER_FLAG(flag) (abs(norm.w-flag)< 0.1)\n");
+ extra_code_text[extra_code_count++] = strdup("#define GET_GBUFFER_FLAG(data, flag) (abs(data-flag)< 0.1)\n");
if (defines)
{
@@ -716,6 +725,9 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
}
}
+ // Master definition can be found in deferredUtil.glsl
+ extra_code_text[extra_code_count++] = strdup("struct GBufferInfo { vec4 albedo; vec4 specular; vec3 normal; vec4 emissive; float gbufferFlag; float envIntensity; };\n");
+
//copy file into memory
enum {
flag_write_to_out_of_extra_block_area = 0x01
@@ -1248,6 +1260,7 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("sky_hdr_scale");
mReservedUniforms.push_back("sky_sunlight_scale");
mReservedUniforms.push_back("sky_ambient_scale");
+ mReservedUniforms.push_back("classic_mode");
mReservedUniforms.push_back("blue_horizon");
mReservedUniforms.push_back("blue_density");
mReservedUniforms.push_back("haze_horizon");
@@ -1470,6 +1483,11 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("debug_normal_draw_length");
+ mReservedUniforms.push_back("edgesTex");
+ mReservedUniforms.push_back("areaTex");
+ mReservedUniforms.push_back("searchTex");
+ mReservedUniforms.push_back("blendTex");
+
llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);
std::set<std::string> dupe_check;