d3d10: Add support for parsing sample masks to parse_fx10_object().

This commit is contained in:
Henri Verbeet 2012-07-18 15:52:32 +02:00 committed by Alexandre Julliard
parent d53ad3acb0
commit 1cfba6cefb
2 changed files with 32 additions and 0 deletions

View File

@ -53,6 +53,7 @@ enum d3d10_effect_object_type
D3D10_EOT_PIXELSHADER = 0x7, D3D10_EOT_PIXELSHADER = 0x7,
D3D10_EOT_GEOMETRYSHADER = 0x8, D3D10_EOT_GEOMETRYSHADER = 0x8,
D3D10_EOT_BLEND_FACTOR = 0xa, D3D10_EOT_BLEND_FACTOR = 0xa,
D3D10_EOT_SAMPLE_MASK = 0xb,
}; };
enum d3d10_effect_object_operation enum d3d10_effect_object_operation
@ -158,6 +159,7 @@ struct d3d10_effect_pass
struct d3d10_effect_object *objects; struct d3d10_effect_object *objects;
struct d3d10_effect_variable *annotations; struct d3d10_effect_variable *annotations;
UINT sample_mask;
float blend_factor[4]; float blend_factor[4];
}; };

View File

@ -917,6 +917,20 @@ static BOOL read_float_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, floa
} }
} }
static BOOL read_int32_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT *out_data, UINT idx)
{
switch (in_type)
{
case D3D10_SVT_INT:
out_data[idx] = value;
return TRUE;
default:
FIXME("Unhandled in_type %#x.\n", in_type);
return FALSE;
}
}
static BOOL read_value_list(const char *ptr, D3D_SHADER_VARIABLE_TYPE out_type, static BOOL read_value_list(const char *ptr, D3D_SHADER_VARIABLE_TYPE out_type,
UINT out_size, void *out_data) UINT out_size, void *out_data)
{ {
@ -944,6 +958,11 @@ static BOOL read_value_list(const char *ptr, D3D_SHADER_VARIABLE_TYPE out_type,
return FALSE; return FALSE;
break; break;
case D3D10_SVT_UINT:
if (!read_int32_value(value, in_type, out_data, i))
return FALSE;
break;
default: default:
FIXME("Unhandled out_type %#x.\n", out_type); FIXME("Unhandled out_type %#x.\n", out_type);
return FALSE; return FALSE;
@ -999,6 +1018,16 @@ static HRESULT parse_fx10_object(struct d3d10_effect_object *o, const char **ptr
hr = S_OK; hr = S_OK;
break; break;
case D3D10_EOT_SAMPLE_MASK:
if (!read_value_list(data + offset, D3D10_SVT_UINT, 1, &o->pass->sample_mask))
{
FIXME("Failed to read sample mask.\n");
return E_FAIL;
}
hr = S_OK;
break;
case D3D10_EOT_BLEND_FACTOR: case D3D10_EOT_BLEND_FACTOR:
if (!read_value_list(data + offset, D3D10_SVT_FLOAT, 4, &o->pass->blend_factor[0])) if (!read_value_list(data + offset, D3D10_SVT_FLOAT, 4, &o->pass->blend_factor[0]))
{ {
@ -2547,6 +2576,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *ifa
} }
} }
desc->SampleMask = This->sample_mask;
memcpy(desc->BlendFactor, This->blend_factor, 4 * sizeof(float)); memcpy(desc->BlendFactor, This->blend_factor, 4 * sizeof(float));
return S_OK; return S_OK;