1 /* 2 * Copyright (c) 2008-2024 Broadcom. All Rights Reserved. 3 * The term “Broadcom” refers to Broadcom Inc. 4 * and/or its subsidiaries. 5 * SPDX-License-Identifier: MIT 6 */ 7 8 #ifndef SVGA_STATE_H 9 #define SVGA_STATE_H 10 11 12 #include "util/compiler.h" 13 #include "pipe/p_defines.h" 14 15 struct svga_context; 16 17 18 void svga_init_state( struct svga_context *svga ); 19 void svga_destroy_state( struct svga_context *svga ); 20 21 22 struct svga_tracked_state { 23 const char *name; 24 uint64_t dirty; 25 enum pipe_error (*update)( struct svga_context *svga, uint64_t dirty ); 26 }; 27 28 /* NEED_SWTNL 29 */ 30 extern struct svga_tracked_state svga_update_need_swvfetch; 31 extern struct svga_tracked_state svga_update_need_pipeline; 32 extern struct svga_tracked_state svga_update_need_swtnl; 33 34 /* HW_CLEAR 35 */ 36 extern struct svga_tracked_state svga_hw_viewport; 37 extern struct svga_tracked_state svga_hw_scissor; 38 extern struct svga_tracked_state svga_hw_framebuffer; 39 40 /* HW_DRAW 41 */ 42 extern struct svga_tracked_state svga_need_tgsi_transform; 43 extern struct svga_tracked_state svga_hw_vs; 44 extern struct svga_tracked_state svga_hw_fs; 45 extern struct svga_tracked_state svga_hw_gs; 46 extern struct svga_tracked_state svga_hw_tcs; 47 extern struct svga_tracked_state svga_hw_tes; 48 extern struct svga_tracked_state svga_hw_rss; 49 extern struct svga_tracked_state svga_hw_pstipple; 50 extern struct svga_tracked_state svga_hw_sampler; 51 extern struct svga_tracked_state svga_hw_sampler_bindings; 52 extern struct svga_tracked_state svga_hw_tss; 53 extern struct svga_tracked_state svga_hw_tss_binding; 54 extern struct svga_tracked_state svga_hw_clip_planes; 55 extern struct svga_tracked_state svga_hw_vdecl; 56 extern struct svga_tracked_state svga_hw_fs_constants; 57 extern struct svga_tracked_state svga_hw_gs_constants; 58 extern struct svga_tracked_state svga_hw_vs_constants; 59 extern struct svga_tracked_state svga_hw_tes_constants; 60 extern struct svga_tracked_state svga_hw_tcs_constants; 61 extern struct svga_tracked_state svga_hw_cs_constants; 62 extern struct svga_tracked_state svga_hw_fs_constbufs; 63 extern struct svga_tracked_state svga_hw_vs_constbufs; 64 extern struct svga_tracked_state svga_hw_gs_constbufs; 65 extern struct svga_tracked_state svga_hw_tcs_constbufs; 66 extern struct svga_tracked_state svga_hw_tes_constbufs; 67 extern struct svga_tracked_state svga_hw_cs_constbufs; 68 extern struct svga_tracked_state svga_hw_uav; 69 70 extern struct svga_tracked_state svga_hw_cs; 71 extern struct svga_tracked_state svga_hw_cs_uav; 72 extern struct svga_tracked_state svga_hw_cs_sampler; 73 extern struct svga_tracked_state svga_hw_cs_sampler_bindings; 74 75 extern struct svga_tracked_state svga_need_rawbuf_srv; 76 extern struct svga_tracked_state svga_cs_need_rawbuf_srv; 77 78 /* SWTNL_DRAW 79 */ 80 extern struct svga_tracked_state svga_update_swtnl_draw; 81 extern struct svga_tracked_state svga_update_swtnl_vdecl; 82 83 /* Bring the hardware fully up-to-date so that we can emit draw 84 * commands. 85 */ 86 #define SVGA_STATE_NEED_SWTNL 0 87 #define SVGA_STATE_HW_CLEAR 1 88 #define SVGA_STATE_HW_DRAW 2 89 #define SVGA_STATE_SWTNL_DRAW 3 90 #define SVGA_STATE_MAX 4 91 92 93 enum pipe_error svga_update_state( struct svga_context *svga, 94 unsigned level ); 95 96 bool svga_update_state_retry(struct svga_context *svga, unsigned level); 97 98 enum pipe_error svga_emit_initial_state( struct svga_context *svga ); 99 100 enum pipe_error svga_reemit_framebuffer_bindings( struct svga_context *svga ); 101 102 enum pipe_error svga_rebind_framebuffer_bindings( struct svga_context *svga ); 103 104 enum pipe_error svga_reemit_tss_bindings( struct svga_context *svga ); 105 106 enum pipe_error svga_reemit_vs_bindings(struct svga_context *svga); 107 108 enum pipe_error svga_reemit_fs_bindings(struct svga_context *svga); 109 110 void svga_init_tracked_state(struct svga_context *svga); 111 112 void * 113 svga_create_fs_state(struct pipe_context *pipe, 114 const struct pipe_shader_state *templ); 115 116 void 117 svga_bind_fs_state(struct pipe_context *pipe, void *shader); 118 119 bool svga_update_compute_state(struct svga_context *svga); 120 121 #endif 122