Lines Matching full:svga
60 struct svga_context *svga = svga_context(pipe);
64 for (i = 0; i < ARRAY_SIZE(svga->rasterizer_no_cull); i++) {
65 if (svga->rasterizer_no_cull[i]) {
66 pipe->delete_rasterizer_state(pipe, svga->rasterizer_no_cull[i]);
71 for (shader = 0; shader < ARRAY_SIZE(svga->state.hw_draw.constbuf); shader++) {
72 pipe_resource_reference(&svga->state.hw_draw.constbuf[shader], NULL);
75 pipe->delete_blend_state(pipe, svga->noop_blend);
78 if (svga->gb_query) {
80 svga->gb_query = NULL;
83 util_blitter_destroy(svga->blitter);
85 svga_cleanup_sampler_state(svga);
86 svga_cleanup_framebuffer(svga);
87 svga_cleanup_tss_binding(svga);
88 svga_cleanup_vertex_state(svga);
90 svga_destroy_swtnl(svga);
91 svga_hwtnl_destroy(svga->hwtnl);
93 svga->swc->destroy(svga->swc);
95 util_bitmask_destroy(svga->blend_object_id_bm);
96 util_bitmask_destroy(svga->ds_object_id_bm);
97 util_bitmask_destroy(svga->input_element_object_id_bm);
98 util_bitmask_destroy(svga->rast_object_id_bm);
99 util_bitmask_destroy(svga->sampler_object_id_bm);
100 util_bitmask_destroy(svga->sampler_view_id_bm);
101 util_bitmask_destroy(svga->shader_id_bm);
102 util_bitmask_destroy(svga->surface_view_id_bm);
103 util_bitmask_destroy(svga->stream_output_id_bm);
104 util_bitmask_destroy(svga->query_id_bm);
105 u_upload_destroy(svga->const0_upload);
106 svga_texture_transfer_map_upload_destroy(svga);
110 for (i = 0; i < ARRAY_SIZE(svga->curr.constbufs[shader]); ++i) {
111 pipe_resource_reference(&svga->curr.constbufs[shader][i].buffer, NULL);
115 FREE(svga);
123 struct svga_context *svga = NULL;
126 svga = CALLOC_STRUCT(svga_context);
127 if (!svga)
130 LIST_INITHEAD(&svga->dirty_buffers);
132 svga->pipe.screen = screen;
133 svga->pipe.priv = priv;
134 svga->pipe.destroy = svga_destroy;
136 svga->swc = svgascreen->sws->context_create(svgascreen->sws);
137 if (!svga->swc)
140 svga_init_resource_functions(svga);
141 svga_init_blend_functions(svga);
142 svga_init_blit_functions(svga);
143 svga_init_depth_stencil_functions(svga);
144 svga_init_draw_functions(svga);
145 svga_init_flush_functions(svga);
146 svga_init_misc_functions(svga);
147 svga_init_rasterizer_functions(svga);
148 svga_init_sampler_functions(svga);
149 svga_init_fs_functions(svga);
150 svga_init_vs_functions(svga);
151 svga_init_gs_functions(svga);
152 svga_init_vertex_functions(svga);
153 svga_init_constbuffer_functions(svga);
154 svga_init_query_functions(svga);
155 svga_init_surface_functions(svga);
156 svga_init_stream_output_functions(svga);
157 svga_init_clear_functions(svga);
160 svga->curr.sample_mask = ~0;
163 svga->debug.no_swtnl = debug_get_option_no_swtnl();
164 svga->debug.force_swtnl = debug_get_option_force_swtnl();
165 svga->debug.use_min_mipmap = debug_get_option_use_min_mipmap();
166 svga->debug.no_line_width = debug_get_option_no_line_width();
167 svga->debug.force_hw_line_stipple = debug_get_option_force_hw_line_stipple();
169 if (!(svga->blend_object_id_bm = util_bitmask_create()))
172 if (!(svga->ds_object_id_bm = util_bitmask_create()))
175 if (!(svga->input_element_object_id_bm = util_bitmask_create()))
178 if (!(svga->rast_object_id_bm = util_bitmask_create()))
181 if (!(svga->sampler_object_id_bm = util_bitmask_create()))
184 if (!(svga->sampler_view_id_bm = util_bitmask_create()))
187 if (!(svga->shader_id_bm = util_bitmask_create()))
190 if (!(svga->surface_view_id_bm = util_bitmask_create()))
193 if (!(svga->stream_output_id_bm = util_bitmask_create()))
196 if (!(svga->query_id_bm = util_bitmask_create()))
199 svga->hwtnl = svga_hwtnl_create(svga);
200 if (svga->hwtnl == NULL)
203 if (!svga_init_swtnl(svga))
206 ret = svga_emit_initial_state(svga);
210 svga->const0_upload = u_upload_create(&svga->pipe,
214 if (!svga->const0_upload)
217 if (!svga_texture_transfer_map_upload_create(svga))
222 memset(&svga->state.hw_clear, 0xcd, sizeof(svga->state.hw_clear));
223 memset(&svga->state.hw_clear.framebuffer, 0x0,
224 sizeof(svga->state.hw_clear.framebuffer));
226 memset(&svga->state.hw_draw, 0xcd, sizeof(svga->state.hw_draw));
227 memset(&svga->state.hw_draw.views, 0x0, sizeof(svga->state.hw_draw.views));
228 memset(&svga->state.hw_draw.num_samplers, 0,
229 sizeof(svga->state.hw_draw.num_samplers));
230 memset(&svga->state.hw_draw.num_sampler_views, 0,
231 sizeof(svga->state.hw_draw.num_sampler_views));
232 memset(svga->state.hw_draw.sampler_views, 0,
233 sizeof(svga->state.hw_draw.sampler_views));
234 svga->state.hw_draw.num_views = 0;
235 svga->state.hw_draw.num_rendertargets = 0;
236 svga->state.hw_draw.dsv = NULL;
239 svga->state.hw_draw.vs = NULL;
240 svga->state.hw_draw.gs = NULL;
241 svga->state.hw_draw.fs = NULL;
244 memset(svga->state.hw_draw.constbuf, 0,
245 sizeof(svga->state.hw_draw.constbuf));
246 memset(svga->state.hw_draw.default_constbuf_size, 0,
247 sizeof(svga->state.hw_draw.default_constbuf_size));
248 memset(svga->state.hw_draw.enabled_constbufs, 0,
249 sizeof(svga->state.hw_draw.enabled_constbufs));
250 svga->state.hw_draw.ib = NULL;
251 svga->state.hw_draw.num_vbuffers = 0;
252 memset(svga->state.hw_draw.vbuffers, 0,
253 sizeof(svga->state.hw_draw.vbuffers));
254 svga->state.hw_draw.const0_buffer = NULL;
255 svga->state.hw_draw.const0_handle = NULL;
273 svga->noop_blend = svga->pipe.create_blend_state(&svga->pipe, &noop_tmpl);
276 svga->dirty = ~0;
277 svga->pred.query_id = SVGA3D_INVALID_ID;
279 return &svga->pipe;
282 svga_destroy_swtnl(svga);
284 if (svga->const0_upload)
285 u_upload_destroy(svga->const0_upload);
286 svga_texture_transfer_map_upload_destroy(svga);
287 if (svga->hwtnl)
288 svga_hwtnl_destroy(svga->hwtnl);
289 if (svga->swc)
290 svga->swc->destroy(svga->swc);
291 util_bitmask_destroy(svga->blend_object_id_bm);
292 util_bitmask_destroy(svga->ds_object_id_bm);
293 util_bitmask_destroy(svga->input_element_object_id_bm);
294 util_bitmask_destroy(svga->rast_object_id_bm);
295 util_bitmask_destroy(svga->sampler_object_id_bm);
296 util_bitmask_destroy(svga->sampler_view_id_bm);
297 util_bitmask_destroy(svga->shader_id_bm);
298 util_bitmask_destroy(svga->surface_view_id_bm);
299 util_bitmask_destroy(svga->stream_output_id_bm);
300 util_bitmask_destroy(svga->query_id_bm);
301 FREE(svga);
307 svga_context_flush(struct svga_context *svga,
310 struct svga_screen *svgascreen = svga_screen(svga->pipe.screen);
314 SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_CONTEXTFLUSH);
316 svga->curr.nr_fbs = 0;
322 if (svga->state.hw_draw.const0_handle) {
323 assert(svga->state.hw_draw.const0_buffer);
324 u_upload_unmap(svga->const0_upload);
325 pipe_resource_reference(&svga->state.hw_draw.const0_buffer, NULL);
326 svga->state.hw_draw.const0_handle = NULL;
332 svga_context_flush_buffers(svga);
334 svga->hud.command_buffer_size +=
335 svga->swc->get_command_buffer_size(svga->swc);
339 t0 = svga_get_time(svga);
340 svga->swc->flush(svga->swc, &fence);
341 svga->hud.flush_time += (svga_get_time(svga) - t0);
343 svga->hud.num_flushes++;
347 SVGA3D_ResetLastCommand(svga->swc);
352 svga->rebind.flags.rendertargets = TRUE;
353 svga->rebind.flags.texture_samplers = TRUE;
355 if (svga_have_gb_objects(svga)) {
357 svga->rebind.flags.constbufs = TRUE;
358 svga->rebind.flags.vs = TRUE;
359 svga->rebind.flags.fs = TRUE;
360 svga->rebind.flags.gs = TRUE;
362 if (svga_need_to_rebind_resources(svga)) {
363 svga->rebind.flags.query = TRUE;
369 svga->pipe.screen->fence_finish(svga->pipe.screen, NULL, fence,
378 SVGA_STATS_TIME_POP(svga_sws(svga));
386 svga_context_finish(struct svga_context *svga)
388 struct pipe_screen *screen = svga->pipe.screen;
391 SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_CONTEXTFINISH);
393 svga_context_flush(svga, &fence);
397 SVGA_STATS_TIME_POP(svga_sws(svga));
407 svga_hwtnl_flush_retry(struct svga_context *svga)
411 ret = svga_hwtnl_flush(svga->hwtnl);
413 svga_context_flush(svga, NULL);
414 ret = svga_hwtnl_flush(svga->hwtnl);
427 svga_hwtnl_flush_buffer(struct svga_context *svga,
430 if (svga_hwtnl_is_buffer_referred(svga->hwtnl, buffer)) {
431 svga_hwtnl_flush_retry(svga);
440 svga_surfaces_flush(struct svga_context *svga)
442 SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_SURFACEFLUSH);
446 svga_hwtnl_flush_retry(svga);
450 svga_propagate_rendertargets(svga);
452 SVGA_STATS_TIME_POP(svga_sws(svga));