2014-09-11 21:43:01 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2017-01-22 12:40:32 +00:00
|
|
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
2017-12-12 07:55:31 +00:00
|
|
|
*
|
2014-09-11 21:43:01 +00:00
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-11-18 12:00:13 +00:00
|
|
|
#ifndef _D3D_COMMON_H
|
|
|
|
#define _D3D_COMMON_H
|
2014-09-11 21:43:01 +00:00
|
|
|
|
2015-11-09 00:04:32 +00:00
|
|
|
#include <boolean.h>
|
2016-06-03 06:06:49 +00:00
|
|
|
#include <retro_common_api.h>
|
2015-11-09 00:04:32 +00:00
|
|
|
|
2015-11-18 12:00:13 +00:00
|
|
|
#include "win32_common.h"
|
2015-11-17 07:20:10 +00:00
|
|
|
#include "../../defines/d3d_defines.h"
|
2014-09-11 21:43:01 +00:00
|
|
|
|
2016-06-03 06:06:49 +00:00
|
|
|
RETRO_BEGIN_DECLS
|
2015-11-09 00:19:09 +00:00
|
|
|
|
2015-11-09 00:04:32 +00:00
|
|
|
bool d3d_swap(void *data, LPDIRECT3DDEVICE dev);
|
2014-09-11 21:43:01 +00:00
|
|
|
|
2014-09-13 15:56:33 +00:00
|
|
|
LPDIRECT3DVERTEXBUFFER d3d_vertex_buffer_new(LPDIRECT3DDEVICE dev,
|
2014-09-11 21:43:01 +00:00
|
|
|
unsigned length, unsigned usage, unsigned fvf,
|
2014-09-13 15:56:33 +00:00
|
|
|
D3DPOOL pool, void *handle);
|
2014-09-11 21:43:01 +00:00
|
|
|
|
2016-10-20 03:00:20 +00:00
|
|
|
void *d3d_vertex_buffer_lock(void *data);
|
|
|
|
void d3d_vertex_buffer_unlock(void *data);
|
2014-09-13 17:33:06 +00:00
|
|
|
|
2015-04-05 15:05:53 +00:00
|
|
|
void d3d_vertex_buffer_free(void *vertex_data, void *vertex_declaration);
|
2014-09-13 16:11:15 +00:00
|
|
|
|
2017-10-03 02:18:27 +00:00
|
|
|
bool d3d_texture_get_level_desc(LPDIRECT3DTEXTURE tex,
|
|
|
|
unsigned idx, void *_ppsurface_level);
|
|
|
|
|
2017-10-03 00:45:06 +00:00
|
|
|
bool d3d_texture_get_surface_level(LPDIRECT3DTEXTURE tex,
|
|
|
|
unsigned idx, void **_ppsurface_level);
|
|
|
|
|
2014-09-13 16:11:15 +00:00
|
|
|
LPDIRECT3DTEXTURE d3d_texture_new(LPDIRECT3DDEVICE dev,
|
|
|
|
const char *path, unsigned width, unsigned height,
|
|
|
|
unsigned miplevels, unsigned usage, D3DFORMAT format,
|
|
|
|
D3DPOOL pool, unsigned filter, unsigned mipfilter,
|
2017-12-12 07:55:31 +00:00
|
|
|
D3DCOLOR color_key, void *src_info,
|
2014-09-13 16:11:15 +00:00
|
|
|
PALETTEENTRY *palette);
|
|
|
|
|
2014-09-11 21:43:01 +00:00
|
|
|
void d3d_set_stream_source(LPDIRECT3DDEVICE dev, unsigned stream_no,
|
2016-10-20 03:00:20 +00:00
|
|
|
void *stream_vertbuf, unsigned offset_bytes,
|
2014-09-11 21:43:01 +00:00
|
|
|
unsigned stride);
|
|
|
|
|
2014-09-13 16:11:15 +00:00
|
|
|
void d3d_texture_free(LPDIRECT3DTEXTURE tex);
|
|
|
|
|
2014-09-13 19:50:07 +00:00
|
|
|
void d3d_set_transform(LPDIRECT3DDEVICE dev,
|
|
|
|
D3DTRANSFORMSTATETYPE state, CONST D3DMATRIX *matrix);
|
|
|
|
|
2014-09-11 21:43:01 +00:00
|
|
|
void d3d_set_sampler_address_u(LPDIRECT3DDEVICE dev,
|
2014-09-12 05:49:25 +00:00
|
|
|
unsigned sampler, unsigned value);
|
2014-09-11 21:43:01 +00:00
|
|
|
|
|
|
|
void d3d_set_sampler_address_v(LPDIRECT3DDEVICE dev,
|
2014-09-12 05:49:25 +00:00
|
|
|
unsigned sampler, unsigned value);
|
2014-09-11 21:43:01 +00:00
|
|
|
|
|
|
|
void d3d_set_sampler_minfilter(LPDIRECT3DDEVICE dev,
|
2014-09-12 05:49:25 +00:00
|
|
|
unsigned sampler, unsigned value);
|
2014-09-11 21:43:01 +00:00
|
|
|
|
|
|
|
void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev,
|
2014-09-12 05:49:25 +00:00
|
|
|
unsigned sampler, unsigned value);
|
2014-09-11 21:43:01 +00:00
|
|
|
|
2017-10-01 23:15:23 +00:00
|
|
|
bool d3d_begin_scene(LPDIRECT3DDEVICE dev);
|
|
|
|
|
|
|
|
void d3d_end_scene(LPDIRECT3DDEVICE dev);
|
|
|
|
|
2014-09-11 21:43:01 +00:00
|
|
|
void d3d_draw_primitive(LPDIRECT3DDEVICE dev,
|
2014-09-11 22:00:20 +00:00
|
|
|
D3DPRIMITIVETYPE type, unsigned start, unsigned count);
|
2014-09-11 21:43:01 +00:00
|
|
|
|
2014-09-13 18:09:55 +00:00
|
|
|
void d3d_clear(LPDIRECT3DDEVICE dev,
|
|
|
|
unsigned count, const D3DRECT *rects, unsigned flags,
|
|
|
|
D3DCOLOR color, float z, unsigned stencil);
|
|
|
|
|
2015-11-09 14:43:03 +00:00
|
|
|
bool d3d_lock_rectangle(LPDIRECT3DTEXTURE tex,
|
2015-11-09 14:34:16 +00:00
|
|
|
unsigned level, D3DLOCKED_RECT *lock_rect, RECT *rect,
|
|
|
|
unsigned rectangle_height, unsigned flags);
|
|
|
|
|
2015-11-09 14:39:47 +00:00
|
|
|
void d3d_lock_rectangle_clear(LPDIRECT3DTEXTURE tex,
|
2014-09-13 03:45:49 +00:00
|
|
|
unsigned level, D3DLOCKED_RECT *lock_rect, RECT *rect,
|
2015-04-05 17:17:24 +00:00
|
|
|
unsigned rectangle_height, unsigned flags);
|
2014-09-11 21:43:01 +00:00
|
|
|
|
2015-11-09 14:39:47 +00:00
|
|
|
void d3d_unlock_rectangle(LPDIRECT3DTEXTURE tex);
|
2015-11-09 14:34:16 +00:00
|
|
|
|
2014-09-12 17:19:11 +00:00
|
|
|
void d3d_set_texture(LPDIRECT3DDEVICE dev, unsigned sampler,
|
2016-12-07 05:26:24 +00:00
|
|
|
void *tex_data);
|
2014-09-12 17:19:11 +00:00
|
|
|
|
2018-01-06 22:10:27 +00:00
|
|
|
bool d3d_create_vertex_shader(LPDIRECT3DDEVICE dev,
|
|
|
|
const DWORD *a, void **b);
|
|
|
|
|
|
|
|
bool d3d_create_pixel_shader(LPDIRECT3DDEVICE dev,
|
|
|
|
const DWORD *a, void **b);
|
|
|
|
|
2018-01-06 21:57:44 +00:00
|
|
|
void d3d_free_pixel_shader(LPDIRECT3DDEVICE dev, void *data);
|
|
|
|
|
|
|
|
void d3d_free_vertex_shader(LPDIRECT3DDEVICE dev, void *data);
|
|
|
|
|
2018-01-06 21:49:17 +00:00
|
|
|
bool d3d_set_pixel_shader(LPDIRECT3DDEVICE dev, void *data);
|
|
|
|
|
|
|
|
bool d3d_set_vertex_shader(LPDIRECT3DDEVICE dev, unsigned index,
|
2014-09-12 18:02:32 +00:00
|
|
|
void *data);
|
2014-09-12 17:42:17 +00:00
|
|
|
|
2015-04-06 22:46:46 +00:00
|
|
|
void d3d_texture_blit(unsigned pixel_size,
|
2014-09-13 03:45:49 +00:00
|
|
|
LPDIRECT3DTEXTURE tex,
|
|
|
|
D3DLOCKED_RECT *lr, const void *frame,
|
2014-09-11 21:43:01 +00:00
|
|
|
unsigned width, unsigned height, unsigned pitch);
|
|
|
|
|
2015-11-12 00:38:13 +00:00
|
|
|
bool d3d_vertex_declaration_new(LPDIRECT3DDEVICE dev,
|
|
|
|
const void *vertex_data, void **decl_data);
|
|
|
|
|
2017-10-01 20:23:04 +00:00
|
|
|
void d3d_vertex_declaration_free(void *data);
|
|
|
|
|
2016-01-07 08:22:04 +00:00
|
|
|
void d3d_set_viewports(LPDIRECT3DDEVICE dev, D3DVIEWPORT *vp);
|
2014-09-12 16:01:32 +00:00
|
|
|
|
2015-04-05 22:55:25 +00:00
|
|
|
void d3d_enable_blend_func(void *data);
|
|
|
|
|
|
|
|
void d3d_disable_blend_func(void *data);
|
|
|
|
|
2015-04-07 00:44:12 +00:00
|
|
|
void d3d_set_vertex_declaration(void *data, void *vertex_data);
|
|
|
|
|
2015-04-10 05:24:13 +00:00
|
|
|
void d3d_enable_alpha_blend_texture_func(void *data);
|
|
|
|
|
2015-04-10 05:33:30 +00:00
|
|
|
void d3d_frame_postprocess(void *data);
|
|
|
|
|
2017-10-01 20:28:48 +00:00
|
|
|
void d3d_surface_free(void *data);
|
|
|
|
|
2017-10-01 21:14:43 +00:00
|
|
|
bool d3d_device_get_render_target_data(LPDIRECT3DDEVICE dev,
|
|
|
|
void *_src, void *_dst);
|
|
|
|
|
2017-10-01 20:38:30 +00:00
|
|
|
bool d3d_device_get_render_target(LPDIRECT3DDEVICE dev,
|
|
|
|
unsigned idx, void **data);
|
|
|
|
|
2017-10-01 21:19:44 +00:00
|
|
|
void d3d_device_set_render_target(LPDIRECT3DDEVICE dev, unsigned idx,
|
|
|
|
void *data);
|
|
|
|
|
2015-11-12 00:28:14 +00:00
|
|
|
void d3d_set_render_state(void *data, D3DRENDERSTATETYPE state, DWORD value);
|
|
|
|
|
2017-10-01 21:19:44 +00:00
|
|
|
void d3d_device_set_render_target(LPDIRECT3DDEVICE dev, unsigned idx,
|
|
|
|
void *data);
|
|
|
|
|
2017-10-01 22:38:05 +00:00
|
|
|
bool d3d_device_create_offscreen_plain_surface(
|
|
|
|
LPDIRECT3DDEVICE dev,
|
|
|
|
unsigned width,
|
|
|
|
unsigned height,
|
|
|
|
unsigned format,
|
|
|
|
unsigned pool,
|
|
|
|
void **surf_data,
|
|
|
|
void *data);
|
|
|
|
|
2017-10-01 22:45:33 +00:00
|
|
|
bool d3d_surface_lock_rect(void *data, void *data2);
|
|
|
|
|
|
|
|
void d3d_surface_unlock_rect(void *data);
|
|
|
|
|
2017-10-02 16:50:54 +00:00
|
|
|
void *d3d_matrix_transpose(void *_pout, const void *_pm);
|
|
|
|
|
|
|
|
void *d3d_matrix_multiply(void *_pout,
|
|
|
|
const void *_pm1, const void *_pm2);
|
|
|
|
|
|
|
|
void *d3d_matrix_ortho_off_center_lh(void *_pout,
|
|
|
|
float l, float r, float b, float t, float zn, float zf);
|
|
|
|
|
|
|
|
void * d3d_matrix_identity(void *_pout);
|
|
|
|
|
|
|
|
void *d3d_matrix_rotation_z(void *_pout, float angle);
|
|
|
|
|
2018-01-06 15:10:05 +00:00
|
|
|
bool d3d_get_adapter_display_mode(LPDIRECT3D d3d,
|
|
|
|
unsigned idx,
|
|
|
|
D3DDISPLAYMODE *display_mode);
|
|
|
|
|
2017-10-02 01:15:49 +00:00
|
|
|
bool d3d_create_device(LPDIRECT3DDEVICE *dev,
|
|
|
|
D3DPRESENT_PARAMETERS *d3dpp,
|
|
|
|
LPDIRECT3D d3d,
|
|
|
|
HWND focus_window,
|
|
|
|
unsigned cur_mon_id);
|
|
|
|
|
2015-11-14 19:02:55 +00:00
|
|
|
bool d3d_reset(LPDIRECT3DDEVICE dev, D3DPRESENT_PARAMETERS *d3dpp);
|
|
|
|
|
2018-01-03 14:21:48 +00:00
|
|
|
bool d3d_device_get_backbuffer(LPDIRECT3DDEVICE dev,
|
|
|
|
unsigned idx, unsigned swapchain_idx,
|
|
|
|
unsigned backbuffer_type, void **data);
|
|
|
|
|
2016-01-06 23:19:27 +00:00
|
|
|
void d3d_device_free(LPDIRECT3DDEVICE dev, LPDIRECT3D pd3d);
|
|
|
|
|
2018-01-03 17:09:31 +00:00
|
|
|
void *d3d_create(void);
|
|
|
|
|
2018-01-03 17:38:13 +00:00
|
|
|
bool d3d_initialize_symbols(void);
|
|
|
|
|
|
|
|
void d3d_deinitialize_symbols(void);
|
|
|
|
|
2018-01-06 18:41:55 +00:00
|
|
|
bool d3d_check_device_type(LPDIRECT3D d3d,
|
|
|
|
unsigned idx,
|
|
|
|
D3DFORMAT disp_format,
|
|
|
|
D3DFORMAT backbuffer_format,
|
|
|
|
bool windowed_mode);
|
|
|
|
|
2018-01-04 13:42:13 +00:00
|
|
|
bool d3dx_create_font_indirect(LPDIRECT3DDEVICE dev,
|
2018-01-03 18:03:19 +00:00
|
|
|
void *desc, void **font_data);
|
|
|
|
|
2018-01-06 20:30:50 +00:00
|
|
|
void d3dxbuffer_release(void *data);
|
|
|
|
|
2016-01-09 05:28:26 +00:00
|
|
|
D3DTEXTUREFILTERTYPE d3d_translate_filter(unsigned type);
|
|
|
|
|
2018-01-07 10:52:32 +00:00
|
|
|
bool d3dx_compile_shader_from_file(
|
|
|
|
const char *src,
|
|
|
|
const void *pdefines,
|
|
|
|
void *pinclude,
|
|
|
|
const char *pfunctionname,
|
|
|
|
const char *pprofile,
|
|
|
|
unsigned flags,
|
|
|
|
void *ppshader,
|
|
|
|
void *pperrormsgs,
|
|
|
|
void *ppconstanttable);
|
|
|
|
|
2016-06-03 06:06:49 +00:00
|
|
|
RETRO_END_DECLS
|
2015-11-09 00:19:09 +00:00
|
|
|
|
2014-09-11 21:43:01 +00:00
|
|
|
#endif
|