RetroArch/gfx/common/d3d_common.h

257 lines
7.0 KiB
C
Raw Normal View History

/* RetroArch - A frontend for libretro.
2017-01-22 12:40:32 +00:00
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* 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
#include <boolean.h>
2016-06-03 06:06:49 +00:00
#include <retro_common_api.h>
2015-11-17 07:20:10 +00:00
#include "../../defines/d3d_defines.h"
2018-01-23 03:25:37 +00:00
#include "../video_driver.h"
2016-06-03 06:06:49 +00:00
RETRO_BEGIN_DECLS
2015-11-09 00:19:09 +00:00
2018-01-15 22:13:02 +00:00
typedef struct d3d_texture
{
2018-01-25 03:28:50 +00:00
void *data;
2018-01-15 22:13:02 +00:00
D3DPOOL pool;
} d3d_texture_t;
2018-01-25 00:45:03 +00:00
bool d3d_swap(void *data, void *dev);
2018-01-25 00:45:03 +00:00
LPDIRECT3DVERTEXBUFFER d3d_vertex_buffer_new(void *dev,
unsigned length, unsigned usage, unsigned fvf,
D3DPOOL pool, void *handle);
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
void d3d_vertex_buffer_free(void *vertex_data, void *vertex_declaration);
2018-01-25 03:28:50 +00:00
bool d3d_texture_get_level_desc(void *tex,
2017-10-03 02:18:27 +00:00
unsigned idx, void *_ppsurface_level);
2018-01-25 03:28:50 +00:00
bool d3d_texture_get_surface_level(void *tex,
2017-10-03 00:45:06 +00:00
unsigned idx, void **_ppsurface_level);
2018-01-25 03:28:50 +00:00
void *d3d_texture_new(void *dev,
const char *path, unsigned width, unsigned height,
unsigned miplevels, unsigned usage, D3DFORMAT format,
D3DPOOL pool, unsigned filter, unsigned mipfilter,
D3DCOLOR color_key, void *src_info,
PALETTEENTRY *palette, bool want_mipmap);
2018-01-25 00:45:03 +00:00
void d3d_set_stream_source(void *dev, unsigned stream_no,
2016-10-20 03:00:20 +00:00
void *stream_vertbuf, unsigned offset_bytes,
unsigned stride);
2018-01-25 03:28:50 +00:00
void d3d_texture_free(void *tex);
2018-01-25 00:45:03 +00:00
void d3d_set_transform(void *dev,
2014-09-13 19:50:07 +00:00
D3DTRANSFORMSTATETYPE state, CONST D3DMATRIX *matrix);
2018-01-25 00:45:03 +00:00
void d3d_set_sampler_address_u(void *dev,
unsigned sampler, unsigned value);
2018-01-25 00:45:03 +00:00
void d3d_set_sampler_address_v(void *dev,
unsigned sampler, unsigned value);
2018-01-25 00:45:03 +00:00
void d3d_set_sampler_minfilter(void *dev,
unsigned sampler, unsigned value);
2018-01-25 00:45:03 +00:00
void d3d_set_sampler_magfilter(void *dev,
unsigned sampler, unsigned value);
2018-01-25 00:45:03 +00:00
void d3d_set_sampler_mipfilter(void *dev,
unsigned sampler, unsigned value);
2018-01-25 00:45:03 +00:00
bool d3d_begin_scene(void *dev);
2017-10-01 23:15:23 +00:00
2018-01-25 00:45:03 +00:00
void d3d_end_scene(void *dev);
2017-10-01 23:15:23 +00:00
2018-01-25 00:45:03 +00:00
void d3d_draw_primitive(void *dev,
2014-09-11 22:00:20 +00:00
D3DPRIMITIVETYPE type, unsigned start, unsigned count);
2018-01-25 00:45:03 +00:00
void d3d_clear(void *dev,
2014-09-13 18:09:55 +00:00
unsigned count, const D3DRECT *rects, unsigned flags,
D3DCOLOR color, float z, unsigned stencil);
2018-01-25 03:28:50 +00:00
bool d3d_lock_rectangle(void *tex,
2015-11-09 14:34:16 +00:00
unsigned level, D3DLOCKED_RECT *lock_rect, RECT *rect,
unsigned rectangle_height, unsigned flags);
2018-01-25 03:28:50 +00:00
void d3d_lock_rectangle_clear(void *tex,
unsigned level, D3DLOCKED_RECT *lock_rect, RECT *rect,
unsigned rectangle_height, unsigned flags);
2018-01-25 03:28:50 +00:00
void d3d_unlock_rectangle(void *tex);
2015-11-09 14:34:16 +00:00
2018-01-25 00:45:03 +00:00
void d3d_set_texture(void *dev, unsigned sampler,
void *tex_data);
2018-01-25 00:45:03 +00:00
bool d3d_create_vertex_shader(void *dev,
const DWORD *a, void **b);
2018-01-25 00:45:03 +00:00
bool d3d_create_pixel_shader(void *dev,
const DWORD *a, void **b);
2018-01-25 00:45:03 +00:00
void d3d_free_pixel_shader(void *dev, void *data);
2018-01-25 00:45:03 +00:00
void d3d_free_vertex_shader(void *dev, void *data);
2018-01-25 00:45:03 +00:00
bool d3d_set_pixel_shader(void *dev, void *data);
2018-01-06 21:49:17 +00:00
2018-01-25 00:45:03 +00:00
bool d3d_set_vertex_shader(void *dev, unsigned index,
void *data);
2018-01-25 00:45:03 +00:00
bool d3d_set_vertex_shader_constantf(void *dev,
UINT start_register,const float* constant_data, unsigned vector4f_count);
2015-04-06 22:46:46 +00:00
void d3d_texture_blit(unsigned pixel_size,
2018-01-25 03:28:50 +00:00
void *tex,
D3DLOCKED_RECT *lr, const void *frame,
unsigned width, unsigned height, unsigned pitch);
2018-01-25 00:45:03 +00:00
bool d3d_vertex_declaration_new(void *dev,
2015-11-12 00:38:13 +00:00
const void *vertex_data, void **decl_data);
void d3d_vertex_declaration_free(void *data);
2018-01-25 09:03:34 +00:00
void d3d_set_viewports(void *dev, void *vp);
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);
void d3d_enable_alpha_blend_texture_func(void *data);
void d3d_frame_postprocess(void *data);
2017-10-01 20:28:48 +00:00
void d3d_surface_free(void *data);
2018-01-25 00:45:03 +00:00
bool d3d_device_get_render_target_data(void *dev,
void *_src, void *_dst);
2018-01-25 00:45:03 +00:00
bool d3d_device_get_render_target(void *dev,
2017-10-01 20:38:30 +00:00
unsigned idx, void **data);
2018-01-25 00:45:03 +00:00
void d3d_device_set_render_target(void *dev, unsigned idx,
2017-10-01 21:19:44 +00:00
void *data);
2018-01-15 05:14:20 +00:00
bool d3d_get_render_state(void *data,
D3DRENDERSTATETYPE state, DWORD *value);
void d3d_set_render_state(void *data,
D3DRENDERSTATETYPE state, DWORD value);
2015-11-12 00:28:14 +00:00
2018-01-25 00:45:03 +00:00
void d3d_device_set_render_target(void *dev, unsigned idx,
2017-10-01 21:19:44 +00:00
void *data);
bool d3d_device_create_offscreen_plain_surface(
2018-01-25 00:45:03 +00:00
void *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);
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 03:12:16 +00:00
bool d3d_get_adapter_display_mode(void *d3d,
2018-01-06 15:10:05 +00:00
unsigned idx,
D3DDISPLAYMODE *display_mode);
2018-01-25 00:45:03 +00:00
bool d3d_create_device(void *dev,
2017-10-02 01:15:49 +00:00
D3DPRESENT_PARAMETERS *d3dpp,
2018-01-25 03:12:16 +00:00
void *d3d,
2017-10-02 01:15:49 +00:00
HWND focus_window,
unsigned cur_mon_id);
2018-01-25 00:45:03 +00:00
bool d3d_reset(void *dev, D3DPRESENT_PARAMETERS *d3dpp);
2015-11-14 19:02:55 +00:00
2018-01-25 00:45:03 +00:00
bool d3d_device_get_backbuffer(void *dev,
2018-01-03 14:21:48 +00:00
unsigned idx, unsigned swapchain_idx,
unsigned backbuffer_type, void **data);
2018-01-25 03:12:16 +00:00
void d3d_device_free(void *dev, void *pd3d);
2016-01-06 23:19:27 +00:00
2018-01-03 17:09:31 +00:00
void *d3d_create(void);
2018-01-23 03:25:37 +00:00
bool d3d_initialize_symbols(enum gfx_ctx_api api);
2018-01-03 17:38:13 +00:00
void d3d_deinitialize_symbols(void);
2018-01-25 03:12:16 +00:00
bool d3d_check_device_type(void *d3d,
2018-01-06 18:41:55 +00:00
unsigned idx,
D3DFORMAT disp_format,
D3DFORMAT backbuffer_format,
bool windowed_mode);
2018-01-25 00:45:03 +00:00
bool d3dx_create_font_indirect(void *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);
D3DTEXTUREFILTERTYPE d3d_translate_filter(unsigned type);
2018-01-07 19:32:43 +00: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 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);
2018-01-20 15:45:45 +00:00
D3DFORMAT d3d_get_rgb565_format(void);
D3DFORMAT d3d_get_argb8888_format(void);
D3DFORMAT d3d_get_xrgb8888_format(void);
2016-06-03 06:06:49 +00:00
RETRO_END_DECLS
2015-11-09 00:19:09 +00:00
#endif