aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/blend.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/blend.c')
-rw-r--r--mesalib/src/mesa/main/blend.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c
index 09a1c9ae8..0c28352b2 100644
--- a/mesalib/src/mesa/main/blend.c
+++ b/mesalib/src/mesa/main/blend.c
@@ -22,9 +22,10 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
@@ -783,7 +784,6 @@ _mesa_ClampColor(GLenum target, GLenum clamp)
_mesa_update_clamp_fragment_color(ctx);
break;
case GL_CLAMP_READ_COLOR_ARB:
- FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.ClampReadColor = clamp;
break;
default:
@@ -856,6 +856,23 @@ _mesa_update_clamp_vertex_color(struct gl_context *ctx)
ctx->Light._ClampVertexColor = _mesa_get_clamp_vertex_color(ctx);
}
+/**
+ * Returns an appropriate gl_format for color rendering based on the
+ * GL_FRAMEBUFFER_SRGB state.
+ *
+ * Some drivers implement GL_FRAMEBUFFER_SRGB using a flag on the blend state
+ * (which GL_FRAMEBUFFER_SRGB maps to reasonably), but some have to do so by
+ * overriding the format of the surface. This is a helper for doing the
+ * surface format override variant.
+ */
+gl_format
+_mesa_get_render_format(const struct gl_context *ctx, gl_format format)
+{
+ if (ctx->Color.sRGBEnabled)
+ return format;
+ else
+ return _mesa_get_srgb_format_linear(format);
+}
/**********************************************************************/
/** \name Initialization */