Browse Source

Shaders: reassign MeshVisualizer uniforms to be contiguous for UBOs too.

pull/518/head
Vladimír Vondruš 5 years ago
parent
commit
0863d9e811
  1. 4
      src/Magnum/Shaders/MeshVisualizer.frag
  2. 4
      src/Magnum/Shaders/MeshVisualizer.geom
  3. 8
      src/Magnum/Shaders/MeshVisualizer.vert
  4. 18
      src/Magnum/Shaders/MeshVisualizerGL.h

4
src/Magnum/Shaders/MeshVisualizer.frag

@ -100,7 +100,7 @@ uniform lowp float smoothness
#if defined(INSTANCED_OBJECT_ID) || defined(PRIMITIVE_ID) || defined(PRIMITIVE_ID_FROM_VERTEX_ID) #if defined(INSTANCED_OBJECT_ID) || defined(PRIMITIVE_ID) || defined(PRIMITIVE_ID_FROM_VERTEX_ID)
#ifdef EXPLICIT_UNIFORM_LOCATION #ifdef EXPLICIT_UNIFORM_LOCATION
layout(location = 6) layout(location = 5)
#endif #endif
uniform lowp vec2 colorMapOffsetScale uniform lowp vec2 colorMapOffsetScale
#ifndef GL_ES #ifndef GL_ES
@ -115,7 +115,7 @@ uniform lowp vec2 colorMapOffsetScale
#else #else
#ifdef EXPLICIT_UNIFORM_LOCATION #ifdef EXPLICIT_UNIFORM_LOCATION
layout(location = 0) layout(location = 1)
#endif #endif
uniform highp uint drawOffset uniform highp uint drawOffset
#ifndef GL_ES #ifndef GL_ES

4
src/Magnum/Shaders/MeshVisualizer.geom

@ -39,7 +39,7 @@
/* This one is for both classic and UBOs, as it's usually set globally instead /* This one is for both classic and UBOs, as it's usually set globally instead
of changing per-draw */ of changing per-draw */
#ifdef EXPLICIT_UNIFORM_LOCATION #ifdef EXPLICIT_UNIFORM_LOCATION
layout(location = 5) layout(location = 0)
#endif #endif
uniform lowp vec2 viewportSize; /* defaults to zero */ uniform lowp vec2 viewportSize; /* defaults to zero */
@ -88,7 +88,7 @@ uniform lowp float smoothness
#else #else
#ifdef EXPLICIT_UNIFORM_LOCATION #ifdef EXPLICIT_UNIFORM_LOCATION
layout(location = 0) layout(location = 1)
#endif #endif
uniform highp uint drawOffset uniform highp uint drawOffset
#ifndef GL_ES #ifndef GL_ES

8
src/Magnum/Shaders/MeshVisualizer.vert

@ -41,7 +41,7 @@
#ifndef UNIFORM_BUFFERS #ifndef UNIFORM_BUFFERS
#ifdef TWO_DIMENSIONS #ifdef TWO_DIMENSIONS
#ifdef EXPLICIT_UNIFORM_LOCATION #ifdef EXPLICIT_UNIFORM_LOCATION
layout(location = 0) layout(location = 6)
#endif #endif
uniform highp mat3 transformationProjectionMatrix uniform highp mat3 transformationProjectionMatrix
#ifndef GL_ES #ifndef GL_ES
@ -50,7 +50,7 @@ uniform highp mat3 transformationProjectionMatrix
; ;
#elif defined(THREE_DIMENSIONS) #elif defined(THREE_DIMENSIONS)
#ifdef EXPLICIT_UNIFORM_LOCATION #ifdef EXPLICIT_UNIFORM_LOCATION
layout(location = 0) layout(location = 6)
#endif #endif
uniform highp mat4 transformationMatrix uniform highp mat4 transformationMatrix
#ifndef GL_ES #ifndef GL_ES
@ -71,7 +71,7 @@ uniform highp mat4 projectionMatrix
#ifdef VERTEX_ID #ifdef VERTEX_ID
#ifdef EXPLICIT_UNIFORM_LOCATION #ifdef EXPLICIT_UNIFORM_LOCATION
layout(location = 6) layout(location = 5)
#endif #endif
uniform lowp vec2 colorMapOffsetScale uniform lowp vec2 colorMapOffsetScale
#ifndef GL_ES #ifndef GL_ES
@ -106,7 +106,7 @@ uniform highp float lineLength
#else #else
#ifdef EXPLICIT_UNIFORM_LOCATION #ifdef EXPLICIT_UNIFORM_LOCATION
layout(location = 0) layout(location = 1)
#endif #endif
uniform highp uint drawOffset uniform highp uint drawOffset
#ifndef GL_ES #ifndef GL_ES

18
src/Magnum/Shaders/MeshVisualizerGL.h

@ -97,16 +97,16 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizerGLBase: public GL::AbstractShaderProgr
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
UnsignedInt _materialCount{}, _drawCount{}; UnsignedInt _materialCount{}, _drawCount{};
#endif #endif
Int _colorUniform{1}, Int _viewportSizeUniform{0},
_colorUniform{1},
_wireframeColorUniform{2}, _wireframeColorUniform{2},
_wireframeWidthUniform{3}, _wireframeWidthUniform{3},
_smoothnessUniform{4}, _smoothnessUniform{4};
_viewportSizeUniform{5};
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
Int _colorMapOffsetScaleUniform{6}; Int _colorMapOffsetScaleUniform{5};
/* Used instead of all other uniforms when Flag::UniformBuffers is set, /* Used instead of all other uniforms except viewportSize when
so it can alias them */ Flag::UniformBuffers is set, so it can alias them */
Int _drawOffsetUniform{0}; Int _drawOffsetUniform{1};
#endif #endif
}; };
@ -565,7 +565,7 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizerGL2D: public Implementation::MeshVisua
*/ */
private: private:
Int _transformationProjectionMatrixUniform{0}; Int _transformationProjectionMatrixUniform{6};
}; };
/** /**
@ -1514,7 +1514,7 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizerGL3D: public Implementation::MeshVisua
*/ */
private: private:
Int _transformationMatrixUniform{0}, Int _transformationMatrixUniform{6},
_projectionMatrixUniform{7}; _projectionMatrixUniform{7};
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Int _normalMatrixUniform{8}, Int _normalMatrixUniform{8},

Loading…
Cancel
Save