2014-09-11 23:43:01 +02:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2017-01-22 13:40:32 +01:00
|
|
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
2017-12-11 23:55:31 -08:00
|
|
|
*
|
2014-09-11 23:43:01 +02: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 13:00:13 +01:00
|
|
|
#ifndef _D3D_COMMON_H
|
|
|
|
#define _D3D_COMMON_H
|
2014-09-11 23:43:01 +02:00
|
|
|
|
2015-11-09 01:04:32 +01:00
|
|
|
#include <boolean.h>
|
2016-06-03 08:06:49 +02:00
|
|
|
#include <retro_common_api.h>
|
2015-11-09 01:04:32 +01:00
|
|
|
|
2018-01-23 04:25:37 +01:00
|
|
|
#include "../video_driver.h"
|
2014-09-11 23:43:01 +02:00
|
|
|
|
2016-06-03 08:06:49 +02:00
|
|
|
RETRO_BEGIN_DECLS
|
2015-11-09 01:19:09 +01:00
|
|
|
|
2018-01-15 23:13:02 +01:00
|
|
|
typedef struct d3d_texture
|
|
|
|
{
|
2018-01-25 04:28:50 +01:00
|
|
|
void *data;
|
2018-01-25 15:30:48 +01:00
|
|
|
INT32 pool;
|
2018-01-15 23:13:02 +01:00
|
|
|
} d3d_texture_t;
|
|
|
|
|
2018-01-25 16:42:10 +01:00
|
|
|
#ifndef D3DCOLOR_ARGB
|
|
|
|
#define D3DCOLOR_ARGB(_a, _r, _g, _b) ( (DWORD)( ( ( (_a)&0xff)<<24)|( ( (_r)&0xff)<<16)|( ( (_g)&0xff)<<8)|( (_b)&0xff) ) )
|
|
|
|
#endif
|
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
bool d3d_swap(void *data, void *dev);
|
2014-09-11 23:43:01 +02:00
|
|
|
|
2018-01-25 14:34:20 +01:00
|
|
|
void *d3d_vertex_buffer_new(void *dev,
|
2014-09-11 23:43:01 +02:00
|
|
|
unsigned length, unsigned usage, unsigned fvf,
|
2018-01-25 15:30:48 +01:00
|
|
|
INT32 pool, void *handle);
|
2014-09-11 23:43:01 +02:00
|
|
|
|
2016-10-20 05:00:20 +02:00
|
|
|
void *d3d_vertex_buffer_lock(void *data);
|
|
|
|
void d3d_vertex_buffer_unlock(void *data);
|
2014-09-13 19:33:06 +02:00
|
|
|
|
2015-04-05 17:05:53 +02:00
|
|
|
void d3d_vertex_buffer_free(void *vertex_data, void *vertex_declaration);
|
2014-09-13 18:11:15 +02:00
|
|
|
|
2018-01-25 04:28:50 +01:00
|
|
|
bool d3d_texture_get_level_desc(void *tex,
|
2017-10-03 04:18:27 +02:00
|
|
|
unsigned idx, void *_ppsurface_level);
|
|
|
|
|
2018-01-25 04:28:50 +01:00
|
|
|
bool d3d_texture_get_surface_level(void *tex,
|
2017-10-03 02:45:06 +02:00
|
|
|
unsigned idx, void **_ppsurface_level);
|
|
|
|
|
2018-01-25 04:28:50 +01:00
|
|
|
void *d3d_texture_new(void *dev,
|
2014-09-13 18:11:15 +02:00
|
|
|
const char *path, unsigned width, unsigned height,
|
2018-01-25 15:30:48 +01:00
|
|
|
unsigned miplevels, unsigned usage, INT32 format,
|
|
|
|
INT32 pool, unsigned filter, unsigned mipfilter,
|
|
|
|
INT32 color_key, void *src_info,
|
2018-01-16 09:11:14 +01:00
|
|
|
PALETTEENTRY *palette, bool want_mipmap);
|
2014-09-13 18:11:15 +02:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_set_stream_source(void *dev, unsigned stream_no,
|
2016-10-20 05:00:20 +02:00
|
|
|
void *stream_vertbuf, unsigned offset_bytes,
|
2014-09-11 23:43:01 +02:00
|
|
|
unsigned stride);
|
|
|
|
|
2018-01-25 04:28:50 +01:00
|
|
|
void d3d_texture_free(void *tex);
|
2014-09-13 18:11:15 +02:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_set_transform(void *dev,
|
2018-01-25 15:30:48 +01:00
|
|
|
INT32 state, const void *_matrix);
|
2014-09-13 21:50:07 +02:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_set_sampler_address_u(void *dev,
|
2014-09-12 07:49:25 +02:00
|
|
|
unsigned sampler, unsigned value);
|
2014-09-11 23:43:01 +02:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_set_sampler_address_v(void *dev,
|
2014-09-12 07:49:25 +02:00
|
|
|
unsigned sampler, unsigned value);
|
2014-09-11 23:43:01 +02:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_set_sampler_minfilter(void *dev,
|
2014-09-12 07:49:25 +02:00
|
|
|
unsigned sampler, unsigned value);
|
2014-09-11 23:43:01 +02:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_set_sampler_magfilter(void *dev,
|
2014-09-12 07:49:25 +02:00
|
|
|
unsigned sampler, unsigned value);
|
2014-09-11 23:43:01 +02:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_set_sampler_mipfilter(void *dev,
|
2018-01-14 02:21:48 +01:00
|
|
|
unsigned sampler, unsigned value);
|
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
bool d3d_begin_scene(void *dev);
|
2017-10-02 01:15:23 +02:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_end_scene(void *dev);
|
2017-10-02 01:15:23 +02:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_draw_primitive(void *dev,
|
2018-01-25 15:30:48 +01:00
|
|
|
INT32 type, unsigned start, unsigned count);
|
2014-09-11 23:43:01 +02:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_clear(void *dev,
|
2018-01-25 15:30:48 +01:00
|
|
|
unsigned count, const void *rects, unsigned flags,
|
|
|
|
INT32 color, float z, unsigned stencil);
|
2014-09-13 20:09:55 +02:00
|
|
|
|
2018-01-25 04:28:50 +01:00
|
|
|
bool d3d_lock_rectangle(void *tex,
|
2018-01-25 15:30:48 +01:00
|
|
|
unsigned level, void *lock_rect, RECT *rect,
|
2015-11-09 15:34:16 +01:00
|
|
|
unsigned rectangle_height, unsigned flags);
|
|
|
|
|
2018-01-25 04:28:50 +01:00
|
|
|
void d3d_lock_rectangle_clear(void *tex,
|
2018-01-25 15:30:48 +01:00
|
|
|
unsigned level, void *lock_rect, RECT *rect,
|
2015-04-05 19:17:24 +02:00
|
|
|
unsigned rectangle_height, unsigned flags);
|
2014-09-11 23:43:01 +02:00
|
|
|
|
2018-01-25 04:28:50 +01:00
|
|
|
void d3d_unlock_rectangle(void *tex);
|
2015-11-09 15:34:16 +01:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_set_texture(void *dev, unsigned sampler,
|
2016-12-07 06:26:24 +01:00
|
|
|
void *tex_data);
|
2014-09-12 19:19:11 +02:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
bool d3d_create_vertex_shader(void *dev,
|
2018-01-06 23:10:27 +01:00
|
|
|
const DWORD *a, void **b);
|
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
bool d3d_create_pixel_shader(void *dev,
|
2018-01-06 23:10:27 +01:00
|
|
|
const DWORD *a, void **b);
|
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_free_pixel_shader(void *dev, void *data);
|
2018-01-06 22:57:44 +01:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_free_vertex_shader(void *dev, void *data);
|
2018-01-06 22:57:44 +01:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
bool d3d_set_pixel_shader(void *dev, void *data);
|
2018-01-06 22:49:17 +01:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
bool d3d_set_vertex_shader(void *dev, unsigned index,
|
2014-09-12 20:02:32 +02:00
|
|
|
void *data);
|
2014-09-12 19:42:17 +02:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
bool d3d_set_vertex_shader_constantf(void *dev,
|
2018-01-15 03:45:37 +01:00
|
|
|
UINT start_register,const float* constant_data, unsigned vector4f_count);
|
|
|
|
|
2015-04-07 00:46:46 +02:00
|
|
|
void d3d_texture_blit(unsigned pixel_size,
|
2018-01-25 04:28:50 +01:00
|
|
|
void *tex,
|
2018-01-25 15:30:48 +01:00
|
|
|
void *lr, const void *frame,
|
2014-09-11 23:43:01 +02:00
|
|
|
unsigned width, unsigned height, unsigned pitch);
|
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
bool d3d_vertex_declaration_new(void *dev,
|
2015-11-12 01:38:13 +01:00
|
|
|
const void *vertex_data, void **decl_data);
|
|
|
|
|
2017-10-01 22:23:04 +02:00
|
|
|
void d3d_vertex_declaration_free(void *data);
|
|
|
|
|
2018-01-25 10:03:34 +01:00
|
|
|
void d3d_set_viewports(void *dev, void *vp);
|
2014-09-12 18:01:32 +02:00
|
|
|
|
2015-04-06 00:55:25 +02:00
|
|
|
void d3d_enable_blend_func(void *data);
|
|
|
|
|
|
|
|
void d3d_disable_blend_func(void *data);
|
|
|
|
|
2015-04-07 02:44:12 +02:00
|
|
|
void d3d_set_vertex_declaration(void *data, void *vertex_data);
|
|
|
|
|
2015-04-10 07:24:13 +02:00
|
|
|
void d3d_enable_alpha_blend_texture_func(void *data);
|
|
|
|
|
2015-04-10 07:33:30 +02:00
|
|
|
void d3d_frame_postprocess(void *data);
|
|
|
|
|
2017-10-01 22:28:48 +02:00
|
|
|
void d3d_surface_free(void *data);
|
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
bool d3d_device_get_render_target_data(void *dev,
|
2017-10-01 23:14:43 +02:00
|
|
|
void *_src, void *_dst);
|
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
bool d3d_device_get_render_target(void *dev,
|
2017-10-01 22:38:30 +02:00
|
|
|
unsigned idx, void **data);
|
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_device_set_render_target(void *dev, unsigned idx,
|
2017-10-01 23:19:44 +02:00
|
|
|
void *data);
|
|
|
|
|
2018-01-15 06:14:20 +01:00
|
|
|
bool d3d_get_render_state(void *data,
|
2018-01-25 15:30:48 +01:00
|
|
|
INT32 state, DWORD *value);
|
2018-01-15 06:14:20 +01:00
|
|
|
|
|
|
|
void d3d_set_render_state(void *data,
|
2018-01-25 15:30:48 +01:00
|
|
|
INT32 state, DWORD value);
|
2015-11-12 01:28:14 +01:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
void d3d_device_set_render_target(void *dev, unsigned idx,
|
2017-10-01 23:19:44 +02:00
|
|
|
void *data);
|
|
|
|
|
2017-10-02 00:38:05 +02:00
|
|
|
bool d3d_device_create_offscreen_plain_surface(
|
2018-01-25 01:45:03 +01:00
|
|
|
void *dev,
|
2017-10-02 00:38:05 +02:00
|
|
|
unsigned width,
|
|
|
|
unsigned height,
|
|
|
|
unsigned format,
|
|
|
|
unsigned pool,
|
|
|
|
void **surf_data,
|
|
|
|
void *data);
|
|
|
|
|
2017-10-02 00:45:33 +02:00
|
|
|
bool d3d_surface_lock_rect(void *data, void *data2);
|
|
|
|
|
|
|
|
void d3d_surface_unlock_rect(void *data);
|
|
|
|
|
2017-10-02 18:50:54 +02: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-25 04:12:16 +01:00
|
|
|
bool d3d_get_adapter_display_mode(void *d3d,
|
2018-01-06 16:10:05 +01:00
|
|
|
unsigned idx,
|
2018-01-25 15:30:48 +01:00
|
|
|
void *display_mode);
|
2018-01-06 16:10:05 +01:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
bool d3d_create_device(void *dev,
|
2018-01-25 15:30:48 +01:00
|
|
|
void *d3dpp,
|
2018-01-25 04:12:16 +01:00
|
|
|
void *d3d,
|
2017-10-02 03:15:49 +02:00
|
|
|
HWND focus_window,
|
|
|
|
unsigned cur_mon_id);
|
|
|
|
|
2018-01-25 15:30:48 +01:00
|
|
|
bool d3d_reset(void *dev, void *d3dpp);
|
2015-11-14 20:02:55 +01:00
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
bool d3d_device_get_backbuffer(void *dev,
|
2018-01-03 15:21:48 +01:00
|
|
|
unsigned idx, unsigned swapchain_idx,
|
|
|
|
unsigned backbuffer_type, void **data);
|
|
|
|
|
2018-01-25 04:12:16 +01:00
|
|
|
void d3d_device_free(void *dev, void *pd3d);
|
2016-01-07 00:19:27 +01:00
|
|
|
|
2018-01-03 18:09:31 +01:00
|
|
|
void *d3d_create(void);
|
|
|
|
|
2018-01-23 04:25:37 +01:00
|
|
|
bool d3d_initialize_symbols(enum gfx_ctx_api api);
|
2018-01-03 18:38:13 +01:00
|
|
|
|
|
|
|
void d3d_deinitialize_symbols(void);
|
|
|
|
|
2018-01-25 04:12:16 +01:00
|
|
|
bool d3d_check_device_type(void *d3d,
|
2018-01-06 19:41:55 +01:00
|
|
|
unsigned idx,
|
2018-01-25 15:30:48 +01:00
|
|
|
INT32 disp_format,
|
|
|
|
INT32 backbuffer_format,
|
2018-01-06 19:41:55 +01:00
|
|
|
bool windowed_mode);
|
|
|
|
|
2018-01-25 01:45:03 +01:00
|
|
|
bool d3dx_create_font_indirect(void *dev,
|
2018-01-03 19:03:19 +01:00
|
|
|
void *desc, void **font_data);
|
|
|
|
|
2018-01-25 14:13:01 +01:00
|
|
|
void d3dx_font_draw_text(void *data, void *sprite_data, void *string_data,
|
|
|
|
unsigned count, void *rect_data, unsigned format, unsigned color);
|
|
|
|
|
2018-01-25 12:16:57 +01:00
|
|
|
void d3dx_font_get_text_metrics(void *data, void *metrics);
|
|
|
|
|
2018-01-06 21:30:50 +01:00
|
|
|
void d3dxbuffer_release(void *data);
|
|
|
|
|
2018-01-25 12:16:57 +01:00
|
|
|
void d3dx_font_release(void *data);
|
|
|
|
|
2018-01-25 15:30:48 +01:00
|
|
|
INT32 d3d_translate_filter(unsigned type);
|
2016-01-09 06:28:26 +01:00
|
|
|
|
2018-01-07 20:32:43 +01:00
|
|
|
bool d3dx_compile_shader(
|
|
|
|
const char *src,
|
|
|
|
unsigned src_data_len,
|
|
|
|
const void *pdefines,
|
|
|
|
void *pinclude,
|
|
|
|
const char *pfunctionname,
|
|
|
|
const char *pprofile,
|
|
|
|
unsigned flags,
|
|
|
|
void *ppshader,
|
|
|
|
void *pperrormsgs,
|
|
|
|
void *ppconstanttable);
|
|
|
|
|
2018-01-07 11:52:32 +01: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);
|
|
|
|
|
2018-01-25 15:30:48 +01:00
|
|
|
INT32 d3d_get_rgb565_format(void);
|
|
|
|
INT32 d3d_get_argb8888_format(void);
|
|
|
|
INT32 d3d_get_xrgb8888_format(void);
|
2018-01-20 16:45:45 +01:00
|
|
|
|
2016-06-03 08:06:49 +02:00
|
|
|
RETRO_END_DECLS
|
2015-11-09 01:19:09 +01:00
|
|
|
|
2014-09-11 23:43:01 +02:00
|
|
|
#endif
|