summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_cb_clear.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2012-10-15 03:55:23 +0200
committerMarek Olšák <maraeo@gmail.com>2012-10-15 16:04:09 +0200
commit2bbd307fa638f6d256d020ddf1cff5fc7f735fd2 (patch)
treedf24d603b4c95e371d5c3ec4164a55607722dc77 /src/mesa/state_tracker/st_cb_clear.c
parent1ec12c53ba71622dc5dcf62c23972aa539792ccb (diff)
downloadexternal_mesa3d-2bbd307fa638f6d256d020ddf1cff5fc7f735fd2.zip
external_mesa3d-2bbd307fa638f6d256d020ddf1cff5fc7f735fd2.tar.gz
external_mesa3d-2bbd307fa638f6d256d020ddf1cff5fc7f735fd2.tar.bz2
st/mesa: fix integer texture border color for some formats (v2)
And the clear color too, though that may be an issue only with GL_RGB if it's actually RGBA in the driver. NOTE: This is a candidate for the stable branches. Reviewed-by: Brian Paul <brianp@vmware.com> v2: The types of st_translate_color parameters were changed to gl_color_union and pipe_color_union as per Brian's comment.
Diffstat (limited to 'src/mesa/state_tracker/st_cb_clear.c')
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index e731b6b..90eb0af 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -37,6 +37,7 @@
#include "main/accum.h"
#include "main/formats.h"
#include "main/macros.h"
+#include "main/glformats.h"
#include "program/prog_instruction.h"
#include "st_context.h"
#include "st_atom.h"
@@ -301,9 +302,13 @@ clear_with_quad(struct gl_context *ctx,
cso_set_geometry_shader_handle(st->cso_context, NULL);
if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {
- st_translate_color(ctx->Color.ClearColor.f,
- ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,
- clearColor.f);
+ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
+ GLboolean is_integer = _mesa_is_enum_format_integer(rb->InternalFormat);
+
+ st_translate_color(&ctx->Color.ClearColor,
+ &clearColor,
+ ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,
+ is_integer);
}
/* draw quad matching scissor rect */
@@ -540,9 +545,13 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
clear_buffers |= PIPE_CLEAR_DEPTHSTENCIL;
if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {
- st_translate_color(ctx->Color.ClearColor.f,
+ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
+ GLboolean is_integer = _mesa_is_enum_format_integer(rb->InternalFormat);
+
+ st_translate_color(&ctx->Color.ClearColor,
+ &clearColor,
ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,
- clearColor.f);
+ is_integer);
}
st->pipe->clear(st->pipe, clear_buffers, &clearColor,