From 3c5d309477c2667ad3cbc370ad0566480f39b95d Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 5 Apr 2017 19:43:31 -0400 Subject: freedreno: extract helper for stage->sb for a4xx+ Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/freedreno_util.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/gallium/drivers/freedreno/freedreno_util.h') diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h index a9b38c93759..e6444337900 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.h +++ b/src/gallium/drivers/freedreno/freedreno_util.h @@ -449,4 +449,27 @@ pack_rgba(enum pipe_format format, const float *rgba) #define foreach_bit(b, mask) \ for (uint32_t _m = (mask); _m && ({(b) = u_bit_scan(&_m); 1;});) + +#define BIT(bit) (1u << bit) + +/* + * a4xx+ helpers: + */ + +static inline enum a4xx_state_block +fd4_stage2shadersb(enum shader_t type) +{ + switch (type) { + case SHADER_VERTEX: + return SB4_VS_SHADER; + case SHADER_FRAGMENT: + return SB4_FS_SHADER; + case SHADER_COMPUTE: + return SB4_CS_SHADER; + default: + unreachable("bad shader type"); + return ~0; + } +} + #endif /* FREEDRENO_UTIL_H_ */ -- cgit v1.2.3