Commit 5e343752 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dcompiler: Parse sampler declarations.

parent de11f800
......@@ -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;
......
......@@ -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;
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment