Path: blob/21.2-virgl/src/microsoft/compiler/dxil_signature.h
4564 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 DXIL_SIGNATURE_H24#define DXIL_SIGNATURE_H2526#include "dxil_enums.h"27#include "nir.h"28#include "util/string_buffer.h"2930#ifdef __cplusplus31extern "C" {32#endif3334/* struct taken from DXILContainer35* Enums values were replaced by uint32_t since they must occupy 32 bit36*/3738struct dxil_signature_element {39uint32_t stream; // Stream index (parameters must appear in non-decreasing stream order)40uint32_t semantic_name_offset; // Offset to char * stream from start of DxilProgramSignature.41uint32_t semantic_index; // Semantic Index42uint32_t system_value; // Semantic type. Similar to DxilSemantic::Kind, but a serialized rather than processing rep.43uint32_t comp_type; // Type of bits.44uint32_t reg; // Register Index (row index)45uint8_t mask; // Mask (column allocation)46union { // Unconditional cases useful for validation of shader linkage.47uint8_t never_writes_mask; // For an output signature, the shader the signature belongs to never48// writes the masked components of the output register.49uint8_t always_reads_mask; // For an input signature, the shader the signature belongs to always50// reads the masked components of the input register.51};52uint16_t pad;53uint32_t min_precision; // Minimum precision of input/output data54};5556struct dxil_signature_record {57struct dxil_signature_element elements[32];58unsigned num_elements;59const char *sysvalue;60char *name;61};6263struct dxil_psv_sem_index_table {64uint32_t data[80];65uint32_t size;66};6768struct dxil_psv_signature_element {69uint32_t semantic_name_offset; // Offset into StringTable70uint32_t semantic_indexes_offset; // Offset into PSVSemanticIndexTable, count == Rows71uint8_t rows; // Number of rows this element occupies72uint8_t start_row; // Starting row of packing location if allocated73uint8_t cols_and_start; // 0:4 = Cols, 4:6 = StartCol, 6:7 == Allocated74uint8_t semantic_kind; // PSVSemanticKind75uint8_t component_type; // DxilProgramSigCompType76uint8_t interpolation_mode; // DXIL::InterpolationMode or D3D10_SB_INTERPOLATION_MODE77uint8_t dynamic_mask_and_stream; // 0:4 = DynamicIndexMask, 4:6 = OutputStream (0-3)78uint8_t reserved;79};8081struct dxil_psv_runtime_info_0 {82union {83struct {84char output_position_present;85} vs;8687struct {88uint32_t input_primitive;89uint32_t output_toplology;90uint32_t output_stream_mask;91char output_position_present;92} gs;9394struct {95char depth_output;96char sample_frequency;97} ps;9899/* Maximum sized defining the union size (MSInfo)*/100struct {101uint32_t dummy1[3];102uint16_t dummy2[2];103} dummy;104};105uint32_t min_expected_wave_lane_count; // minimum lane count required, 0 if unused106uint32_t max_expected_wave_lane_count; // maximum lane count required, 0xffffffff if unused107};108109struct dxil_psv_runtime_info_1 {110struct dxil_psv_runtime_info_0 psv0;111uint8_t shader_stage; // PSVShaderKind112uint8_t uses_view_id;113union {114uint16_t max_vertex_count; // MaxVertexCount for GS only (max 1024)115uint8_t sig_patch_const_or_prim_vectors; // Output for HS; Input for DS; Primitive output for MS (overlaps MS1::SigPrimVectors)116// struct { uint8_t dummy[2]; } fill;117};118119// PSVSignatureElement counts120uint8_t sig_input_elements;121uint8_t sig_output_elements;122uint8_t sig_patch_const_or_prim_elements;123124// Number of packed vectors per signature125uint8_t sig_input_vectors;126uint8_t sig_output_vectors[4];127};128129struct dxil_mdnode;130struct dxil_module;131132const struct dxil_mdnode *133get_signatures(struct dxil_module *mod, nir_shader *s, bool vulkan);134135#ifdef __cplusplus136}137#endif138139#endif140141142