diff options
Diffstat (limited to 'src/gallium/state_trackers/vega/shaders_cache.h')
-rw-r--r-- | src/gallium/state_trackers/vega/shaders_cache.h | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/src/gallium/state_trackers/vega/shaders_cache.h b/src/gallium/state_trackers/vega/shaders_cache.h index feca58b61a9..2d0c2da30ec 100644 --- a/src/gallium/state_trackers/vega/shaders_cache.h +++ b/src/gallium/state_trackers/vega/shaders_cache.h @@ -33,26 +33,51 @@ struct pipe_context; struct tgsi_token; struct shaders_cache; +#define _SHADERS_PAINT_BITS 3 +#define _SHADERS_IMAGE_BITS 2 +#define _SHADERS_MASK_BITS 1 +#define _SHADERS_BLEND_BITS 3 +#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_MASK_SHIFT (SHADERS_IMAGE_SHIFT + _SHADERS_IMAGE_BITS) +#define SHADERS_BLEND_SHIFT (SHADERS_MASK_SHIFT + _SHADERS_MASK_BITS) +#define SHADERS_PREMULTIPLY_SHIFT (SHADERS_BLEND_SHIFT + _SHADERS_BLEND_BITS) +#define SHADERS_BW_SHIFT (SHADERS_PREMULTIPLY_SHIFT + _SHADERS_PREMULTIPLY_BITS) + +#define _SHADERS_GET_STAGE(stage, id) \ + ((id) & (((1 << _SHADERS_ ## stage ## _BITS) - 1) << SHADERS_ ## stage ## _SHIFT)) + +#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_MASK_SHADER(id) _SHADERS_GET_STAGE(MASK, id) +#define SHADERS_GET_BLEND_SHADER(id) _SHADERS_GET_STAGE(BLEND, id) +#define SHADERS_GET_PREMULTIPLY_SHADER(id) _SHADERS_GET_STAGE(PREMULTIPLY, id) +#define SHADERS_GET_BW_SHADER(id) _SHADERS_GET_STAGE(BW, id) + enum VegaShaderType { - VEGA_SOLID_FILL_SHADER = 1 << 0, - VEGA_LINEAR_GRADIENT_SHADER = 1 << 1, - VEGA_RADIAL_GRADIENT_SHADER = 1 << 2, - VEGA_PATTERN_SHADER = 1 << 3, - VEGA_IMAGE_NORMAL_SHADER = 1 << 4, - VEGA_IMAGE_MULTIPLY_SHADER = 1 << 5, - VEGA_IMAGE_STENCIL_SHADER = 1 << 6, + VEGA_SOLID_FILL_SHADER = 1 << SHADERS_PAINT_SHIFT, + VEGA_LINEAR_GRADIENT_SHADER = 2 << SHADERS_PAINT_SHIFT, + VEGA_RADIAL_GRADIENT_SHADER = 3 << SHADERS_PAINT_SHIFT, + VEGA_PATTERN_SHADER = 4 << SHADERS_PAINT_SHIFT, + + VEGA_IMAGE_NORMAL_SHADER = 1 << SHADERS_IMAGE_SHIFT, + VEGA_IMAGE_MULTIPLY_SHADER = 2 << SHADERS_IMAGE_SHIFT, + VEGA_IMAGE_STENCIL_SHADER = 3 << SHADERS_IMAGE_SHIFT, - VEGA_MASK_SHADER = 1 << 7, + VEGA_MASK_SHADER = 1 << SHADERS_MASK_SHIFT, - VEGA_BLEND_MULTIPLY_SHADER = 1 << 8, - VEGA_BLEND_SCREEN_SHADER = 1 << 9, - VEGA_BLEND_DARKEN_SHADER = 1 << 10, - VEGA_BLEND_LIGHTEN_SHADER = 1 << 11, + 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_PREMULTIPLY_SHADER = 1 << 12, - VEGA_UNPREMULTIPLY_SHADER = 1 << 13, + VEGA_PREMULTIPLY_SHADER = 1 << SHADERS_PREMULTIPLY_SHIFT, + VEGA_UNPREMULTIPLY_SHADER = 2 << SHADERS_PREMULTIPLY_SHIFT, - VEGA_BW_SHADER = 1 << 14 + VEGA_BW_SHADER = 1 << SHADERS_BW_SHIFT }; struct vg_shader { |