16 #ifndef __D3D9_RENDERCHAIN_H__ 17 #define __D3D9_RENDERCHAIN_H__ 26 #include "../common/d3d9_common.h" 27 #include "../../verbosity.h" 31 #define D3D_DEFAULT_NONPOW2 ((UINT)-2) 32 #define D3D_FILTER_LINEAR (3 << 0) 33 #define D3D_FILTER_POINT (2 << 0) 57 #define D3D_PI 3.14159265358979323846264338327 59 #define VECTOR_LIST_TYPE unsigned 60 #define VECTOR_LIST_NAME unsigned 61 #include "../../libretro-common/lists/vector_list.c" 62 #undef VECTOR_LIST_TYPE 63 #undef VECTOR_LIST_NAME 65 #define VECTOR_LIST_TYPE struct lut_info 66 #define VECTOR_LIST_NAME lut_info 67 #include "../../libretro-common/lists/vector_list.c" 68 #undef VECTOR_LIST_TYPE 69 #undef VECTOR_LIST_NAME 71 #define VECTOR_LIST_TYPE struct shader_pass 72 #define VECTOR_LIST_NAME shader_pass 73 #include "../../libretro-common/lists/vector_list.c" 74 #undef VECTOR_LIST_TYPE 75 #undef VECTOR_LIST_NAME 99 struct shader_pass_vector_list *
passes;
102 struct lut_info_vector_list *
luts;
109 unsigned out_width,
unsigned out_height,
110 unsigned vp_width,
unsigned vp_height,
126 vert[0].
y = out_height;
130 vert[0].
lut_u = 0.0f;
131 vert[0].
lut_v = 0.0f;
137 vert[1].
x = out_width;
138 vert[1].
y = out_height;
142 vert[1].
lut_u = 1.0f;
143 vert[1].
lut_v = 0.0f;
154 vert[2].
lut_u = 0.0f;
155 vert[2].
lut_v = 1.0f;
161 vert[3].
x = out_width;
166 vert[3].
lut_u = 1.0f;
167 vert[3].
lut_v = 1.0f;
178 for (i = 0; i < 4; i++)
185 memcpy(verts, vert,
sizeof(vert));
202 pass->vertex_buf = vertbuf;
212 chain->
passes->count - 1].info.pass->fbo.fp_fbo
226 shader_pass_vector_list_append(chain->
passes, *
pass);
232 const char *
id,
const char *
path,
bool smooth)
266 lut_info_vector_list_append(chain->
luts,
info);
278 for (i = 0; i < chain->
passes->count; i++)
280 if (chain->
passes->data[i].attrib_map)
284 shader_pass_vector_list_free(chain->
passes);
289 lut_info_vector_list_free(chain->
luts);
290 unsigned_vector_list_free(chain->
bound_tex);
300 unsigned index,
unsigned i)
338 for (i = 0; i < chain->
bound_tex->count; i++)
348 for (i = 0; i < chain->
bound_vert->count; i++)
354 unsigned_vector_list_free(chain->
bound_tex);
355 chain->
bound_tex = unsigned_vector_list_new();
361 chain->
bound_vert = unsigned_vector_list_new();
406 unsigned input_scale = d3d->video_info.input_scale
408 unsigned current_width = input_scale;
409 unsigned current_height = input_scale;
410 unsigned out_width = 0;
411 unsigned out_height = 0;
413 link_info.
pass = &d3d->shader.pass[0];
414 link_info.
tex_w = current_width;
415 link_info.
tex_h = current_height;
421 chain->
passes->count - 1],
422 current_width, current_height))
424 RARCH_ERR(
"[D3D9]: Failed to set pass size.\n");
428 for (i = 1; i < d3d->shader.passes; i++)
432 &out_width, &out_height,
433 current_width, current_height, &d3d->final_viewport);
441 chain->
passes->count - 1],
444 RARCH_ERR(
"[D3D9]: Failed to set pass size.\n");
448 current_width = out_width;
449 current_height = out_height;
451 link_info.
pass = &d3d->shader.pass[i];
457 chain->
passes = shader_pass_vector_list_new();
458 chain->
luts = lut_info_vector_list_new();
459 chain->
bound_tex = unsigned_vector_list_new();
460 chain->
bound_vert = unsigned_vector_list_new();
466 unsigned tex_width,
unsigned tex_height,
468 unsigned last_width,
unsigned last_height,
469 unsigned pitch,
unsigned pixel_size)
unsigned last_height
Definition: d3d9_renderchain.h:44
float b
Definition: d3d9_renderchain.h:82
LPDIRECT3DTEXTURE9 tex[TEXTURES]
Definition: d3d9_renderchain.h:91
Vertex _v[4]
Definition: TexturedView.m:14
struct LinkInfo info
Definition: d3d9_renderchain.h:45
struct video_shader_pass * pass
Definition: video_driver.h:83
Definition: d3d9_renderchain.h:77
unsigned ptr
Definition: d3d9_renderchain.h:93
LPDIRECT3DVERTEXBUFFER9 vertex_buf[TEXTURES]
Definition: d3d9_renderchain.h:92
static INLINE void d3d9_vertex_buffer_unlock(LPDIRECT3DVERTEXBUFFER9 vertbuf)
Definition: d3d9_common.h:138
#define INLINE
Definition: retro_inline.h:35
static INLINE void d3d9_set_sampler_minfilter(LPDIRECT3DDEVICE9 dev, unsigned sampler, unsigned value)
Definition: d3d9_common.h:224
#define D3D_DEFAULT_NONPOW2
Definition: d3d9_renderchain.h:31
#define RETRO_BEGIN_DECLS
Definition: retro_common_api.h:41
bool smooth
Definition: d3d9_renderchain.h:39
Definition: d3d8types.h:242
Definition: ffmpeg_core.c:151
rotation
Definition: video_defines.h:62
Definition: d3d8types.h:560
float r
Definition: d3d9_renderchain.h:82
#define RARCH_SCALE_BASE
Definition: video_driver.h:44
Definition: libretro.h:2275
static INLINE void d3d9_recompute_pass_sizes(LPDIRECT3DDEVICE9 dev, d3d9_renderchain_t *chain, d3d9_video_t *d3d)
Definition: d3d9_renderchain.h:399
#define D3D_FILTER_POINT
Definition: d3d9_renderchain.h:33
GLsizei const GLchar ** path
Definition: glext.h:7901
static INLINE void d3d9_renderchain_end_render(d3d9_renderchain_t *chain)
Definition: d3d9_renderchain.h:324
float z
Definition: d3d9_renderchain.h:79
float y
Definition: d3d9_renderchain.h:79
D3DVIEWPORT9 * final_viewport
Definition: d3d9_renderchain.h:98
Definition: video_driver.h:76
LPDIRECT3DTEXTURE9 tex
Definition: d3d9_renderchain.h:47
Definition: video_driver.h:80
unsigned last_height[TEXTURES]
Definition: d3d9_renderchain.h:95
struct IDirect3DVertexDeclaration9 * LPDIRECT3DVERTEXDECLARATION9
Definition: d3d9.h:837
static INLINE void d3d9_texture_free(LPDIRECT3DTEXTURE9 tex)
Definition: d3d9_common.h:191
#define D3DUSAGE_RENDERTARGET
Definition: d3d8types.h:1420
struct shader_pass_vector_list * passes
Definition: d3d9_renderchain.h:99
static INLINE bool d3d9_lock_rectangle(LPDIRECT3DTEXTURE9 tex, unsigned level, D3DLOCKED_RECT *lr, const RECT *rect, unsigned rectangle_height, unsigned flags)
Definition: d3d9_common.h:292
uint64_t frame_count
Definition: d3d9_renderchain.h:88
static INLINE void d3d9_renderchain_set_vertices_on_change(d3d9_renderchain_t *chain, struct shader_pass *pass, unsigned width, unsigned height, unsigned out_width, unsigned out_height, unsigned vp_width, unsigned vp_height, unsigned rotation)
Definition: d3d9_renderchain.h:105
static INLINE bool d3d9_renderchain_set_pass_size(LPDIRECT3DDEVICE9 dev, struct shader_pass *pass, struct shader_pass *pass2, unsigned width, unsigned height)
Definition: d3d9_renderchain.h:365
static INLINE void d3d9_convert_geometry(const struct LinkInfo *info, unsigned *out_width, unsigned *out_height, unsigned width, unsigned height, D3DVIEWPORT9 *final_viewport)
Definition: d3d9_common.h:767
static INLINE bool d3d9_renderchain_add_lut(d3d9_renderchain_t *chain, const char *id, const char *path, bool smooth)
Definition: d3d9_renderchain.h:231
void RARCH_LOG(const char *fmt,...)
Definition: verbosity.c:281
struct unsigned_vector_list * bound_tex
Definition: d3d9_renderchain.h:100
Definition: video_shader_parse.h:71
#define strlcpy(dst, src, size)
Definition: strl.h:46
void * d3d9_vertex_buffer_new(void *_dev, unsigned length, unsigned usage, unsigned fvf, INT32 pool, void *handle)
Definition: d3d9_common.c:294
unsigned tex_w
Definition: video_driver.h:82
enum _D3DFORMAT D3DFORMAT
struct gfx_fbo_scale fbo
Definition: video_shader_parse.h:124
void * attrib_map
Definition: d3d9_renderchain.h:50
static INLINE uint32_t next_pow2(uint32_t v)
Definition: retro_math.h:64
unsigned pixel_size
Definition: d3d9_renderchain.h:87
#define NULL
Pointer to 0.
Definition: gctypes.h:65
void * ftable
Definition: d3d9_renderchain.h:54
struct IDirect3DVertexBuffer9 * LPDIRECT3DVERTEXBUFFER9
Definition: d3d9.h:1274
typedefRETRO_BEGIN_DECLS struct d3d9_video d3d9_video_t
Definition: d3d9_common.h:36
static INLINE void d3d9_set_stream_source(LPDIRECT3DDEVICE9 dev, unsigned stream_no, LPDIRECT3DVERTEXBUFFER9 stream_vertbuf, unsigned offset_bytes, unsigned stride)
Definition: d3d9_common.h:178
unsigned tex_h
Definition: video_driver.h:82
float u
Definition: d3d9_renderchain.h:80
float lut_u
Definition: d3d9_renderchain.h:81
Definition: video_driver.h:77
Definition: d3d8types.h:1343
float lut_v
Definition: d3d9_renderchain.h:81
struct unsigned_vector_list * bound_vert
Definition: d3d9_renderchain.h:101
float v
Definition: d3d9_renderchain.h:80
struct lut_info_vector_list * luts
Definition: d3d9_renderchain.h:102
struct d3d9_renderchain d3d9_renderchain_t
static INLINE void d3d9_unlock_rectangle(LPDIRECT3DTEXTURE9 tex)
Definition: d3d9_common.h:311
void * fprg
Definition: d3d9_renderchain.h:52
LPDIRECT3DVERTEXDECLARATION9 vertex_decl
Definition: d3d9_renderchain.h:49
static INLINE void d3d9_renderchain_destroy_passes_and_luts(d3d9_renderchain_t *chain)
Definition: d3d9_renderchain.h:271
Definition: d3d9types.h:1443
float x
Definition: d3d9_renderchain.h:79
struct IDirect3DTexture9 * LPDIRECT3DTEXTURE9
Definition: d3d9.h:1025
LPDIRECT3DTEXTURE9 tex
Definition: d3d9_renderchain.h:37
#define RETRO_END_DECLS
Definition: retro_common_api.h:42
static INLINE void d3d9_set_sampler_address_u(LPDIRECT3DDEVICE9 dev, unsigned sampler, unsigned value)
Definition: d3d9_common.h:208
#define D3D_FILTER_LINEAR
Definition: d3d9_renderchain.h:32
bool fp_fbo
Definition: video_shader_parse.h:92
static INLINE void d3d9_init_renderchain(d3d9_renderchain_t *chain)
Definition: d3d9_renderchain.h:455
GLuint index
Definition: glext.h:6671
Definition: d3d9_renderchain.h:42
Definition: video_shader_parse.h:70
struct d3d9_renderchain::@247 prev
struct IDirect3DDevice9 * LPDIRECT3DDEVICE9
Definition: d3d9.h:442
LPDIRECT3DVERTEXBUFFER9 vertex_buf
Definition: d3d9_renderchain.h:48
D3DPOOL pool
Definition: d3d9_renderchain.h:46
void * d3d9_texture_new(void *_dev, const char *path, unsigned width, unsigned height, unsigned miplevels, unsigned usage, INT32 format, INT32 pool, unsigned filter, unsigned mipfilter, INT32 color_key, void *src_info_data, PALETTEENTRY *palette, bool want_mipmap)
Definition: d3d9_common.c:257
static INLINE bool d3d9_renderchain_add_pass(d3d9_renderchain_t *chain, struct shader_pass *pass, const struct LinkInfo *info)
Definition: d3d9_renderchain.h:189
Definition: d3d8types.h:1506
GLint GLint GLsizei width
Definition: glext.h:6293
float g
Definition: d3d9_renderchain.h:82
static INLINE void d3d9_renderchain_add_lut_internal(d3d9_renderchain_t *chain, unsigned index, unsigned i)
Definition: d3d9_renderchain.h:298
static INLINE void d3d9_set_sampler_address_v(LPDIRECT3DDEVICE9 dev, unsigned sampler, unsigned value)
Definition: d3d9_common.h:216
static INLINE void d3d9_texture_blit(unsigned pixel_size, void *tex, D3DLOCKED_RECT *lr, const void *frame, unsigned width, unsigned height, unsigned pitch)
Definition: d3d9_common.h:416
static INLINE void d3d9_set_texture(LPDIRECT3DDEVICE9 dev, unsigned sampler, LPDIRECT3DTEXTURE9 tex)
Definition: d3d9_common.h:328
LPDIRECT3DDEVICE9 dev
Definition: d3d9_renderchain.h:97
static INLINE INT32 d3d9_get_argb8888_format(void)
Definition: d3d9_common.h:749
static INLINE void d3d9_lock_rectangle_clear(void *tex, unsigned level, D3DLOCKED_RECT *lr, RECT *rect, unsigned rectangle_height, unsigned flags)
Definition: d3d9_common.h:317
void * vtable
Definition: d3d9_renderchain.h:53
void * vprg
Definition: d3d9_renderchain.h:51
#define false
Definition: ordinals.h:83
static INLINE void d3d9_set_sampler_magfilter(LPDIRECT3DDEVICE9 dev, unsigned sampler, unsigned value)
Definition: d3d9_common.h:233
static INLINE void * d3d9_vertex_buffer_lock(LPDIRECT3DVERTEXBUFFER9 vertbuf)
Definition: d3d9_common.h:125
int32_t d3d_translate_filter(unsigned type)
Definition: d3d_common.c:112
static INLINE void d3d9_renderchain_unbind_all(d3d9_renderchain_t *chain)
Definition: d3d9_renderchain.h:331
float a
Definition: d3d9_renderchain.h:82
Definition: d3d9types.h:100
static INLINE void d3d9_renderchain_blit_to_texture(LPDIRECT3DTEXTURE9 tex, const void *frame, unsigned tex_width, unsigned tex_height, unsigned width, unsigned height, unsigned last_width, unsigned last_height, unsigned pitch, unsigned pixel_size)
Definition: d3d9_renderchain.h:463
unsigned last_width
Definition: d3d9_renderchain.h:44
unsigned __int64 uint64_t
Definition: stdint.h:136
unsigned last_width[TEXTURES]
Definition: d3d9_renderchain.h:94
Definition: d3d9_renderchain.h:85
#define D3DLOCK_NOSYSLOCK
Definition: d3d8types.h:1450
static INLINE void d3d9_renderchain_start_render(d3d9_renderchain_t *chain)
Definition: d3d9_renderchain.h:312
Definition: d3d9_renderchain.h:35
#define D3DUSAGE_WRITEONLY
Definition: d3d8types.h:1424
Definition: d3d8types.h:1344
GLint GLint GLsizei GLsizei height
Definition: glext.h:6293
void RARCH_ERR(const char *fmt,...)
Definition: verbosity.c:313
void * memcpy(void *dst, const void *src, size_t len)
Definition: string.c:26