Lines Matching refs:svga
49 svga_hwtnl_create(struct svga_context *svga)
55 hwtnl->svga = svga;
57 hwtnl->cmd.swc = svga->swc;
91 struct svga_screen *svgascreen = svga_screen(hwtnl->svga->pipe.screen);
194 struct svga_context *svga = hwtnl->svga;
211 if (svga->state.hw_draw.num_backed_views) {
212 for (i = 0; i < svga->state.hw_draw.num_views; i++) {
213 struct svga_hw_view_state *view = &svga->state.hw_draw.views[i];
217 svga_validate_sampler_view(svga, view->v);
223 handle = svga_buffer_handle(svga, hwtnl->cmd.vbufs[j].buffer.resource,
233 handle = svga_buffer_handle(svga, hwtnl->cmd.prim_ib[i],
244 if (svga->rebind.flags.rendertargets) {
245 ret = svga_reemit_framebuffer_bindings(svga);
251 if (svga->rebind.flags.texture_samplers) {
252 ret = svga_reemit_tss_bindings(svga);
258 if (svga->rebind.flags.vs) {
259 ret = svga_reemit_vs_bindings(svga);
265 if (svga->rebind.flags.fs) {
266 ret = svga_reemit_fs_bindings(svga);
273 svga->curr.framebuffer.cbufs[0] ?
274 svga_surface(svga->curr.framebuffer.cbufs[0])->handle : NULL,
351 svga_validate_sampler_resources(struct svga_context *svga,
356 assert(svga_have_vgpu10(svga));
363 assert(svga_have_gl43(svga));
369 unsigned count = svga->curr.num_sampler_views[shader];
380 svga_pipe_sampler_view(svga->curr.sampler_views[shader][i]);
384 surfaces[i] = svga_buffer_handle(svga, sv->base.texture,
397 svga->curr.rast->templ.poly_stipple_enable) {
399 svga_fs_variant(svga->state.hw_draw.fs)->pstipple_sampler_unit;
401 svga->polygon_stipple.sampler_view;
409 if (svga->rebind.flags.texture_samplers) {
412 ret = svga->swc->resource_rebind(svga->swc,
422 svga->rebind.flags.texture_samplers = FALSE;
434 svga_validate_constant_buffers(struct svga_context *svga,
439 assert(svga_have_vgpu10(svga));
446 assert(svga_have_gl43(svga));
457 if (svga->rebind.flags.constbufs) {
458 buffer = svga_buffer(svga->state.hw_draw.constbuf[shader][0]);
460 ret = svga->swc->resource_rebind(svga->swc,
476 enabled_constbufs = svga->state.hw_draw.enabled_constbufs[shader] & ~1u;
479 buffer = svga_buffer(svga->curr.constbufs[shader][i].buffer);
485 handle = svga_buffer_handle(svga, &buffer->b,
488 handle = svga->state.hw_draw.constbufoffsets[shader][i].handle;
490 if (svga->rebind.flags.constbufs && handle) {
491 ret = svga->swc->resource_rebind(svga->swc,
503 unsigned enabled_rawbufs = svga->state.hw_draw.enabled_rawbufs[shader] & ~1u;
506 buffer = svga_buffer(svga->curr.constbufs[shader][i].buffer);
509 handle = svga_buffer_handle(svga, &buffer->b,
512 if (svga->rebind.flags.constbufs && handle) {
513 ret = svga->swc->resource_rebind(svga->swc,
522 svga->rebind.flags.constbufs = FALSE;
534 svga_validate_image_views(struct svga_context *svga,
538 bool rebind = svga->rebind.flags.images;
541 assert(svga_have_gl43(svga));
553 ret = svga_validate_image_view_resources(svga,
554 svga->state.hw_draw.num_image_views[shader],
555 &svga->state.hw_draw.image_views[shader][0], rebind);
561 svga->rebind.flags.images = FALSE;
573 svga_validate_shader_buffers(struct svga_context *svga,
577 bool rebind = svga->rebind.flags.shaderbufs;
580 assert(svga_have_gl43(svga));
592 ret = svga_validate_shader_buffer_resources(svga,
593 svga->state.hw_draw.num_shader_buffers[shader],
594 &svga->state.hw_draw.shader_buffers[shader][0], rebind);
600 svga->rebind.flags.shaderbufs = FALSE;
602 ret = svga_validate_shader_buffer_resources(svga,
603 svga->state.hw_draw.num_atomic_buffers,
604 svga->state.hw_draw.atomic_buffers,
605 svga->rebind.flags.atomicbufs);
610 svga->rebind.flags.atomicbufs = FALSE;
627 last_command_was_draw(const struct svga_context *svga)
629 switch (SVGA3D_GetLastCommand(svga->swc)) {
669 struct svga_context *svga = hwtnl->svga;
678 assert(svga_have_vgpu10(svga));
681 if (svga->state.hw_draw.layout_id != hwtnl->cmd.vdecl_layout_id) {
683 SVGA3D_vgpu10_SetInputLayout(svga->swc,
688 svga->state.hw_draw.layout_id = hwtnl->cmd.vdecl_layout_id;
696 so_vertex_count_handle = svga_buffer_handle(svga,
725 vbuffer_handles[i] = svga_buffer_handle(svga, &sbuf->b,
744 for (; i < svga->state.hw_draw.num_vbuffers; i++) {
759 vbuffer_handles[i] = svga_buffer_handle(svga, &sbuf->b,
773 for (; i < svga->state.hw_draw.num_vbuffers; i++) {
779 if (svga->state.hw_draw.layout_id != hwtnl->cmd.vdecl_layout_id) {
781 SVGA3D_vgpu10_SetInputLayout(svga->swc,
786 svga->state.hw_draw.layout_id = hwtnl->cmd.vdecl_layout_id;
791 so_vertex_count_handle = svga_buffer_handle(svga,
808 if (vbuf_count != svga->state.hw_draw.num_vbuffers ||
812 svga->state.hw_draw.vbuffer_attrs,
813 svga->state.hw_draw.vbuffers)) {
821 num_vbuffers = MAX2(vbuf_count, svga->state.hw_draw.num_vbuffers);
828 !svga_sws(svga)->have_index_vertex_buffer_offset_cmd ||
829 svga->rebind.flags.vertexbufs;
840 &svga->state.hw_draw.vbuffer_attrs[i],
841 &svga->state.hw_draw.vbuffers[i]);
845 (vbuffers[i] != svga->state.hw_draw.vbuffers[i]);
869 ret = SVGA3D_vgpu10_SetVertexBuffers(svga->swc,
874 ret = SVGA3D_vgpu10_SetVertexBuffersOffsetAndSize(svga->swc,
893 svga->state.hw_draw.num_vbuffers = last_vbuf + 1;
894 memcpy(svga->state.hw_draw.vbuffer_attrs, vbuffer_attrs,
897 pipe_resource_reference(&svga->state.hw_draw.vbuffers[i],
907 if (vbuffer_handles[i] && !last_command_was_draw(svga)) {
909 svga->swc->resource_rebind(svga->swc, vbuffer_handles[i],
918 svga->rebind.flags.vertexbufs = FALSE;
932 struct svga_context *svga = hwtnl->svga;
934 svga_buffer_handle(svga, ib, PIPE_BIND_INDEX_BUFFER);
946 if (ib != svga->state.hw_draw.ib ||
947 indexFormat != svga->state.hw_draw.ib_format ||
948 range->indexArray.offset != svga->state.hw_draw.ib_offset) {
952 if ((ib == svga->state.hw_draw.ib) &&
953 svga_sws(hwtnl->svga)->have_index_vertex_buffer_offset_cmd &&
954 !svga->rebind.flags.indexbuf) {
956 ret = SVGA3D_vgpu10_SetIndexBufferOffsetAndSize(svga->swc,
965 ret = SVGA3D_vgpu10_SetIndexBuffer(svga->swc, ib_handle,
972 pipe_resource_reference(&svga->state.hw_draw.ib, ib);
973 svga->state.hw_draw.ib_format = indexFormat;
974 svga->state.hw_draw.ib_offset = range->indexArray.offset;
980 if (!last_command_was_draw(svga)) {
981 enum pipe_error ret = svga->swc->resource_rebind(svga->swc,
990 svga->rebind.flags.indexbuf = FALSE;
1006 struct svga_context *svga = hwtnl->svga;
1010 assert(svga_have_vgpu10(svga));
1018 if (svga->rebind.val) {
1019 ret = svga_rebind_framebuffer_bindings(svga);
1023 ret = svga_rebind_shaders(svga);
1028 ret = svga_rebind_stream_output_targets(svga);
1039 ret = svga_validate_sampler_resources(svga, SVGA_PIPE_GRAPHICS);
1043 ret = svga_validate_constant_buffers(svga, SVGA_PIPE_GRAPHICS);
1047 if (svga_have_gl43(svga)) {
1048 ret = svga_validate_image_views(svga, SVGA_PIPE_GRAPHICS);
1052 ret = svga_validate_shader_buffers(svga, SVGA_PIPE_GRAPHICS);
1056 if (svga->rebind.flags.uav) {
1057 ret= svga_rebind_uav(svga);
1074 indirect_handle = svga_buffer_handle(svga, indirect->buffer,
1084 if (svga->state.hw_draw.topology != range->primType) {
1085 ret = SVGA3D_vgpu10_SetTopology(svga->swc, range->primType);
1089 svga->state.hw_draw.topology = range->primType;
1095 ret = SVGA3D_sm5_DrawIndexedInstancedIndirect(svga->swc,
1100 ret = SVGA3D_vgpu10_DrawIndexedInstanced(svga->swc,
1109 ret = SVGA3D_vgpu10_DrawIndexed(svga->swc,
1120 if (svga->state.hw_draw.ib_format != SVGA3D_FORMAT_INVALID ||
1121 svga->state.hw_draw.ib != NULL) {
1123 ret = SVGA3D_vgpu10_SetIndexBuffer(svga->swc, NULL,
1127 pipe_resource_reference(&svga->state.hw_draw.ib, NULL);
1128 svga->state.hw_draw.ib_format = SVGA3D_FORMAT_INVALID;
1131 assert(svga->state.hw_draw.ib == NULL);
1135 ret = SVGA3D_vgpu10_DrawAuto(svga->swc);
1138 ret = SVGA3D_sm5_DrawInstancedIndirect(svga->swc,
1143 ret = SVGA3D_vgpu10_DrawInstanced(svga->swc,
1151 ret = SVGA3D_vgpu10_Draw(svga->swc,
1179 SVGA_STATS_TIME_PUSH(svga_sws(hwtnl->svga), SVGA_STATS_TIME_HWTNLFLUSH);
1181 if (!svga_have_vgpu10(hwtnl->svga) && hwtnl->cmd.prim_count) {
1186 SVGA_STATS_TIME_POP(svga_screen(hwtnl->svga->pipe.screen)->sws);
1214 assert(!svga_have_vgpu10(hwtnl->svga));
1367 SVGA_STATS_TIME_PUSH(svga_sws(hwtnl->svga), SVGA_STATS_TIME_HWTNLPRIM);
1369 if (svga_have_vgpu10(hwtnl->svga)) {
1371 SVGA_RETRY(hwtnl->svga, draw_vgpu10(hwtnl, range, vcount, min_index,
1405 SVGA_STATS_TIME_POP(svga_screen(hwtnl->svga->pipe.screen)->sws);