summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/nine_shader.h
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2015-01-07 11:07:23 +0100
committerAxel Davy <[email protected]>2015-02-06 00:07:18 +0100
commita249c7a161cdbb995b17195f1af88ed14f69f8b6 (patch)
treeab7af507defc4faf5bbc588f2534b9f2d091b118 /src/gallium/state_trackers/nine/nine_shader.h
parent65ca8e4b3d6903ef086b81a5bf94688898290c4f (diff)
st/nine: Refactor how user constbufs sizes are calculated
Count explicitly the slots for float, int and bool constants, and deduce the constbuf size in nine_shader. Reviewed-by: Tiziano Bacocco <[email protected]> Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/nine_shader.h')
-rw-r--r--src/gallium/state_trackers/nine/nine_shader.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/gallium/state_trackers/nine/nine_shader.h b/src/gallium/state_trackers/nine/nine_shader.h
index ddee3724079..56c5d99b4d2 100644
--- a/src/gallium/state_trackers/nine/nine_shader.h
+++ b/src/gallium/state_trackers/nine/nine_shader.h
@@ -63,32 +63,30 @@ struct nine_shader_info
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 */
};
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
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
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