static void * svga_create_fs_state(struct pipe_context *pipe, const struct pipe_shader_state *templ) { struct svga_context *svga = svga_context(pipe); struct svga_fragment_shader *fs; fs = CALLOC_STRUCT(svga_fragment_shader); if (!fs) return NULL; fs->base.tokens = tgsi_dup_tokens(templ->tokens); /* Collect basic info that we'll need later: */ tgsi_scan_shader(fs->base.tokens, &fs->base.info); fs->base.id = svga->debug.shader_id++; fs->generic_inputs = svga_get_generic_inputs_mask(&fs->base.info); svga_remap_generics(fs->generic_inputs, fs->generic_remap_table); fs->draw_shader = draw_create_fragment_shader(svga->swtnl.draw, templ); if (SVGA_DEBUG & DEBUG_TGSI || 0) { debug_printf("%s id: %u, inputs: %u, outputs: %u\n", __FUNCTION__, fs->base.id, fs->base.info.num_inputs, fs->base.info.num_outputs); } return fs; }
/* SVGA_NEW_PRESCALE, SVGA_NEW_RAST, SVGA_NEW_FS */ static void make_vs_key(struct svga_context *svga, struct svga_compile_key *key) { const unsigned shader = PIPE_SHADER_VERTEX; memset(key, 0, sizeof *key); if (svga->state.sw.need_swtnl && svga_have_vgpu10(svga)) { /* Set both of these flags, to match compile_passthrough_vs() */ key->vs.passthrough = 1; key->vs.undo_viewport = 1; return; } /* SVGA_NEW_PRESCALE */ key->vs.need_prescale = svga->state.hw_clear.prescale.enabled && (svga->curr.gs == NULL); /* SVGA_NEW_RAST */ key->vs.allow_psiz = svga->curr.rast->templ.point_size_per_vertex; /* SVGA_NEW_FS */ key->vs.fs_generic_inputs = svga->curr.fs->generic_inputs; svga_remap_generics(key->vs.fs_generic_inputs, key->generic_remap_table); /* SVGA_NEW_VELEMENT */ key->vs.adjust_attrib_range = svga->curr.velems->adjust_attrib_range; key->vs.adjust_attrib_w_1 = svga->curr.velems->adjust_attrib_w_1; key->vs.attrib_is_pure_int = svga->curr.velems->attrib_is_pure_int; key->vs.adjust_attrib_itof = svga->curr.velems->adjust_attrib_itof; key->vs.adjust_attrib_utof = svga->curr.velems->adjust_attrib_utof; key->vs.attrib_is_bgra = svga->curr.velems->attrib_is_bgra; key->vs.attrib_puint_to_snorm = svga->curr.velems->attrib_puint_to_snorm; key->vs.attrib_puint_to_uscaled = svga->curr.velems->attrib_puint_to_uscaled; key->vs.attrib_puint_to_sscaled = svga->curr.velems->attrib_puint_to_sscaled; /* SVGA_NEW_TEXTURE_BINDING | SVGA_NEW_SAMPLER */ svga_init_shader_key_common(svga, shader, key); /* SVGA_NEW_RAST */ key->clip_plane_enable = svga->curr.rast->templ.clip_plane_enable; }