From 1a28e7d9c6b73841f4c2cda37815e4910dbb58a3 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sun, 3 Nov 2024 15:31:29 +0100 Subject: [PATCH] vkd3d-shader/hlsl: Add parser support for the ByteAddressBuffer type. Signed-off-by: Nikolay Sivov --- libs/vkd3d-shader/hlsl.c | 6 ++++++ libs/vkd3d-shader/hlsl.l | 1 + libs/vkd3d-shader/hlsl.y | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 1f90a4ba..96de18dc 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -2774,6 +2774,12 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru return string; case HLSL_CLASS_TEXTURE: + if (type->sampler_dim == HLSL_SAMPLER_DIM_RAW_BUFFER) + { + vkd3d_string_buffer_printf(string, "ByteAddressBuffer"); + return string; + } + if (type->sampler_dim == HLSL_SAMPLER_DIM_GENERIC) { vkd3d_string_buffer_printf(string, "Texture"); diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l index 18effcc5..8dace119 100644 --- a/libs/vkd3d-shader/hlsl.l +++ b/libs/vkd3d-shader/hlsl.l @@ -74,6 +74,7 @@ ANY (.) BlendState {return KW_BLENDSTATE; } break {return KW_BREAK; } Buffer {return KW_BUFFER; } +ByteAddressBuffer {return KW_BYTEADDRESSBUFFER; } case {return KW_CASE; } cbuffer {return KW_CBUFFER; } centroid {return KW_CENTROID; } diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index d830c401..6dfcc25a 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -6509,6 +6509,7 @@ static void validate_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, %token KW_BLENDSTATE %token KW_BREAK %token KW_BUFFER +%token KW_BYTEADDRESSBUFFER %token KW_CASE %token KW_CONSTANTBUFFER %token KW_CBUFFER @@ -7878,6 +7879,10 @@ type_no_void: $$ = hlsl_new_texture_type(ctx, $1, $3, sample_count); } + | KW_BYTEADDRESSBUFFER + { + $$ = hlsl_new_texture_type(ctx, HLSL_SAMPLER_DIM_RAW_BUFFER, hlsl_get_scalar_type(ctx, HLSL_TYPE_UINT), 0); + } | uav_type '<' resource_format '>' { validate_uav_type(ctx, $1, $3, &@3);