1bf215546Sopenharmony_ci/********************************************************** 2bf215546Sopenharmony_ci * Copyright 2008-2022 VMware, Inc. All rights reserved. 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person 5bf215546Sopenharmony_ci * obtaining a copy of this software and associated documentation 6bf215546Sopenharmony_ci * files (the "Software"), to deal in the Software without 7bf215546Sopenharmony_ci * restriction, including without limitation the rights to use, copy, 8bf215546Sopenharmony_ci * modify, merge, publish, distribute, sublicense, and/or sell copies 9bf215546Sopenharmony_ci * of the Software, and to permit persons to whom the Software is 10bf215546Sopenharmony_ci * furnished to do so, subject to the following conditions: 11bf215546Sopenharmony_ci * 12bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be 13bf215546Sopenharmony_ci * included in all copies or substantial portions of the Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16bf215546Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18bf215546Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19bf215546Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20bf215546Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21bf215546Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22bf215546Sopenharmony_ci * SOFTWARE. 23bf215546Sopenharmony_ci * 24bf215546Sopenharmony_ci **********************************************************/ 25bf215546Sopenharmony_ci 26bf215546Sopenharmony_ci#include "util/u_inlines.h" 27bf215546Sopenharmony_ci#include "pipe/p_defines.h" 28bf215546Sopenharmony_ci#include "util/u_math.h" 29bf215546Sopenharmony_ci#include "util/u_memory.h" 30bf215546Sopenharmony_ci#include "util/u_bitmask.h" 31bf215546Sopenharmony_ci#include "translate/translate.h" 32bf215546Sopenharmony_ci#include "tgsi/tgsi_ureg.h" 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_ci#include "svga_context.h" 35bf215546Sopenharmony_ci#include "svga_state.h" 36bf215546Sopenharmony_ci#include "svga_cmd.h" 37bf215546Sopenharmony_ci#include "svga_shader.h" 38bf215546Sopenharmony_ci#include "svga_tgsi.h" 39bf215546Sopenharmony_ci 40bf215546Sopenharmony_ci#include "svga_hw_reg.h" 41bf215546Sopenharmony_ci 42bf215546Sopenharmony_ci 43bf215546Sopenharmony_ci/** 44bf215546Sopenharmony_ci * If we fail to compile a vertex shader we'll use a dummy/fallback shader 45bf215546Sopenharmony_ci * that simply emits a (0,0,0,1) vertex position. 46bf215546Sopenharmony_ci */ 47bf215546Sopenharmony_cistatic const struct tgsi_token * 48bf215546Sopenharmony_ciget_dummy_vertex_shader(void) 49bf215546Sopenharmony_ci{ 50bf215546Sopenharmony_ci static const float zero[4] = { 0.0, 0.0, 0.0, 1.0 }; 51bf215546Sopenharmony_ci struct ureg_program *ureg; 52bf215546Sopenharmony_ci const struct tgsi_token *tokens; 53bf215546Sopenharmony_ci struct ureg_src src; 54bf215546Sopenharmony_ci struct ureg_dst dst; 55bf215546Sopenharmony_ci 56bf215546Sopenharmony_ci ureg = ureg_create(PIPE_SHADER_VERTEX); 57bf215546Sopenharmony_ci if (!ureg) 58bf215546Sopenharmony_ci return NULL; 59bf215546Sopenharmony_ci 60bf215546Sopenharmony_ci dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0); 61bf215546Sopenharmony_ci src = ureg_DECL_immediate(ureg, zero, 4); 62bf215546Sopenharmony_ci ureg_MOV(ureg, dst, src); 63bf215546Sopenharmony_ci ureg_END(ureg); 64bf215546Sopenharmony_ci 65bf215546Sopenharmony_ci tokens = ureg_get_tokens(ureg, NULL); 66bf215546Sopenharmony_ci 67bf215546Sopenharmony_ci ureg_destroy(ureg); 68bf215546Sopenharmony_ci 69bf215546Sopenharmony_ci return tokens; 70bf215546Sopenharmony_ci} 71bf215546Sopenharmony_ci 72bf215546Sopenharmony_ci 73bf215546Sopenharmony_ci/** 74bf215546Sopenharmony_ci * Replace the given shader's instruction with a simple / dummy shader. 75bf215546Sopenharmony_ci * We use this when normal shader translation fails. 76bf215546Sopenharmony_ci */ 77bf215546Sopenharmony_cistruct svga_shader_variant * 78bf215546Sopenharmony_cisvga_get_compiled_dummy_vertex_shader(struct svga_context *svga, 79bf215546Sopenharmony_ci struct svga_shader *shader, 80bf215546Sopenharmony_ci const struct svga_compile_key *key) 81bf215546Sopenharmony_ci{ 82bf215546Sopenharmony_ci struct svga_vertex_shader *vs = (struct svga_vertex_shader *)shader; 83bf215546Sopenharmony_ci const struct tgsi_token *dummy = get_dummy_vertex_shader(); 84bf215546Sopenharmony_ci struct svga_shader_variant *variant; 85bf215546Sopenharmony_ci 86bf215546Sopenharmony_ci if (!dummy) { 87bf215546Sopenharmony_ci return NULL; 88bf215546Sopenharmony_ci } 89bf215546Sopenharmony_ci 90bf215546Sopenharmony_ci FREE((void *) vs->base.tokens); 91bf215546Sopenharmony_ci vs->base.tokens = dummy; 92bf215546Sopenharmony_ci 93bf215546Sopenharmony_ci svga_tgsi_scan_shader(&vs->base); 94bf215546Sopenharmony_ci 95bf215546Sopenharmony_ci variant = svga_tgsi_compile_shader(svga, shader, key); 96bf215546Sopenharmony_ci return variant; 97bf215546Sopenharmony_ci} 98bf215546Sopenharmony_ci 99bf215546Sopenharmony_ci 100bf215546Sopenharmony_ci/* SVGA_NEW_PRESCALE, SVGA_NEW_RAST, SVGA_NEW_FS 101bf215546Sopenharmony_ci */ 102bf215546Sopenharmony_cistatic void 103bf215546Sopenharmony_cimake_vs_key(struct svga_context *svga, struct svga_compile_key *key) 104bf215546Sopenharmony_ci{ 105bf215546Sopenharmony_ci struct svga_vertex_shader *vs = svga->curr.vs; 106bf215546Sopenharmony_ci 107bf215546Sopenharmony_ci memset(key, 0, sizeof *key); 108bf215546Sopenharmony_ci 109bf215546Sopenharmony_ci if (svga->state.sw.need_swtnl && svga_have_vgpu10(svga)) { 110bf215546Sopenharmony_ci /* Set both of these flags, to match compile_passthrough_vs() */ 111bf215546Sopenharmony_ci key->vs.passthrough = 1; 112bf215546Sopenharmony_ci key->vs.undo_viewport = 1; 113bf215546Sopenharmony_ci return; 114bf215546Sopenharmony_ci } 115bf215546Sopenharmony_ci 116bf215546Sopenharmony_ci if (svga_have_vgpu10(svga)) { 117bf215546Sopenharmony_ci key->vs.need_vertex_id_bias = 1; 118bf215546Sopenharmony_ci } 119bf215546Sopenharmony_ci 120bf215546Sopenharmony_ci /* SVGA_NEW_PRESCALE */ 121bf215546Sopenharmony_ci key->vs.need_prescale = svga->state.hw_clear.prescale[0].enabled && 122bf215546Sopenharmony_ci (svga->curr.tes == NULL) && 123bf215546Sopenharmony_ci (svga->curr.gs == NULL); 124bf215546Sopenharmony_ci 125bf215546Sopenharmony_ci /* SVGA_NEW_RAST */ 126bf215546Sopenharmony_ci key->vs.allow_psiz = svga->curr.rast->templ.point_size_per_vertex; 127bf215546Sopenharmony_ci 128bf215546Sopenharmony_ci /* SVGA_NEW_FS */ 129bf215546Sopenharmony_ci key->vs.fs_generic_inputs = svga->curr.fs->base.info.generic_inputs_mask; 130bf215546Sopenharmony_ci 131bf215546Sopenharmony_ci svga_remap_generics(key->vs.fs_generic_inputs, key->generic_remap_table); 132bf215546Sopenharmony_ci 133bf215546Sopenharmony_ci /* SVGA_NEW_VELEMENT */ 134bf215546Sopenharmony_ci key->vs.adjust_attrib_range = svga->curr.velems->adjust_attrib_range; 135bf215546Sopenharmony_ci key->vs.adjust_attrib_w_1 = svga->curr.velems->adjust_attrib_w_1; 136bf215546Sopenharmony_ci key->vs.attrib_is_pure_int = svga->curr.velems->attrib_is_pure_int; 137bf215546Sopenharmony_ci key->vs.adjust_attrib_itof = svga->curr.velems->adjust_attrib_itof; 138bf215546Sopenharmony_ci key->vs.adjust_attrib_utof = svga->curr.velems->adjust_attrib_utof; 139bf215546Sopenharmony_ci key->vs.attrib_is_bgra = svga->curr.velems->attrib_is_bgra; 140bf215546Sopenharmony_ci key->vs.attrib_puint_to_snorm = svga->curr.velems->attrib_puint_to_snorm; 141bf215546Sopenharmony_ci key->vs.attrib_puint_to_uscaled = svga->curr.velems->attrib_puint_to_uscaled; 142bf215546Sopenharmony_ci key->vs.attrib_puint_to_sscaled = svga->curr.velems->attrib_puint_to_sscaled; 143bf215546Sopenharmony_ci 144bf215546Sopenharmony_ci /* SVGA_NEW_TEXTURE_BINDING | SVGA_NEW_SAMPLER */ 145bf215546Sopenharmony_ci svga_init_shader_key_common(svga, PIPE_SHADER_VERTEX, &vs->base, key); 146bf215546Sopenharmony_ci 147bf215546Sopenharmony_ci /* SVGA_NEW_RAST */ 148bf215546Sopenharmony_ci key->clip_plane_enable = svga->curr.rast->templ.clip_plane_enable; 149bf215546Sopenharmony_ci 150bf215546Sopenharmony_ci /* Determine if this shader is the last shader in the vertex 151bf215546Sopenharmony_ci * processing stage. 152bf215546Sopenharmony_ci */ 153bf215546Sopenharmony_ci key->last_vertex_stage = !(svga->curr.gs || 154bf215546Sopenharmony_ci svga->curr.tcs || svga->curr.tes); 155bf215546Sopenharmony_ci} 156bf215546Sopenharmony_ci 157bf215546Sopenharmony_ci 158bf215546Sopenharmony_ci/** 159bf215546Sopenharmony_ci * svga_reemit_vs_bindings - Reemit the vertex shader bindings 160bf215546Sopenharmony_ci */ 161bf215546Sopenharmony_cienum pipe_error 162bf215546Sopenharmony_cisvga_reemit_vs_bindings(struct svga_context *svga) 163bf215546Sopenharmony_ci{ 164bf215546Sopenharmony_ci enum pipe_error ret; 165bf215546Sopenharmony_ci struct svga_winsys_gb_shader *gbshader = NULL; 166bf215546Sopenharmony_ci SVGA3dShaderId shaderId = SVGA3D_INVALID_ID; 167bf215546Sopenharmony_ci 168bf215546Sopenharmony_ci assert(svga->rebind.flags.vs); 169bf215546Sopenharmony_ci assert(svga_have_gb_objects(svga)); 170bf215546Sopenharmony_ci 171bf215546Sopenharmony_ci if (svga->state.hw_draw.vs) { 172bf215546Sopenharmony_ci gbshader = svga->state.hw_draw.vs->gb_shader; 173bf215546Sopenharmony_ci shaderId = svga->state.hw_draw.vs->id; 174bf215546Sopenharmony_ci } 175bf215546Sopenharmony_ci 176bf215546Sopenharmony_ci if (!svga_need_to_rebind_resources(svga)) { 177bf215546Sopenharmony_ci ret = svga->swc->resource_rebind(svga->swc, NULL, gbshader, 178bf215546Sopenharmony_ci SVGA_RELOC_READ); 179bf215546Sopenharmony_ci } 180bf215546Sopenharmony_ci else { 181bf215546Sopenharmony_ci if (svga_have_vgpu10(svga)) 182bf215546Sopenharmony_ci ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_VS, 183bf215546Sopenharmony_ci gbshader, shaderId); 184bf215546Sopenharmony_ci else 185bf215546Sopenharmony_ci ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_VS, gbshader); 186bf215546Sopenharmony_ci } 187bf215546Sopenharmony_ci 188bf215546Sopenharmony_ci if (ret != PIPE_OK) 189bf215546Sopenharmony_ci return ret; 190bf215546Sopenharmony_ci 191bf215546Sopenharmony_ci svga->rebind.flags.vs = FALSE; 192bf215546Sopenharmony_ci return PIPE_OK; 193bf215546Sopenharmony_ci} 194bf215546Sopenharmony_ci 195bf215546Sopenharmony_ci 196bf215546Sopenharmony_ci/** 197bf215546Sopenharmony_ci * The current vertex shader is already executed by the 'draw' 198bf215546Sopenharmony_ci * module, so we just need to generate a simple vertex shader 199bf215546Sopenharmony_ci * to pass through all those VS outputs that will 200bf215546Sopenharmony_ci * be consumed by the fragment shader. 201bf215546Sopenharmony_ci * Used when we employ the 'draw' module. 202bf215546Sopenharmony_ci */ 203bf215546Sopenharmony_cistatic enum pipe_error 204bf215546Sopenharmony_cicompile_passthrough_vs(struct svga_context *svga, 205bf215546Sopenharmony_ci struct svga_vertex_shader *vs, 206bf215546Sopenharmony_ci struct svga_fragment_shader *fs, 207bf215546Sopenharmony_ci struct svga_shader_variant **out_variant) 208bf215546Sopenharmony_ci{ 209bf215546Sopenharmony_ci struct svga_shader_variant *variant = NULL; 210bf215546Sopenharmony_ci unsigned num_inputs; 211bf215546Sopenharmony_ci unsigned i; 212bf215546Sopenharmony_ci unsigned num_elements; 213bf215546Sopenharmony_ci struct svga_vertex_shader new_vs; 214bf215546Sopenharmony_ci struct ureg_src src[PIPE_MAX_SHADER_INPUTS]; 215bf215546Sopenharmony_ci struct ureg_dst dst[PIPE_MAX_SHADER_OUTPUTS]; 216bf215546Sopenharmony_ci struct ureg_program *ureg; 217bf215546Sopenharmony_ci struct svga_compile_key key; 218bf215546Sopenharmony_ci enum pipe_error ret; 219bf215546Sopenharmony_ci 220bf215546Sopenharmony_ci assert(svga_have_vgpu10(svga)); 221bf215546Sopenharmony_ci assert(fs); 222bf215546Sopenharmony_ci 223bf215546Sopenharmony_ci num_inputs = fs->base.tgsi_info.num_inputs; 224bf215546Sopenharmony_ci 225bf215546Sopenharmony_ci ureg = ureg_create(PIPE_SHADER_VERTEX); 226bf215546Sopenharmony_ci if (!ureg) 227bf215546Sopenharmony_ci return PIPE_ERROR_OUT_OF_MEMORY; 228bf215546Sopenharmony_ci 229bf215546Sopenharmony_ci /* draw will always add position */ 230bf215546Sopenharmony_ci dst[0] = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0); 231bf215546Sopenharmony_ci src[0] = ureg_DECL_vs_input(ureg, 0); 232bf215546Sopenharmony_ci num_elements = 1; 233bf215546Sopenharmony_ci 234bf215546Sopenharmony_ci /** 235bf215546Sopenharmony_ci * swtnl backend redefines the input layout based on the 236bf215546Sopenharmony_ci * fragment shader's inputs. So we only need to passthrough 237bf215546Sopenharmony_ci * those inputs that will be consumed by the fragment shader. 238bf215546Sopenharmony_ci * Note: DX10 requires the number of vertex elements 239bf215546Sopenharmony_ci * specified in the input layout to be no less than the 240bf215546Sopenharmony_ci * number of inputs to the vertex shader. 241bf215546Sopenharmony_ci */ 242bf215546Sopenharmony_ci for (i = 0; i < num_inputs; i++) { 243bf215546Sopenharmony_ci switch (fs->base.tgsi_info.input_semantic_name[i]) { 244bf215546Sopenharmony_ci case TGSI_SEMANTIC_COLOR: 245bf215546Sopenharmony_ci case TGSI_SEMANTIC_GENERIC: 246bf215546Sopenharmony_ci case TGSI_SEMANTIC_FOG: 247bf215546Sopenharmony_ci dst[num_elements] = ureg_DECL_output(ureg, 248bf215546Sopenharmony_ci fs->base.tgsi_info.input_semantic_name[i], 249bf215546Sopenharmony_ci fs->base.tgsi_info.input_semantic_index[i]); 250bf215546Sopenharmony_ci src[num_elements] = ureg_DECL_vs_input(ureg, num_elements); 251bf215546Sopenharmony_ci num_elements++; 252bf215546Sopenharmony_ci break; 253bf215546Sopenharmony_ci default: 254bf215546Sopenharmony_ci break; 255bf215546Sopenharmony_ci } 256bf215546Sopenharmony_ci } 257bf215546Sopenharmony_ci 258bf215546Sopenharmony_ci for (i = 0; i < num_elements; i++) { 259bf215546Sopenharmony_ci ureg_MOV(ureg, dst[i], src[i]); 260bf215546Sopenharmony_ci } 261bf215546Sopenharmony_ci 262bf215546Sopenharmony_ci ureg_END(ureg); 263bf215546Sopenharmony_ci 264bf215546Sopenharmony_ci memset(&new_vs, 0, sizeof(new_vs)); 265bf215546Sopenharmony_ci new_vs.base.tokens = ureg_get_tokens(ureg, NULL); 266bf215546Sopenharmony_ci svga_tgsi_scan_shader(&new_vs.base); 267bf215546Sopenharmony_ci 268bf215546Sopenharmony_ci memset(&key, 0, sizeof(key)); 269bf215546Sopenharmony_ci key.vs.undo_viewport = 1; 270bf215546Sopenharmony_ci 271bf215546Sopenharmony_ci ret = svga_compile_shader(svga, &new_vs.base, &key, &variant); 272bf215546Sopenharmony_ci if (ret != PIPE_OK) 273bf215546Sopenharmony_ci return ret; 274bf215546Sopenharmony_ci 275bf215546Sopenharmony_ci ureg_free_tokens(new_vs.base.tokens); 276bf215546Sopenharmony_ci ureg_destroy(ureg); 277bf215546Sopenharmony_ci 278bf215546Sopenharmony_ci /* Overwrite the variant key to indicate it's a pass-through VS */ 279bf215546Sopenharmony_ci memset(&variant->key, 0, sizeof(variant->key)); 280bf215546Sopenharmony_ci variant->key.vs.passthrough = 1; 281bf215546Sopenharmony_ci variant->key.vs.undo_viewport = 1; 282bf215546Sopenharmony_ci 283bf215546Sopenharmony_ci *out_variant = variant; 284bf215546Sopenharmony_ci 285bf215546Sopenharmony_ci return PIPE_OK; 286bf215546Sopenharmony_ci} 287bf215546Sopenharmony_ci 288bf215546Sopenharmony_ci 289bf215546Sopenharmony_cistatic enum pipe_error 290bf215546Sopenharmony_ciemit_hw_vs(struct svga_context *svga, uint64_t dirty) 291bf215546Sopenharmony_ci{ 292bf215546Sopenharmony_ci struct svga_shader_variant *variant; 293bf215546Sopenharmony_ci struct svga_vertex_shader *vs = svga->curr.vs; 294bf215546Sopenharmony_ci struct svga_fragment_shader *fs = svga->curr.fs; 295bf215546Sopenharmony_ci enum pipe_error ret = PIPE_OK; 296bf215546Sopenharmony_ci struct svga_compile_key key; 297bf215546Sopenharmony_ci 298bf215546Sopenharmony_ci SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_EMITVS); 299bf215546Sopenharmony_ci 300bf215546Sopenharmony_ci /* If there is an active geometry shader, and it has stream output 301bf215546Sopenharmony_ci * defined, then we will skip the stream output from the vertex shader 302bf215546Sopenharmony_ci */ 303bf215546Sopenharmony_ci if (!svga_have_gs_streamout(svga)) { 304bf215546Sopenharmony_ci /* No GS stream out */ 305bf215546Sopenharmony_ci if (svga_have_vs_streamout(svga)) { 306bf215546Sopenharmony_ci /* Set VS stream out */ 307bf215546Sopenharmony_ci ret = svga_set_stream_output(svga, vs->base.stream_output); 308bf215546Sopenharmony_ci } 309bf215546Sopenharmony_ci else { 310bf215546Sopenharmony_ci /* turn off stream out */ 311bf215546Sopenharmony_ci ret = svga_set_stream_output(svga, NULL); 312bf215546Sopenharmony_ci } 313bf215546Sopenharmony_ci if (ret != PIPE_OK) { 314bf215546Sopenharmony_ci goto done; 315bf215546Sopenharmony_ci } 316bf215546Sopenharmony_ci } 317bf215546Sopenharmony_ci 318bf215546Sopenharmony_ci /* SVGA_NEW_NEED_SWTNL */ 319bf215546Sopenharmony_ci if (svga->state.sw.need_swtnl && !svga_have_vgpu10(svga)) { 320bf215546Sopenharmony_ci /* No vertex shader is needed */ 321bf215546Sopenharmony_ci variant = NULL; 322bf215546Sopenharmony_ci } 323bf215546Sopenharmony_ci else { 324bf215546Sopenharmony_ci make_vs_key(svga, &key); 325bf215546Sopenharmony_ci 326bf215546Sopenharmony_ci /* See if we already have a VS variant that matches the key */ 327bf215546Sopenharmony_ci variant = svga_search_shader_key(&vs->base, &key); 328bf215546Sopenharmony_ci 329bf215546Sopenharmony_ci if (!variant) { 330bf215546Sopenharmony_ci /* Create VS variant now */ 331bf215546Sopenharmony_ci if (key.vs.passthrough) { 332bf215546Sopenharmony_ci ret = compile_passthrough_vs(svga, vs, fs, &variant); 333bf215546Sopenharmony_ci } 334bf215546Sopenharmony_ci else { 335bf215546Sopenharmony_ci ret = svga_compile_shader(svga, &vs->base, &key, &variant); 336bf215546Sopenharmony_ci } 337bf215546Sopenharmony_ci if (ret != PIPE_OK) 338bf215546Sopenharmony_ci goto done; 339bf215546Sopenharmony_ci } 340bf215546Sopenharmony_ci } 341bf215546Sopenharmony_ci 342bf215546Sopenharmony_ci if (variant != svga->state.hw_draw.vs) { 343bf215546Sopenharmony_ci /* Bind the new variant */ 344bf215546Sopenharmony_ci if (variant) { 345bf215546Sopenharmony_ci ret = svga_set_shader(svga, SVGA3D_SHADERTYPE_VS, variant); 346bf215546Sopenharmony_ci if (ret != PIPE_OK) 347bf215546Sopenharmony_ci goto done; 348bf215546Sopenharmony_ci svga->rebind.flags.vs = FALSE; 349bf215546Sopenharmony_ci } 350bf215546Sopenharmony_ci 351bf215546Sopenharmony_ci svga->dirty |= SVGA_NEW_VS_VARIANT; 352bf215546Sopenharmony_ci svga->state.hw_draw.vs = variant; 353bf215546Sopenharmony_ci } 354bf215546Sopenharmony_ci 355bf215546Sopenharmony_cidone: 356bf215546Sopenharmony_ci SVGA_STATS_TIME_POP(svga_sws(svga)); 357bf215546Sopenharmony_ci return ret; 358bf215546Sopenharmony_ci} 359bf215546Sopenharmony_ci 360bf215546Sopenharmony_cistruct svga_tracked_state svga_hw_vs = 361bf215546Sopenharmony_ci{ 362bf215546Sopenharmony_ci "vertex shader (hwtnl)", 363bf215546Sopenharmony_ci (SVGA_NEW_VS | 364bf215546Sopenharmony_ci SVGA_NEW_FS | 365bf215546Sopenharmony_ci SVGA_NEW_TEXTURE_BINDING | 366bf215546Sopenharmony_ci SVGA_NEW_SAMPLER | 367bf215546Sopenharmony_ci SVGA_NEW_RAST | 368bf215546Sopenharmony_ci SVGA_NEW_PRESCALE | 369bf215546Sopenharmony_ci SVGA_NEW_VELEMENT | 370bf215546Sopenharmony_ci SVGA_NEW_NEED_SWTNL | 371bf215546Sopenharmony_ci SVGA_NEW_VS_RAW_BUFFER), 372bf215546Sopenharmony_ci emit_hw_vs 373bf215546Sopenharmony_ci}; 374