(D3D9 HLSL) Add calc_and_set_shader_mvp

This commit is contained in:
twinaphex 2018-05-15 05:53:15 +02:00
parent 52fcdd183a
commit 6afd100d2f
3 changed files with 28 additions and 2 deletions

View File

@ -48,8 +48,6 @@
#define d3d9_cg_set_param_1f(param, x) if (param) cgD3D9SetUniform(param, x)
#define D3D_PI 3.14159265358979323846264338327
#define set_cg_param(prog, param, val) do { \
CGparameter cgp = cgGetNamedParameter(prog, param); \
if (cgp) \

View File

@ -253,6 +253,10 @@ static void hlsl_d3d9_renderchain_set_vertices(
params.fbo_info = NULL;
params.fbo_info_cnt = 0;
#if 0
d3d9_cg_renderchain_calc_and_set_shader_mvp(
/*pass->vPrg, */vp_width, vp_height, rotation);
#endif
video_shader_driver_set_parameters(&params);
}
@ -527,6 +531,24 @@ static void hlsl_d3d9_renderchain_render_pass(
d3d9_set_sampler_magfilter(chain->dev, 0, D3DTEXF_POINT);
}
static void d3d9_hlsl_renderchain_calc_and_set_shader_mvp(
unsigned vp_width, unsigned vp_height,
unsigned rotation)
{
struct d3d_matrix proj, ortho, rot, matrix;
d3d_matrix_ortho_off_center_lh(&ortho, 0, vp_width, 0, vp_height, 0, 1);
d3d_matrix_identity(&rot);
d3d_matrix_rotation_z(&rot, rotation * (D3D_PI / 2.0));
d3d_matrix_multiply(&proj, &ortho, &rot);
d3d_matrix_transpose(&matrix, &proj);
#if 0
cgD3D9SetUniformMatrix(cgpModelViewProj, (D3DMATRIX*)&matrix);
#endif
}
static bool hlsl_d3d9_renderchain_render(
d3d9_video_t *d3d,
state_tracker_t *tracker,
@ -578,6 +600,10 @@ static bool hlsl_d3d9_renderchain_render(
chain->frame_count++;
d3d9_hlsl_renderchain_calc_and_set_shader_mvp(
/* chain->vStock, */ chain->final_viewport->Width,
chain->final_viewport->Height, 0);
return true;
}

View File

@ -34,6 +34,8 @@ struct lut_info
bool smooth;
};
#define D3D_PI 3.14159265358979323846264338327
#define VECTOR_LIST_TYPE unsigned
#define VECTOR_LIST_NAME unsigned
#include "../../libretro-common/lists/vector_list.c"