mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
st/xorg: implement repeatnone and make some code smell less like ass
This commit is contained in:
parent
493d599af4
commit
2cfbbc76e4
4 changed files with 67 additions and 23 deletions
|
|
@ -199,10 +199,6 @@ boolean xorg_composite_accelerated(int op,
|
||||||
op);
|
op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((pSrcPicture && pSrcPicture->repeatType == RepeatNone) ||
|
|
||||||
(pMaskPicture && pMaskPicture->repeatType == RepeatNone)) {
|
|
||||||
XORG_FALLBACK("RepeatNone is not supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -243,6 +239,9 @@ bind_shaders(struct exa_context *exa, int op,
|
||||||
exa->has_solid_color = FALSE;
|
exa->has_solid_color = FALSE;
|
||||||
|
|
||||||
if (pSrcPicture) {
|
if (pSrcPicture) {
|
||||||
|
if (pSrcPicture->repeatType == RepeatNone && pSrcPicture->transform)
|
||||||
|
fs_traits |= FS_SRC_REPEAT_NONE;
|
||||||
|
|
||||||
if (pSrcPicture->pSourcePict) {
|
if (pSrcPicture->pSourcePict) {
|
||||||
if (pSrcPicture->pSourcePict->type == SourcePictTypeSolidFill) {
|
if (pSrcPicture->pSourcePict->type == SourcePictTypeSolidFill) {
|
||||||
fs_traits |= FS_SOLID_FILL;
|
fs_traits |= FS_SOLID_FILL;
|
||||||
|
|
@ -263,6 +262,8 @@ bind_shaders(struct exa_context *exa, int op,
|
||||||
if (pMaskPicture) {
|
if (pMaskPicture) {
|
||||||
vs_traits |= VS_MASK;
|
vs_traits |= VS_MASK;
|
||||||
fs_traits |= FS_MASK;
|
fs_traits |= FS_MASK;
|
||||||
|
if (pMaskPicture->repeatType == RepeatNone && pMaskPicture->transform)
|
||||||
|
fs_traits |= FS_MASK_REPEAT_NONE;
|
||||||
if (pMaskPicture->componentAlpha) {
|
if (pMaskPicture->componentAlpha) {
|
||||||
struct xorg_composite_blend blend;
|
struct xorg_composite_blend blend;
|
||||||
blend_for_op(&blend, op,
|
blend_for_op(&blend, op,
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@
|
||||||
/*
|
/*
|
||||||
* Helper functions
|
* Helper functions
|
||||||
*/
|
*/
|
||||||
#if DEBUG_PRINT
|
|
||||||
struct render_format_str {
|
struct render_format_str {
|
||||||
int format;
|
int format;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
@ -109,7 +108,6 @@ static const char *render_format_name(int format)
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp, int *picture_format)
|
exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp, int *picture_format)
|
||||||
|
|
|
||||||
|
|
@ -233,10 +233,10 @@ create_vs(struct pipe_context *pipe,
|
||||||
struct ureg_src src;
|
struct ureg_src src;
|
||||||
struct ureg_dst dst;
|
struct ureg_dst dst;
|
||||||
struct ureg_src const0, const1;
|
struct ureg_src const0, const1;
|
||||||
boolean is_fill = vs_traits & VS_FILL;
|
boolean is_fill = (vs_traits & VS_FILL) != 0;
|
||||||
boolean is_composite = vs_traits & VS_COMPOSITE;
|
boolean is_composite = (vs_traits & VS_COMPOSITE) != 0;
|
||||||
boolean has_mask = vs_traits & VS_MASK;
|
boolean has_mask = (vs_traits & VS_MASK) != 0;
|
||||||
boolean is_yuv = vs_traits & VS_YUV;
|
boolean is_yuv = (vs_traits & VS_YUV) != 0;
|
||||||
unsigned input_slot = 0;
|
unsigned input_slot = 0;
|
||||||
|
|
||||||
ureg = ureg_create(TGSI_PROCESSOR_VERTEX);
|
ureg = ureg_create(TGSI_PROCESSOR_VERTEX);
|
||||||
|
|
@ -353,6 +353,47 @@ create_yuv_shader(struct pipe_context *pipe, struct ureg_program *ureg)
|
||||||
return ureg_create_shader_and_destroy(ureg, pipe);
|
return ureg_create_shader_and_destroy(ureg, pipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static INLINE void
|
||||||
|
xrender_tex(struct ureg_program *ureg,
|
||||||
|
struct ureg_dst dst,
|
||||||
|
struct ureg_src coords,
|
||||||
|
struct ureg_src sampler,
|
||||||
|
boolean repeat_none)
|
||||||
|
{
|
||||||
|
if (repeat_none) {
|
||||||
|
struct ureg_dst tmp0 = ureg_DECL_temporary(ureg);
|
||||||
|
struct ureg_dst tmp1 = ureg_DECL_temporary(ureg);
|
||||||
|
struct ureg_src const0 = ureg_DECL_constant(ureg, 0);
|
||||||
|
unsigned label;
|
||||||
|
ureg_SLT(ureg, tmp1, ureg_swizzle(coords,
|
||||||
|
TGSI_SWIZZLE_X,
|
||||||
|
TGSI_SWIZZLE_Y,
|
||||||
|
TGSI_SWIZZLE_X,
|
||||||
|
TGSI_SWIZZLE_Y),
|
||||||
|
ureg_scalar(const0, TGSI_SWIZZLE_X));
|
||||||
|
ureg_SGT(ureg, tmp0, ureg_swizzle(coords,
|
||||||
|
TGSI_SWIZZLE_X,
|
||||||
|
TGSI_SWIZZLE_Y,
|
||||||
|
TGSI_SWIZZLE_X,
|
||||||
|
TGSI_SWIZZLE_Y),
|
||||||
|
ureg_scalar(const0, TGSI_SWIZZLE_W));
|
||||||
|
ureg_MAX(ureg, tmp0, ureg_src(tmp0), ureg_src(tmp1));
|
||||||
|
ureg_MAX(ureg, tmp0, ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_X),
|
||||||
|
ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_Y));
|
||||||
|
label = ureg_get_instruction_number(ureg) + 2;
|
||||||
|
ureg_IF(ureg, ureg_src(tmp0), &label);
|
||||||
|
ureg_MOV(ureg, dst, ureg_scalar(const0, TGSI_SWIZZLE_X));
|
||||||
|
label += 2;
|
||||||
|
ureg_ELSE(ureg, &label);
|
||||||
|
ureg_TEX(ureg, dst, TGSI_TEXTURE_2D, coords, sampler);
|
||||||
|
ureg_ENDIF(ureg);
|
||||||
|
ureg_release_temporary(ureg, tmp0);
|
||||||
|
ureg_release_temporary(ureg, tmp1);
|
||||||
|
} else
|
||||||
|
ureg_TEX(ureg, dst, TGSI_TEXTURE_2D, coords, sampler);
|
||||||
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
create_fs(struct pipe_context *pipe,
|
create_fs(struct pipe_context *pipe,
|
||||||
unsigned fs_traits)
|
unsigned fs_traits)
|
||||||
|
|
@ -362,14 +403,16 @@ create_fs(struct pipe_context *pipe,
|
||||||
struct ureg_src /*dst_pos,*/ src_input, mask_pos;
|
struct ureg_src /*dst_pos,*/ src_input, mask_pos;
|
||||||
struct ureg_dst src, mask;
|
struct ureg_dst src, mask;
|
||||||
struct ureg_dst out;
|
struct ureg_dst out;
|
||||||
boolean has_mask = fs_traits & FS_MASK;
|
unsigned has_mask = (fs_traits & FS_MASK) != 0;
|
||||||
boolean is_fill = fs_traits & FS_FILL;
|
unsigned is_fill = (fs_traits & FS_FILL) != 0;
|
||||||
boolean is_composite = fs_traits & FS_COMPOSITE;
|
unsigned is_composite = (fs_traits & FS_COMPOSITE) != 0;
|
||||||
boolean is_solid = fs_traits & FS_SOLID_FILL;
|
unsigned is_solid = (fs_traits & FS_SOLID_FILL) != 0;
|
||||||
boolean is_lingrad = fs_traits & FS_LINGRAD_FILL;
|
unsigned is_lingrad = (fs_traits & FS_LINGRAD_FILL) != 0;
|
||||||
boolean is_radgrad = fs_traits & FS_RADGRAD_FILL;
|
unsigned is_radgrad = (fs_traits & FS_RADGRAD_FILL) != 0;
|
||||||
unsigned comp_alpha = fs_traits & FS_COMPONENT_ALPHA;
|
unsigned comp_alpha = (fs_traits & FS_COMPONENT_ALPHA) != 0;
|
||||||
boolean is_yuv = fs_traits & FS_YUV;
|
unsigned is_yuv = (fs_traits & FS_YUV) != 0;
|
||||||
|
unsigned src_repeat_none = (fs_traits & FS_SRC_REPEAT_NONE) != 0;
|
||||||
|
unsigned mask_repeat_none = (fs_traits & FS_MASK_REPEAT_NONE) != 0;
|
||||||
|
|
||||||
ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT);
|
ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT);
|
||||||
if (ureg == NULL)
|
if (ureg == NULL)
|
||||||
|
|
@ -425,8 +468,8 @@ create_fs(struct pipe_context *pipe,
|
||||||
src = ureg_DECL_temporary(ureg);
|
src = ureg_DECL_temporary(ureg);
|
||||||
else
|
else
|
||||||
src = out;
|
src = out;
|
||||||
ureg_TEX(ureg, src,
|
xrender_tex(ureg, src, src_input, src_sampler,
|
||||||
TGSI_TEXTURE_2D, src_input, src_sampler);
|
src_repeat_none);
|
||||||
} else if (is_fill) {
|
} else if (is_fill) {
|
||||||
if (is_solid) {
|
if (is_solid) {
|
||||||
if (has_mask)
|
if (has_mask)
|
||||||
|
|
@ -465,8 +508,8 @@ create_fs(struct pipe_context *pipe,
|
||||||
|
|
||||||
if (has_mask) {
|
if (has_mask) {
|
||||||
mask = ureg_DECL_temporary(ureg);
|
mask = ureg_DECL_temporary(ureg);
|
||||||
ureg_TEX(ureg, mask,
|
xrender_tex(ureg, mask, mask_pos, mask_sampler,
|
||||||
TGSI_TEXTURE_2D, mask_pos, mask_sampler);
|
mask_repeat_none);
|
||||||
/* src IN mask */
|
/* src IN mask */
|
||||||
src_in_mask(ureg, out, ureg_src(src), ureg_src(mask), comp_alpha);
|
src_in_mask(ureg, out, ureg_src(src), ureg_src(mask), comp_alpha);
|
||||||
ureg_release_temporary(ureg, mask);
|
ureg_release_temporary(ureg, mask);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,9 @@ enum xorg_fs_traits {
|
||||||
FS_RADGRAD_FILL = 1 << 4,
|
FS_RADGRAD_FILL = 1 << 4,
|
||||||
FS_CA_FULL = 1 << 5, /* src.rgba * mask.rgba */
|
FS_CA_FULL = 1 << 5, /* src.rgba * mask.rgba */
|
||||||
FS_CA_SRCALPHA = 1 << 6, /* src.aaaa * mask.rgba */
|
FS_CA_SRCALPHA = 1 << 6, /* src.aaaa * mask.rgba */
|
||||||
FS_YUV = 1<< 7,
|
FS_YUV = 1 << 7,
|
||||||
|
FS_SRC_REPEAT_NONE = 1 << 8,
|
||||||
|
FS_MASK_REPEAT_NONE = 1 << 9,
|
||||||
|
|
||||||
FS_FILL = (FS_SOLID_FILL |
|
FS_FILL = (FS_SOLID_FILL |
|
||||||
FS_LINGRAD_FILL |
|
FS_LINGRAD_FILL |
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue