Path: blob/21.2-virgl/src/microsoft/compiler/dxil_container.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_CONTAINER_H24#define DXIL_CONTAINER_H2526#ifdef __cplusplus27extern "C" {28#endif2930#include "util/blob.h"3132#include "dxil_signature.h"3334#define DXIL_MAX_PARTS 835struct dxil_container {36struct blob parts;37unsigned part_offsets[DXIL_MAX_PARTS];38unsigned num_parts;39};4041enum dxil_resource_type {42DXIL_RES_INVALID = 0,43DXIL_RES_SAMPLER = 1,44DXIL_RES_CBV = 2,45DXIL_RES_SRV_TYPED = 3,46DXIL_RES_SRV_RAW = 4,47DXIL_RES_SRC_STRUCTURED = 5,48DXIL_RES_UAV_TYPED = 6,49DXIL_RES_UAV_RAW = 7,50DXIL_RES_UAV_STRUCTURED,51DXIL_RES_UAV_STRUCTURED_WITH_COUNTER,52DXIL_RES_NUM_ENTRIES /* should always be last */53};5455#define DXIL_FOURCC(ch0, ch1, ch2, ch3) ( \56(uint32_t)(ch0) | (uint32_t)(ch1) << 8 | \57(uint32_t)(ch2) << 16 | (uint32_t)(ch3) << 24)5859enum dxil_part_fourcc {60DXIL_RDEF = DXIL_FOURCC('R', 'D', 'E', 'F'),61DXIL_ISG1 = DXIL_FOURCC('I', 'S', 'G', '1'),62DXIL_OSG1 = DXIL_FOURCC('O', 'S', 'G', '1'),63DXIL_PSG1 = DXIL_FOURCC('P', 'S', 'G', '1'),64DXIL_STAT = DXIL_FOURCC('S', 'T', 'A', 'T'),65DXIL_ILDB = DXIL_FOURCC('I', 'L', 'D', 'B'),66DXIL_ILDN = DXIL_FOURCC('I', 'L', 'D', 'N'),67DXIL_SFI0 = DXIL_FOURCC('S', 'F', 'I', '0'),68DXIL_PRIV = DXIL_FOURCC('P', 'R', 'I', 'V'),69DXIL_RTS0 = DXIL_FOURCC('R', 'T', 'S', '0'),70DXIL_DXIL = DXIL_FOURCC('D', 'X', 'I', 'L'),71DXIL_PSV0 = DXIL_FOURCC('P', 'S', 'V', '0'),72DXIL_RDAT = DXIL_FOURCC('R', 'D', 'A', 'T'),73DXIL_HASH = DXIL_FOURCC('H', 'A', 'S', 'H'),74};7576struct dxil_resource {77uint32_t resource_type;78uint32_t space;79uint32_t lower_bound;80uint32_t upper_bound;81};8283struct dxil_validation_state {84struct dxil_psv_runtime_info_1 state;85const struct dxil_resource *resources;86uint32_t num_resources;87};8889void90dxil_container_init(struct dxil_container *c);9192void93dxil_container_finish(struct dxil_container *c);9495struct dxil_features;9697bool98dxil_container_add_features(struct dxil_container *c,99const struct dxil_features *features);100101102bool103dxil_container_add_io_signature(struct dxil_container *c,104enum dxil_part_fourcc part,105unsigned num_records,106struct dxil_signature_record *io);107108bool109dxil_container_add_state_validation(struct dxil_container *c,110const struct dxil_module *m,111struct dxil_validation_state *state);112113bool114dxil_container_add_module(struct dxil_container *c,115const struct dxil_module *m);116117bool118dxil_container_write(struct dxil_container *c, struct blob *blob);119120#ifdef __cplusplus121}122#endif123124#endif125126127