Mesa (floating): gallium: add color clamping to the interface

Luca Barbieri lb at kemper.freedesktop.org
Fri Aug 27 17:26:50 UTC 2010


Module: Mesa
Branch: floating
Commit: cb950316df8803bda4a487a6cafc9375dba13650
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb950316df8803bda4a487a6cafc9375dba13650

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Thu Aug 26 18:18:25 2010 +0200

gallium: add color clamping to the interface

---

 src/gallium/docs/source/cso/rasterizer.rst |   28 ++++++++++++++++++++++++++++
 src/gallium/include/pipe/p_defines.h       |    4 +++-
 src/gallium/include/pipe/p_state.h         |    2 ++
 3 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/src/gallium/docs/source/cso/rasterizer.rst b/src/gallium/docs/source/cso/rasterizer.rst
index ee3419c..622798a 100644
--- a/src/gallium/docs/source/cso/rasterizer.rst
+++ b/src/gallium/docs/source/cso/rasterizer.rst
@@ -7,6 +7,34 @@ The rasterizer state controls the rendering of points, lines and triangles.
 Attributes include polygon culling state, line width, line stipple,
 multisample state, scissoring and flat/smooth shading.
 
+Linkage
+-------
+
+clamp_vertex_color
+^^^^^^^^^^^^^^^^^^
+
+If set, TGSI_SEMANTIC_COLOR registers are clamped to the [0, 1] range after
+the execution of the vertex shader, before being passed to the geometry
+shader or fragment shader.
+
+OpenGL: glClampColor(GL_CLAMP_VERTEX_COLOR) in GL 3.0 or GL_ARB_color_buffer_float
+
+D3D11: seems always disabled
+
+XXX: this happens _before_ the geometry shader and thus might not belong here.
+
+clamp_fragment_color
+^^^^^^^^^^^^^^^^^^^^
+
+Controls whether TGSI_SEMANTIC_COLOR outputs of the fragment shader
+are clamped to [0, 1].
+
+OpenGL: glClampColor(GL_CLAMP_FRAGMENT_COLOR) in GL 3.0 or ARB_color_buffer_float
+
+D3D11: seems always disabled
+
+XXX: this happens _after_ the fragment shader and thus might not belong here.
+
 Shading
 -------
 
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 35eccf1..3cb6fc6 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -494,7 +494,9 @@ enum pipe_cap {
    PIPE_CAP_MAX_VS_PREDS,
 
    PIPE_CAP_GEOMETRY_SHADER4,
-   PIPE_CAP_DEPTH_CLAMP
+   PIPE_CAP_DEPTH_CLAMP,
+   PIPE_CAP_UNCLAMPED_VERTEX_COLOR,
+   PIPE_CAP_UNCLAMPED_FRAGMENT_COLOR,
 };
 
 
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 0f1a44c..917560c 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -81,6 +81,8 @@ struct pipe_rasterizer_state
 {
    unsigned flatshade:1;
    unsigned light_twoside:1;
+   unsigned clamp_vertex_color:1; /* probably shouldn't be there... */
+   unsigned clamp_fragment_color:1; /* probably shouldn't be there... */
    unsigned front_ccw:1;
    unsigned cull_face:2;      /**< PIPE_FACE_x */
    unsigned fill_front:2;     /**< PIPE_POLYGON_MODE_x */




More information about the mesa-commit mailing list