Path: blob/21.2-virgl/src/gallium/drivers/d3d12/d3d12_pipeline_state.h
4570 views
/*1* Copyright © Microsoft Corporation2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#ifndef D3D12_PIPELINE_STATE_H24#define D3D12_PIPELINE_STATE_H2526#include "pipe/p_state.h"2728#ifndef _WIN3229#include <wsl/winadapter.h>30#endif3132#define D3D12_IGNORE_SDK_LAYERS33#include <directx/d3d12.h>3435struct d3d12_context;36struct d3d12_root_signature;3738struct d3d12_vertex_elements_state {39D3D12_INPUT_ELEMENT_DESC elements[PIPE_MAX_ATTRIBS];40enum pipe_format format_conversion[PIPE_MAX_ATTRIBS];41unsigned num_elements:6; // <= PIPE_MAX_ATTRIBS42unsigned needs_format_emulation:1;43unsigned unused:25;44};4546struct d3d12_rasterizer_state {47struct pipe_rasterizer_state base;48D3D12_RASTERIZER_DESC desc;49void *twoface_back;50};5152struct d3d12_blend_state {53D3D12_BLEND_DESC desc;54unsigned blend_factor_flags;55bool is_dual_src;56};5758struct d3d12_depth_stencil_alpha_state {59D3D12_DEPTH_STENCIL_DESC desc;60};6162struct d3d12_gfx_pipeline_state {63ID3D12RootSignature *root_signature;64struct d3d12_shader *stages[PIPE_SHADER_TYPES - 1];65struct pipe_stream_output_info so_info;6667struct d3d12_vertex_elements_state *ves;68struct d3d12_blend_state *blend;69struct d3d12_depth_stencil_alpha_state *zsa;70struct d3d12_rasterizer_state *rast;7172unsigned samples;73unsigned sample_mask;74unsigned num_cbufs;75unsigned num_so_targets;76bool has_float_rtv;77DXGI_FORMAT rtv_formats[8];78DXGI_FORMAT dsv_format;79D3D12_INDEX_BUFFER_STRIP_CUT_VALUE ib_strip_cut_value;80enum pipe_prim_type prim_type;81};8283DXGI_FORMAT84d3d12_rtv_format(struct d3d12_context *ctx, unsigned index);8586void87d3d12_gfx_pipeline_state_cache_init(struct d3d12_context *ctx);8889void90d3d12_gfx_pipeline_state_cache_destroy(struct d3d12_context *ctx);9192ID3D12PipelineState *93d3d12_get_gfx_pipeline_state(struct d3d12_context *ctx);9495void96d3d12_gfx_pipeline_state_cache_invalidate(struct d3d12_context *ctx, const void *state);9798void99d3d12_gfx_pipeline_state_cache_invalidate_shader(struct d3d12_context *ctx,100enum pipe_shader_type stage,101struct d3d12_shader_selector *selector);102103#endif104105106