vkd3d-shader: Write SM5.1 register spaces.

This commit is contained in:
Elizabeth Figura 2023-08-29 12:47:03 -05:00 committed by Henri Verbeet
parent 4355e6ca69
commit bb41947fc6
Notes: Henri Verbeet 2024-06-11 17:09:29 +02:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/865

View File

@ -3185,7 +3185,7 @@ struct extern_resource
bool is_user_packed;
enum hlsl_regset regset;
unsigned int id, index, bind_count;
unsigned int id, space, index, bind_count;
};
static int sm4_compare_extern_resources(const void *a, const void *b)
@ -3282,6 +3282,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un
extern_resources[*count].regset = regset;
extern_resources[*count].id = var->regs[regset].id;
extern_resources[*count].space = var->regs[regset].space;
extern_resources[*count].index = var->regs[regset].index + regset_offset;
extern_resources[*count].bind_count = 1;
@ -3325,6 +3326,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un
extern_resources[*count].regset = r;
extern_resources[*count].id = var->regs[r].id;
extern_resources[*count].space = var->regs[r].space;
extern_resources[*count].index = var->regs[r].index;
extern_resources[*count].bind_count = var->bind_count[r];
@ -3362,6 +3364,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un
extern_resources[*count].regset = HLSL_REGSET_NUMERIC;
extern_resources[*count].id = buffer->reg.id;
extern_resources[*count].space = buffer->reg.space;
extern_resources[*count].index = buffer->reg.index;
extern_resources[*count].bind_count = 1;
@ -4233,7 +4236,8 @@ static void write_sm4_dcl_constant_buffer(const struct tpf_writer *tpf, const st
instr.srcs[0].reg.idx_count = 3;
instr.idx[0] = size;
instr.idx_count = 1;
instr.idx[1] = cbuffer->reg.space;
instr.idx_count = 2;
}
else
{
@ -4276,6 +4280,9 @@ static void write_sm4_dcl_samplers(const struct tpf_writer *tpf, const struct ex
instr.dsts[0].reg.idx[1].offset = resource->index;
instr.dsts[0].reg.idx[2].offset = resource->index; /* FIXME: array end */
instr.dsts[0].reg.idx_count = 3;
instr.idx[0] = resource->space;
instr.idx_count = 1;
}
else
{
@ -4321,6 +4328,9 @@ static void write_sm4_dcl_textures(const struct tpf_writer *tpf, const struct ex
instr.dsts[0].reg.idx[1].offset = resource->index;
instr.dsts[0].reg.idx[2].offset = resource->index; /* FIXME: array end */
instr.dsts[0].reg.idx_count = 3;
instr.idx[1] = resource->space;
instr.idx_count = 2;
}
else
{
@ -5915,22 +5925,13 @@ static void write_sm4_shdr(struct hlsl_ctx *ctx,
LIST_FOR_EACH_ENTRY(cbuffer, &ctx->buffers, struct hlsl_buffer, entry)
{
if (cbuffer->reg.allocated)
{
if (hlsl_version_ge(ctx, 5, 1))
hlsl_fixme(ctx, &cbuffer->loc, "Shader model 5.1 resource definition.");
write_sm4_dcl_constant_buffer(&tpf, cbuffer);
}
}
for (i = 0; i < extern_resources_count; ++i)
{
const struct extern_resource *resource = &extern_resources[i];
if (hlsl_version_ge(ctx, 5, 1))
hlsl_fixme(ctx, resource->buffer ? &resource->buffer->loc : &resource->var->loc,
"Shader model 5.1 resource declaration.");
if (resource->regset == HLSL_REGSET_SAMPLERS)
write_sm4_dcl_samplers(&tpf, resource);
else if (resource->regset == HLSL_REGSET_TEXTURES)