mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Add parser support for the RWByteAddressBuffer type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
4195a2f18a
commit
cf27065b7d
Notes:
Henri Verbeet
2024-10-28 18:12:37 +01:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1222
@ -2799,6 +2799,11 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
|
||||
return string;
|
||||
|
||||
case HLSL_CLASS_UAV:
|
||||
if (type->sampler_dim == HLSL_SAMPLER_DIM_RAW_BUFFER)
|
||||
{
|
||||
vkd3d_string_buffer_printf(string, "RWByteAddressBuffer");
|
||||
return string;
|
||||
}
|
||||
if (type->sampler_dim == HLSL_SAMPLER_DIM_BUFFER)
|
||||
vkd3d_string_buffer_printf(string, "RWBuffer");
|
||||
else if (type->sampler_dim == HLSL_SAMPLER_DIM_STRUCTURED_BUFFER)
|
||||
|
@ -136,7 +136,8 @@ enum hlsl_sampler_dim
|
||||
HLSL_SAMPLER_DIM_CUBEARRAY,
|
||||
HLSL_SAMPLER_DIM_BUFFER,
|
||||
HLSL_SAMPLER_DIM_STRUCTURED_BUFFER,
|
||||
HLSL_SAMPLER_DIM_MAX = HLSL_SAMPLER_DIM_STRUCTURED_BUFFER,
|
||||
HLSL_SAMPLER_DIM_RAW_BUFFER,
|
||||
HLSL_SAMPLER_DIM_MAX = HLSL_SAMPLER_DIM_RAW_BUFFER,
|
||||
/* NOTE: Remember to update object_methods[] in hlsl.y if this enum is modified. */
|
||||
};
|
||||
|
||||
@ -1394,6 +1395,7 @@ static inline unsigned int hlsl_sampler_dim_count(enum hlsl_sampler_dim dim)
|
||||
{
|
||||
case HLSL_SAMPLER_DIM_1D:
|
||||
case HLSL_SAMPLER_DIM_BUFFER:
|
||||
case HLSL_SAMPLER_DIM_RAW_BUFFER:
|
||||
case HLSL_SAMPLER_DIM_STRUCTURED_BUFFER:
|
||||
return 1;
|
||||
case HLSL_SAMPLER_DIM_1DARRAY:
|
||||
|
@ -127,6 +127,7 @@ RenderTargetView {return KW_RENDERTARGETVIEW; }
|
||||
return {return KW_RETURN; }
|
||||
row_major {return KW_ROW_MAJOR; }
|
||||
RWBuffer {return KW_RWBUFFER; }
|
||||
RWByteAddressBuffer {return KW_RWBYTEADDRESSBUFFER; }
|
||||
RWStructuredBuffer {return KW_RWSTRUCTUREDBUFFER; }
|
||||
RWTexture1D {return KW_RWTEXTURE1D; }
|
||||
RWTexture1DArray {return KW_RWTEXTURE1DARRAY; }
|
||||
|
@ -5579,6 +5579,7 @@ static unsigned int hlsl_offset_dim_count(enum hlsl_sampler_dim dim)
|
||||
case HLSL_SAMPLER_DIM_CUBE:
|
||||
case HLSL_SAMPLER_DIM_CUBEARRAY:
|
||||
case HLSL_SAMPLER_DIM_BUFFER:
|
||||
case HLSL_SAMPLER_DIM_RAW_BUFFER:
|
||||
/* Offset parameters not supported for these types. */
|
||||
return 0;
|
||||
default:
|
||||
@ -6205,22 +6206,22 @@ static const struct method_function
|
||||
}
|
||||
object_methods[] =
|
||||
{
|
||||
{ "Gather", add_gather_method_call, "0001010100100" },
|
||||
{ "GatherAlpha", add_gather_method_call, "0001010100100" },
|
||||
{ "GatherBlue", add_gather_method_call, "0001010100100" },
|
||||
{ "GatherGreen", add_gather_method_call, "0001010100100" },
|
||||
{ "GatherRed", add_gather_method_call, "0001010100100" },
|
||||
{ "Gather", add_gather_method_call, "00010101001000" },
|
||||
{ "GatherAlpha", add_gather_method_call, "00010101001000" },
|
||||
{ "GatherBlue", add_gather_method_call, "00010101001000" },
|
||||
{ "GatherGreen", add_gather_method_call, "00010101001000" },
|
||||
{ "GatherRed", add_gather_method_call, "00010101001000" },
|
||||
|
||||
{ "GetDimensions", add_getdimensions_method_call, "0011111111111" },
|
||||
{ "GetDimensions", add_getdimensions_method_call, "00111111111110" },
|
||||
|
||||
{ "Load", add_load_method_call, "0011101111011" },
|
||||
{ "Load", add_load_method_call, "00111011110110" },
|
||||
|
||||
{ "Sample", add_sample_method_call, "0011111100100" },
|
||||
{ "SampleBias", add_sample_lod_method_call, "0011111100100" },
|
||||
{ "SampleCmp", add_sample_cmp_method_call, "0011111100100" },
|
||||
{ "SampleCmpLevelZero", add_sample_cmp_method_call, "0011111100100" },
|
||||
{ "SampleGrad", add_sample_grad_method_call, "0011111100100" },
|
||||
{ "SampleLevel", add_sample_lod_method_call, "0011111100100" },
|
||||
{ "Sample", add_sample_method_call, "00111111001000" },
|
||||
{ "SampleBias", add_sample_lod_method_call, "00111111001000" },
|
||||
{ "SampleCmp", add_sample_cmp_method_call, "00111111001000" },
|
||||
{ "SampleCmpLevelZero", add_sample_cmp_method_call, "00111111001000" },
|
||||
{ "SampleGrad", add_sample_grad_method_call, "00111111001000" },
|
||||
{ "SampleLevel", add_sample_lod_method_call, "00111111001000" },
|
||||
};
|
||||
|
||||
static int object_method_function_name_compare(const void *a, const void *b)
|
||||
@ -6492,6 +6493,7 @@ static void validate_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim,
|
||||
%token KW_REGISTER
|
||||
%token KW_ROW_MAJOR
|
||||
%token KW_RWBUFFER
|
||||
%token KW_RWBYTEADDRESSBUFFER
|
||||
%token KW_RWSTRUCTUREDBUFFER
|
||||
%token KW_RWTEXTURE1D
|
||||
%token KW_RWTEXTURE1DARRAY
|
||||
@ -7806,6 +7808,10 @@ type_no_void:
|
||||
validate_uav_type(ctx, $1, $3, &@4);
|
||||
$$ = hlsl_new_uav_type(ctx, $1, $3, true);
|
||||
}
|
||||
| KW_RWBYTEADDRESSBUFFER
|
||||
{
|
||||
$$ = hlsl_new_uav_type(ctx, HLSL_SAMPLER_DIM_RAW_BUFFER, hlsl_get_scalar_type(ctx, HLSL_TYPE_UINT), false);
|
||||
}
|
||||
| KW_STRING
|
||||
{
|
||||
$$ = ctx->builtin_types.string;
|
||||
|
Loading…
Reference in New Issue
Block a user