summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2008-10-06 13:17:59 -0700
committerCarl Worth <cworth@cworth.org>2008-10-06 13:22:08 -0700
commit260cbcfe61868175ba3e649ce07d43f57601f9be (patch)
tree9e3175f2b306ce9c6da09743065ef1ca61b6ae78 /src
parent98ca9e2af1b0a67ed91e10cf661af70dfba44d43 (diff)
Document and use 'legacy' border color mode
It's very convenient that the hardware supports this non-default mode since it's exactly what is specified by the Render extension. This provides a more efficient means of fixing bug #16820: [EXA] Composition result in black for areas outside of source-surface bo https://bugs.freedesktop.org/show_bug.cgi?id=16820 without the software fallback we had in the earlier fix, (commit 76c9ece36e6400fd10f364ee330faea470e2da64 ).
Diffstat (limited to 'src')
-rw-r--r--src/brw_defines.h3
-rw-r--r--src/brw_structs.h18
-rw-r--r--src/i965_render.c19
3 files changed, 31 insertions, 9 deletions
diff --git a/src/brw_defines.h b/src/brw_defines.h
index 13cb4396..0df2491c 100644
--- a/src/brw_defines.h
+++ b/src/brw_defines.h
@@ -466,6 +466,9 @@
#define BRW_SURFACE_BUFFER 4
#define BRW_SURFACE_NULL 7
+#define BRW_BORDER_COLOR_MODE_DEFAULT 0
+#define BRW_BORDER_COLOR_MODE_LEGACY 1
+
#define BRW_TEXCOORDMODE_WRAP 0
#define BRW_TEXCOORDMODE_MIRROR 1
#define BRW_TEXCOORDMODE_CLAMP 2
diff --git a/src/brw_structs.h b/src/brw_structs.h
index 553aeebb..022915d1 100644
--- a/src/brw_structs.h
+++ b/src/brw_structs.h
@@ -840,10 +840,26 @@ struct brw_wm_unit_state
float global_depth_offset_scale;
};
-struct brw_sampler_border_color {
+/* The hardware supports two different modes for border color. The
+ * default (OpenGL) mode uses floating-point color channels, while the
+ * legacy mode uses 4 bytes.
+ *
+ * More significantly, the legacy mode respects the components of the
+ * border color for channels not present in the source, (whereas the
+ * default mode will ignore the border color's alpha channel and use
+ * alpha==1 for an RGB source, for example).
+ *
+ * The legacy mode matches the semantics specified by the Render
+ * extension.
+ */
+struct brw_sampler_default_border_color {
float color[4];
};
+struct brw_sampler_legacy_border_color {
+ uint8_t color[4];
+};
+
struct brw_sampler_state
{
diff --git a/src/i965_render.c b/src/i965_render.c
index 4bffe0d7..9ee273c0 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -496,8 +496,8 @@ typedef struct _gen4_state {
[SAMPLER_STATE_FILTER_COUNT]
[SAMPLER_STATE_EXTEND_COUNT][2];
- struct brw_sampler_border_color sampler_border_color;
- PAD64 (brw_sampler_border_color, 0);
+ struct brw_sampler_legacy_border_color sampler_border_color;
+ PAD64 (brw_sampler_legacy_border_color, 0);
/* Index by [src_blend][dst_blend] */
brw_cc_unit_state_padded cc_state[BRW_BLENDFACTOR_COUNT]
@@ -572,7 +572,10 @@ sampler_state_init (struct brw_sampler_state *sampler_state,
memset(sampler_state, 0, sizeof(*sampler_state));
sampler_state->ss0.lod_preclamp = 1; /* GL mode */
- sampler_state->ss0.border_color_mode = 0; /* GL mode */
+
+ /* We use the legacy mode to get the semantics specified by
+ * the Render extension. */
+ sampler_state->ss0.border_color_mode = BRW_BORDER_COLOR_MODE_LEGACY;
switch(filter) {
default:
@@ -734,13 +737,13 @@ gen4_state_init (struct gen4_render_state *render_state)
card_state->vs_state.vs6.vs_enable = 0;
card_state->vs_state.vs6.vert_cache_disable = 1;
- /* Set up the sampler default color (always transparent black) */
+ /* Set up the sampler border color (always transparent black) */
memset(&card_state->sampler_border_color, 0,
sizeof(card_state->sampler_border_color));
- card_state->sampler_border_color.color[0] = 0.0; /* R */
- card_state->sampler_border_color.color[1] = 0.0; /* G */
- card_state->sampler_border_color.color[2] = 0.0; /* B */
- card_state->sampler_border_color.color[3] = 0.0; /* A */
+ card_state->sampler_border_color.color[0] = 0; /* R */
+ card_state->sampler_border_color.color[1] = 0; /* G */
+ card_state->sampler_border_color.color[2] = 0; /* B */
+ card_state->sampler_border_color.color[3] = 0; /* A */
card_state->cc_viewport.min_depth = -1.e35;
card_state->cc_viewport.max_depth = 1.e35;