frontend/nine: Drop max_ps_const_f
Replace max_ps_const_f with a constant. In practice it already was always the same value no matter the hw. Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Signed-off-by: Axel Davy <davyaxel0@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>
This commit is contained in:
@@ -440,25 +440,23 @@ NineDevice9_ctor( struct NineDevice9 *This,
|
|||||||
|
|
||||||
/* Create constant buffers. */
|
/* Create constant buffers. */
|
||||||
{
|
{
|
||||||
unsigned max_const_vs, max_const_ps;
|
unsigned max_const_vs;
|
||||||
|
|
||||||
/* vs 3.0: >= 256 float constants, but for cards with exactly 256 slots,
|
/* vs 3.0: >= 256 float constants, but for cards with exactly 256 slots,
|
||||||
* we have to take in some more slots for int and bool*/
|
* we have to take in some more slots for int and bool*/
|
||||||
max_const_vs = _min(pScreen->get_shader_param(pScreen, PIPE_SHADER_VERTEX,
|
max_const_vs = _min(pScreen->get_shader_param(pScreen, PIPE_SHADER_VERTEX,
|
||||||
PIPE_SHADER_CAP_MAX_CONST_BUFFER0_SIZE) /
|
PIPE_SHADER_CAP_MAX_CONST_BUFFER0_SIZE) /
|
||||||
sizeof(float[4]),
|
sizeof(float[4]),
|
||||||
NINE_MAX_CONST_ALL);
|
NINE_MAX_CONST_ALL_VS);
|
||||||
/* ps 3.0: 224 float constants. All cards supported support at least
|
/* ps 3.0: 224 float constants. All cards supported support at least
|
||||||
* 256 constants for ps */
|
* 256 constants for ps */
|
||||||
max_const_ps = NINE_MAX_CONST_F_PS3 + (NINE_MAX_CONST_I + NINE_MAX_CONST_B / 4);
|
assert(NINE_MAX_CONST_ALL_PS <= 256);
|
||||||
|
|
||||||
This->max_vs_const_f = max_const_vs -
|
This->max_vs_const_f = max_const_vs -
|
||||||
(NINE_MAX_CONST_I + NINE_MAX_CONST_B / 4);
|
(NINE_MAX_CONST_I + NINE_MAX_CONST_B / 4);
|
||||||
This->max_ps_const_f = max_const_ps -
|
|
||||||
(NINE_MAX_CONST_I + NINE_MAX_CONST_B / 4);
|
|
||||||
|
|
||||||
This->vs_const_size = max_const_vs * sizeof(float[4]);
|
This->vs_const_size = max_const_vs * sizeof(float[4]);
|
||||||
This->ps_const_size = max_const_ps * sizeof(float[4]);
|
This->ps_const_size = NINE_MAX_CONST_ALL_PS * sizeof(float[4]);
|
||||||
/* Include space for I,B constants for user constbuf. */
|
/* Include space for I,B constants for user constbuf. */
|
||||||
if (This->may_swvp) {
|
if (This->may_swvp) {
|
||||||
This->state.vs_const_f = CALLOC(NINE_MAX_CONST_F_SWVP * sizeof(float[4]),1);
|
This->state.vs_const_f = CALLOC(NINE_MAX_CONST_F_SWVP * sizeof(float[4]),1);
|
||||||
@@ -2516,7 +2514,7 @@ NineDevice9_CreateStateBlock( struct NineDevice9 *This,
|
|||||||
NINE_STATE_PS | NINE_STATE_PS_CONST | NINE_STATE_FF_PS_CONSTS;
|
NINE_STATE_PS | NINE_STATE_PS_CONST | NINE_STATE_FF_PS_CONSTS;
|
||||||
memcpy(dst->changed.rs,
|
memcpy(dst->changed.rs,
|
||||||
nine_render_states_pixel, sizeof(dst->changed.rs));
|
nine_render_states_pixel, sizeof(dst->changed.rs));
|
||||||
nine_ranges_insert(&dst->changed.ps_const_f, 0, This->max_ps_const_f,
|
nine_ranges_insert(&dst->changed.ps_const_f, 0, NINE_MAX_CONST_F_PS3,
|
||||||
&This->range_pool);
|
&This->range_pool);
|
||||||
dst->changed.ps_const_i = 0xffff;
|
dst->changed.ps_const_i = 0xffff;
|
||||||
dst->changed.ps_const_b = 0xffff;
|
dst->changed.ps_const_b = 0xffff;
|
||||||
|
@@ -95,7 +95,6 @@ struct NineDevice9
|
|||||||
uint16_t vs_const_size;
|
uint16_t vs_const_size;
|
||||||
uint16_t ps_const_size;
|
uint16_t ps_const_size;
|
||||||
uint16_t max_vs_const_f;
|
uint16_t max_vs_const_f;
|
||||||
uint16_t max_ps_const_f;
|
|
||||||
|
|
||||||
struct pipe_resource *dummy_texture;
|
struct pipe_resource *dummy_texture;
|
||||||
struct pipe_sampler_view *dummy_sampler_view;
|
struct pipe_sampler_view *dummy_sampler_view;
|
||||||
|
@@ -510,7 +510,7 @@ struct shader_translator
|
|||||||
struct sm1_local_const *lconstb;
|
struct sm1_local_const *lconstb;
|
||||||
unsigned num_lconstb;
|
unsigned num_lconstb;
|
||||||
|
|
||||||
boolean slots_used[NINE_MAX_CONST_ALL];
|
boolean slots_used[NINE_MAX_CONST_ALL_VS];
|
||||||
unsigned *slot_map;
|
unsigned *slot_map;
|
||||||
unsigned num_slots;
|
unsigned num_slots;
|
||||||
|
|
||||||
@@ -4018,14 +4018,14 @@ nine_translate_shader(struct NineDevice9 *device, struct nine_shader_info *info,
|
|||||||
|
|
||||||
num_ranges = 0;
|
num_ranges = 0;
|
||||||
prev = -2;
|
prev = -2;
|
||||||
for (i = 0; i < NINE_MAX_CONST_ALL; i++) {
|
for (i = 0; i < NINE_MAX_CONST_ALL_VS; i++) {
|
||||||
if (tx->slots_used[i]) {
|
if (tx->slots_used[i]) {
|
||||||
if (prev != i - 1)
|
if (prev != i - 1)
|
||||||
num_ranges++;
|
num_ranges++;
|
||||||
prev = i;
|
prev = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
slot_map = MALLOC(NINE_MAX_CONST_ALL * sizeof(unsigned));
|
slot_map = MALLOC(NINE_MAX_CONST_ALL_VS * sizeof(unsigned));
|
||||||
const_ranges = CALLOC(num_ranges + 1, 2 * sizeof(unsigned)); /* ranges stop when last is of size 0 */
|
const_ranges = CALLOC(num_ranges + 1, 2 * sizeof(unsigned)); /* ranges stop when last is of size 0 */
|
||||||
if (!slot_map || !const_ranges) {
|
if (!slot_map || !const_ranges) {
|
||||||
hr = E_OUTOFMEMORY;
|
hr = E_OUTOFMEMORY;
|
||||||
@@ -4034,7 +4034,7 @@ nine_translate_shader(struct NineDevice9 *device, struct nine_shader_info *info,
|
|||||||
c = 0;
|
c = 0;
|
||||||
j = -1;
|
j = -1;
|
||||||
prev = -2;
|
prev = -2;
|
||||||
for (i = 0; i < NINE_MAX_CONST_ALL; i++) {
|
for (i = 0; i < NINE_MAX_CONST_ALL_VS; i++) {
|
||||||
if (tx->slots_used[i]) {
|
if (tx->slots_used[i]) {
|
||||||
if (prev != i - 1)
|
if (prev != i - 1)
|
||||||
j++;
|
j++;
|
||||||
|
@@ -560,12 +560,12 @@ prepare_ps_constants_userbuf(struct NineDevice9 *device)
|
|||||||
cb.user_buffer = context->ps_const_f;
|
cb.user_buffer = context->ps_const_f;
|
||||||
|
|
||||||
if (context->changed.ps_const_i) {
|
if (context->changed.ps_const_i) {
|
||||||
int *idst = (int *)&context->ps_const_f[4 * device->max_ps_const_f];
|
int *idst = (int *)&context->ps_const_f[4 * NINE_MAX_CONST_F_PS3];
|
||||||
memcpy(idst, context->ps_const_i, sizeof(context->ps_const_i));
|
memcpy(idst, context->ps_const_i, sizeof(context->ps_const_i));
|
||||||
context->changed.ps_const_i = 0;
|
context->changed.ps_const_i = 0;
|
||||||
}
|
}
|
||||||
if (context->changed.ps_const_b) {
|
if (context->changed.ps_const_b) {
|
||||||
int *idst = (int *)&context->ps_const_f[4 * device->max_ps_const_f];
|
int *idst = (int *)&context->ps_const_f[4 * NINE_MAX_CONST_F_PS3];
|
||||||
uint32_t *bdst = (uint32_t *)&idst[4 * NINE_MAX_CONST_I];
|
uint32_t *bdst = (uint32_t *)&idst[4 * NINE_MAX_CONST_I];
|
||||||
memcpy(bdst, context->ps_const_b, sizeof(context->ps_const_b));
|
memcpy(bdst, context->ps_const_b, sizeof(context->ps_const_b));
|
||||||
context->changed.ps_const_b = 0;
|
context->changed.ps_const_b = 0;
|
||||||
|
@@ -111,7 +111,8 @@
|
|||||||
#define NINE_MAX_CONST_F_SWVP 8192
|
#define NINE_MAX_CONST_F_SWVP 8192
|
||||||
#define NINE_MAX_CONST_I_SWVP 2048
|
#define NINE_MAX_CONST_I_SWVP 2048
|
||||||
#define NINE_MAX_CONST_B_SWVP 2048
|
#define NINE_MAX_CONST_B_SWVP 2048
|
||||||
#define NINE_MAX_CONST_ALL 276 /* B consts count only 1/4 th */
|
#define NINE_MAX_CONST_ALL_VS 276 /* B consts count only 1/4 th */
|
||||||
|
#define NINE_MAX_CONST_ALL_PS (NINE_MAX_CONST_F_PS3 + (NINE_MAX_CONST_I + NINE_MAX_CONST_B / 4))
|
||||||
|
|
||||||
#define NINE_CONST_I_BASE(nconstf) \
|
#define NINE_CONST_I_BASE(nconstf) \
|
||||||
((nconstf) * 4 * sizeof(float))
|
((nconstf) * 4 * sizeof(float))
|
||||||
|
@@ -54,8 +54,8 @@ NinePixelShader9_ctor( struct NinePixelShader9 *This,
|
|||||||
|
|
||||||
info.type = PIPE_SHADER_FRAGMENT;
|
info.type = PIPE_SHADER_FRAGMENT;
|
||||||
info.byte_code = pFunction;
|
info.byte_code = pFunction;
|
||||||
info.const_i_base = NINE_CONST_I_BASE(device->max_ps_const_f) / 16;
|
info.const_i_base = NINE_CONST_I_BASE(NINE_MAX_CONST_F_PS3) / 16;
|
||||||
info.const_b_base = NINE_CONST_B_BASE(device->max_ps_const_f) / 16;
|
info.const_b_base = NINE_CONST_B_BASE(NINE_MAX_CONST_F_PS3) / 16;
|
||||||
info.sampler_mask_shadow = 0x0;
|
info.sampler_mask_shadow = 0x0;
|
||||||
info.fetch4 = 0x0;
|
info.fetch4 = 0x0;
|
||||||
info.sampler_ps1xtypes = 0x0;
|
info.sampler_ps1xtypes = 0x0;
|
||||||
@@ -192,8 +192,8 @@ NinePixelShader9_GetVariant( struct NinePixelShader9 *This,
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
info.type = PIPE_SHADER_FRAGMENT;
|
info.type = PIPE_SHADER_FRAGMENT;
|
||||||
info.const_i_base = NINE_CONST_I_BASE(device->max_ps_const_f) / 16;
|
info.const_i_base = NINE_CONST_I_BASE(NINE_MAX_CONST_F_PS3) / 16;
|
||||||
info.const_b_base = NINE_CONST_B_BASE(device->max_ps_const_f) / 16;
|
info.const_b_base = NINE_CONST_B_BASE(NINE_MAX_CONST_F_PS3) / 16;
|
||||||
info.byte_code = This->byte_code.tokens;
|
info.byte_code = This->byte_code.tokens;
|
||||||
info.sampler_mask_shadow = key & 0xffff;
|
info.sampler_mask_shadow = key & 0xffff;
|
||||||
/* intended overlap with sampler_mask_shadow */
|
/* intended overlap with sampler_mask_shadow */
|
||||||
|
Reference in New Issue
Block a user