mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Write an empty SHDR section.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
committed by
Alexandre Julliard
parent
96d523722d
commit
ed49461309
@@ -20,12 +20,44 @@
|
|||||||
|
|
||||||
#include "hlsl.h"
|
#include "hlsl.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "sm4.h"
|
||||||
|
|
||||||
|
static void write_sm4_shdr(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc)
|
||||||
|
{
|
||||||
|
const struct hlsl_profile_info *profile = ctx->profile;
|
||||||
|
struct vkd3d_bytecode_buffer buffer = {0};
|
||||||
|
|
||||||
|
static const uint16_t shader_types[VKD3D_SHADER_TYPE_COUNT] =
|
||||||
|
{
|
||||||
|
VKD3D_SM4_PS,
|
||||||
|
VKD3D_SM4_VS,
|
||||||
|
VKD3D_SM4_GS,
|
||||||
|
VKD3D_SM5_HS,
|
||||||
|
VKD3D_SM5_DS,
|
||||||
|
VKD3D_SM5_CS,
|
||||||
|
0, /* EFFECT */
|
||||||
|
0, /* TEXTURE */
|
||||||
|
VKD3D_SM4_LIB,
|
||||||
|
};
|
||||||
|
|
||||||
|
put_u32(&buffer, (shader_types[profile->type] << 16) | (profile->major_version << 4) | profile->minor_version);
|
||||||
|
put_u32(&buffer, 0); /* FIXME: instruction token count */
|
||||||
|
|
||||||
|
dxbc_writer_add_section(dxbc, TAG_SHDR, buffer.data, buffer.size);
|
||||||
|
}
|
||||||
|
|
||||||
int hlsl_sm4_write(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func, struct vkd3d_shader_code *out)
|
int hlsl_sm4_write(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func, struct vkd3d_shader_code *out)
|
||||||
{
|
{
|
||||||
struct dxbc_writer dxbc;
|
struct dxbc_writer dxbc;
|
||||||
|
size_t i;
|
||||||
|
int ret;
|
||||||
|
|
||||||
dxbc_writer_init(&dxbc);
|
dxbc_writer_init(&dxbc);
|
||||||
|
|
||||||
return dxbc_writer_write(&dxbc, out);
|
write_sm4_shdr(ctx, &dxbc);
|
||||||
|
|
||||||
|
ret = dxbc_writer_write(&dxbc, out);
|
||||||
|
for (i = 0; i < dxbc.section_count; ++i)
|
||||||
|
vkd3d_free((void *)dxbc.sections[i].data);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#define VKD3D_SM5_HS 0x0003u
|
#define VKD3D_SM5_HS 0x0003u
|
||||||
#define VKD3D_SM5_DS 0x0004u
|
#define VKD3D_SM5_DS 0x0004u
|
||||||
#define VKD3D_SM5_CS 0x0005u
|
#define VKD3D_SM5_CS 0x0005u
|
||||||
|
#define VKD3D_SM4_LIB 0xfff0u
|
||||||
|
|
||||||
#define VKD3D_SM4_INSTRUCTION_MODIFIER (0x1u << 31)
|
#define VKD3D_SM4_INSTRUCTION_MODIFIER (0x1u << 31)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user