d3dcompiler: Parse sampler declarations.

oldstable
Matteo Bruni 2012-06-11 19:18:32 +02:00 committed by Alexandre Julliard
parent de11f800fd
commit 5e34375238
3 changed files with 45 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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);
}