From: Axel Davy Date: Sun, 20 Jan 2019 20:43:19 +0000 (+0100) Subject: st/nine: Make swvp_on imply IS_VS X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6f3da226e67051d92825554bdc6eb7caa8bd9365;p=mesa.git st/nine: Make swvp_on imply IS_VS swvp cannot happen with ps, thus it makes sense to force it to false with ps. Signed-off-by: Axel Davy --- diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index 09f14a415f3..9ec6c874a28 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -558,7 +558,7 @@ static struct ureg_src nine_float_constant_src(struct shader_translator *tx, int * doesn't need to be elsewhere, because all the instructions * accessing the constants directly are VS1, and swvp * is VS >= 2 */ - if (IS_VS && tx->info->swvp_on && idx >= 4096) { + if (tx->info->swvp_on && idx >= 4096) { /* TODO: swvp rel is broken if many constants are used */ src = ureg_src_register(TGSI_FILE_CONSTANT, idx - 4096); src = ureg_src_dimension(src, 1); @@ -577,7 +577,7 @@ static struct ureg_src nine_integer_constant_src(struct shader_translator *tx, i { struct ureg_src src; - if (IS_VS && tx->info->swvp_on) { + if (tx->info->swvp_on) { src = ureg_src_register(TGSI_FILE_CONSTANT, idx); src = ureg_src_dimension(src, 2); } else { @@ -600,7 +600,7 @@ static struct ureg_src nine_boolean_constant_src(struct shader_translator *tx, i char r = idx / 4; char s = idx & 3; - if (IS_VS && tx->info->swvp_on) { + if (tx->info->swvp_on) { src = ureg_src_register(TGSI_FILE_CONSTANT, r); src = ureg_src_dimension(src, 3); } else { @@ -3655,6 +3655,8 @@ nine_translate_shader(struct NineDevice9 *device, struct nine_shader_info *info, return E_OUTOFMEMORY; tx_ctor(tx, info); + assert(IS_VS || !info->swvp_on); + if (((tx->version.major << 16) | tx->version.minor) > 0x00030000) { hr = D3DERR_INVALIDCALL; DBG("Unsupported shader version: %u.%u !\n", @@ -3702,7 +3704,7 @@ nine_translate_shader(struct NineDevice9 *device, struct nine_shader_info *info, tx->num_constb_allowed = NINE_MAX_CONST_B; } - if (IS_VS && tx->version.major >= 2 && info->swvp_on) { + if (info->swvp_on && tx->version.major >= 2) { tx->num_constf_allowed = 8192; tx->num_consti_allowed = 2048; tx->num_constb_allowed = 2048; @@ -3854,14 +3856,14 @@ nine_translate_shader(struct NineDevice9 *device, struct nine_shader_info *info, /* r500 */ if (info->const_float_slots > device->max_vs_const_f && (info->const_int_slots || info->const_bool_slots) && - (!IS_VS || !info->swvp_on)) + !info->swvp_on) ERR("Overlapping constant slots. The shader is likely to be buggy\n"); if (tx->indirect_const_access) /* vs only */ info->const_float_slots = device->max_vs_const_f; - if (!IS_VS || !info->swvp_on) { + if (!info->swvp_on) { unsigned s, slot_max; unsigned max_const_f = IS_VS ? device->max_vs_const_f : device->max_ps_const_f; diff --git a/src/gallium/state_trackers/nine/pixelshader9.c b/src/gallium/state_trackers/nine/pixelshader9.c index 127d56161bf..f4b28e8d039 100644 --- a/src/gallium/state_trackers/nine/pixelshader9.c +++ b/src/gallium/state_trackers/nine/pixelshader9.c @@ -64,6 +64,7 @@ NinePixelShader9_ctor( struct NinePixelShader9 *This, info.add_constants_defs.int_const_added = NULL; info.add_constants_defs.bool_const_added = NULL; info.process_vertices = false; + info.swvp_on = false; pipe = nine_context_get_pipe_acquire(device); hr = nine_translate_shader(device, &info, pipe); @@ -199,6 +200,7 @@ NinePixelShader9_GetVariant( struct NinePixelShader9 *This ) info.add_constants_defs.int_const_added = &This->int_slots_used; info.add_constants_defs.bool_const_added = &This->bool_slots_used; info.process_vertices = false; + info.swvp_on = false; hr = nine_translate_shader(This->base.device, &info, pipe); if (FAILED(hr))