diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h index 5e5f1d3eb38..1c4b7762afd 100644 --- a/dlls/d3dcompiler_43/d3dcompiler_private.h +++ b/dlls/d3dcompiler_43/d3dcompiler_private.h @@ -644,6 +644,15 @@ enum hlsl_base_type HLSL_TYPE_VOID, }; +enum hlsl_sampler_dim +{ + HLSL_SAMPLER_DIM_GENERIC, + HLSL_SAMPLER_DIM_1D, + HLSL_SAMPLER_DIM_2D, + HLSL_SAMPLER_DIM_3D, + HLSL_SAMPLER_DIM_CUBE, +}; + enum hlsl_matrix_majority { HLSL_COLUMN_MAJOR, @@ -656,6 +665,7 @@ struct hlsl_type struct list scope_entry; enum hlsl_type_class type; enum hlsl_base_type base_type; + enum hlsl_sampler_dim sampler_dim; const char *name; unsigned int modifiers; unsigned int dimx; diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index cc13e25b517..7384e88f21d 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -343,6 +343,31 @@ base_type: KW_VOID { $$ = new_hlsl_type("void", HLSL_CLASS_SCALAR, HLSL_TYPE_VOID, 1, 1); } + | KW_SAMPLER + { + $$ = new_hlsl_type("sampler", HLSL_CLASS_OBJECT, HLSL_TYPE_SAMPLER, 1, 1); + $$->sampler_dim = HLSL_SAMPLER_DIM_GENERIC; + } + | KW_SAMPLER1D + { + $$ = new_hlsl_type("sampler1D", HLSL_CLASS_OBJECT, HLSL_TYPE_SAMPLER, 1, 1); + $$->sampler_dim = HLSL_SAMPLER_DIM_1D; + } + | KW_SAMPLER2D + { + $$ = new_hlsl_type("sampler2D", HLSL_CLASS_OBJECT, HLSL_TYPE_SAMPLER, 1, 1); + $$->sampler_dim = HLSL_SAMPLER_DIM_2D; + } + | KW_SAMPLER3D + { + $$ = new_hlsl_type("sampler3D", HLSL_CLASS_OBJECT, HLSL_TYPE_SAMPLER, 1, 1); + $$->sampler_dim = HLSL_SAMPLER_DIM_3D; + } + | KW_SAMPLERCUBE + { + $$ = new_hlsl_type("samplerCUBE", HLSL_CLASS_OBJECT, HLSL_TYPE_SAMPLER, 1, 1); + $$->sampler_dim = HLSL_SAMPLER_DIM_CUBE; + } | TYPE_IDENTIFIER { struct hlsl_type *type; diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index 304f70c5905..6f8b01355cd 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -897,6 +897,16 @@ static const char *debug_base_type(const struct hlsl_type *type) case HLSL_TYPE_INT: name = "int"; break; case HLSL_TYPE_UINT: name = "uint"; break; case HLSL_TYPE_BOOL: name = "bool"; break; + case HLSL_TYPE_SAMPLER: + switch (type->sampler_dim) + { + case HLSL_SAMPLER_DIM_GENERIC: name = "sampler"; break; + case HLSL_SAMPLER_DIM_1D: name = "sampler1D"; break; + case HLSL_SAMPLER_DIM_2D: name = "sampler2D"; break; + case HLSL_SAMPLER_DIM_3D: name = "sampler3D"; break; + case HLSL_SAMPLER_DIM_CUBE: name = "samplerCUBE"; break; + } + break; default: FIXME("Unhandled case %u\n", type->base_type); }