Commit d6ab655a authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

d3dx9: Support effect state manager.

parent de8e03c4
......@@ -232,12 +232,16 @@ struct d3dx9_base_effect;
struct d3dx_parameter *get_parameter_by_name(struct d3dx9_base_effect *base,
struct d3dx_parameter *parameter, const char *name) DECLSPEC_HIDDEN;
#define SET_D3D_STATE_(manager, device, method, args...) (manager ? manager->lpVtbl->method(manager, args) \
: device->lpVtbl->method(device, args))
#define SET_D3D_STATE(base_effect, args...) SET_D3D_STATE_(base_effect->manager, base_effect->device, args)
void d3dx_create_param_eval(struct d3dx9_base_effect *base_effect, void *byte_code,
unsigned int byte_code_size, D3DXPARAMETER_TYPE type, struct d3dx_param_eval **peval) DECLSPEC_HIDDEN;
void d3dx_free_param_eval(struct d3dx_param_eval *peval) DECLSPEC_HIDDEN;
HRESULT d3dx_evaluate_parameter(struct d3dx_param_eval *peval,
const struct d3dx_parameter *param, void *param_value, BOOL update_all) DECLSPEC_HIDDEN;
HRESULT d3dx_param_eval_set_shader_constants(struct IDirect3DDevice9 *device,
HRESULT d3dx_param_eval_set_shader_constants(ID3DXEffectStateManager *manager, struct IDirect3DDevice9 *device,
struct d3dx_param_eval *peval, BOOL update_all) DECLSPEC_HIDDEN;
BOOL is_param_eval_input_dirty(struct d3dx_param_eval *peval) DECLSPEC_HIDDEN;
......
......@@ -1302,8 +1302,8 @@ HRESULT d3dx_evaluate_parameter(struct d3dx_param_eval *peval, const struct d3dx
return D3D_OK;
}
static HRESULT set_shader_constants_device(struct IDirect3DDevice9 *device, struct d3dx_regstore *rs,
D3DXPARAMETER_TYPE type, enum pres_reg_tables table)
static HRESULT set_shader_constants_device(ID3DXEffectStateManager *manager, struct IDirect3DDevice9 *device,
struct d3dx_regstore *rs, D3DXPARAMETER_TYPE type, enum pres_reg_tables table)
{
unsigned int start, count;
void *ptr;
......@@ -1328,13 +1328,13 @@ static HRESULT set_shader_constants_device(struct IDirect3DDevice9 *device, stru
switch(table)
{
case PRES_REGTAB_OCONST:
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, start, (const float *)ptr, count);
hr = SET_D3D_STATE_(manager, device, SetVertexShaderConstantF, start, (const float *)ptr, count);
break;
case PRES_REGTAB_OICONST:
hr = IDirect3DDevice9_SetVertexShaderConstantI(device, start, (const int *)ptr, count);
hr = SET_D3D_STATE_(manager, device, SetVertexShaderConstantI, start, (const int *)ptr, count);
break;
case PRES_REGTAB_OBCONST:
hr = IDirect3DDevice9_SetVertexShaderConstantB(device, start, (const BOOL *)ptr, count);
hr = SET_D3D_STATE_(manager, device, SetVertexShaderConstantB, start, (const BOOL *)ptr, count);
break;
default:
FIXME("Unexpected register table %u.\n", table);
......@@ -1346,13 +1346,13 @@ static HRESULT set_shader_constants_device(struct IDirect3DDevice9 *device, stru
switch(table)
{
case PRES_REGTAB_OCONST:
hr = IDirect3DDevice9_SetPixelShaderConstantF(device, start, (const float *)ptr, count);
hr = SET_D3D_STATE_(manager, device, SetPixelShaderConstantF, start, (const float *)ptr, count);
break;
case PRES_REGTAB_OICONST:
hr = IDirect3DDevice9_SetPixelShaderConstantI(device, start, (const int *)ptr, count);
hr = SET_D3D_STATE_(manager, device, SetPixelShaderConstantI, start, (const int *)ptr, count);
break;
case PRES_REGTAB_OBCONST:
hr = IDirect3DDevice9_SetPixelShaderConstantB(device, start, (const BOOL *)ptr, count);
hr = SET_D3D_STATE_(manager, device, SetPixelShaderConstantB, start, (const BOOL *)ptr, count);
break;
default:
FIXME("Unexpected register table %u.\n", table);
......@@ -1376,8 +1376,8 @@ static HRESULT set_shader_constants_device(struct IDirect3DDevice9 *device, stru
return result;
}
HRESULT d3dx_param_eval_set_shader_constants(struct IDirect3DDevice9 *device, struct d3dx_param_eval *peval,
BOOL update_all)
HRESULT d3dx_param_eval_set_shader_constants(ID3DXEffectStateManager *manager, struct IDirect3DDevice9 *device,
struct d3dx_param_eval *peval, BOOL update_all)
{
static const enum pres_reg_tables set_tables[] =
{PRES_REGTAB_OCONST, PRES_REGTAB_OICONST, PRES_REGTAB_OBCONST};
......@@ -1399,7 +1399,7 @@ HRESULT d3dx_param_eval_set_shader_constants(struct IDirect3DDevice9 *device, st
result = D3D_OK;
for (i = 0; i < ARRAY_SIZE(set_tables); ++i)
{
if (FAILED(hr = set_shader_constants_device(device, rs, peval->param_type, set_tables[i])))
if (FAILED(hr = set_shader_constants_device(manager, device, rs, peval->param_type, set_tables[i])))
result = hr;
}
return result;
......
......@@ -5653,13 +5653,11 @@ static void test_effect_state_manager(IDirect3DDevice9 *device)
qsort(state_manager->update_record, state_manager->update_record_count,
sizeof(*state_manager->update_record), compare_update_record);
todo_wine
ok(ARRAY_SIZE(expected_updates) == state_manager->update_record_count,
"Got %u update records.\n", state_manager->update_record_count);
n = min(ARRAY_SIZE(expected_updates), state_manager->update_record_count);
for (i = 0; i < n; ++i)
{
todo_wine
ok(!memcmp(&expected_updates[i], &state_manager->update_record[i],
sizeof(expected_updates[i])),
"Update record mismatch, expected %s, %u, %u, got %s, %u, %u.\n",
......
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