mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 11:33:44 +02:00
add apotential fix to the issue with viewInverse for Legacy transform path support
This commit is contained in:
parent
c47cee3f3b
commit
b7d88e2642
3 changed files with 34 additions and 0 deletions
|
@ -87,6 +87,11 @@ public:
|
|||
GLuint _transformCameraSlot = -1;
|
||||
GLuint _transformObjectSlot = -1;
|
||||
|
||||
#if (GPU_TRANSFORM_PROFILE == GPU_CORE)
|
||||
#else
|
||||
GLuint _transformCamera_viewInverse = -1;
|
||||
#endif
|
||||
|
||||
GLShader();
|
||||
~GLShader();
|
||||
};
|
||||
|
@ -311,6 +316,11 @@ protected:
|
|||
GLuint _program;
|
||||
bool _invalidProgram;
|
||||
|
||||
#if (GPU_TRANSFORM_PROFILE == GPU_CORE)
|
||||
#else
|
||||
GLuint _program_transformCamera_viewInverse = -1;
|
||||
#endif
|
||||
|
||||
State::Data _stateCache;
|
||||
State::Signature _stateSignatureCache;
|
||||
|
||||
|
|
|
@ -71,6 +71,11 @@ void GLBackend::do_setPipeline(Batch& batch, uint32 paramOffset) {
|
|||
_pipeline._program = 0;
|
||||
_pipeline._invalidProgram = true;
|
||||
|
||||
#if (GPU_TRANSFORM_PROFILE == GPU_CORE)
|
||||
#else
|
||||
_pipeline._program_transformCamera_viewInverse = -1
|
||||
#endif
|
||||
|
||||
_pipeline._state = nullptr;
|
||||
_pipeline._invalidState = true;
|
||||
} else {
|
||||
|
@ -83,6 +88,11 @@ void GLBackend::do_setPipeline(Batch& batch, uint32 paramOffset) {
|
|||
if (_pipeline._program != pipelineObject->_program->_program) {
|
||||
_pipeline._program = pipelineObject->_program->_program;
|
||||
_pipeline._invalidProgram = true;
|
||||
|
||||
#if (GPU_TRANSFORM_PROFILE == GPU_CORE)
|
||||
#else
|
||||
_pipeline._program_transformCamera_viewInverse = pipelineObject->_program->_transformCamera_viewInverse;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Now for the state
|
||||
|
@ -130,6 +140,15 @@ void GLBackend::updatePipeline() {
|
|||
}
|
||||
_pipeline._invalidState = false;
|
||||
}
|
||||
|
||||
#if (GPU_TRANSFORM_PROFILE == GPU_CORE)
|
||||
#else
|
||||
// If shader program needs the inverseView we need to provide it
|
||||
// YES InverseView in the shade is called View on the Batch interface
|
||||
if (_pipeline._program_transformCamera_viewInverse >= 0) {
|
||||
glUniformMatrix4fv(_pipeline._program_transformCamera_viewInverse, 1, false, &_transform._view);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GLBackend::do_setUniformBuffer(Batch& batch, uint32 paramOffset) {
|
||||
|
|
|
@ -106,6 +106,11 @@ void makeBindings(GLBackend::GLShader* shader) {
|
|||
glUniformBlockBinding(glprogram, loc, gpu::TRANSFORM_CAMERA_SLOT);
|
||||
shader->_transformCameraSlot = gpu::TRANSFORM_CAMERA_SLOT;
|
||||
}
|
||||
#else
|
||||
loc = glGetUniformLocation(glprogram, "transformCamera_viewInverse");
|
||||
if (loc >= 0) {
|
||||
shader->_transformCamera_viewInverse = loc;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue