Browse Source

Shaders: link to the bind*Buffer() functions from UBO usage docs.

With skinning the TransformationUniform*D structure will be reused for
two different UBOs and referencing it without the corresponding
bind*Buffer() API would be confusing. So just do that for all.
pull/499/head
Vladimír Vondruš 3 years ago
parent
commit
3f721d6667
  1. 15
      src/Magnum/Shaders/DistanceFieldVectorGL.h
  2. 15
      src/Magnum/Shaders/FlatGL.h
  3. 22
      src/Magnum/Shaders/MeshVisualizerGL.h
  4. 21
      src/Magnum/Shaders/PhongGL.h
  5. 14
      src/Magnum/Shaders/VectorGL.h
  6. 6
      src/Magnum/Shaders/VertexColorGL.h

15
src/Magnum/Shaders/DistanceFieldVectorGL.h

@ -88,12 +88,15 @@ See @ref shaders-usage-ubo for a high-level overview that applies to all
shaders. In this particular case, because the shader doesn't need a separate shaders. In this particular case, because the shader doesn't need a separate
projection and transformation matrix, a combined one is supplied via a projection and transformation matrix, a combined one is supplied via a
@ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D @ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D
buffer. To maximize use of the limited uniform buffer memory, materials are buffer bound with @ref bindTransformationProjectionBuffer(). To maximize use of
supplied separately in a @ref DistanceFieldVectorMaterialUniform buffer and the limited uniform buffer memory, materials are supplied separately in a
then referenced via @relativeref{DistanceFieldVectorDrawUniform,materialId} @ref DistanceFieldVectorMaterialUniform buffer bound with
from a @ref DistanceFieldVectorDrawUniform; for optional texture transformation @ref bindMaterialBuffer() and then referenced via
a per-draw @ref TextureTransformationUniform can be supplied as well. A uniform @relativeref{DistanceFieldVectorDrawUniform,materialId} from a
buffer setup equivalent to the above would look like this: @ref DistanceFieldVectorDrawUniform bound with @ref bindDrawBuffer(); for
optional texture transformation a per-draw @ref TextureTransformationUniform
buffer bound with @ref bindTextureTransformationBuffer() can be supplied as
well. A uniform buffer setup equivalent to the above would look like this:
@snippet MagnumShaders-gl.cpp DistanceFieldVectorGL-ubo @snippet MagnumShaders-gl.cpp DistanceFieldVectorGL-ubo

15
src/Magnum/Shaders/FlatGL.h

@ -170,12 +170,15 @@ See @ref shaders-usage-ubo for a high-level overview that applies to all
shaders. In this particular case, because the shader doesn't need a separate shaders. In this particular case, because the shader doesn't need a separate
projection and transformation matrix, a combined one is supplied via a projection and transformation matrix, a combined one is supplied via a
@ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D @ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D
buffer. To maximize use of the limited uniform buffer memory, materials are buffer bound with @ref bindTransformationProjectionBuffer(). To maximize use of
supplied separately in a @ref FlatMaterialUniform buffer and then referenced the limited uniform buffer memory, materials are supplied separately in a
via @relativeref{FlatDrawUniform,materialId} from a @ref FlatDrawUniform; for @ref FlatMaterialUniform buffer bound with @ref bindMaterialBuffer() and then
optional texture transformation a per-draw @ref TextureTransformationUniform referenced via @relativeref{FlatDrawUniform,materialId} from a
can be supplied as well. A uniform buffer setup equivalent to the @ref FlatDrawUniform bound with @ref bindDrawBuffer(); for optional texture
@ref Shaders-FlatGL-colored "colored case at the top" would look like this: transformation a per-draw @ref TextureTransformationUniform buffer bound with
@ref bindTextureTransformationBuffer() can be supplied as well. A uniform
buffer setup equivalent to
the @ref Shaders-FlatGL-colored "colored case at the top" would look like this:
@snippet MagnumShaders-gl.cpp FlatGL-ubo @snippet MagnumShaders-gl.cpp FlatGL-ubo

22
src/Magnum/Shaders/MeshVisualizerGL.h

