mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Handle "unsigned int" type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
36c123c005
commit
ea177a7750
Notes:
Alexandre Julliard
2024-05-30 23:26:49 +02:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Elizabeth Figura (@zfigura) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/871
@ -234,6 +234,7 @@ vkd3d_shader_tests = \
|
||||
tests/hlsl/uav-rwstructuredbuffer.shader_test \
|
||||
tests/hlsl/uav-rwtexture.shader_test \
|
||||
tests/hlsl/unbounded-array-5.1.shader_test \
|
||||
tests/hlsl/unsigned.shader_test \
|
||||
tests/hlsl/uniform-parameters.shader_test \
|
||||
tests/hlsl/uniform-semantics.shader_test \
|
||||
tests/hlsl/vector-indexing-uniform.shader_test \
|
||||
|
@ -49,7 +49,7 @@ static void update_location(struct hlsl_ctx *ctx, YYLTYPE *loc);
|
||||
RESERVED1 auto|catch|char|class|const_cast|delete|dynamic_cast|enum
|
||||
RESERVED2 explicit|friend|goto|long|mutable|new|operator|private|protected|public
|
||||
RESERVED3 reinterpret_cast|short|signed|sizeof|static_cast|template|this|throw|try
|
||||
RESERVED4 typename|union|unsigned|using|virtual
|
||||
RESERVED4 typename|union|using|virtual
|
||||
|
||||
WS [ \t]
|
||||
NEWLINE (\n)|(\r\n)
|
||||
@ -164,6 +164,7 @@ textureCUBE {return KW_TEXTURECUBE; }
|
||||
TextureCubeArray {return KW_TEXTURECUBEARRAY; }
|
||||
true {return KW_TRUE; }
|
||||
typedef {return KW_TYPEDEF; }
|
||||
unsigned {return KW_UNSIGNED; }
|
||||
uniform {return KW_UNIFORM; }
|
||||
vector {return KW_VECTOR; }
|
||||
VertexShader {return KW_VERTEXSHADER; }
|
||||
|
@ -5566,6 +5566,7 @@ static bool state_block_add_entry(struct hlsl_state_block *state_block, struct h
|
||||
%token KW_TEXTURECUBEARRAY
|
||||
%token KW_TRUE
|
||||
%token KW_TYPEDEF
|
||||
%token KW_UNSIGNED
|
||||
%token KW_UNIFORM
|
||||
%token KW_VECTOR
|
||||
%token KW_VERTEXSHADER
|
||||
@ -6713,6 +6714,26 @@ type_no_void:
|
||||
}
|
||||
vkd3d_free($1);
|
||||
}
|
||||
| KW_UNSIGNED TYPE_IDENTIFIER
|
||||
{
|
||||
struct hlsl_type *type = hlsl_get_type(ctx->cur_scope, $2, true, true);
|
||||
|
||||
if (hlsl_is_numeric_type(type) && type->e.numeric.type == HLSL_TYPE_INT)
|
||||
{
|
||||
if (!(type = hlsl_type_clone(ctx, type, 0, 0)))
|
||||
YYABORT;
|
||||
vkd3d_free((void *)type->name);
|
||||
type->name = NULL;
|
||||
type->e.numeric.type = HLSL_TYPE_UINT;
|
||||
}
|
||||
else
|
||||
{
|
||||
hlsl_error(ctx, &@2, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||
"The 'unsigned' keyword can't be used with type %s.", $2);
|
||||
}
|
||||
|
||||
$$ = type;
|
||||
}
|
||||
| KW_STRUCT TYPE_IDENTIFIER
|
||||
{
|
||||
$$ = hlsl_get_type(ctx->cur_scope, $2, true, true);
|
||||
|
66
tests/hlsl/unsigned.shader_test
Normal file
66
tests/hlsl/unsigned.shader_test
Normal file
@ -0,0 +1,66 @@
|
||||
[pixel shader]
|
||||
unsigned int var1;
|
||||
unsigned int2x2 var2;
|
||||
unsigned int2 var3;
|
||||
unsigned int var4[2];
|
||||
|
||||
typedef int Int;
|
||||
typedef int2x2 Int2x2;
|
||||
typedef int2 Int2;
|
||||
|
||||
unsigned Int var5;
|
||||
unsigned Int2x2 var6;
|
||||
unsigned Int2 var7;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
[pixel shader fail(sm<6)]
|
||||
unsigned uint var;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
[pixel shader fail(sm<6)]
|
||||
unsigned uint2 var;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
[pixel shader fail(sm<6)]
|
||||
unsigned uint2x2 var;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
[require]
|
||||
shader model >= 4.0
|
||||
|
||||
[pixel shader]
|
||||
Texture2D<unsigned int> t;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
[require]
|
||||
shader model < 6.0
|
||||
|
||||
[pixel shader fail]
|
||||
// crashes with dxc
|
||||
typedef int Int[2];
|
||||
unsigned Int var;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user