mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
microsoft/spirv2dxil: Refactor to make SM and validator versions public
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19227>
This commit is contained in:
parent
677def1d4e
commit
0bf5bbb3e4
5 changed files with 66 additions and 27 deletions
|
|
@ -150,7 +150,7 @@ compile_nir(struct d3d12_context *ctx, struct d3d12_shader_selector *sel,
|
|||
opts.environment = DXIL_ENVIRONMENT_GL;
|
||||
static_assert(D3D_SHADER_MODEL_6_0 == 0x60 && SHADER_MODEL_6_0 == 0x60000, "Validating math below");
|
||||
static_assert(D3D_SHADER_MODEL_6_7 == 0x67 && SHADER_MODEL_6_7 == 0x60007, "Validating math below");
|
||||
opts.shader_model_max = ((screen->max_shader_model & 0xf0) << 12) | (screen->max_shader_model & 0xf);
|
||||
opts.shader_model_max = static_cast<dxil_shader_model>(((screen->max_shader_model & 0xf0) << 12) | (screen->max_shader_model & 0xf));
|
||||
#ifdef _WIN32
|
||||
opts.validator_version_max = dxil_get_validator_version(ctx->dxil_validator);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#ifndef DXIL_VALIDATOR_H
|
||||
#define DXIL_VALIDATOR_H
|
||||
|
||||
#include "dxil_versions.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
struct dxil_validator;
|
||||
|
|
@ -32,18 +34,6 @@ struct dxil_validator;
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum dxil_validator_version {
|
||||
NO_DXIL_VALIDATION,
|
||||
DXIL_VALIDATOR_1_0 = 0x10000,
|
||||
DXIL_VALIDATOR_1_1,
|
||||
DXIL_VALIDATOR_1_2,
|
||||
DXIL_VALIDATOR_1_3,
|
||||
DXIL_VALIDATOR_1_4,
|
||||
DXIL_VALIDATOR_1_5,
|
||||
DXIL_VALIDATOR_1_6,
|
||||
DXIL_VALIDATOR_1_7,
|
||||
};
|
||||
|
||||
struct dxil_validator *
|
||||
dxil_create_validator(const void *ctx);
|
||||
|
||||
|
|
|
|||
58
src/microsoft/compiler/dxil_versions.h
Normal file
58
src/microsoft/compiler/dxil_versions.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright © Microsoft Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef DXIL_VERSIONS_H
|
||||
#define DXIL_VERSIONS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum dxil_shader_model {
|
||||
SHADER_MODEL_6_0 = 0x60000,
|
||||
SHADER_MODEL_6_1,
|
||||
SHADER_MODEL_6_2,
|
||||
SHADER_MODEL_6_3,
|
||||
SHADER_MODEL_6_4,
|
||||
SHADER_MODEL_6_5,
|
||||
SHADER_MODEL_6_6,
|
||||
SHADER_MODEL_6_7,
|
||||
};
|
||||
|
||||
enum dxil_validator_version {
|
||||
NO_DXIL_VALIDATION,
|
||||
DXIL_VALIDATOR_1_0 = 0x10000,
|
||||
DXIL_VALIDATOR_1_1,
|
||||
DXIL_VALIDATOR_1_2,
|
||||
DXIL_VALIDATOR_1_3,
|
||||
DXIL_VALIDATOR_1_4,
|
||||
DXIL_VALIDATOR_1_5,
|
||||
DXIL_VALIDATOR_1_6,
|
||||
DXIL_VALIDATOR_1_7,
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
#include <stdbool.h>
|
||||
|
||||
#include "nir.h"
|
||||
#include "dxil_validator.h"
|
||||
#include "dxil_versions.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -81,17 +81,6 @@ enum dxil_environment {
|
|||
DXIL_ENVIRONMENT_VULKAN,
|
||||
};
|
||||
|
||||
enum dxil_shader_model {
|
||||
SHADER_MODEL_6_0 = 0x60000,
|
||||
SHADER_MODEL_6_1,
|
||||
SHADER_MODEL_6_2,
|
||||
SHADER_MODEL_6_3,
|
||||
SHADER_MODEL_6_4,
|
||||
SHADER_MODEL_6_5,
|
||||
SHADER_MODEL_6_6,
|
||||
SHADER_MODEL_6_7,
|
||||
};
|
||||
|
||||
struct nir_to_dxil_options {
|
||||
bool interpolate_at_vertex;
|
||||
bool lower_int16;
|
||||
|
|
@ -102,8 +91,8 @@ struct nir_to_dxil_options {
|
|||
unsigned num_kernel_globals;
|
||||
unsigned input_clip_size;
|
||||
enum dxil_environment environment;
|
||||
uint32_t shader_model_max;
|
||||
uint32_t validator_version_max;
|
||||
enum dxil_shader_model shader_model_max;
|
||||
enum dxil_validator_version validator_version_max;
|
||||
};
|
||||
|
||||
typedef void (*dxil_msg_callback)(void *priv, const char *msg);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#ifndef SPIRV_TO_DXIL_H
|
||||
#define SPIRV_TO_DXIL_H
|
||||
|
||||
#include "dxil_versions.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue