Same fix as the point lighting flashing for rc69 in master

This commit is contained in:
Sam Gateau 2018-06-22 13:28:09 -07:00 committed by Sam Gateau
parent df3d689098
commit 7b4b6bc3b8
5 changed files with 29 additions and 5 deletions

View file

@ -278,6 +278,7 @@ protected:
struct InputStageState {
bool _invalidFormat { true };
bool _lastUpdateStereoState{ false };
bool _hadColorAttribute{ true };
Stream::FormatPointer _format;
std::string _formatKey;

View file

@ -156,6 +156,14 @@ void GLBackend::do_setIndirectBuffer(const Batch& batch, size_t paramOffset) {
}
void GLBackend::updateInput() {
bool isStereoNow = isStereo();
// track stereo state change potentially happening wihtout changing the input format
// this is a rare case requesting to invalid the format
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
_input._invalidFormat |= (isStereoNow != _input._lastUpdateStereoState);
#endif
_input._lastUpdateStereoState = isStereoNow;
if (_input._invalidFormat) {
InputStageState::ActivationCache newActivation;
@ -213,7 +221,7 @@ void GLBackend::updateInput() {
(void)CHECK_GL_ERROR();
}
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
glVertexBindingDivisor(bufferChannelNum, frequency * (isStereo() ? 2 : 1));
glVertexBindingDivisor(bufferChannelNum, frequency * (isStereoNow ? 2 : 1));
#else
glVertexBindingDivisor(bufferChannelNum, frequency);
#endif

View file

@ -18,7 +18,7 @@
#define DEFAULT_ALLOWED_TEXTURE_MEMORY_MB ((size_t)1024)
#define MAX_RESOURCE_TEXTURES_PER_FRAME 2
#define NO_BUFFER_WORK_SLEEP_TIME_MS 2
//#define THREADED_TEXTURE_BUFFERING 1
#define THREADED_TEXTURE_BUFFERING 1
static const size_t DEFAULT_ALLOWED_TEXTURE_MEMORY = MB_TO_BYTES(DEFAULT_ALLOWED_TEXTURE_MEMORY_MB);
@ -375,7 +375,6 @@ void GLTextureTransferEngineDefault::populateActiveBufferQueue() {
}
bool GLTextureTransferEngineDefault::processActiveBufferQueue() {
PROFILE_RANGE(render_gpu_gl, __FUNCTION__);
ActiveTransferQueue activeBufferQueue;
{
Lock lock(_bufferMutex);

View file

@ -25,6 +25,14 @@ void GL41Backend::resetInputStage() {
}
void GL41Backend::updateInput() {
bool isStereoNow = isStereo();
// track stereo state change potentially happening wihtout changing the input format
// this is a rare case requesting to invalid the format
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
_input._invalidFormat |= (isStereoNow != _input._lastUpdateStereoState);
#endif
_input._lastUpdateStereoState = isStereoNow;
if (_input._invalidFormat || _input._invalidBuffers.any()) {
if (_input._invalidFormat) {
@ -111,7 +119,7 @@ void GL41Backend::updateInput() {
reinterpret_cast<GLvoid*>(pointer + perLocationStride * (GLuint)locNum));
}
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
glVertexAttribDivisor(slot + (GLuint)locNum, attrib._frequency * (isStereo() ? 2 : 1));
glVertexAttribDivisor(slot + (GLuint)locNum, attrib._frequency * (isStereoNow ? 2 : 1));
#else
glVertexAttribDivisor(slot + (GLuint)locNum, attrib._frequency);
#endif

View file

@ -27,6 +27,14 @@ void GL45Backend::resetInputStage() {
}
void GL45Backend::updateInput() {
bool isStereoNow = isStereo();
// track stereo state change potentially happening wihtout changing the input format
// this is a rare case requesting to invalid the format
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
_input._invalidFormat |= (isStereoNow != _input._lastUpdateStereoState);
#endif
_input._lastUpdateStereoState = isStereoNow;
if (_input._invalidFormat) {
InputStageState::ActivationCache newActivation;
@ -84,7 +92,7 @@ void GL45Backend::updateInput() {
(void)CHECK_GL_ERROR();
}
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
glVertexBindingDivisor(bufferChannelNum, frequency * (isStereo() ? 2 : 1));
glVertexBindingDivisor(bufferChannelNum, frequency * (isStereoNow ? 2 : 1));
#else
glVertexBindingDivisor(bufferChannelNum, frequency);
#endif