mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Check MS texture declaration without sample count only for used variables.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
80b2a2eb55
commit
d945d5e78c
Notes:
Henri Verbeet
2024-08-13 21:26:02 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/980
@ -7304,12 +7304,6 @@ type_no_void:
|
|||||||
{
|
{
|
||||||
validate_texture_format_type(ctx, $3, &@3);
|
validate_texture_format_type(ctx, $3, &@3);
|
||||||
|
|
||||||
if (hlsl_version_lt(ctx, 4, 1))
|
|
||||||
{
|
|
||||||
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
|
||||||
"Multisampled texture object declaration needs sample count for profile %s.", ctx->profile->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
$$ = hlsl_new_texture_type(ctx, $1, $3, 0);
|
$$ = hlsl_new_texture_type(ctx, $1, $3, 0);
|
||||||
}
|
}
|
||||||
| texture_ms_type '<' type ',' shift_expr '>'
|
| texture_ms_type '<' type ',' shift_expr '>'
|
||||||
|
@ -3196,6 +3196,8 @@ struct extern_resource
|
|||||||
|
|
||||||
enum hlsl_regset regset;
|
enum hlsl_regset regset;
|
||||||
unsigned int id, space, index, bind_count;
|
unsigned int id, space, index, bind_count;
|
||||||
|
|
||||||
|
struct vkd3d_shader_location loc;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int sm4_compare_extern_resources(const void *a, const void *b)
|
static int sm4_compare_extern_resources(const void *a, const void *b)
|
||||||
@ -3298,6 +3300,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un
|
|||||||
extern_resources[*count].space = var->regs[regset].space;
|
extern_resources[*count].space = var->regs[regset].space;
|
||||||
extern_resources[*count].index = var->regs[regset].index + regset_offset;
|
extern_resources[*count].index = var->regs[regset].index + regset_offset;
|
||||||
extern_resources[*count].bind_count = 1;
|
extern_resources[*count].bind_count = 1;
|
||||||
|
extern_resources[*count].loc = var->loc;
|
||||||
|
|
||||||
++*count;
|
++*count;
|
||||||
}
|
}
|
||||||
@ -3345,6 +3348,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un
|
|||||||
extern_resources[*count].space = var->regs[r].space;
|
extern_resources[*count].space = var->regs[r].space;
|
||||||
extern_resources[*count].index = var->regs[r].index;
|
extern_resources[*count].index = var->regs[r].index;
|
||||||
extern_resources[*count].bind_count = var->bind_count[r];
|
extern_resources[*count].bind_count = var->bind_count[r];
|
||||||
|
extern_resources[*count].loc = var->loc;
|
||||||
|
|
||||||
++*count;
|
++*count;
|
||||||
}
|
}
|
||||||
@ -3383,6 +3387,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un
|
|||||||
extern_resources[*count].space = buffer->reg.space;
|
extern_resources[*count].space = buffer->reg.space;
|
||||||
extern_resources[*count].index = buffer->reg.index;
|
extern_resources[*count].index = buffer->reg.index;
|
||||||
extern_resources[*count].bind_count = 1;
|
extern_resources[*count].bind_count = 1;
|
||||||
|
extern_resources[*count].loc = buffer->loc;
|
||||||
|
|
||||||
++*count;
|
++*count;
|
||||||
}
|
}
|
||||||
@ -4318,6 +4323,7 @@ static void write_sm4_dcl_textures(const struct tpf_writer *tpf, const struct ex
|
|||||||
enum hlsl_regset regset = uav ? HLSL_REGSET_UAVS : HLSL_REGSET_TEXTURES;
|
enum hlsl_regset regset = uav ? HLSL_REGSET_UAVS : HLSL_REGSET_TEXTURES;
|
||||||
struct hlsl_type *component_type;
|
struct hlsl_type *component_type;
|
||||||
struct sm4_instruction instr;
|
struct sm4_instruction instr;
|
||||||
|
bool multisampled;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
VKD3D_ASSERT(resource->regset == regset);
|
VKD3D_ASSERT(resource->regset == regset);
|
||||||
@ -4340,6 +4346,16 @@ static void write_sm4_dcl_textures(const struct tpf_writer *tpf, const struct ex
|
|||||||
.idx_count = 1,
|
.idx_count = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
multisampled = component_type->sampler_dim == HLSL_SAMPLER_DIM_2DMS
|
||||||
|
|| component_type->sampler_dim == HLSL_SAMPLER_DIM_2DMSARRAY;
|
||||||
|
|
||||||
|
if (hlsl_version_lt(tpf->ctx, 4, 1) && multisampled && !component_type->sample_count)
|
||||||
|
{
|
||||||
|
hlsl_error(tpf->ctx, &resource->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||||
|
"Multisampled texture object declaration needs sample count for profile %s.",
|
||||||
|
tpf->ctx->profile->name);
|
||||||
|
}
|
||||||
|
|
||||||
if (hlsl_version_ge(tpf->ctx, 5, 1))
|
if (hlsl_version_ge(tpf->ctx, 5, 1))
|
||||||
{
|
{
|
||||||
VKD3D_ASSERT(!i);
|
VKD3D_ASSERT(!i);
|
||||||
@ -4379,11 +4395,8 @@ static void write_sm4_dcl_textures(const struct tpf_writer *tpf, const struct ex
|
|||||||
}
|
}
|
||||||
instr.extra_bits |= (sm4_resource_dimension(component_type) << VKD3D_SM4_RESOURCE_TYPE_SHIFT);
|
instr.extra_bits |= (sm4_resource_dimension(component_type) << VKD3D_SM4_RESOURCE_TYPE_SHIFT);
|
||||||
|
|
||||||
if (component_type->sampler_dim == HLSL_SAMPLER_DIM_2DMS
|
if (multisampled)
|
||||||
|| component_type->sampler_dim == HLSL_SAMPLER_DIM_2DMSARRAY)
|
|
||||||
{
|
|
||||||
instr.extra_bits |= component_type->sample_count << VKD3D_SM4_RESOURCE_SAMPLE_COUNT_SHIFT;
|
instr.extra_bits |= component_type->sample_count << VKD3D_SM4_RESOURCE_SAMPLE_COUNT_SHIFT;
|
||||||
}
|
|
||||||
|
|
||||||
write_sm4_instruction(tpf, &instr);
|
write_sm4_instruction(tpf, &instr);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0)
|
|||||||
[pixel shader]
|
[pixel shader]
|
||||||
static const int size = 2;
|
static const int size = 2;
|
||||||
Texture2DMS<float4, size - 1> t;
|
Texture2DMS<float4, size - 1> t;
|
||||||
|
Texture2DMS<float4> t2;
|
||||||
|
|
||||||
float4 main(float4 pos : sv_position) : sv_target
|
float4 main(float4 pos : sv_position) : sv_target
|
||||||
{
|
{
|
||||||
@ -76,7 +77,7 @@ probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1)
|
|||||||
probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8)
|
probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8)
|
||||||
probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0)
|
probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0)
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader]
|
||||||
static const int size = 2;
|
static const int size = 2;
|
||||||
Texture2DMS<float4, size - 1> t;
|
Texture2DMS<float4, size - 1> t;
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ float4 main(float4 pos : sv_position) : sv_target
|
|||||||
}
|
}
|
||||||
|
|
||||||
[test]
|
[test]
|
||||||
todo draw quad
|
todo(glsl) draw quad
|
||||||
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
|
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
|
||||||
probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1)
|
probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1)
|
||||||
probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8)
|
probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8)
|
||||||
|
Loading…
Reference in New Issue
Block a user