mirror of
https://github.com/libretro/RetroArch
synced 2025-02-11 06:40:48 +00:00
(HLSL) Fix build - work with new shader backend
This commit is contained in:
parent
a6db35875d
commit
a5bbc7da5f
@ -17,7 +17,9 @@
|
||||
#define SHADER_COMMON_H__
|
||||
|
||||
#include "../boolean.h"
|
||||
#ifdef HAVE_OPENGL
|
||||
#include "gl_common.h"
|
||||
#endif
|
||||
#include "gfx_context.h"
|
||||
#include "shader_parse.h"
|
||||
#include "math/matrix.h"
|
||||
|
@ -103,7 +103,10 @@ void hlsl_set_proj_matrix(XMMATRIX rotation_value)
|
||||
static void hlsl_set_params(unsigned width, unsigned height,
|
||||
unsigned tex_width, unsigned tex_height,
|
||||
unsigned out_width, unsigned out_height,
|
||||
unsigned frame_count)
|
||||
unsigned frame_counter,
|
||||
const struct gl_tex_info *info,
|
||||
const struct gl_tex_info *prev_info,
|
||||
const struct gl_tex_info *fbo_info, unsigned fbo_info_cnt)
|
||||
{
|
||||
if (!hlsl_active)
|
||||
return;
|
||||
@ -111,7 +114,7 @@ static void hlsl_set_params(unsigned width, unsigned height,
|
||||
const float ori_size[2] = { (float)width, (float)height };
|
||||
const float tex_size[2] = { (float)tex_width, (float)tex_height };
|
||||
const float out_size[2] = { (float)out_width, (float)out_height };
|
||||
float frame_cnt = frame_count;
|
||||
float frame_cnt = frame_counter;
|
||||
|
||||
prg[active_index].f_ctable->SetDefaults(d3d_device_ptr);
|
||||
prg[active_index].v_ctable->SetDefaults(d3d_device_ptr);
|
||||
@ -330,12 +333,9 @@ static bool load_preset(const char *path)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool hlsl_init(const char *path, IDirect3DDevice9 * device_ptr)
|
||||
static bool hlsl_init(const char *path)
|
||||
{
|
||||
if (!device_ptr)
|
||||
return false;
|
||||
|
||||
d3d_device_ptr = device_ptr;
|
||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||
|
||||
if (path && strcmp(path_get_extension(path), ".cgp") == 0)
|
||||
{
|
||||
@ -351,8 +351,9 @@ static bool hlsl_init(const char *path, IDirect3DDevice9 * device_ptr)
|
||||
for(unsigned i = 1; i <= cg_shader->passes; i++)
|
||||
set_program_attributes(i);
|
||||
|
||||
d3d_device_ptr->SetVertexShader(prg[1].vprg);
|
||||
d3d_device_ptr->SetPixelShader(prg[1].fprg);
|
||||
d3d_device_ptr = d3d->d3d_render_device;
|
||||
d3d->d3d_render_device->SetVertexShader(prg[1].vprg);
|
||||
d3d->d3d_render_device->SetPixelShader(prg[1].fprg);
|
||||
|
||||
hlsl_active = true;
|
||||
return true;
|
||||
|
@ -18,7 +18,7 @@
|
||||
#ifndef __RARCH_HLSL_H
|
||||
#define __RARCH_HLSL_H
|
||||
|
||||
#include "../boolean.h"
|
||||
#include "shader_common.h"
|
||||
#include <stdint.h>
|
||||
|
||||
void hlsl_set_proj_matrix(XMMATRIX rotation_value);
|
||||
|
@ -171,11 +171,12 @@ static void xdk_d3d_free(void *data)
|
||||
if (!d3d)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_HLSL
|
||||
hlsl_deinit();
|
||||
#endif
|
||||
d3d->font_ctx->deinit(d3d);
|
||||
|
||||
if (d3d->shader)
|
||||
d3d->shader->deinit();
|
||||
d3d->shader = NULL;
|
||||
|
||||
d3d->ctx_driver->destroy();
|
||||
|
||||
free(d3d);
|
||||
@ -255,6 +256,9 @@ static void xdk_d3d_set_viewport(bool force_full)
|
||||
vp.MaxZ = m_zFar;
|
||||
d3dr->SetViewport(&vp);
|
||||
|
||||
if (d3d->shader)
|
||||
d3d->shader->set_mvp(NULL);
|
||||
|
||||
#ifdef _XBOX1
|
||||
font_x = vp.X;
|
||||
font_y = vp.Y;
|
||||
@ -672,7 +676,7 @@ static void *xdk_d3d_init(const video_info_t *video, const input_driver_t **inpu
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RARCH_LOG("D3D: Loaded %u program(s).\n", d3d->shader->num_func());
|
||||
RARCH_LOG("D3D: Loaded %u program(s).\n", d3d->shader->num_shaders());
|
||||
#endif
|
||||
|
||||
#if 0 /* ifdef HAVE_FBO */
|
||||
@ -888,9 +892,12 @@ static bool xdk_d3d_frame(void *data, const void *frame,
|
||||
#endif
|
||||
{
|
||||
#ifdef HAVE_HLSL
|
||||
|
||||
if (d3d->shader)
|
||||
d3d->shader->set_params(width, height, d3d->tex_w, d3d->tex_h, d3d->win_width,
|
||||
d3d->win_height, g_extern.frame_count);
|
||||
d3d->win_height, g_extern.frame_count,
|
||||
/* TODO - missing a bunch of params at the end */
|
||||
NULL, NULL, NULL, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -41,9 +41,12 @@ typedef struct DrawVerticeFormats
|
||||
float u, v;
|
||||
} DrawVerticeFormats;
|
||||
|
||||
typedef struct gl_shader_backend gl_shader_backend_t;
|
||||
|
||||
typedef struct xdk_d3d_video
|
||||
{
|
||||
const gfx_ctx_driver_t *ctx_driver;
|
||||
const gl_shader_backend_t *shader;
|
||||
#ifdef HAVE_FBO
|
||||
bool fbo_inited;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user