(HLSL) Cleanups

This commit is contained in:
twinaphex 2017-10-03 05:18:32 +02:00
parent a1b39b9c8b
commit 7dcafe4b40

View File

@ -119,9 +119,9 @@ static void hlsl_set_uniform_parameter(
}
#define set_param_2f(param, xy, constanttable) \
if (param) constanttable->SetFloatArray(d3d_device_ptr, param, xy, 2)
if (param) constanttable->SetFloatArray(d3dr, param, xy, 2)
#define set_param_1f(param, x, constanttable) \
if (param) constanttable->SetFloat(d3d_device_ptr, param, x)
if (param) constanttable->SetFloat(d3dr, param, x)
static void hlsl_set_params(void *data, void *shader_data,
unsigned width, unsigned height,
@ -134,7 +134,7 @@ static void hlsl_set_params(void *data, void *shader_data,
const void *_fbo_info, unsigned fbo_info_cnt)
{
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
const struct video_tex_info *info = (const struct video_tex_info*)_info;
const struct video_tex_info *prev_info = (const struct video_tex_info*)_prev_info;
const struct video_tex_info *fbo_info = (const struct video_tex_info*)_fbo_info;
@ -148,8 +148,8 @@ static void hlsl_set_params(void *data, void *shader_data,
const float out_size[2] = { (float)out_width, (float)out_height };
float frame_cnt = frame_counter;
hlsl->prg[hlsl->active_idx].f_ctable->SetDefaults(d3d_device_ptr);
hlsl->prg[hlsl->active_idx].v_ctable->SetDefaults(d3d_device_ptr);
hlsl->prg[hlsl->active_idx].f_ctable->SetDefaults(d3dr);
hlsl->prg[hlsl->active_idx].v_ctable->SetDefaults(d3dr);
set_param_2f(hlsl->prg[hlsl->active_idx].vid_size_f, ori_size, hlsl->prg[hlsl->active_idx].f_ctable);
set_param_2f(hlsl->prg[hlsl->active_idx].tex_size_f, tex_size, hlsl->prg[hlsl->active_idx].f_ctable);
@ -176,7 +176,7 @@ static bool hlsl_compile_program(
hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)data;
d3d_video_t *d3d = (d3d_video_t*)hlsl->d3d;
struct shader_program_hlsl_data *program = (struct shader_program_hlsl_data*)program_data;
LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
ID3DXBuffer *listing_f = NULL;
ID3DXBuffer *listing_v = NULL;
ID3DXBuffer *code_f = NULL;
@ -213,8 +213,8 @@ static bool hlsl_compile_program(
goto end;
}
d3d_device_ptr->CreatePixelShader((const DWORD*)code_f->GetBufferPointer(), &program->fprg);
d3d_device_ptr->CreateVertexShader((const DWORD*)code_v->GetBufferPointer(), &program->vprg);
d3dr->CreatePixelShader((const DWORD*)code_f->GetBufferPointer(), &program->fprg);
d3dr->CreateVertexShader((const DWORD*)code_v->GetBufferPointer(), &program->vprg);
code_f->Release();
code_v->Release();
@ -499,13 +499,13 @@ static void hlsl_shader_scale(void *data, unsigned idx, struct gfx_fbo_scale *sc
static bool hlsl_set_mvp(void *data, void *shader_data, const math_matrix_4x4 *mat)
{
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev;
hlsl_shader_data_t *hlsl_data = (hlsl_shader_data_t*)shader_data;
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
hlsl_shader_data_t *hlsl_data = (hlsl_shader_data_t*)shader_data;
if(hlsl_data && hlsl_data->prg[hlsl_data->active_idx].mvp)
{
hlsl_data->prg[hlsl_data->active_idx].v_ctable->SetMatrix(d3d_device_ptr,
hlsl_data->prg[hlsl_data->active_idx].v_ctable->SetMatrix(d3dr,
hlsl_data->prg[hlsl_data->active_idx].mvp,
(D3DXMATRIX*)&hlsl_data->prg[hlsl_data->active_idx].mvp_val);
return true;