@ -177,6 +177,15 @@ texture offset (or offset and layer).
in OpenGL ES 2.0. in OpenGL ES 2.0.
@requires_webgl20 Extension @webgl_extension{ANGLE,instanced_arrays} in WebGL @requires_webgl20 Extension @webgl_extension{ANGLE,instanced_arrays} in WebGL
1.0. 1.0.
@section Shaders-MeshVisualizerGL2D-ubo Uniform buffers
Unlike with @ref Shaders-MeshVisualizerGL2D-ubo "uniform buffers in the 3D variant",
because the shader doesn't need a separate projection and transformation
matrix, a combined one is supplied via a @ref TransformationProjectionUniform2D
buffer bound with @ref bindTransformationProjectionBuffer(), and
a trimmed-down @ref MeshVisualizerDrawUniform2D is used instead of
@ref MeshVisualizerDrawUniform3D. The rest is the same.
*/ */
class MAGNUM_SHADERS_EXPORT MeshVisualizerGL2D: public Implementation::MeshVisualizerGLBase { class MAGNUM_SHADERS_EXPORT MeshVisualizerGL2D: public Implementation::MeshVisualizerGLBase {
public: public:
@ -1192,11 +1201,16 @@ texture offset (or offset and layer).
See @ref shaders-usage-ubo for a high-level overview that applies to all See @ref shaders-usage-ubo for a high-level overview that applies to all
shaders. In this particular case, the shader needs a separate shaders. In this particular case, the shader needs a separate
@ref ProjectionUniform3D and @ref TransformationUniform3D buffer. To maximize @ref ProjectionUniform3D and @ref TransformationUniform3D buffer bound with
use of the limited uniform buffer memory, materials are supplied separately in @ref bindProjectionBuffer() and @ref bindTransformationBuffer(), respectively.
a @ref MeshVisualizerMaterialUniform and then referenced via To maximize use of the limited uniform buffer memory, materials are supplied
separately in a @ref MeshVisualizerMaterialUniform buffer bound with
@ref bindMaterialBuffer() and then referenced via
@relativeref{MeshVisualizerDrawUniform3D,materialId} from a @relativeref{MeshVisualizerDrawUniform3D,materialId} from a
@ref MeshVisualizerDrawUniform3D. A uniform buffer setup equivalent to the @ref MeshVisualizerDrawUniform3D buffer bound with @ref bindDrawBuffer(); for optional texture transformation a per-draw
@ref TextureTransformationUniform buffer bound with
@ref bindTextureTransformationBuffer() can be supplied as well. A uniform
buffer setup equivalent to the
@ref Shaders-MeshVisualizerGL3D-wireframe "wireframe case at the top" would @ref Shaders-MeshVisualizerGL3D-wireframe "wireframe case at the top" would
look like this --- note that @ref setViewportSize() is an immediate uniform look like this --- note that @ref setViewportSize() is an immediate uniform
here as well, as it's assumed to be set globally and rarely changed: here as well, as it's assumed to be set globally and rarely changed:

21
src/Magnum/Shaders/PhongGL.h

@ -259,14 +259,19 @@ well to ensure lighting works:
See @ref shaders-usage-ubo for a high-level overview that applies to all See @ref shaders-usage-ubo for a high-level overview that applies to all
shaders. In this particular case, the shader needs a separate shaders. In this particular case, the shader needs a separate
@ref ProjectionUniform3D and @ref TransformationUniform3D buffer, lights are @ref ProjectionUniform3D and @ref TransformationUniform3D buffer bound with
supplied via a @ref PhongLightUniform. To maximize use of the limited uniform @ref bindProjectionBuffer() and @ref bindTransformationBuffer(), respectively,
buffer memory, materials are supplied separately in a @ref PhongMaterialUniform lights are supplied via a @ref PhongLightUniform buffer bound with
buffer and then referenced via @relativeref{PhongDrawUniform,materialId} from a @ref bindLightBuffer(). To maximize use of the limited uniform buffer memory,
@ref PhongDrawUniform; for optional texture transformation a per-draw materials are supplied separately in a @ref PhongMaterialUniform buffer
@ref TextureTransformationUniform can be supplied as well. A uniform buffer bound with @ref bindMaterialBuffer() and then referenced via
setup equivalent to the @ref Shaders-PhongGL-colored "colored case at the top", @relativeref{PhongDrawUniform,materialId} from a @ref PhongDrawUniform bound
with one default light, would look like this: with @ref bindDrawBuffer(); for optional texture transformation a per-draw
@ref TextureTransformationUniform buffer bound with
@ref bindTextureTransformationBuffer() can be supplied as well. A uniform
buffer setup equivalent to the
@ref Shaders-PhongGL-colored "colored case at the top", with one default light,
would look like this:
@snippet MagnumShaders-gl.cpp PhongGL-ubo @snippet MagnumShaders-gl.cpp PhongGL-ubo

14
src/Magnum/Shaders/VectorGL.h

@ -86,12 +86,14 @@ See @ref shaders-usage-ubo for a high-level overview that applies to all
shaders. In this particular case, because the shader doesn't need a separate shaders. In this particular case, because the shader doesn't need a separate
projection and transformation matrix, a combined one is supplied via a projection and transformation matrix, a combined one is supplied via a
@ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D @ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D
buffer. To maximize use of the limited uniform buffer memory, materials are buffer bound with @ref bindTransformationProjectionBuffer(). To maximize use of
supplied separately in a @ref VectorMaterialUniform buffer and then referenced the limited uniform buffer memory, materials are supplied separately in a
via @relativeref{VectorDrawUniform,materialId} from a @ref VectorDrawUniform; @ref VectorMaterialUniform buffer bound with @ref bindMaterialBuffer() and then
for optional texture transformation a per-draw referenced via @relativeref{VectorDrawUniform,materialId} from a
@ref TextureTransformationUniform can be supplied as well. A uniform buffer @ref VectorDrawUniform buffer bound with @ref bindDrawBuffer(); for optional
setup equivalent to the above would look like this: texture transformation a per-draw @ref TextureTransformationUniform buffer
bound with @ref bindTextureTransformationBuffer() can be supplied as well. A
uniform buffer setup equivalent to the above would look like this:
@snippet MagnumShaders-gl.cpp VectorGL-ubo @snippet MagnumShaders-gl.cpp VectorGL-ubo

6
src/Magnum/Shaders/VertexColorGL.h

@ -87,9 +87,9 @@ See @ref shaders-usage-ubo for a high-level overview that applies to all
shaders. In this particular case, because the shader doesn't need a separate shaders. In this particular case, because the shader doesn't need a separate
projection and transformation matrix, a combined one is supplied via a projection and transformation matrix, a combined one is supplied via a
@ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D @ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D
buffer. This is also the only buffer supplied, as there are no other draw buffer bound with @ref bindTransformationProjectionBuffer(). This is also the
parameters. A uniform buffer setup equivalent to the above would look like only buffer supplied, as there are no other draw parameters. A uniform buffer
this: setup equivalent to the above would look like this:
@snippet MagnumShaders-gl.cpp VectorGL-ubo @snippet MagnumShaders-gl.cpp VectorGL-ubo

Loading…
Cancel
Save