X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fstate_trackers%2Fnine%2Fnine_shader.h;h=41577ac572b2a747ca7fbf01f2850070b0aa2e4f;hb=3cc205bbeb19d417b17be0f6200cb5cda9adca8a;hp=ddee3724079a9eb093230dde11dcd444f0811b57;hpb=712a4c5438d0ce257344b5196c20ad7929b54a0e;p=mesa.git diff --git a/src/gallium/state_trackers/nine/nine_shader.h b/src/gallium/state_trackers/nine/nine_shader.h index ddee3724079..41577ac572b 100644 --- a/src/gallium/state_trackers/nine/nine_shader.h +++ b/src/gallium/state_trackers/nine/nine_shader.h @@ -59,36 +59,39 @@ struct nine_shader_info uint16_t sampler_mask_shadow; /* in, which samplers use depth compare */ uint8_t rt_mask; /* out, which render targets are being written */ + uint8_t fog_enable; + uint8_t fog_mode; + uint16_t projected; /* ps 1.1 to 1.3 */ + unsigned const_i_base; /* in vec4 (16 byte) units */ unsigned const_b_base; /* in vec4 (16 byte) units */ unsigned const_used_size; + unsigned const_float_slots; + unsigned const_int_slots; + unsigned const_bool_slots; + struct nine_lconstf lconstf; /* out, NOTE: members to be free'd by user */ + uint8_t bumpenvmat_needed; }; -static INLINE void +static inline void nine_info_mark_const_f_used(struct nine_shader_info *info, int idx) { - unsigned size = (idx + 1) * 16; - - if (info->const_used_size < size) - info->const_used_size = size; + if (info->const_float_slots < (idx + 1)) + info->const_float_slots = idx + 1; } -static INLINE void +static inline void nine_info_mark_const_i_used(struct nine_shader_info *info, int idx) { - unsigned size = (info->const_i_base + (idx + 1)) * 16; - - if (info->const_used_size < size) - info->const_used_size = size; + if (info->const_int_slots < (idx + 1)) + info->const_int_slots = idx + 1; } -static INLINE void +static inline void nine_info_mark_const_b_used(struct nine_shader_info *info, int idx) { - unsigned size = (info->const_b_base + ((idx + 4) / 4)) * 16; - - if (info->const_used_size < size) - info->const_used_size = size; + if (info->const_bool_slots < (idx + 1)) + info->const_bool_slots = idx + 1; } HRESULT @@ -102,7 +105,7 @@ struct nine_shader_variant uint32_t key; }; -static INLINE void * +static inline void * nine_shader_variant_get(struct nine_shader_variant *list, uint32_t key) { while (list->key != key && list->next) @@ -112,7 +115,7 @@ nine_shader_variant_get(struct nine_shader_variant *list, uint32_t key) return NULL; } -static INLINE boolean +static inline boolean nine_shader_variant_add(struct nine_shader_variant *list, uint32_t key, void *cso) { @@ -129,7 +132,7 @@ nine_shader_variant_add(struct nine_shader_variant *list, return TRUE; } -static INLINE void +static inline void nine_shader_variants_free(struct nine_shader_variant *list) { while (list->next) { @@ -139,4 +142,48 @@ nine_shader_variants_free(struct nine_shader_variant *list) } } +struct nine_shader_variant64 +{ + struct nine_shader_variant64 *next; + void *cso; + uint64_t key; +}; + +static inline void * +nine_shader_variant_get64(struct nine_shader_variant64 *list, uint64_t key) +{ + while (list->key != key && list->next) + list = list->next; + if (list->key == key) + return list->cso; + return NULL; +} + +static inline boolean +nine_shader_variant_add64(struct nine_shader_variant64 *list, + uint64_t key, void *cso) +{ + while (list->next) { + assert(list->key != key); + list = list->next; + } + list->next = MALLOC_STRUCT(nine_shader_variant64); + if (!list->next) + return FALSE; + list->next->next = NULL; + list->next->key = key; + list->next->cso = cso; + return TRUE; +} + +static inline void +nine_shader_variants_free64(struct nine_shader_variant64 *list) +{ + while (list->next) { + struct nine_shader_variant64 *ptr = list->next; + list->next = ptr->next; + FREE(ptr); + } +} + #endif /* _NINE_SHADER_H_ */