Lines Matching defs:svga
61 struct svga_context *svga = svga_context(pipe);
65 if (svga->depthstencil_disable) {
66 pipe->delete_depth_stencil_alpha_state(pipe, svga->depthstencil_disable);
70 for (shader = 0; shader < ARRAY_SIZE(svga->state.hw_draw.constbuf); shader++) {
71 for (i = 0; i < ARRAY_SIZE(svga->state.hw_draw.constbuf[0]); i++) {
72 pipe_resource_reference(&svga->state.hw_draw.constbuf[shader][i], NULL);
76 pipe->delete_blend_state(pipe, svga->noop_blend);
79 svga_destroy_stream_output_queries(svga);
82 if (svga->gb_query) {
84 svga->gb_query = NULL;
87 util_blitter_destroy(svga->blitter);
89 svga_cleanup_sampler_state(svga);
90 svga_cleanup_framebuffer(svga);
91 svga_cleanup_tss_binding(svga);
92 svga_cleanup_vertex_state(svga);
93 svga_cleanup_tcs_state(svga);
94 svga_cleanup_shader_image_state(svga);
96 svga_destroy_swtnl(svga);
97 svga_hwtnl_destroy(svga->hwtnl);
99 svga->swc->destroy(svga->swc);
101 util_bitmask_destroy(svga->blend_object_id_bm);
102 util_bitmask_destroy(svga->ds_object_id_bm);
103 util_bitmask_destroy(svga->input_element_object_id_bm);
104 util_bitmask_destroy(svga->rast_object_id_bm);
105 util_bitmask_destroy(svga->sampler_object_id_bm);
106 util_bitmask_destroy(svga->sampler_view_id_bm);
107 util_bitmask_destroy(svga->shader_id_bm);
108 util_bitmask_destroy(svga->surface_view_id_bm);
109 util_bitmask_destroy(svga->stream_output_id_bm);
110 util_bitmask_destroy(svga->query_id_bm);
111 util_bitmask_destroy(svga->uav_id_bm);
112 util_bitmask_destroy(svga->uav_to_free_id_bm);
114 u_upload_destroy(svga->const0_upload);
115 u_upload_destroy(svga->pipe.stream_uploader);
116 u_upload_destroy(svga->pipe.const_uploader);
117 svga_texture_transfer_map_upload_destroy(svga);
121 for (i = 0; i < ARRAY_SIZE(svga->curr.constbufs[shader]); ++i) {
122 pipe_resource_reference(&svga->curr.constbufs[shader][i].buffer, NULL);
129 if (svga_have_gl43(svga)) {
130 svga_destroy_rawbuf_srv(svga);
131 util_bitmask_destroy(svga->sampler_view_to_free_id_bm);
132 pipe_resource_reference(&svga->dummy_resource, NULL);
135 FREE(svga);
143 struct svga_context *svga = NULL;
148 svga = CALLOC_STRUCT(svga_context);
149 if (!svga)
152 list_inithead(&svga->dirty_buffers);
154 svga->pipe.screen = screen;
155 svga->pipe.priv = priv;
156 svga->pipe.destroy = svga_destroy;
157 svga->pipe.stream_uploader = u_upload_create(&svga->pipe, 1024 * 1024,
161 if (!svga->pipe.stream_uploader)
164 u_upload_disable_persistent(svga->pipe.stream_uploader);
166 svga->pipe.const_uploader = u_upload_create(&svga->pipe, 128 * 1024,
169 if (!svga->pipe.const_uploader)
172 u_upload_disable_persistent(svga->pipe.const_uploader);
174 svga->swc = svgascreen->sws->context_create(svgascreen->sws);
175 if (!svga->swc)
178 svga_init_resource_functions(svga);
179 svga_init_blend_functions(svga);
180 svga_init_blit_functions(svga);
181 svga_init_depth_stencil_functions(svga);
182 svga_init_draw_functions(svga);
183 svga_init_flush_functions(svga);
184 svga_init_misc_functions(svga);
185 svga_init_rasterizer_functions(svga);
186 svga_init_sampler_functions(svga);
187 svga_init_fs_functions(svga);
188 svga_init_vs_functions(svga);
189 svga_init_gs_functions(svga);
190 svga_init_ts_functions(svga);
191 svga_init_vertex_functions(svga);
192 svga_init_constbuffer_functions(svga);
193 svga_init_query_functions(svga);
194 svga_init_surface_functions(svga);
195 svga_init_stream_output_functions(svga);
196 svga_init_clear_functions(svga);
197 svga_init_tracked_state(svga);
198 svga_init_shader_image_functions(svga);
199 svga_init_shader_buffer_functions(svga);
200 svga_init_cs_functions(svga);
203 svga->curr.sample_mask = ~0;
206 svga->debug.no_swtnl = debug_get_option_no_swtnl();
207 svga->debug.force_swtnl = debug_get_option_force_swtnl();
208 svga->debug.use_min_mipmap = debug_get_option_use_min_mipmap();
209 svga->debug.no_line_width = debug_get_option_no_line_width();
210 svga->debug.force_hw_line_stipple = debug_get_option_force_hw_line_stipple();
212 if (!(svga->blend_object_id_bm = util_bitmask_create()))
215 if (!(svga->ds_object_id_bm = util_bitmask_create()))
218 if (!(svga->input_element_object_id_bm = util_bitmask_create()))
221 if (!(svga->rast_object_id_bm = util_bitmask_create()))
224 if (!(svga->sampler_object_id_bm = util_bitmask_create()))
227 if (!(svga->sampler_view_id_bm = util_bitmask_create()))
230 if (!(svga->shader_id_bm = util_bitmask_create()))
233 if (!(svga->surface_view_id_bm = util_bitmask_create()))
236 if (!(svga->stream_output_id_bm = util_bitmask_create()))
239 if (!(svga->query_id_bm = util_bitmask_create()))
242 if (!(svga->uav_id_bm = util_bitmask_create()))
245 if (!(svga->uav_to_free_id_bm = util_bitmask_create()))
248 if (!(svga->sampler_view_to_free_id_bm = util_bitmask_create()))
251 svga->hwtnl = svga_hwtnl_create(svga);
252 if (svga->hwtnl == NULL)
255 if (!svga_init_swtnl(svga))
258 ret = svga_emit_initial_state(svga);
262 svga->const0_upload = u_upload_create(&svga->pipe,
267 if (!svga->const0_upload)
270 u_upload_disable_persistent(svga->const0_upload);
272 if (!svga_texture_transfer_map_upload_create(svga))
277 memset(&svga->state.hw_clear, 0xcd, sizeof(svga->state.hw_clear));
278 memset(&svga->state.hw_clear.framebuffer, 0x0,
279 sizeof(svga->state.hw_clear.framebuffer));
280 memset(&svga->state.hw_clear.rtv, 0, sizeof(svga->state.hw_clear.rtv));
281 svga->state.hw_clear.num_rendertargets = 0;
282 svga->state.hw_clear.dsv = NULL;
284 memset(&svga->state.hw_draw, 0xcd, sizeof(svga->state.hw_draw));
285 memset(&svga->state.hw_draw.views, 0x0, sizeof(svga->state.hw_draw.views));
286 memset(&svga->state.hw_draw.num_samplers, 0,
287 sizeof(svga->state.hw_draw.num_samplers));
288 memset(&svga->state.hw_draw.num_sampler_views, 0,
289 sizeof(svga->state.hw_draw.num_sampler_views));
290 memset(svga->state.hw_draw.sampler_views, 0,
291 sizeof(svga->state.hw_draw.sampler_views));
292 svga->state.hw_draw.num_views = 0;
293 svga->state.hw_draw.num_backed_views = 0;
294 svga->state.hw_draw.rasterizer_discard = FALSE;
297 svga->state.hw_draw.uavSpliceIndex = -1;
298 svga->state.hw_draw.num_uavs = 0;
299 svga->state.hw_draw.num_cs_uavs = 0;
302 svga->state.hw_draw.vs = NULL;
303 svga->state.hw_draw.gs = NULL;
304 svga->state.hw_draw.fs = NULL;
305 svga->state.hw_draw.tcs = NULL;
306 svga->state.hw_draw.tes = NULL;
309 memset(svga->state.hw_draw.constbuf, 0,
310 sizeof(svga->state.hw_draw.constbuf));
311 memset(svga->state.hw_draw.default_constbuf_size, 0,
312 sizeof(svga->state.hw_draw.default_constbuf_size));
313 memset(svga->state.hw_draw.enabled_constbufs, 0,
314 sizeof(svga->state.hw_draw.enabled_constbufs));
315 memset(svga->state.hw_draw.enabled_rawbufs, 0,
316 sizeof(svga->state.hw_draw.enabled_rawbufs));
317 memset(svga->state.hw_draw.rawbufs, 0,
318 sizeof(svga->state.hw_draw.rawbufs));
319 svga->state.hw_draw.ib = NULL;
320 svga->state.hw_draw.num_vbuffers = 0;
321 memset(svga->state.hw_draw.vbuffers, 0,
322 sizeof(svga->state.hw_draw.vbuffers));
323 svga->state.hw_draw.const0_buffer = NULL;
324 svga->state.hw_draw.const0_handle = NULL;
326 if (svga_have_gl43(svga)) {
329 i < ARRAY_SIZE(svga->state.hw_draw.rawbufs[shader]); i++) {
330 svga->state.hw_draw.rawbufs[shader][i].srvid = SVGA3D_INVALID_ID;
333 svga_uav_cache_init(svga);
334 svga->dummy_resource = NULL;
353 svga->noop_blend = svga->pipe.create_blend_state(&svga->pipe, &noop_tmpl);
356 svga->dirty = SVGA_NEW_ALL;
357 svga->pred.query_id = SVGA3D_INVALID_ID;
358 svga->disable_rasterizer = FALSE;
364 svga_create_stream_output_queries(svga);
369 svga_destroy_swtnl(svga);
371 if (svga->const0_upload)
372 u_upload_destroy(svga->const0_upload);
373 if (svga->pipe.const_uploader)
374 u_upload_destroy(svga->pipe.const_uploader);
375 if (svga->pipe.stream_uploader)
376 u_upload_destroy(svga->pipe.stream_uploader);
377 svga_texture_transfer_map_upload_destroy(svga);
378 if (svga->hwtnl)
379 svga_hwtnl_destroy(svga->hwtnl);
380 if (svga->swc)
381 svga->swc->destroy(svga->swc);
382 util_bitmask_destroy(svga->blend_object_id_bm);
383 util_bitmask_destroy(svga->ds_object_id_bm);
384 util_bitmask_destroy(svga->input_element_object_id_bm);
385 util_bitmask_destroy(svga->rast_object_id_bm);
386 util_bitmask_destroy(svga->sampler_object_id_bm);
387 util_bitmask_destroy(svga->shader_id_bm);
388 util_bitmask_destroy(svga->surface_view_id_bm);
389 util_bitmask_destroy(svga->stream_output_id_bm);
390 util_bitmask_destroy(svga->query_id_bm);
392 util_bitmask_destroy(svga->uav_id_bm);
393 util_bitmask_destroy(svga->uav_to_free_id_bm);
394 util_bitmask_destroy(svga->sampler_view_id_bm);
396 FREE(svga);
397 svga = NULL;
401 return svga ? &svga->pipe:NULL;
406 svga_context_flush(struct svga_context *svga,
409 struct svga_screen *svgascreen = svga_screen(svga->pipe.screen);
413 SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_CONTEXTFLUSH);
415 svga->curr.nr_fbs = 0;
421 if (svga->state.hw_draw.const0_handle) {
422 assert(svga->state.hw_draw.const0_buffer);
423 u_upload_unmap(svga->const0_upload);
424 pipe_resource_reference(&svga->state.hw_draw.const0_buffer, NULL);
425 svga->state.hw_draw.const0_handle = NULL;
431 svga_context_flush_buffers(svga);
433 svga->hud.command_buffer_size +=
434 svga->swc->get_command_buffer_size(svga->swc);
438 t0 = svga_get_time(svga);
439 svga->swc->flush(svga->swc, &fence);
440 svga->hud.flush_time += (svga_get_time(svga) - t0);
442 svga->hud.num_flushes++;
444 svga_screen_cache_flush(svgascreen, svga, fence);
446 SVGA3D_ResetLastCommand(svga->swc);
451 svga->rebind.flags.rendertargets = TRUE;
452 svga->rebind.flags.texture_samplers = TRUE;
454 if (svga_have_gb_objects(svga)) {
456 svga->rebind.flags.constbufs = TRUE;
457 svga->rebind.flags.vs = TRUE;
458 svga->rebind.flags.fs = TRUE;
459 svga->rebind.flags.gs = TRUE;
461 if (svga_have_sm5(svga)) {
462 svga->rebind.flags.tcs = TRUE;
463 svga->rebind.flags.tes = TRUE;
466 if (svga_need_to_rebind_resources(svga)) {
467 svga->rebind.flags.query = TRUE;
470 if (svga_sws(svga)->have_index_vertex_buffer_offset_cmd) {
471 svga->rebind.flags.vertexbufs = TRUE;
472 svga->rebind.flags.indexbuf = TRUE;
478 svga->pipe.screen->fence_finish(svga->pipe.screen, NULL, fence,
487 SVGA_STATS_TIME_POP(svga_sws(svga));
495 svga_context_finish(struct svga_context *svga)
497 struct pipe_screen *screen = svga->pipe.screen;
500 SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_CONTEXTFINISH);
502 svga_context_flush(svga, &fence);
506 SVGA_STATS_TIME_POP(svga_sws(svga));
516 svga_hwtnl_flush_retry(struct svga_context *svga)
520 SVGA_RETRY_OOM(svga, ret, svga_hwtnl_flush(svga->hwtnl));
531 svga_hwtnl_flush_buffer(struct svga_context *svga,
534 if (svga_hwtnl_is_buffer_referred(svga->hwtnl, buffer)) {
535 svga_hwtnl_flush_retry(svga);
544 svga_surfaces_flush(struct svga_context *svga)
546 SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_SURFACEFLUSH);
550 svga_hwtnl_flush_retry(svga);
554 svga_propagate_rendertargets(svga);
556 SVGA_STATS_TIME_POP(svga_sws(svga));