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 76c9ece36e ).
This commit is contained in:
Carl Worth 2008-10-06 13:17:59 -07:00
parent 98ca9e2af1
commit 260cbcfe61
3 changed files with 31 additions and 9 deletions

View File

@ -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

View File

@ -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
{

View File

@ -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;