vkd3d-shader/spirv: Avoid using DXBC-specific definitions.

This commit is contained in:
Zebediah Figura 2022-03-12 15:47:38 -06:00 committed by Alexandre Julliard
parent ba08825ccd
commit e2aed38509
Notes: Alexandre Julliard 2022-11-08 23:05:02 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/45
3 changed files with 11 additions and 6 deletions

View File

@ -21,6 +21,10 @@
#include "vkd3d_shader_private.h"
#include "sm4.h"
#define SM4_MAX_SRC_COUNT 6
STATIC_ASSERT(SM4_MAX_SRC_COUNT <= SPIRV_MAX_SRC_COUNT);
void dxbc_writer_init(struct dxbc_writer *dxbc)
{
memset(dxbc, 0, sizeof(*dxbc));
@ -91,7 +95,7 @@ struct vkd3d_shader_sm4_parser
unsigned int output_map[MAX_REG_OUTPUT];
struct vkd3d_shader_src_param src_param[VKD3D_DXBC_MAX_SOURCE_COUNT];
struct vkd3d_shader_src_param src_param[SM4_MAX_SRC_COUNT];
struct vkd3d_shader_dst_param dst_param[2];
struct list src_free;
struct list src;

View File

@ -6938,7 +6938,7 @@ static void spirv_compiler_emit_alu_instruction(struct spirv_compiler *compiler,
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
const struct vkd3d_shader_dst_param *dst = instruction->dst;
const struct vkd3d_shader_src_param *src = instruction->src;
uint32_t src_ids[VKD3D_DXBC_MAX_SOURCE_COUNT];
uint32_t src_ids[SPIRV_MAX_SRC_COUNT];
uint32_t type_id, val_id;
unsigned int i;
SpvOp op;
@ -6951,7 +6951,7 @@ static void spirv_compiler_emit_alu_instruction(struct spirv_compiler *compiler,
}
assert(instruction->dst_count == 1);
assert(instruction->src_count <= VKD3D_DXBC_MAX_SOURCE_COUNT);
assert(instruction->src_count <= SPIRV_MAX_SRC_COUNT);
type_id = spirv_compiler_get_type_id_for_dst(compiler, dst);
@ -7031,7 +7031,7 @@ static void spirv_compiler_emit_ext_glsl_instruction(struct spirv_compiler *comp
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
const struct vkd3d_shader_dst_param *dst = instruction->dst;
const struct vkd3d_shader_src_param *src = instruction->src;
uint32_t src_id[VKD3D_DXBC_MAX_SOURCE_COUNT];
uint32_t src_id[SPIRV_MAX_SRC_COUNT];
uint32_t instr_set_id, type_id, val_id;
enum GLSLstd450 glsl_inst;
unsigned int i;
@ -7046,7 +7046,7 @@ static void spirv_compiler_emit_ext_glsl_instruction(struct spirv_compiler *comp
instr_set_id = vkd3d_spirv_get_glsl_std450_instr_set(builder);
assert(instruction->dst_count == 1);
assert(instruction->src_count <= VKD3D_DXBC_MAX_SOURCE_COUNT);
assert(instruction->src_count <= SPIRV_MAX_SRC_COUNT);
type_id = spirv_compiler_get_type_id_for_dst(compiler, dst);

View File

@ -1085,6 +1085,8 @@ int vkd3d_glsl_generator_generate(struct vkd3d_glsl_generator *generator,
struct vkd3d_shader_parser *parser, struct vkd3d_shader_code *out);
void vkd3d_glsl_generator_destroy(struct vkd3d_glsl_generator *generator);
#define SPIRV_MAX_SRC_COUNT 6
struct spirv_compiler;
struct spirv_compiler *spirv_compiler_create(const struct vkd3d_shader_version *shader_version,
@ -1237,7 +1239,6 @@ static inline void *vkd3d_find_struct_(const struct vkd3d_struct *chain,
return NULL;
}
#define VKD3D_DXBC_MAX_SOURCE_COUNT 6
#define VKD3D_DXBC_HEADER_SIZE (8 * sizeof(uint32_t))
#define TAG_AON9 VKD3D_MAKE_TAG('A', 'o', 'n', '9')