info->position_t = FALSE;
info->point_size = FALSE;
- tx->info->const_used_size = 0;
+ tx->info->const_float_slots = 0;
+ tx->info->const_int_slots = 0;
+ tx->info->const_bool_slots = 0;
info->sampler_mask = 0x0;
info->rt_mask = 0x0;
struct shader_translator *tx;
HRESULT hr = D3D_OK;
const unsigned processor = tgsi_processor_from_type(info->type);
+ unsigned slot_max;
user_assert(processor != ~0, D3DERR_INVALIDCALL);
hr = D3D_OK;
}
- if (tx->indirect_const_access)
- info->const_used_size = ~0;
+ if (tx->indirect_const_access) /* vs only */
+ info->const_float_slots = device->max_vs_const_f;
+
+ slot_max = info->const_bool_slots > 0 ?
+ device->max_vs_const_f + NINE_MAX_CONST_I
+ + info->const_bool_slots :
+ info->const_int_slots > 0 ?
+ device->max_vs_const_f + info->const_int_slots :
+ info->const_float_slots;
+ info->const_used_size = sizeof(float[4]) * slot_max; /* slots start from 1 */
info->cso = ureg_create_shader_and_destroy(tx->ureg, device->pipe);
if (!info->cso) {
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
((nconstf) * 4 * sizeof(float) + \
NINE_MAX_CONST_I * 4 * sizeof(int))
-#define NINE_CONSTBUF_SIZE(nconstf) \
- ((nconstf) * 4 * sizeof(float) + \
- NINE_MAX_CONST_I * 4 * sizeof(int) + \
- NINE_MAX_CONST_B * 1 * sizeof(float))
-
#define NINE_MAX_LIGHTS 65536
#define NINE_MAX_LIGHTS_ACTIVE 8
This->rt_mask = info.rt_mask;
This->const_used_size = info.const_used_size;
/* no constant relative addressing for ps */
- assert(info.const_used_size != ~0);
assert(info.lconstf.data == NULL);
assert(info.lconstf.ranges == NULL);
This->variant.cso = info.cso;
This->const_used_size = info.const_used_size;
- if (info.const_used_size == ~0)
- This->const_used_size = NINE_CONSTBUF_SIZE(device->max_vs_const_f);
This->lconstf = info.lconstf;
This->sampler_mask = info.sampler_mask;
This->position_t = info.position_t;