diff options
Diffstat (limited to 'src/i965_render.c')
-rw-r--r-- | src/i965_render.c | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/src/i965_render.c b/src/i965_render.c index 7dee5f3f..9ee273c0 100644 --- a/src/i965_render.c +++ b/src/i965_render.c @@ -209,7 +209,7 @@ static Bool i965_check_composite_texture(PicturePtr pPict, int unit) I830FALLBACK("Unsupported picture format 0x%x\n", (int)pPict->format); - if (pPict->repeat && pPict->repeatType != RepeatNormal) + if (pPict->repeatType > RepeatReflect) I830FALLBACK("extended repeat (%d) not supported\n", pPict->repeatType); @@ -427,6 +427,8 @@ typedef enum { typedef enum { SAMPLER_STATE_EXTEND_NONE, SAMPLER_STATE_EXTEND_REPEAT, + SAMPLER_STATE_EXTEND_PAD, + SAMPLER_STATE_EXTEND_REFLECT, SAMPLER_STATE_EXTEND_COUNT } sampler_state_extend_t; @@ -494,8 +496,8 @@ typedef struct _gen4_state { [SAMPLER_STATE_FILTER_COUNT] [SAMPLER_STATE_EXTEND_COUNT][2]; - struct brw_sampler_default_color sampler_default_color; - PAD64 (brw_sampler_default_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] @@ -564,13 +566,16 @@ static void sampler_state_init (struct brw_sampler_state *sampler_state, sampler_state_filter_t filter, sampler_state_extend_t extend, - int default_color_offset) + int border_color_offset) { /* PS kernel use this sampler */ memset(sampler_state, 0, sizeof(*sampler_state)); sampler_state->ss0.lod_preclamp = 1; /* GL mode */ - sampler_state->ss0.default_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: @@ -596,10 +601,20 @@ sampler_state_init (struct brw_sampler_state *sampler_state, sampler_state->ss1.s_wrap_mode = BRW_TEXCOORDMODE_WRAP; sampler_state->ss1.t_wrap_mode = BRW_TEXCOORDMODE_WRAP; break; + case SAMPLER_STATE_EXTEND_PAD: + sampler_state->ss1.r_wrap_mode = BRW_TEXCOORDMODE_CLAMP; + sampler_state->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CLAMP; + sampler_state->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CLAMP; + break; + case SAMPLER_STATE_EXTEND_REFLECT: + sampler_state->ss1.r_wrap_mode = BRW_TEXCOORDMODE_MIRROR; + sampler_state->ss1.s_wrap_mode = BRW_TEXCOORDMODE_MIRROR; + sampler_state->ss1.t_wrap_mode = BRW_TEXCOORDMODE_MIRROR; + break; } - assert((default_color_offset & 31) == 0); - sampler_state->ss2.default_color_pointer = default_color_offset >> 5; + assert((border_color_offset & 31) == 0); + sampler_state->ss2.border_color_pointer = border_color_offset >> 5; sampler_state->ss3.chroma_key_enable = 0; /* disable chromakey */ } @@ -722,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) */ - memset(&card_state->sampler_default_color, 0, - sizeof(card_state->sampler_default_color)); - card_state->sampler_default_color.color[0] = 0.0; /* R */ - card_state->sampler_default_color.color[1] = 0.0; /* G */ - card_state->sampler_default_color.color[2] = 0.0; /* B */ - card_state->sampler_default_color.color[3] = 0.0; /* A */ + /* 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; /* 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; @@ -748,12 +763,12 @@ gen4_state_init (struct gen4_render_state *render_state) i, j, state_base_offset + offsetof (gen4_state_t, - sampler_default_color)); + sampler_border_color)); sampler_state_init (&card_state->sampler_state[i][j][k][l][1], k, l, state_base_offset + offsetof (gen4_state_t, - sampler_default_color)); + sampler_border_color)); } } } @@ -828,13 +843,17 @@ sampler_state_filter_from_picture (int filter) } static sampler_state_extend_t -sampler_state_extend_from_picture (int repeat) +sampler_state_extend_from_picture (int repeat_type) { - switch (repeat) { + switch (repeat_type) { case RepeatNone: return SAMPLER_STATE_EXTEND_NONE; case RepeatNormal: return SAMPLER_STATE_EXTEND_REPEAT; + case RepeatPad: + return SAMPLER_STATE_EXTEND_PAD; + case RepeatReflect: + return SAMPLER_STATE_EXTEND_REFLECT; default: return -1; } @@ -1010,17 +1029,17 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture, src_filter = sampler_state_filter_from_picture (pSrcPicture->filter); if (src_filter < 0) I830FALLBACK ("Bad src filter 0x%x\n", pSrcPicture->filter); - src_extend = sampler_state_extend_from_picture (pSrcPicture->repeat); + src_extend = sampler_state_extend_from_picture (pSrcPicture->repeatType); if (src_extend < 0) - I830FALLBACK ("Bad src repeat 0x%x\n", pSrcPicture->repeat); + I830FALLBACK ("Bad src repeat 0x%x\n", pSrcPicture->repeatType); if (pMaskPicture) { mask_filter = sampler_state_filter_from_picture (pMaskPicture->filter); if (mask_filter < 0) I830FALLBACK ("Bad mask filter 0x%x\n", pMaskPicture->filter); - mask_extend = sampler_state_extend_from_picture (pMaskPicture->repeat); + mask_extend = sampler_state_extend_from_picture (pMaskPicture->repeatType); if (mask_extend < 0) - I830FALLBACK ("Bad mask repeat 0x%x\n", pMaskPicture->repeat); + I830FALLBACK ("Bad mask repeat 0x%x\n", pMaskPicture->repeatType); } else { mask_filter = SAMPLER_STATE_FILTER_NEAREST; mask_extend = SAMPLER_STATE_EXTEND_NONE; |