diff --git a/360/xdk360_video.cpp b/360/xdk360_video.cpp index 1c892fa3a3..083e5348e6 100644 --- a/360/xdk360_video.cpp +++ b/360/xdk360_video.cpp @@ -435,7 +435,8 @@ static bool xdk360_gfx_frame(void *data, const void *frame, } hlsl_use(0); - hlsl_set_params(); + hlsl_set_params(width, height, 512, 512, vid->d3dpp.BackBufferWidth, + vid->d3dpp.BackBufferHeight); D3DLOCKED_RECT d3dlr; D3DTexture_LockRect(vid->lpTexture, 0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK); diff --git a/gfx/shader_hlsl.c b/gfx/shader_hlsl.c index e5ad5ab0cd..23d01b2061 100644 --- a/gfx/shader_hlsl.c +++ b/gfx/shader_hlsl.c @@ -84,12 +84,28 @@ void hlsl_set_proj_matrix(XMMATRIX rotation_value) prg[active_index].mvp_val = rotation_value; } -void hlsl_set_params(void) +#define set_param_2f(param, xy, constanttable) \ + if (param) constanttable->SetFloatArray(d3d_device_ptr, param, xy, 2); + +void hlsl_set_params(unsigned width, unsigned height, + unsigned tex_width, unsigned tex_height, + unsigned out_width, unsigned out_height) { if (!hlsl_active) return; - //const float val[2] = {2.5f, 2.5f}; + const float ori_size[2] = {(float)width, (float)height }; + const float out_size[2] = {(float)out_width, (float)out_height}; + const float tex_size[2] = {(float)tex_width, (float)tex_height}; + + set_param_2f(prg[active_index].vid_size_f, ori_size, prg[active_index].f_ctable); + set_param_2f(prg[active_index].tex_size_f, tex_size, prg[active_index].f_ctable); + set_param_2f(prg[active_index].out_size_f, out_size, prg[active_index].f_ctable); + + set_param_2f(prg[active_index].vid_size_v, ori_size, prg[active_index].v_ctable); + set_param_2f(prg[active_index].tex_size_v, tex_size, prg[active_index].v_ctable); + set_param_2f(prg[active_index].out_size_v, out_size, prg[active_index].v_ctable); + prg[active_index].v_ctable->SetMatrix(d3d_device_ptr, prg[active_index].mvp, (D3DXMATRIX*)&prg[active_index].mvp_val); //prg[active_index].f_ctable->SetFloatArray(d3d_device_ptr, prg[active_index].out_size_f, val, 2); } diff --git a/gfx/shader_hlsl.h b/gfx/shader_hlsl.h index 7b083b7202..90653d1c02 100644 --- a/gfx/shader_hlsl.h +++ b/gfx/shader_hlsl.h @@ -27,7 +27,9 @@ void hlsl_deinit(void); void hlsl_set_proj_matrix(XMMATRIX rotation_value); -void hlsl_set_params(void); +void hlsl_set_params(unsigned width, unsigned height, + unsigned tex_width, unsigned tex_height, + unsigned out_width, unsigned out_height); void hlsl_use(unsigned index); diff --git a/msvc-360/SSNES-360/SSNES-360.vcxproj b/msvc-360/SSNES-360/SSNES-360.vcxproj index a65d5b4430..feddcb3605 100644 --- a/msvc-360/SSNES-360/SSNES-360.vcxproj +++ b/msvc-360/SSNES-360/SSNES-360.vcxproj @@ -562,6 +562,7 @@ copy %(FullPath) $(OutDir)media\shaders\stock.cg copy %(FullPath) $(OutDir)media\shaders\stock.cg copy %(FullPath) $(OutDir)media\shaders\stock.cg + true @@ -644,4 +645,4 @@ - + \ No newline at end of file