This change only implements case-sensitivity of technique keywords and related checks when corresponding profile is used. My immediate plan is to add some synthetic type for technique variables, for example as {object, void}, then add named techniques as variables. This is useful because these names are participating in global scope, and should not collide with normal variables. After that "pass_list" will be split, at least in two variants because of how much d3d9 syntax differs. Some trivial changes will be need later to have some top level fx compilation helper that considers only fx objects and calls ps/vs/gs compiler to create inner shader blobs on same original source.
-- v2: vkd3d-shader/hlsl: Improve handling of "technique" tokens.
From: Nikolay Sivov nsivov@codeweavers.com
--- libs/vkd3d-shader/hlsl.l | 3 ++- libs/vkd3d-shader/hlsl.y | 45 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l index e9ae3ccf3..7b7abb416 100644 --- a/libs/vkd3d-shader/hlsl.l +++ b/libs/vkd3d-shader/hlsl.l @@ -125,8 +125,9 @@ string {return KW_STRING; } struct {return KW_STRUCT; } switch {return KW_SWITCH; } tbuffer {return KW_TBUFFER; } -technique {return KW_TECHNIQUE; } +(?i:technique) {return KW_TECHNIQUE; } technique10 {return KW_TECHNIQUE10; } +technique11 {return KW_TECHNIQUE11; } texture {return KW_TEXTURE; } texture1D {return KW_TEXTURE1D; } Texture1D {return KW_TEXTURE1D; } diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 0e07fe578..eedb16bdb 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -4349,6 +4349,7 @@ static void validate_texture_format_type(struct hlsl_ctx *ctx, struct hlsl_type %token KW_TBUFFER %token KW_TECHNIQUE %token KW_TECHNIQUE10 +%token KW_TECHNIQUE11 %token KW_TEXTURE %token KW_TEXTURE1D %token KW_TEXTURE1DARRAY @@ -4469,6 +4470,7 @@ static void validate_texture_format_type(struct hlsl_ctx *ctx, struct hlsl_type
%type <name> any_identifier %type <name> var_identifier +%type <name> technique_name
%type <parameter> parameter
@@ -4507,8 +4509,51 @@ hlsl_prog: destroy_instr_list($2); } | hlsl_prog preproc_directive + | hlsl_prog technique | hlsl_prog ';'
+technique_name: + %empty + { + $$ = NULL; + } + | any_identifier + +pass_list: + %empty + +technique9: + KW_TECHNIQUE technique_name '{' pass_list '}' + { + if (ctx->profile->type == VKD3D_SHADER_TYPE_EFFECT && ctx->profile->major_version == 2) + { + hlsl_fixme(ctx, &@$, "Unsupported keyword 'technique'."); + } + } + +technique10: + KW_TECHNIQUE10 technique_name '{' pass_list '}' + { + if (ctx->profile->type == VKD3D_SHADER_TYPE_EFFECT && ctx->profile->major_version >= 4) + { + hlsl_fixme(ctx, &@$, "Unsupported keyword 'technique10'."); + } + } + +technique11: + KW_TECHNIQUE11 technique_name '{' pass_list '}' + { + if (ctx->profile->type == VKD3D_SHADER_TYPE_EFFECT && ctx->profile->major_version >= 4) + { + hlsl_fixme(ctx, &@$, "Unsupported keyword 'technique11'."); + } + } + +technique: + technique9 + | technique10 + | technique11 + buffer_declaration: buffer_type any_identifier colon_attribute {
I tried again, and I couldn't reproduce behavior of initial version. I pushed now something that should correctly ignore techniques depending on compilation profile and version. It seems that only 'technique' is case-insensitive.