ureg_TEX(ureg, *out, TGSI_TEXTURE_1D, ureg_src(temp[1]), sampler[0]);
}
-static INLINE void
-color_transform( struct ureg_program *ureg,
- struct ureg_dst *out,
- struct ureg_src *in,
- struct ureg_src *sampler,
- struct ureg_dst *temp,
- struct ureg_src *constant)
-{
- ureg_MAD(ureg, temp[1], ureg_src(temp[0]), constant[0], constant[1]);
- /* clamp to [0.0f, 1.0f] */
- ureg_CLAMP(ureg, temp[1],
- ureg_src(temp[1]),
- ureg_scalar(constant[3], TGSI_SWIZZLE_X),
- ureg_scalar(constant[3], TGSI_SWIZZLE_Y));
- ureg_MOV(ureg, *out, ureg_src(temp[1]));
-}
-
-static INLINE void
-mask( struct ureg_program *ureg,
- struct ureg_dst *out,
- struct ureg_src *in,
- struct ureg_src *sampler,
- struct ureg_dst *temp,
- struct ureg_src *constant)
-{
- ureg_TEX(ureg, temp[1], TGSI_TEXTURE_2D, in[0], sampler[1]);
- ureg_MUL(ureg, ureg_writemask(temp[0], TGSI_WRITEMASK_W),
- ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W),
- ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));
- ureg_MOV(ureg, *out, ureg_src(temp[0]));
-}
-
static INLINE void
image_normal( struct ureg_program *ureg,
struct ureg_dst *out,
ureg_MUL(ureg, *out, ureg_src(temp[0]), ureg_src(temp[1]));
}
+static INLINE void
+color_transform( struct ureg_program *ureg,
+ struct ureg_dst *out,
+ struct ureg_src *in,
+ struct ureg_src *sampler,
+ struct ureg_dst *temp,
+ struct ureg_src *constant)
+{
+ ureg_MAD(ureg, temp[1], ureg_src(temp[0]), constant[0], constant[1]);
+ /* clamp to [0.0f, 1.0f] */
+ ureg_CLAMP(ureg, temp[1],
+ ureg_src(temp[1]),
+ ureg_scalar(constant[3], TGSI_SWIZZLE_X),
+ ureg_scalar(constant[3], TGSI_SWIZZLE_Y));
+ ureg_MOV(ureg, *out, ureg_src(temp[1]));
+}
+
/**
* Emit instructions for the specified blend mode. Colors should be
* premultiplied. Two temporary registers are required.
temp + 2);
}
+static INLINE void
+mask( struct ureg_program *ureg,
+ struct ureg_dst *out,
+ struct ureg_src *in,
+ struct ureg_src *sampler,
+ struct ureg_dst *temp,
+ struct ureg_src *constant)
+{
+ ureg_TEX(ureg, temp[1], TGSI_TEXTURE_2D, in[0], sampler[1]);
+ ureg_MUL(ureg, ureg_writemask(temp[0], TGSI_WRITEMASK_W),
+ ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W),
+ ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));
+ ureg_MOV(ureg, *out, ureg_src(temp[0]));
+}
+
static INLINE void
premultiply( struct ureg_program *ureg,
struct ureg_dst *out,
VG_FALSE, 0, 4, 0, 0, 0, 2}
};
-static const struct shader_asm_info shaders_mask_asm[] = {
- {VEGA_MASK_SHADER, mask,
- VG_TRUE, 0, 0, 1, 1, 0, 2}
-};
-
/* extra blend modes */
static const struct shader_asm_info shaders_blend_asm[] = {
{VEGA_BLEND_MULTIPLY_SHADER, blend_multiply,
VG_TRUE, 3, 1, 2, 1, 0, 4},
};
+static const struct shader_asm_info shaders_mask_asm[] = {
+ {VEGA_MASK_SHADER, mask,
+ VG_TRUE, 0, 0, 1, 1, 0, 2}
+};
+
/* premultiply */
static const struct shader_asm_info shaders_premultiply_asm[] = {
{VEGA_PREMULTIPLY_SHADER, premultiply,
* 1) Paint generation (color/gradient/pattern)
* 2) Image composition (normal/multiply/stencil)
* 3) Color transform
- * 4) Mask
- * 5) Extended blend (multiply/screen/darken/lighten)
+ * 4) Extended blend (multiply/screen/darken/lighten)
+ * 5) Mask
* 6) Premultiply/Unpremultiply
* 7) Color transform (to black and white)
*/
}
/* fourth stage */
- sh = SHADERS_GET_MASK_SHADER(id);
+ sh = SHADERS_GET_BLEND_SHADER(id);
switch (sh) {
- case VEGA_MASK_SHADER:
- shaders[idx] = &shaders_mask_asm[(sh >> SHADERS_MASK_SHIFT) - 1];
+ case VEGA_BLEND_MULTIPLY_SHADER:
+ case VEGA_BLEND_SCREEN_SHADER:
+ case VEGA_BLEND_DARKEN_SHADER:
+ case VEGA_BLEND_LIGHTEN_SHADER:
+ shaders[idx] = &shaders_blend_asm[(sh >> SHADERS_BLEND_SHIFT) - 1];
assert(shaders[idx]->id == sh);
idx++;
break;
}
/* fifth stage */
- sh = SHADERS_GET_BLEND_SHADER(id);
+ sh = SHADERS_GET_MASK_SHADER(id);
switch (sh) {
- case VEGA_BLEND_MULTIPLY_SHADER:
- case VEGA_BLEND_SCREEN_SHADER:
- case VEGA_BLEND_DARKEN_SHADER:
- case VEGA_BLEND_LIGHTEN_SHADER:
- shaders[idx] = &shaders_blend_asm[(sh >> SHADERS_BLEND_SHIFT) - 1];
+ case VEGA_MASK_SHADER:
+ shaders[idx] = &shaders_mask_asm[(sh >> SHADERS_MASK_SHIFT) - 1];
assert(shaders[idx]->id == sh);
idx++;
break;
#define _SHADERS_PAINT_BITS 3
#define _SHADERS_IMAGE_BITS 2
#define _SHADERS_COLOR_TRANSFORM_BITS 1
-#define _SHADERS_MASK_BITS 1
#define _SHADERS_BLEND_BITS 3
+#define _SHADERS_MASK_BITS 1
#define _SHADERS_PREMULTIPLY_BITS 2
#define _SHADERS_BW_BITS 1
#define SHADERS_PAINT_SHIFT (0)
#define SHADERS_IMAGE_SHIFT (SHADERS_PAINT_SHIFT + _SHADERS_PAINT_BITS)
#define SHADERS_COLOR_TRANSFORM_SHIFT (SHADERS_IMAGE_SHIFT + _SHADERS_IMAGE_BITS)
-#define SHADERS_MASK_SHIFT (SHADERS_COLOR_TRANSFORM_SHIFT + _SHADERS_COLOR_TRANSFORM_BITS)
-#define SHADERS_BLEND_SHIFT (SHADERS_MASK_SHIFT + _SHADERS_MASK_BITS)
-#define SHADERS_PREMULTIPLY_SHIFT (SHADERS_BLEND_SHIFT + _SHADERS_BLEND_BITS)
+#define SHADERS_BLEND_SHIFT (SHADERS_COLOR_TRANSFORM_SHIFT + _SHADERS_COLOR_TRANSFORM_BITS)
+#define SHADERS_MASK_SHIFT (SHADERS_BLEND_SHIFT + _SHADERS_BLEND_BITS)
+#define SHADERS_PREMULTIPLY_SHIFT (SHADERS_MASK_SHIFT + _SHADERS_MASK_BITS)
#define SHADERS_BW_SHIFT (SHADERS_PREMULTIPLY_SHIFT + _SHADERS_PREMULTIPLY_BITS)
#define _SHADERS_GET_STAGE(stage, id) \
#define SHADERS_GET_PAINT_SHADER(id) _SHADERS_GET_STAGE(PAINT, id)
#define SHADERS_GET_IMAGE_SHADER(id) _SHADERS_GET_STAGE(IMAGE, id)
#define SHADERS_GET_COLOR_TRANSFORM_SHADER(id) _SHADERS_GET_STAGE(COLOR_TRANSFORM, id)
-#define SHADERS_GET_MASK_SHADER(id) _SHADERS_GET_STAGE(MASK, id)
#define SHADERS_GET_BLEND_SHADER(id) _SHADERS_GET_STAGE(BLEND, id)
+#define SHADERS_GET_MASK_SHADER(id) _SHADERS_GET_STAGE(MASK, id)
#define SHADERS_GET_PREMULTIPLY_SHADER(id) _SHADERS_GET_STAGE(PREMULTIPLY, id)
#define SHADERS_GET_BW_SHADER(id) _SHADERS_GET_STAGE(BW, id)
VEGA_COLOR_TRANSFORM_SHADER = 1 << SHADERS_COLOR_TRANSFORM_SHIFT,
- VEGA_MASK_SHADER = 1 << SHADERS_MASK_SHIFT,
-
VEGA_BLEND_MULTIPLY_SHADER = 1 << SHADERS_BLEND_SHIFT,
VEGA_BLEND_SCREEN_SHADER = 2 << SHADERS_BLEND_SHIFT,
VEGA_BLEND_DARKEN_SHADER = 3 << SHADERS_BLEND_SHIFT,
VEGA_BLEND_LIGHTEN_SHADER = 4 << SHADERS_BLEND_SHIFT,
+ VEGA_MASK_SHADER = 1 << SHADERS_MASK_SHIFT,
+
VEGA_PREMULTIPLY_SHADER = 1 << SHADERS_PREMULTIPLY_SHIFT,
VEGA_UNPREMULTIPLY_SHADER = 2 << SHADERS_PREMULTIPLY_SHIFT,