On Sun, Apr 26, 2015 at 5:14 AM, Axel Davy <axel.d...@ens.fr> wrote: > On 24/04/2015 23:40, Ilia Mirkin wrote : >> >> On Fri, Apr 24, 2015 at 4:09 PM, Axel Davy <axel.d...@ens.fr> wrote: >>> >>> From: Xavier Bouchoux <xavi...@gmail.com> >>> >>> Was sometimes too large for PS. >>> >>> Reviewed-by: Axel Davy <axel.d...@ens.fr> >>> Signed-off-by: Xavier Bouchoux <xavi...@gmail.com> >>> --- >>> src/gallium/state_trackers/nine/nine_shader.c | 8 +++++--- >>> 1 file changed, 5 insertions(+), 3 deletions(-) >>> >>> diff --git a/src/gallium/state_trackers/nine/nine_shader.c >>> b/src/gallium/state_trackers/nine/nine_shader.c >>> index 1f1f7c8..7beb1ab 100644 >>> --- a/src/gallium/state_trackers/nine/nine_shader.c >>> +++ b/src/gallium/state_trackers/nine/nine_shader.c >>> @@ -3082,6 +3082,7 @@ nine_translate_shader(struct NineDevice9 *device, >>> struct nine_shader_info *info) >>> HRESULT hr = D3D_OK; >>> const unsigned processor = tgsi_processor_from_type(info->type); >>> unsigned s, slot_max; >>> + unsigned max_const_f; >>> >>> user_assert(processor != ~0, D3DERR_INVALIDCALL); >>> >>> @@ -3221,11 +3222,12 @@ nine_translate_shader(struct NineDevice9 *device, >>> struct nine_shader_info *info) >>> if (tx->indirect_const_access) /* vs only */ >>> info->const_float_slots = device->max_vs_const_f; >>> >>> + max_const_f = IS_VS ? device->max_vs_const_f : >>> device->max_ps_const_f; >>> slot_max = info->const_bool_slots > 0 ? >>> - device->max_vs_const_f + NINE_MAX_CONST_I >>> - + info->const_bool_slots : >>> + max_const_f + NINE_MAX_CONST_I >>> + + (info->const_bool_slots+3)/4 : >> >> aka DIV_ROUND_UP(info->const_bool_slots, 4) ? >> >> With that fixed up, >> >> Reviewed-by: Ilia Mirkin <imir...@alum.mit.edu> >> > DIV_ROUND_UP seems to be defined in src/mesa/main/macros.h, thus we don't > have access to it > in gallium nine. What is the problem with (x+3)/4 ?
The problem is that you have 50 implementations of the same thing, and you have to ask yourself, "what is this doing". We already have src/gallium/drivers/svga/include/svga3d_surfacedefs.h:#define DIV_ROUND_UP(x, y) (((x) + (y) - 1) / (y)) src/mesa/main/macros.h:#define DIV_ROUND_UP( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 ) I think the one in macros.h also works for negative numbers? Not sure... seems odd. I'd recommend unifying into src/util/macros.h and removing both of the above. -ilia _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev