1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright © Microsoft Corporation 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 10bf215546Sopenharmony_ci * 11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next 12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 13bf215546Sopenharmony_ci * Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21bf215546Sopenharmony_ci * IN THE SOFTWARE. 22bf215546Sopenharmony_ci */ 23bf215546Sopenharmony_ci 24bf215546Sopenharmony_ci#ifndef D3D12_CONTEXT_H 25bf215546Sopenharmony_ci#define D3D12_CONTEXT_H 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_ci#include "d3d12_batch.h" 28bf215546Sopenharmony_ci#include "d3d12_descriptor_pool.h" 29bf215546Sopenharmony_ci#include "d3d12_pipeline_state.h" 30bf215546Sopenharmony_ci 31bf215546Sopenharmony_ci#include "dxil_nir_lower_int_samplers.h" 32bf215546Sopenharmony_ci 33bf215546Sopenharmony_ci#include "pipe/p_context.h" 34bf215546Sopenharmony_ci#include "pipe/p_state.h" 35bf215546Sopenharmony_ci#include "util/list.h" 36bf215546Sopenharmony_ci#include "util/slab.h" 37bf215546Sopenharmony_ci#include "util/u_suballoc.h" 38bf215546Sopenharmony_ci#include "util/u_threaded_context.h" 39bf215546Sopenharmony_ci 40bf215546Sopenharmony_ci#define D3D12_GFX_SHADER_STAGES (PIPE_SHADER_TYPES - 1) 41bf215546Sopenharmony_ci 42bf215546Sopenharmony_cienum d3d12_dirty_flags 43bf215546Sopenharmony_ci{ 44bf215546Sopenharmony_ci D3D12_DIRTY_NONE = 0, 45bf215546Sopenharmony_ci D3D12_DIRTY_BLEND = (1 << 0), 46bf215546Sopenharmony_ci D3D12_DIRTY_RASTERIZER = (1 << 1), 47bf215546Sopenharmony_ci D3D12_DIRTY_ZSA = (1 << 2), 48bf215546Sopenharmony_ci D3D12_DIRTY_VERTEX_ELEMENTS = (1 << 3), 49bf215546Sopenharmony_ci D3D12_DIRTY_BLEND_COLOR = (1 << 4), 50bf215546Sopenharmony_ci D3D12_DIRTY_STENCIL_REF = (1 << 5), 51bf215546Sopenharmony_ci D3D12_DIRTY_SAMPLE_MASK = (1 << 6), 52bf215546Sopenharmony_ci D3D12_DIRTY_VIEWPORT = (1 << 7), 53bf215546Sopenharmony_ci D3D12_DIRTY_FRAMEBUFFER = (1 << 8), 54bf215546Sopenharmony_ci D3D12_DIRTY_SCISSOR = (1 << 9), 55bf215546Sopenharmony_ci D3D12_DIRTY_VERTEX_BUFFERS = (1 << 10), 56bf215546Sopenharmony_ci D3D12_DIRTY_INDEX_BUFFER = (1 << 11), 57bf215546Sopenharmony_ci D3D12_DIRTY_PRIM_MODE = (1 << 12), 58bf215546Sopenharmony_ci D3D12_DIRTY_SHADER = (1 << 13), 59bf215546Sopenharmony_ci D3D12_DIRTY_ROOT_SIGNATURE = (1 << 14), 60bf215546Sopenharmony_ci D3D12_DIRTY_STREAM_OUTPUT = (1 << 15), 61bf215546Sopenharmony_ci D3D12_DIRTY_STRIP_CUT_VALUE = (1 << 16), 62bf215546Sopenharmony_ci D3D12_DIRTY_COMPUTE_SHADER = (1 << 17), 63bf215546Sopenharmony_ci D3D12_DIRTY_COMPUTE_ROOT_SIGNATURE = (1 << 18), 64bf215546Sopenharmony_ci}; 65bf215546Sopenharmony_ci 66bf215546Sopenharmony_cienum d3d12_shader_dirty_flags 67bf215546Sopenharmony_ci{ 68bf215546Sopenharmony_ci D3D12_SHADER_DIRTY_CONSTBUF = (1 << 0), 69bf215546Sopenharmony_ci D3D12_SHADER_DIRTY_SAMPLER_VIEWS = (1 << 1), 70bf215546Sopenharmony_ci D3D12_SHADER_DIRTY_SAMPLERS = (1 << 2), 71bf215546Sopenharmony_ci D3D12_SHADER_DIRTY_SSBO = (1 << 3), 72bf215546Sopenharmony_ci D3D12_SHADER_DIRTY_IMAGE = (1 << 4), 73bf215546Sopenharmony_ci}; 74bf215546Sopenharmony_ci 75bf215546Sopenharmony_ci#define D3D12_DIRTY_GFX_PSO (D3D12_DIRTY_BLEND | D3D12_DIRTY_RASTERIZER | D3D12_DIRTY_ZSA | \ 76bf215546Sopenharmony_ci D3D12_DIRTY_FRAMEBUFFER | D3D12_DIRTY_SAMPLE_MASK | \ 77bf215546Sopenharmony_ci D3D12_DIRTY_VERTEX_ELEMENTS | D3D12_DIRTY_PRIM_MODE | \ 78bf215546Sopenharmony_ci D3D12_DIRTY_SHADER | D3D12_DIRTY_ROOT_SIGNATURE | \ 79bf215546Sopenharmony_ci D3D12_DIRTY_STRIP_CUT_VALUE | D3D12_DIRTY_STREAM_OUTPUT) 80bf215546Sopenharmony_ci#define D3D12_DIRTY_COMPUTE_PSO (D3D12_DIRTY_COMPUTE_SHADER | D3D12_DIRTY_COMPUTE_ROOT_SIGNATURE) 81bf215546Sopenharmony_ci 82bf215546Sopenharmony_ci#define D3D12_DIRTY_COMPUTE_MASK (D3D12_DIRTY_COMPUTE_SHADER | D3D12_DIRTY_COMPUTE_ROOT_SIGNATURE) 83bf215546Sopenharmony_ci#define D3D12_DIRTY_GFX_MASK ~D3D12_DIRTY_COMPUTE_MASK 84bf215546Sopenharmony_ci 85bf215546Sopenharmony_ci 86bf215546Sopenharmony_ci#define D3D12_SHADER_DIRTY_ALL (D3D12_SHADER_DIRTY_CONSTBUF | D3D12_SHADER_DIRTY_SAMPLER_VIEWS | \ 87bf215546Sopenharmony_ci D3D12_SHADER_DIRTY_SAMPLERS | D3D12_SHADER_DIRTY_SSBO | \ 88bf215546Sopenharmony_ci D3D12_SHADER_DIRTY_IMAGE) 89bf215546Sopenharmony_ci 90bf215546Sopenharmony_cienum d3d12_binding_type { 91bf215546Sopenharmony_ci D3D12_BINDING_CONSTANT_BUFFER, 92bf215546Sopenharmony_ci D3D12_BINDING_SHADER_RESOURCE_VIEW, 93bf215546Sopenharmony_ci D3D12_BINDING_SAMPLER, 94bf215546Sopenharmony_ci D3D12_BINDING_STATE_VARS, 95bf215546Sopenharmony_ci D3D12_BINDING_SSBO, 96bf215546Sopenharmony_ci D3D12_BINDING_IMAGE, 97bf215546Sopenharmony_ci D3D12_NUM_BINDING_TYPES 98bf215546Sopenharmony_ci}; 99bf215546Sopenharmony_ci 100bf215546Sopenharmony_cistruct d3d12_sampler_state { 101bf215546Sopenharmony_ci struct d3d12_descriptor_handle handle, handle_without_shadow; 102bf215546Sopenharmony_ci bool is_integer_texture; 103bf215546Sopenharmony_ci bool is_shadow_sampler; 104bf215546Sopenharmony_ci enum pipe_tex_wrap wrap_r; 105bf215546Sopenharmony_ci enum pipe_tex_wrap wrap_s; 106bf215546Sopenharmony_ci enum pipe_tex_wrap wrap_t; 107bf215546Sopenharmony_ci enum pipe_tex_filter filter; 108bf215546Sopenharmony_ci float lod_bias; 109bf215546Sopenharmony_ci float min_lod, max_lod; 110bf215546Sopenharmony_ci float border_color[4]; 111bf215546Sopenharmony_ci enum pipe_compare_func compare_func; 112bf215546Sopenharmony_ci}; 113bf215546Sopenharmony_ci 114bf215546Sopenharmony_cienum d3d12_blend_factor_flags { 115bf215546Sopenharmony_ci D3D12_BLEND_FACTOR_NONE = 0, 116bf215546Sopenharmony_ci D3D12_BLEND_FACTOR_COLOR = 1 << 0, 117bf215546Sopenharmony_ci D3D12_BLEND_FACTOR_ALPHA = 1 << 1, 118bf215546Sopenharmony_ci D3D12_BLEND_FACTOR_ANY = 1 << 2, 119bf215546Sopenharmony_ci}; 120bf215546Sopenharmony_ci 121bf215546Sopenharmony_cistruct d3d12_sampler_view { 122bf215546Sopenharmony_ci struct pipe_sampler_view base; 123bf215546Sopenharmony_ci struct d3d12_descriptor_handle handle; 124bf215546Sopenharmony_ci unsigned mip_levels; 125bf215546Sopenharmony_ci unsigned array_size; 126bf215546Sopenharmony_ci unsigned texture_generation_id; 127bf215546Sopenharmony_ci unsigned swizzle_override_r:3; /**< PIPE_SWIZZLE_x for red component */ 128bf215546Sopenharmony_ci unsigned swizzle_override_g:3; /**< PIPE_SWIZZLE_x for green component */ 129bf215546Sopenharmony_ci unsigned swizzle_override_b:3; /**< PIPE_SWIZZLE_x for blue component */ 130bf215546Sopenharmony_ci unsigned swizzle_override_a:3; /**< PIPE_SWIZZLE_x for alpha component */ 131bf215546Sopenharmony_ci}; 132bf215546Sopenharmony_ci 133bf215546Sopenharmony_cistatic inline struct d3d12_sampler_view * 134bf215546Sopenharmony_cid3d12_sampler_view(struct pipe_sampler_view *pview) 135bf215546Sopenharmony_ci{ 136bf215546Sopenharmony_ci return (struct d3d12_sampler_view *)pview; 137bf215546Sopenharmony_ci} 138bf215546Sopenharmony_ci 139bf215546Sopenharmony_cistruct d3d12_stream_output_target { 140bf215546Sopenharmony_ci struct pipe_stream_output_target base; 141bf215546Sopenharmony_ci struct pipe_resource *fill_buffer; 142bf215546Sopenharmony_ci unsigned fill_buffer_offset; 143bf215546Sopenharmony_ci}; 144bf215546Sopenharmony_ci 145bf215546Sopenharmony_cistruct d3d12_shader_state { 146bf215546Sopenharmony_ci struct d3d12_shader *current; 147bf215546Sopenharmony_ci unsigned state_dirty; 148bf215546Sopenharmony_ci}; 149bf215546Sopenharmony_ci 150bf215546Sopenharmony_cistruct blitter_context; 151bf215546Sopenharmony_cistruct primconvert_context; 152bf215546Sopenharmony_ci 153bf215546Sopenharmony_ci#ifdef _WIN32 154bf215546Sopenharmony_cistruct dxil_validator; 155bf215546Sopenharmony_ci#endif 156bf215546Sopenharmony_ci 157bf215546Sopenharmony_ci#ifdef __cplusplus 158bf215546Sopenharmony_ciclass ResourceStateManager; 159bf215546Sopenharmony_ci#endif 160bf215546Sopenharmony_ci 161bf215546Sopenharmony_cistruct d3d12_context { 162bf215546Sopenharmony_ci struct pipe_context base; 163bf215546Sopenharmony_ci struct slab_child_pool transfer_pool; 164bf215546Sopenharmony_ci struct slab_child_pool transfer_pool_unsync; 165bf215546Sopenharmony_ci struct list_head context_list_entry; 166bf215546Sopenharmony_ci struct threaded_context *threaded_context; 167bf215546Sopenharmony_ci struct primconvert_context *primconvert; 168bf215546Sopenharmony_ci struct blitter_context *blitter; 169bf215546Sopenharmony_ci struct u_suballocator query_allocator; 170bf215546Sopenharmony_ci struct u_suballocator so_allocator; 171bf215546Sopenharmony_ci struct hash_table *pso_cache; 172bf215546Sopenharmony_ci struct hash_table *compute_pso_cache; 173bf215546Sopenharmony_ci struct hash_table *root_signature_cache; 174bf215546Sopenharmony_ci struct hash_table *cmd_signature_cache; 175bf215546Sopenharmony_ci struct hash_table *gs_variant_cache; 176bf215546Sopenharmony_ci struct hash_table *tcs_variant_cache; 177bf215546Sopenharmony_ci struct hash_table *compute_transform_cache; 178bf215546Sopenharmony_ci struct hash_table_u64 *bo_state_table; 179bf215546Sopenharmony_ci 180bf215546Sopenharmony_ci struct d3d12_batch batches[4]; 181bf215546Sopenharmony_ci unsigned current_batch_idx; 182bf215546Sopenharmony_ci 183bf215546Sopenharmony_ci struct util_dynarray recently_destroyed_bos; 184bf215546Sopenharmony_ci struct util_dynarray barrier_scratch; 185bf215546Sopenharmony_ci struct set *pending_barriers_bos; 186bf215546Sopenharmony_ci 187bf215546Sopenharmony_ci struct pipe_constant_buffer cbufs[PIPE_SHADER_TYPES][PIPE_MAX_CONSTANT_BUFFERS]; 188bf215546Sopenharmony_ci struct pipe_framebuffer_state fb; 189bf215546Sopenharmony_ci struct pipe_vertex_buffer vbs[PIPE_MAX_ATTRIBS]; 190bf215546Sopenharmony_ci D3D12_VERTEX_BUFFER_VIEW vbvs[PIPE_MAX_ATTRIBS]; 191bf215546Sopenharmony_ci unsigned num_vbs; 192bf215546Sopenharmony_ci float flip_y; 193bf215546Sopenharmony_ci bool need_zero_one_depth_range; 194bf215546Sopenharmony_ci enum pipe_prim_type initial_api_prim; 195bf215546Sopenharmony_ci struct pipe_viewport_state viewport_states[PIPE_MAX_VIEWPORTS]; 196bf215546Sopenharmony_ci D3D12_VIEWPORT viewports[PIPE_MAX_VIEWPORTS]; 197bf215546Sopenharmony_ci unsigned num_viewports; 198bf215546Sopenharmony_ci struct pipe_scissor_state scissor_states[PIPE_MAX_VIEWPORTS]; 199bf215546Sopenharmony_ci D3D12_RECT scissors[PIPE_MAX_VIEWPORTS]; 200bf215546Sopenharmony_ci float blend_factor[4]; 201bf215546Sopenharmony_ci struct pipe_stencil_ref stencil_ref; 202bf215546Sopenharmony_ci struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_SAMPLER_VIEWS]; 203bf215546Sopenharmony_ci unsigned num_sampler_views[PIPE_SHADER_TYPES]; 204bf215546Sopenharmony_ci unsigned has_int_samplers; 205bf215546Sopenharmony_ci struct pipe_shader_buffer ssbo_views[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_BUFFERS]; 206bf215546Sopenharmony_ci unsigned num_ssbo_views[PIPE_SHADER_TYPES]; 207bf215546Sopenharmony_ci struct pipe_image_view image_views[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_IMAGES]; 208bf215546Sopenharmony_ci enum pipe_format image_view_emulation_formats[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_IMAGES]; 209bf215546Sopenharmony_ci unsigned num_image_views[PIPE_SHADER_TYPES]; 210bf215546Sopenharmony_ci struct d3d12_sampler_state *samplers[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; 211bf215546Sopenharmony_ci unsigned num_samplers[PIPE_SHADER_TYPES]; 212bf215546Sopenharmony_ci D3D12_INDEX_BUFFER_VIEW ibv; 213bf215546Sopenharmony_ci dxil_wrap_sampler_state tex_wrap_states[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_SAMPLER_VIEWS]; 214bf215546Sopenharmony_ci dxil_texture_swizzle_state tex_swizzle_state[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_SAMPLER_VIEWS]; 215bf215546Sopenharmony_ci enum compare_func tex_compare_func[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_SAMPLER_VIEWS]; 216bf215546Sopenharmony_ci 217bf215546Sopenharmony_ci struct { 218bf215546Sopenharmony_ci bool enabled; 219bf215546Sopenharmony_ci uint32_t pattern[32]; 220bf215546Sopenharmony_ci struct pipe_resource *texture; 221bf215546Sopenharmony_ci struct pipe_sampler_view *sampler_view; 222bf215546Sopenharmony_ci struct d3d12_sampler_state *sampler_cso; 223bf215546Sopenharmony_ci } pstipple; 224bf215546Sopenharmony_ci 225bf215546Sopenharmony_ci struct pipe_stream_output_target *so_targets[PIPE_MAX_SO_BUFFERS]; 226bf215546Sopenharmony_ci D3D12_STREAM_OUTPUT_BUFFER_VIEW so_buffer_views[PIPE_MAX_SO_BUFFERS]; 227bf215546Sopenharmony_ci struct pipe_stream_output_target *fake_so_targets[PIPE_MAX_SO_BUFFERS]; 228bf215546Sopenharmony_ci D3D12_STREAM_OUTPUT_BUFFER_VIEW fake_so_buffer_views[PIPE_MAX_SO_BUFFERS]; 229bf215546Sopenharmony_ci unsigned fake_so_buffer_factor; 230bf215546Sopenharmony_ci uint8_t patch_vertices; 231bf215546Sopenharmony_ci float default_outer_tess_factor[4]; 232bf215546Sopenharmony_ci float default_inner_tess_factor[2]; 233bf215546Sopenharmony_ci 234bf215546Sopenharmony_ci struct d3d12_shader_selector *gfx_stages[D3D12_GFX_SHADER_STAGES]; 235bf215546Sopenharmony_ci struct d3d12_shader_selector *compute_state; 236bf215546Sopenharmony_ci 237bf215546Sopenharmony_ci struct d3d12_gfx_pipeline_state gfx_pipeline_state; 238bf215546Sopenharmony_ci struct d3d12_compute_pipeline_state compute_pipeline_state; 239bf215546Sopenharmony_ci unsigned shader_dirty[PIPE_SHADER_TYPES]; 240bf215546Sopenharmony_ci unsigned state_dirty; 241bf215546Sopenharmony_ci unsigned cmdlist_dirty; 242bf215546Sopenharmony_ci ID3D12PipelineState *current_gfx_pso; 243bf215546Sopenharmony_ci ID3D12PipelineState *current_compute_pso; 244bf215546Sopenharmony_ci uint16_t reverse_depth_range; 245bf215546Sopenharmony_ci 246bf215546Sopenharmony_ci uint64_t submit_id; 247bf215546Sopenharmony_ci ID3D12GraphicsCommandList *cmdlist; 248bf215546Sopenharmony_ci ID3D12GraphicsCommandList *state_fixup_cmdlist; 249bf215546Sopenharmony_ci 250bf215546Sopenharmony_ci struct list_head active_queries; 251bf215546Sopenharmony_ci bool queries_disabled; 252bf215546Sopenharmony_ci 253bf215546Sopenharmony_ci struct d3d12_descriptor_pool *sampler_pool; 254bf215546Sopenharmony_ci struct d3d12_descriptor_handle null_sampler; 255bf215546Sopenharmony_ci 256bf215546Sopenharmony_ci PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE D3D12SerializeVersionedRootSignature; 257bf215546Sopenharmony_ci#ifdef _WIN32 258bf215546Sopenharmony_ci struct dxil_validator *dxil_validator; 259bf215546Sopenharmony_ci#endif 260bf215546Sopenharmony_ci 261bf215546Sopenharmony_ci struct d3d12_resource *current_predication; 262bf215546Sopenharmony_ci bool predication_condition; 263bf215546Sopenharmony_ci 264bf215546Sopenharmony_ci uint32_t transform_state_vars[4]; 265bf215546Sopenharmony_ci 266bf215546Sopenharmony_ci#ifdef __cplusplus 267bf215546Sopenharmony_ci ResourceStateManager *resource_state_manager; 268bf215546Sopenharmony_ci#else 269bf215546Sopenharmony_ci void *resource_state_manager; /* opaque pointer; we don't know about classes in C */ 270bf215546Sopenharmony_ci#endif 271bf215546Sopenharmony_ci struct pipe_query *timestamp_query; 272bf215546Sopenharmony_ci 273bf215546Sopenharmony_ci /* used by d3d12_blit.cpp */ 274bf215546Sopenharmony_ci void *stencil_resolve_vs, *stencil_resolve_fs, *stencil_resolve_fs_no_flip, *sampler_state; 275bf215546Sopenharmony_ci}; 276bf215546Sopenharmony_ci 277bf215546Sopenharmony_cistatic inline struct d3d12_context * 278bf215546Sopenharmony_cid3d12_context(struct pipe_context *context) 279bf215546Sopenharmony_ci{ 280bf215546Sopenharmony_ci return (struct d3d12_context *)context; 281bf215546Sopenharmony_ci} 282bf215546Sopenharmony_ci 283bf215546Sopenharmony_cistatic inline struct d3d12_batch * 284bf215546Sopenharmony_cid3d12_current_batch(struct d3d12_context *ctx) 285bf215546Sopenharmony_ci{ 286bf215546Sopenharmony_ci assert(ctx->current_batch_idx < ARRAY_SIZE(ctx->batches)); 287bf215546Sopenharmony_ci return ctx->batches + ctx->current_batch_idx; 288bf215546Sopenharmony_ci} 289bf215546Sopenharmony_ci 290bf215546Sopenharmony_ci#define d3d12_foreach_submitted_batch(ctx, batch) \ 291bf215546Sopenharmony_ci unsigned oldest = (ctx->current_batch_idx + 1) % ARRAY_SIZE(ctx->batches); \ 292bf215546Sopenharmony_ci while (ctx->batches[oldest].fence == NULL && oldest != ctx->current_batch_idx) \ 293bf215546Sopenharmony_ci oldest = (oldest + 1) % ARRAY_SIZE(ctx->batches); \ 294bf215546Sopenharmony_ci struct d3d12_batch *batch = &ctx->batches[oldest]; \ 295bf215546Sopenharmony_ci for (; oldest != ctx->current_batch_idx; \ 296bf215546Sopenharmony_ci oldest = (oldest + 1) % ARRAY_SIZE(ctx->batches), \ 297bf215546Sopenharmony_ci batch = &ctx->batches[oldest]) 298bf215546Sopenharmony_ci 299bf215546Sopenharmony_cistruct pipe_context * 300bf215546Sopenharmony_cid3d12_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags); 301bf215546Sopenharmony_ci 302bf215546Sopenharmony_cibool 303bf215546Sopenharmony_cid3d12_enable_fake_so_buffers(struct d3d12_context *ctx, unsigned factor); 304bf215546Sopenharmony_ci 305bf215546Sopenharmony_cibool 306bf215546Sopenharmony_cid3d12_disable_fake_so_buffers(struct d3d12_context *ctx); 307bf215546Sopenharmony_ci 308bf215546Sopenharmony_civoid 309bf215546Sopenharmony_cid3d12_flush_cmdlist(struct d3d12_context *ctx); 310bf215546Sopenharmony_ci 311bf215546Sopenharmony_civoid 312bf215546Sopenharmony_cid3d12_flush_cmdlist_and_wait(struct d3d12_context *ctx); 313bf215546Sopenharmony_ci 314bf215546Sopenharmony_ci 315bf215546Sopenharmony_cienum d3d12_transition_flags { 316bf215546Sopenharmony_ci D3D12_TRANSITION_FLAG_NONE = 0, 317bf215546Sopenharmony_ci D3D12_TRANSITION_FLAG_INVALIDATE_BINDINGS = 1, 318bf215546Sopenharmony_ci D3D12_TRANSITION_FLAG_ACCUMULATE_STATE = 2, 319bf215546Sopenharmony_ci}; 320bf215546Sopenharmony_ci 321bf215546Sopenharmony_civoid 322bf215546Sopenharmony_cid3d12_transition_resource_state(struct d3d12_context* ctx, 323bf215546Sopenharmony_ci struct d3d12_resource* res, 324bf215546Sopenharmony_ci D3D12_RESOURCE_STATES state, 325bf215546Sopenharmony_ci d3d12_transition_flags flags); 326bf215546Sopenharmony_ci 327bf215546Sopenharmony_civoid 328bf215546Sopenharmony_cid3d12_transition_subresources_state(struct d3d12_context *ctx, 329bf215546Sopenharmony_ci struct d3d12_resource *res, 330bf215546Sopenharmony_ci unsigned start_level, unsigned num_levels, 331bf215546Sopenharmony_ci unsigned start_layer, unsigned num_layers, 332bf215546Sopenharmony_ci unsigned start_plane, unsigned num_planes, 333bf215546Sopenharmony_ci D3D12_RESOURCE_STATES state, 334bf215546Sopenharmony_ci d3d12_transition_flags flags); 335bf215546Sopenharmony_ci 336bf215546Sopenharmony_civoid 337bf215546Sopenharmony_cid3d12_apply_resource_states(struct d3d12_context* ctx, bool is_implicit_dispatch); 338bf215546Sopenharmony_ci 339bf215546Sopenharmony_civoid 340bf215546Sopenharmony_cid3d12_draw_vbo(struct pipe_context *pctx, 341bf215546Sopenharmony_ci const struct pipe_draw_info *dinfo, 342bf215546Sopenharmony_ci unsigned drawid_offset, 343bf215546Sopenharmony_ci const struct pipe_draw_indirect_info *indirect, 344bf215546Sopenharmony_ci const struct pipe_draw_start_count_bias *draws, 345bf215546Sopenharmony_ci unsigned num_draws); 346bf215546Sopenharmony_ci 347bf215546Sopenharmony_civoid 348bf215546Sopenharmony_cid3d12_launch_grid(struct pipe_context *pctx, 349bf215546Sopenharmony_ci const struct pipe_grid_info *info); 350bf215546Sopenharmony_ci 351bf215546Sopenharmony_civoid 352bf215546Sopenharmony_cid3d12_blit(struct pipe_context *pctx, 353bf215546Sopenharmony_ci const struct pipe_blit_info *info); 354bf215546Sopenharmony_ci 355bf215546Sopenharmony_civoid 356bf215546Sopenharmony_cid3d12_context_query_init(struct pipe_context *pctx); 357bf215546Sopenharmony_ci 358bf215546Sopenharmony_cibool 359bf215546Sopenharmony_cid3d12_need_zero_one_depth_range(struct d3d12_context *ctx); 360bf215546Sopenharmony_ci 361bf215546Sopenharmony_civoid 362bf215546Sopenharmony_cid3d12_init_sampler_view_descriptor(struct d3d12_sampler_view *sampler_view); 363bf215546Sopenharmony_ci 364bf215546Sopenharmony_civoid 365bf215546Sopenharmony_cid3d12_invalidate_context_bindings(struct d3d12_context *ctx, struct d3d12_resource *res); 366bf215546Sopenharmony_ci 367bf215546Sopenharmony_ci#ifdef HAVE_GALLIUM_D3D12_VIDEO 368bf215546Sopenharmony_cistruct pipe_video_codec* d3d12_video_create_codec( struct pipe_context *context, 369bf215546Sopenharmony_ci const struct pipe_video_codec *t); 370bf215546Sopenharmony_ci#endif 371bf215546Sopenharmony_ci 372bf215546Sopenharmony_ci#endif 373