3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-17 18:48:20 +02:00

Merge pull request from samcake/black

Fix the local lights not working on AMD
This commit is contained in:
Bradley Austin Davis 2018-08-21 15:36:12 -07:00 committed by GitHub
commit d3fd2132ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 15 deletions
libraries

View file

@ -212,6 +212,8 @@ GLShader* GLBackend::compileBackendProgram(const Shader& program, const Shader::
glprogram = ::gl::buildProgram(shaderGLObjects);
if (!::gl::linkProgram(glprogram, compilationLogs[version].message)) {
qCWarning(gpugllogging) << "GLBackend::compileBackendProgram - Program didn't link:\n" << compilationLogs[version].message.c_str();
compilationLogs[version].compiled = false;
glDeleteProgram(glprogram);
glprogram = 0;
return nullptr;
@ -254,7 +256,7 @@ GLint GLBackend::getRealUniformLocation(GLint location) const {
// uniforms. If someone is requesting a uniform that isn't in the remapping structure
// that's a bug from the calling code, because it means that location wasn't in the
// reflection
qWarning() << "Unexpected location requested for shader";
qWarning() << "Unexpected location requested for shader: #" << location;
return INVALID_UNIFORM_INDEX;
}
return itr->second;

View file

@ -496,10 +496,6 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
batch.setPipeline(program);
}
// Adjust the texcoordTransform in the case we are rendeirng a sub region(mini mirror)
auto textureFrameTransform = gpu::Framebuffer::evalSubregionTexcoordTransformCoefficients(deferredFramebuffer->getFrameSize(), args->_viewport);
batch._glUniform4fv(ru::Uniform::TexcoordTransform, 1, reinterpret_cast< const float* >(&textureFrameTransform));
// Setup the global lighting
deferredLightingEffect->setupKeyLightBatch(args, batch);
@ -560,23 +556,18 @@ void RenderDeferredLocals::run(const render::RenderContextPointer& renderContext
batch.setViewportTransform(viewport);
batch.setStateScissorRect(viewport);
auto textureFrameTransform = gpu::Framebuffer::evalSubregionTexcoordTransformCoefficients(deferredFramebuffer->getFrameSize(), viewport);
auto& lightIndices = lightClusters->_visibleLightIndices;
if (!lightIndices.empty() && lightIndices[0] > 0) {
deferredLightingEffect->setupLocalLightsBatch(batch, lightClusters);
// Local light pipeline
batch.setPipeline(deferredLightingEffect->_localLight);
batch._glUniform4fv(ru::Uniform::TexcoordTransform, 1, reinterpret_cast<const float*>(&textureFrameTransform));
batch.draw(gpu::TRIANGLE_STRIP, 4);
// Draw outline as well ?
if (lightingModel->isShowLightContourEnabled()) {
batch.setPipeline(deferredLightingEffect->_localLightOutline);
batch._glUniform4fv(ru::Uniform::TexcoordTransform, 1, reinterpret_cast<const float*>(&textureFrameTransform));
batch.draw(gpu::TRIANGLE_STRIP, 4);
}

View file

@ -16,8 +16,6 @@
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01;
layout(location=RENDER_UTILS_UNIFORM_LIGHT_TEXCOORD_TRANSFORM) uniform vec4 texcoordFrameTransform;
void main(void) {
const float depth = 1.0;
const vec4 UNIT_QUAD[4] = vec4[4](
@ -30,8 +28,5 @@ void main(void) {
_texCoord01.xy = (pos.xy + 1.0) * 0.5;
_texCoord01.xy *= texcoordFrameTransform.zw;
_texCoord01.xy += texcoordFrameTransform.xy;
gl_Position = pos;
}