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
projection and transformation matrix, a combined one is supplied via a
@ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D
buffer. To maximize use of the limited uniform buffer memory, materials are
supplied separately in a @ref DistanceFieldVectorMaterialUniform buffer and
then referenced via @relativeref{DistanceFieldVectorDrawUniform,materialId}
from a @ref DistanceFieldVectorDrawUniform; for optional texture transformation
a per-draw @ref TextureTransformationUniform can be supplied as well. A uniform
buffer setup equivalent to the above would look like this:
buffer bound with @ref bindTransformationProjectionBuffer(). To maximize use of
the limited uniform buffer memory, materials are supplied separately in a
@ref DistanceFieldVectorMaterialUniform buffer bound with
@ref bindMaterialBuffer() and then referenced via
@relativeref{DistanceFieldVectorDrawUniform,materialId} from a
@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

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
projection and transformation matrix, a combined one is supplied via a
@ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D
buffer. To maximize use of the limited uniform buffer memory, materials are
supplied separately in a @ref FlatMaterialUniform buffer and then referenced
via @relativeref{FlatDrawUniform,materialId} from a @ref FlatDrawUniform; for
optional texture transformation a per-draw @ref TextureTransformationUniform
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:
buffer bound with @ref bindTransformationProjectionBuffer(). To maximize use of
the limited uniform buffer memory, materials are supplied separately in a
@ref FlatMaterialUniform buffer bound with @ref bindMaterialBuffer() and then
referenced via @relativeref{FlatDrawUniform,materialId} from a
@ref FlatDrawUniform 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-FlatGL-colored "colored case at the top" would look like this:
@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.
@requires_webgl20 Extension @webgl_extension{ANGLE,instanced_arrays} in WebGL
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 {
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
shaders. In this particular case, the shader needs a separate
@ref ProjectionUniform3D and @ref TransformationUniform3D buffer. To maximize
use of the limited uniform buffer memory, materials are supplied separately in
a @ref MeshVisualizerMaterialUniform and then referenced via
@ref ProjectionUniform3D and @ref TransformationUniform3D buffer bound with
@ref bindProjectionBuffer() and @ref bindTransformationBuffer(), respectively.
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
@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
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:

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
shaders. In this particular case, the shader needs a separate
@ref ProjectionUniform3D and @ref TransformationUniform3D buffer, lights are
supplied via a @ref PhongLightUniform. To maximize use of the limited uniform
buffer memory, materials are supplied separately in a @ref PhongMaterialUniform
buffer and then referenced via @relativeref{PhongDrawUniform,materialId} from a
@ref PhongDrawUniform; for optional texture transformation a per-draw
@ref TextureTransformationUniform 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:
@ref ProjectionUniform3D and @ref TransformationUniform3D buffer bound with
@ref bindProjectionBuffer() and @ref bindTransformationBuffer(), respectively,
lights are supplied via a @ref PhongLightUniform buffer bound with
@ref bindLightBuffer(). To maximize use of the limited uniform buffer memory,
materials are supplied separately in a @ref PhongMaterialUniform buffer
bound with @ref bindMaterialBuffer() and then referenced via
@relativeref{PhongDrawUniform,materialId} from a @ref PhongDrawUniform 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-PhongGL-colored "colored case at the top", with one default light,
would look like this:
@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
projection and transformation matrix, a combined one is supplied via a
@ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D
buffer. To maximize use of the limited uniform buffer memory, materials are
supplied separately in a @ref VectorMaterialUniform buffer and then referenced
via @relativeref{VectorDrawUniform,materialId} from a @ref VectorDrawUniform;
for optional texture transformation a per-draw
@ref TextureTransformationUniform can be supplied as well. A uniform buffer
setup equivalent to the above would look like this:
buffer bound with @ref bindTransformationProjectionBuffer(). To maximize use of
the limited uniform buffer memory, materials are supplied separately in a
@ref VectorMaterialUniform buffer bound with @ref bindMaterialBuffer() and then
referenced via @relativeref{VectorDrawUniform,materialId} from a
@ref VectorDrawUniform 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 above would look like this:
@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
projection and transformation matrix, a combined one is supplied via a
@ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D
buffer. This is also the only buffer supplied, as there are no other draw
parameters. A uniform buffer setup equivalent to the above would look like
this:
buffer bound with @ref bindTransformationProjectionBuffer(). This is also the
only buffer supplied, as there are no other draw parameters. A uniform buffer
setup equivalent to the above would look like this:
@snippet MagnumShaders-gl.cpp VectorGL-ubo

Loading…
Cancel
Save