From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- libs/vkd3d-shader/hlsl.l | 3 +++ libs/vkd3d-shader/hlsl.y | 3 +++ 2 files changed, 6 insertions(+)
diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l index 558506db1..decc26df2 100644 --- a/libs/vkd3d-shader/hlsl.l +++ b/libs/vkd3d-shader/hlsl.l @@ -76,6 +76,7 @@ case {return KW_CASE; } cbuffer {return KW_CBUFFER; } centroid {return KW_CENTROID; } column_major {return KW_COLUMN_MAJOR; } +ComputeShader {return KW_COMPUTESHADER; } compile {return KW_COMPILE; } const {return KW_CONST; } continue {return KW_CONTINUE; } @@ -83,6 +84,7 @@ DepthStencilState {return KW_DEPTHSTENCILSTATE; } DepthStencilView {return KW_DEPTHSTENCILVIEW; } default {return KW_DEFAULT; } discard {return KW_DISCARD; } +DomainShader {return KW_DOMAINSHADER; } do {return KW_DO; } double {return KW_DOUBLE; } else {return KW_ELSE; } @@ -92,6 +94,7 @@ for {return KW_FOR; } fxgroup {return KW_FXGROUP; } GeometryShader {return KW_GEOMETRYSHADER; } groupshared {return KW_GROUPSHARED; } +HullShader {return KW_HULLSHADER; } if {return KW_IF; } in {return KW_IN; } inline {return KW_INLINE; } diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index cd05fd008..9475a3c80 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -5243,6 +5243,7 @@ static void validate_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, %token KW_CENTROID %token KW_COLUMN_MAJOR %token KW_COMPILE +%token KW_COMPUTESHADER %token KW_CONST %token KW_CONTINUE %token KW_DEFAULT @@ -5250,6 +5251,7 @@ static void validate_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, %token KW_DEPTHSTENCILVIEW %token KW_DISCARD %token KW_DO +%token KW_DOMAINSHADER %token KW_DOUBLE %token KW_ELSE %token KW_EXTERN @@ -5258,6 +5260,7 @@ static void validate_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, %token KW_FXGROUP %token KW_GEOMETRYSHADER %token KW_GROUPSHARED +%token KW_HULLSHADER %token KW_IF %token KW_IN %token KW_INLINE
From: Nikolay Sivov nsivov@codeweavers.com
Such techniques are ignored later, but do not cause compilation errors.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- libs/vkd3d-shader/hlsl.y | 4 ---- tests/hlsl/technique-fx_2.shader_test | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 9475a3c80..8cdc82263 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -5538,10 +5538,6 @@ technique10: struct hlsl_scope *scope = ctx->cur_scope; hlsl_pop_scope(ctx);
- if (ctx->profile->type == VKD3D_SHADER_TYPE_EFFECT && ctx->profile->major_version == 2) - hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX, - "The 'technique10' keyword is invalid for this profile."); - if (!add_technique(ctx, $2, scope, $3, "technique10", &@1)) YYABORT; } diff --git a/tests/hlsl/technique-fx_2.shader_test b/tests/hlsl/technique-fx_2.shader_test index b84bbc167..3b71d0a3b 100644 --- a/tests/hlsl/technique-fx_2.shader_test +++ b/tests/hlsl/technique-fx_2.shader_test @@ -76,7 +76,7 @@ float4 main() : sv_target return fxGroup; }
-[effect todo] +[effect] technique { }
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- libs/vkd3d-shader/fx.c | 30 +++++++++++++----------- libs/vkd3d-shader/vkd3d_shader_private.h | 1 + tests/hlsl/technique-fx_2.shader_test | 2 +- 3 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index bc70d5220..5ba24e6dc 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -179,7 +179,6 @@ static void fx_write_context_init(struct hlsl_ctx *ctx, const struct fx_write_co static int fx_write_context_cleanup(struct fx_write_context *fx) { struct type_entry *type, *next_type; - int status = fx->status;
rb_destroy(&fx->strings, string_storage_destroy, NULL);
@@ -189,7 +188,7 @@ static int fx_write_context_cleanup(struct fx_write_context *fx) vkd3d_free(type); }
- return status; + return fx->ctx->result; }
static bool technique_matches_version(const struct hlsl_ir_var *var, const struct fx_write_context *fx) @@ -643,15 +642,18 @@ static int hlsl_fx_2_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out) vkd3d_free(fx.unstructured.data); vkd3d_free(fx.structured.data);
- if (!fx.status) + if (!fx.technique_count) + hlsl_error(ctx, &ctx->location, VKD3D_SHADER_ERROR_HLSL_MISSING_TECHNIQUE, "No techniques found."); + + if (fx.status < 0) + ctx->result = fx.status; + + if (!ctx->result) { out->code = buffer.data; out->size = buffer.size; }
- if (fx.status < 0) - ctx->result = fx.status; - return fx_write_context_cleanup(&fx); }
@@ -870,15 +872,15 @@ static int hlsl_fx_4_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
set_status(&fx, buffer.status);
- if (!fx.status) + if (fx.status < 0) + ctx->result = fx.status; + + if (!ctx->result) { out->code = buffer.data; out->size = buffer.size; }
- if (fx.status < 0) - ctx->result = fx.status; - return fx_write_context_cleanup(&fx); }
@@ -933,15 +935,15 @@ static int hlsl_fx_5_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
set_status(&fx, buffer.status);
- if (!fx.status) + if (fx.status < 0) + ctx->result = fx.status; + + if (!ctx->result) { out->code = buffer.data; out->size = buffer.size; }
- if (fx.status < 0) - ctx->result = fx.status; - return fx_write_context_cleanup(&fx); }
diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 4b322b95b..8dca450f6 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -148,6 +148,7 @@ enum vkd3d_shader_error VKD3D_SHADER_ERROR_HLSL_INCONSISTENT_SAMPLER = 5026, VKD3D_SHADER_ERROR_HLSL_NON_FINITE_RESULT = 5027, VKD3D_SHADER_ERROR_HLSL_DUPLICATE_SWITCH_CASE = 5028, + VKD3D_SHADER_ERROR_HLSL_MISSING_TECHNIQUE = 5029,
VKD3D_SHADER_WARNING_HLSL_IMPLICIT_TRUNCATION = 5300, VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO = 5301, diff --git a/tests/hlsl/technique-fx_2.shader_test b/tests/hlsl/technique-fx_2.shader_test index 3b71d0a3b..35963cd04 100644 --- a/tests/hlsl/technique-fx_2.shader_test +++ b/tests/hlsl/technique-fx_2.shader_test @@ -86,7 +86,7 @@ technique10 }
% Effects without techniques are not allowed for fx_2_0 -[effect fail todo] +[effect fail] float4 f;
% fx_5_0 keyword fails with fx_2_0 profile
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- libs/vkd3d-shader/fx.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index 5ba24e6dc..fd5c84432 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -284,6 +284,7 @@ static uint32_t get_fx_4_numeric_type_description(const struct hlsl_type *type, [HLSL_TYPE_UINT ] = 3, [HLSL_TYPE_BOOL ] = 4, }; + struct hlsl_ctx *ctx = fx->ctx; uint32_t value = 0;
switch (type->class) @@ -294,8 +295,7 @@ static uint32_t get_fx_4_numeric_type_description(const struct hlsl_type *type, value |= numeric_type_class[type->class]; break; default: - FIXME("Unexpected type class %u.\n", type->class); - set_status(fx, VKD3D_ERROR_NOT_IMPLEMENTED); + hlsl_fixme(ctx, &ctx->location, "Not implemented for type class %u.\n", type->class); return 0; }
@@ -308,8 +308,7 @@ static uint32_t get_fx_4_numeric_type_description(const struct hlsl_type *type, value |= (numeric_base_type[type->base_type] << NUMERIC_BASE_TYPE_SHIFT); break; default: - FIXME("Unexpected base type %u.\n", type->base_type); - set_status(fx, VKD3D_ERROR_NOT_IMPLEMENTED); + hlsl_fixme(ctx, &ctx->location, "Not implemented for base type %u.\n", type->base_type); return 0; }
@@ -358,6 +357,7 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co [HLSL_SAMPLER_DIM_BUFFER] = "RWBuffer", [HLSL_SAMPLER_DIM_STRUCTURED_BUFFER] = "RWStructuredBuffer", }; + struct hlsl_ctx *ctx = fx->ctx;
/* Resolve arrays to element type and number of elements. */ if (type->class == HLSL_CLASS_ARRAY) @@ -386,8 +386,7 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co put_u32_unaligned(buffer, variable_type[type->class]); break; default: - FIXME("Writing type class %u is not implemented.\n", type->class); - set_status(fx, VKD3D_ERROR_NOT_IMPLEMENTED); + hlsl_fixme(ctx, &ctx->location, "Writing type class %u is not implemented.\n", type->class); return 0; }
@@ -465,8 +464,7 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co put_u32_unaligned(buffer, uav_type[type->sampler_dim]); break; default: - FIXME("Object type %u is not supported.\n", type->base_type); - set_status(fx, VKD3D_ERROR_NOT_IMPLEMENTED); + hlsl_fixme(ctx, &ctx->location, "Object type %u is not supported.\n", type->base_type); return 0; } }
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- Makefile.am | 2 ++ .../effect-shader-objects-fx_2.shader_test | 35 +++++++++++++++++++ .../effect-shader-objects-fx_5.shader_test | 34 ++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 tests/hlsl/effect-shader-objects-fx_2.shader_test create mode 100644 tests/hlsl/effect-shader-objects-fx_5.shader_test
diff --git a/Makefile.am b/Makefile.am index cfb225f9c..d27d0a9e5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -90,6 +90,8 @@ vkd3d_shader_tests = \ tests/hlsl/distance.shader_test \ tests/hlsl/dot.shader_test \ tests/hlsl/duplicate-modifiers.shader_test \ + tests/hlsl/effect-shader-objects-fx_2.shader_test \ + tests/hlsl/effect-shader-objects-fx_5.shader_test \ tests/hlsl/entry-point-semantics.shader_test \ tests/hlsl/exp.shader_test \ tests/hlsl/expr-indexing.shader_test \ diff --git a/tests/hlsl/effect-shader-objects-fx_2.shader_test b/tests/hlsl/effect-shader-objects-fx_2.shader_test new file mode 100644 index 000000000..8068a4664 --- /dev/null +++ b/tests/hlsl/effect-shader-objects-fx_2.shader_test @@ -0,0 +1,35 @@ +[require] +shader model < 3.0 + +[pixel shader] +float4 vertexshadeR; +float4 geometryshader; + +float4 main() : sv_target +{ + return 0; +} + +[pixel shader fail todo] +float4 vertexshader; + +float4 main() : sv_target +{ + return 0; +} + +[pixel shader fail] +float4 VertexShader; + +float4 main() : sv_target +{ + return 0; +} + +[effect todo] +vertexshader vs1; +verteXshadeR vs2; +pixelshader ps1; +pixeLshadeR ps2; + +technique {} diff --git a/tests/hlsl/effect-shader-objects-fx_5.shader_test b/tests/hlsl/effect-shader-objects-fx_5.shader_test new file mode 100644 index 000000000..03f019232 --- /dev/null +++ b/tests/hlsl/effect-shader-objects-fx_5.shader_test @@ -0,0 +1,34 @@ +[require] +shader model >= 5.0 +shader model < 6.0 + +[pixel shader] +float4 vertexshadeR; +float4 geometryshader; + +float4 main() : sv_target +{ + return 0; +} + +[pixel shader fail todo] +float4 vertexshader; + +float4 main() : sv_target +{ + return 0; +} + +[pixel shader fail] +float4 VertexShader; + +float4 main() : sv_target +{ + return 0; +} + +[effect todo] +vertexshader vs1; +verteXshadeR vs2; +pixelshader ps1; +pixeLshadeR ps2;
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- libs/vkd3d-shader/hlsl.c | 6 ++++-- libs/vkd3d-shader/hlsl.l | 2 ++ tests/hlsl/effect-shader-objects-fx_2.shader_test | 2 +- tests/hlsl/effect-shader-objects-fx_5.shader_test | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 0e75edd46..76811ef3d 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -784,7 +784,9 @@ static const char * get_case_insensitive_typename(const char *name) "dword", "float", "matrix", + "pixelshader", "vector", + "vertexshader", }; unsigned int i;
@@ -3395,8 +3397,8 @@ static void declare_predefined_types(struct hlsl_ctx *ctx) {"pass", HLSL_CLASS_OBJECT, HLSL_TYPE_PASS, 1, 1}, {"STRING", HLSL_CLASS_OBJECT, HLSL_TYPE_STRING, 1, 1}, {"TEXTURE", HLSL_CLASS_OBJECT, HLSL_TYPE_TEXTURE, 1, 1}, - {"PIXELSHADER", HLSL_CLASS_OBJECT, HLSL_TYPE_PIXELSHADER, 1, 1}, - {"VERTEXSHADER", HLSL_CLASS_OBJECT, HLSL_TYPE_VERTEXSHADER, 1, 1}, + {"pixelshader", HLSL_CLASS_OBJECT, HLSL_TYPE_PIXELSHADER, 1, 1}, + {"vertexshader", HLSL_CLASS_OBJECT, HLSL_TYPE_VERTEXSHADER, 1, 1}, {"RenderTargetView",HLSL_CLASS_OBJECT, HLSL_TYPE_RENDERTARGETVIEW, 1, 1}, {"DepthStencilView",HLSL_CLASS_OBJECT, HLSL_TYPE_DEPTHSTENCILVIEW, 1, 1}, }; diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l index decc26df2..8dcceb94c 100644 --- a/libs/vkd3d-shader/hlsl.l +++ b/libs/vkd3d-shader/hlsl.l @@ -108,6 +108,7 @@ out {return KW_OUT; } packoffset {return KW_PACKOFFSET; } pass {return KW_PASS; } PixelShader {return KW_PIXELSHADER; } +pixelshader {return KW_PIXELSHADER; } precise {return KW_PRECISE; } RasterizerOrderedBuffer {return KW_RASTERIZERORDEREDBUFFER; } RasterizerOrderedStructuredBuffer {return KW_RASTERIZERORDEREDSTRUCTUREDBUFFER; } @@ -166,6 +167,7 @@ typedef {return KW_TYPEDEF; } uniform {return KW_UNIFORM; } vector {return KW_VECTOR; } VertexShader {return KW_VERTEXSHADER; } +vertexshader {return KW_VERTEXSHADER; } void {return KW_VOID; } volatile {return KW_VOLATILE; } while {return KW_WHILE; } diff --git a/tests/hlsl/effect-shader-objects-fx_2.shader_test b/tests/hlsl/effect-shader-objects-fx_2.shader_test index 8068a4664..8801ed1f7 100644 --- a/tests/hlsl/effect-shader-objects-fx_2.shader_test +++ b/tests/hlsl/effect-shader-objects-fx_2.shader_test @@ -10,7 +10,7 @@ float4 main() : sv_target return 0; }
-[pixel shader fail todo] +[pixel shader fail] float4 vertexshader;
float4 main() : sv_target diff --git a/tests/hlsl/effect-shader-objects-fx_5.shader_test b/tests/hlsl/effect-shader-objects-fx_5.shader_test index 03f019232..1d2f43386 100644 --- a/tests/hlsl/effect-shader-objects-fx_5.shader_test +++ b/tests/hlsl/effect-shader-objects-fx_5.shader_test @@ -11,7 +11,7 @@ float4 main() : sv_target return 0; }
-[pixel shader fail todo] +[pixel shader fail] float4 vertexshader;
float4 main() : sv_target
This merge request was approved by Zebediah Figura.
This merge request was approved by Giovanni Mascellani.
This merge request was approved by Henri Verbeet.