diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index 13566c38..40bf3a72 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -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; diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index ff8c020a..734ba315 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -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); diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 0c83edf1..a750b55e 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -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')