RetroArch
d3d9_common.h
Go to the documentation of this file.
1 /* RetroArch - A frontend for libretro.
2  * Copyright (C) 2011-2017 - Daniel De Matteis
3  *
4  * RetroArch is free software: you can redistribute it and/or modify it under the terms
5  * of the GNU General Public License as published by the Free Software Found-
6  * ation, either version 3 of the License, or (at your option) any later version.
7  *
8  * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10  * PURPOSE. See the GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License along with RetroArch.
13  * If not, see <http://www.gnu.org/licenses/>.
14  */
15 
16 #ifndef _D3D9_COMMON_H
17 #define _D3D9_COMMON_H
18 
19 #include <boolean.h>
20 #include <retro_common_api.h>
21 #include <retro_inline.h>
22 #include <gfx/math/matrix_4x4.h>
23 
24 #include <d3d9.h>
25 
26 #include "d3d_common.h"
27 #include "../video_driver.h"
28 #include "../../verbosity.h"
29 
30 #define D3D9_DECL_FVF_TEXCOORD(stream, offset, index) \
31  { (WORD)(stream), (WORD)(offset * sizeof(float)), D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, \
32  D3DDECLUSAGE_TEXCOORD, (BYTE)(index) }
33 
35 
36 typedef struct d3d9_video d3d9_video_t;
37 
39 {
40  void (*chain_free)(void *data);
41  void *(*chain_new)(void);
43  const video_info_t *video_info,
45  const D3DVIEWPORT9 *final_viewport,
46  const struct LinkInfo *info,
47  bool rgb32);
49  void *renderchain_data, const D3DVIEWPORT9 *final_viewport);
50  bool (*add_pass)(void *data, const struct LinkInfo *info);
51  bool (*add_lut)(void *data,
52  const char *id, const char *path,
53  bool smooth);
56  state_tracker_t *tracker,
57  const void *frame,
58  unsigned width, unsigned height, unsigned pitch, unsigned rotation);
59  const char *ident;
61 
62 typedef struct d3d9_video
63 {
66  bool quitting;
69  /* TODO - refactor this away properly. */
71 
72  unsigned cur_mon_id;
73  unsigned dev_rotation;
74 
78 
79  RECT font_rect;
84 
89 #ifdef HAVE_WINDOW
90  WNDCLASSEX windowClass;
91 #endif
94 
95  char *shader_path;
96 
97  struct
98  {
99  int size;
100  int offset;
101  void *buffer;
102  void *decl;
103  }menu_display;
104 
107 } d3d9_video_t;
108 
109 static INLINE bool d3d9_swap(void *data, LPDIRECT3DDEVICE9 dev)
110 {
111 #ifdef _XBOX
113 #else
116  return false;
117 #endif
118  return true;
119 }
120 
121 void *d3d9_vertex_buffer_new(void *dev,
122  unsigned length, unsigned usage, unsigned fvf,
123  INT32 pool, void *handle);
124 
126 {
127  void *buf = NULL;
128  if (!vertbuf)
129  return NULL;
130  IDirect3DVertexBuffer9_Lock(vertbuf, 0, 0, &buf, 0);
131 
132  if (!buf)
133  return NULL;
134 
135  return buf;
136 }
137 
139 {
140  if (vertbuf)
142 }
143 
144 void d3d9_vertex_buffer_free(void *vertex_data, void *vertex_declaration);
145 
147  LPDIRECT3DTEXTURE9 tex,
148  unsigned idx,
149  D3DSURFACE_DESC *_ppsurface_level)
150 {
151 #if defined(_XBOX)
152  D3DTexture_GetLevelDesc(tex, idx, _ppsurface_level);
153 #else
154  if (FAILED(IDirect3DTexture9_GetLevelDesc(tex, idx, _ppsurface_level)))
155  return false;
156 #endif
157  return true;
158 }
159 
161  LPDIRECT3DTEXTURE9 tex,
162  unsigned idx, void **_ppsurface_level)
163 {
164  if (tex &&
166  tex, idx, (IDirect3DSurface9**)_ppsurface_level)))
167  return true;
168  return false;
169 }
170 
171 void *d3d9_texture_new(void *dev,
172  const char *path, unsigned width, unsigned height,
173  unsigned miplevels, unsigned usage, INT32 format,
174  INT32 pool, unsigned filter, unsigned mipfilter,
175  INT32 color_key, void *src_info,
176  PALETTEENTRY *palette, bool want_mipmap);
177 
179  LPDIRECT3DDEVICE9 dev,
180  unsigned stream_no,
181  LPDIRECT3DVERTEXBUFFER9 stream_vertbuf,
182  unsigned offset_bytes,
183  unsigned stride)
184 {
185  if (stream_vertbuf)
186  IDirect3DDevice9_SetStreamSource(dev, stream_no, stream_vertbuf,
187  offset_bytes,
188  stride);
189 }
190 
192 {
193  if (tex)
195 }
196 
198  LPDIRECT3DDEVICE9 dev,
201 {
202  /* XBox 360 D3D9 does not support fixed-function pipeline. */
203 #ifndef _XBOX
205 #endif
206 }
207 
209  LPDIRECT3DDEVICE9 dev,
210  unsigned sampler, unsigned value)
211 {
214 }
215 
217  LPDIRECT3DDEVICE9 dev,
218  unsigned sampler, unsigned value)
219 {
222 }
223 
225  LPDIRECT3DDEVICE9 dev,
226  unsigned sampler, unsigned value)
227 {
228  if (dev)
231 }
232 
234  LPDIRECT3DDEVICE9 dev,
235  unsigned sampler, unsigned value)
236 {
237  if (dev)
240 }
241 
243  LPDIRECT3DDEVICE9 dev,
244  unsigned sampler, unsigned value)
245 {
246  if (dev)
249 }
250 
252 {
253  if (!dev)
254  return false;
255 #if defined(_XBOX)
257 #else
258  if (FAILED(IDirect3DDevice9_BeginScene(dev)))
259  return false;
260 #endif
261 
262  return true;
263 }
264 
266 {
267  if (dev)
269 }
270 
272  LPDIRECT3DDEVICE9 dev,
274  unsigned start, unsigned count)
275 {
276  if (!dev || !d3d9_begin_scene(dev))
277  return;
279  d3d9_end_scene(dev);
280 }
281 
282 static INLINE void d3d9_clear(
283  LPDIRECT3DDEVICE9 dev,
284  unsigned count, const D3DRECT *rects, unsigned flags,
285  INT32 color, float z, unsigned stencil)
286 {
287  if (dev)
288  IDirect3DDevice9_Clear(dev, count, rects, flags,
289  color, z, stencil);
290 }
291 
293  LPDIRECT3DTEXTURE9 tex,
294  unsigned level,
295  D3DLOCKED_RECT *lr,
296  const RECT *rect,
297  unsigned rectangle_height, unsigned flags)
298 {
299  if (!tex)
300  return false;
301 #ifdef _XBOX
302  IDirect3DTexture9_LockRect(tex, level, lr, rect, flags);
303 #else
304  if (IDirect3DTexture9_LockRect(tex, level, lr, rect, flags) != D3D_OK)
305  return false;
306 #endif
307 
308  return true;
309 }
310 
312 {
313  if (tex)
315 }
316 
317 static INLINE void d3d9_lock_rectangle_clear(void *tex,
318  unsigned level, D3DLOCKED_RECT *lr, RECT *rect,
319  unsigned rectangle_height, unsigned flags)
320 {
321 #if defined(_XBOX)
322  level = 0;
323 #endif
324  memset(lr->pBits, level, rectangle_height * lr->Pitch);
326 }
327 
329  LPDIRECT3DDEVICE9 dev,
330  unsigned sampler,
331  LPDIRECT3DTEXTURE9 tex)
332 {
333  if (dev && tex)
335  (IDirect3DBaseTexture9*)tex);
336 }
337 
339  LPDIRECT3DDEVICE9 dev, const DWORD *a, void **b)
340 {
341  if (dev && IDirect3DDevice9_CreateVertexShader(dev, a,
343  return true;
344  return false;
345 }
346 
348  LPDIRECT3DDEVICE9 dev, const DWORD *a, void **b)
349 {
350  if (dev &&
353  return true;
354  return false;
355 }
356 
359 {
360  if (dev && vs)
362 }
363 
366 {
367  if (dev && ps)
369 }
370 
372  LPDIRECT3DDEVICE9 dev,
374 {
375 #ifdef _XBOX
376  /* Returns void on Xbox */
378 #else
380  return false;
381 #endif
382  return true;
383 }
384 
387 {
388 #ifdef _XBOX
390 #else
392  return false;
393 #endif
394 
395  return true;
396 }
397 
399  LPDIRECT3DDEVICE9 dev,
400  UINT start_register,
401  const float* constant_data,
402  unsigned vector4f_count)
403 {
404 #ifdef _XBOX
406  start_register, constant_data, vector4f_count);
407 #else
409  start_register, constant_data, vector4f_count) != D3D_OK)
410  return false;
411 #endif
412 
413  return true;
414 }
415 
417  unsigned pixel_size,
418  void *tex,
419  D3DLOCKED_RECT *lr, const void *frame,
420  unsigned width, unsigned height, unsigned pitch)
421 {
422  unsigned y;
423 
424  for (y = 0; y < height; y++)
425  {
426  const uint8_t *in = (const uint8_t*)frame + y * pitch;
427  uint8_t *out = (uint8_t*)lr->pBits + y * lr->Pitch;
428  memcpy(out, in, width * pixel_size);
429  }
430 }
431 
433  LPDIRECT3DDEVICE9 dev,
434  const void *vertex_data, void **decl_data)
435 {
436  const D3DVERTEXELEMENT9 *vertex_elements = (const D3DVERTEXELEMENT9*)vertex_data;
437  LPDIRECT3DVERTEXDECLARATION9 **vertex_decl = (LPDIRECT3DVERTEXDECLARATION9**)decl_data;
438 
440  vertex_elements, (IDirect3DVertexDeclaration9**)vertex_decl)))
441  return true;
442 
443  return false;
444 }
445 
448 {
449  if (decl)
451 }
452 
454  void *vp)
455 {
456  if (dev)
458 }
459 
462 {
464 }
465 
467 {
468  if (!dev)
469  return;
470 
474 }
475 
477 {
478  if (dev)
480 }
481 
482 static INLINE void
484  LPDIRECT3DVERTEXDECLARATION9 vertex_data)
485 {
486  if (dev)
487  IDirect3DDevice9_SetVertexDeclaration(dev, vertex_data);
488 }
489 
491  LPDIRECT3DDEVICE9 dev,
492  unsigned sampler,
494  unsigned value)
495 {
496 #ifndef _XBOX
497  /* XBox 360 has no fixed-function pipeline. */
499  type, value) != D3D_OK)
500  RARCH_ERR("SetTextureStageState call failed, sampler"
501  ": %d, value: %d, type: %d\n", sampler, value, type);
502 #endif
503 }
504 
506 {
507  if (!dev)
508  return;
509 
510  /* Also blend the texture with the set alpha value. */
514 }
515 
516 void d3d9_frame_postprocess(void *data);
517 
519 {
520  if (surf)
522 }
523 
525  LPDIRECT3DDEVICE9 dev,
527 {
528 #ifndef _XBOX
529  if (dev &&
531  dev, src, dst)))
532  return true;
533 #endif
534 
535  return false;
536 }
537 
539  LPDIRECT3DDEVICE9 dev,
540  unsigned idx, void **data)
541 {
542  if (dev &&
543  SUCCEEDED(IDirect3DDevice9_GetRenderTarget(dev,
545  return true;
546  return false;
547 }
548 
550  LPDIRECT3DDEVICE9 dev, unsigned idx,
551  LPDIRECT3DSURFACE9 surf)
552 {
553  if (dev)
555 }
556 
558  LPDIRECT3DDEVICE9 dev, INT32 state, DWORD *value)
559 {
560  if (!dev)
561  return false;
562 
563 #ifdef _XBOX
566 #else
569  return false;
570 #endif
571  return true;
572 }
573 
575  LPDIRECT3DDEVICE9 dev,
576  unsigned width,
577  unsigned height,
578  unsigned format,
579  unsigned pool,
580  void **surf_data,
581  void *data)
582 {
583 #ifndef _XBOX
585  width, height,
586  (D3DFORMAT)format, (D3DPOOL)pool,
587  (LPDIRECT3DSURFACE9*)surf_data,
588  (HANDLE*)data)))
589  return true;
590 #endif
591  return false;
592 }
593 
595  D3DLOCKED_RECT *data2)
596 {
597  if (!surf)
598  return false;
599 #if defined(_XBOX)
601  data2, NULL, D3DLOCK_READONLY);
602 #else
603  if (FAILED(IDirect3DSurface9_LockRect(surf,
604  data2, NULL, D3DLOCK_READONLY)))
605  return false;
606 #endif
607 
608  return true;
609 }
610 
612 {
613  if (surf)
615 }
616 
618  LPDIRECT3D9 d3d,
619  unsigned idx,
620  D3DDISPLAYMODE *display_mode)
621 {
622  if (!d3d)
623  return false;
624 #ifndef _XBOX
625  if (FAILED(
627  d3d, idx, display_mode)))
628  return false;
629 #endif
630 
631  return true;
632 }
633 
634 bool d3d9_create_device(void *dev,
635  void *d3dpp,
636  void *d3d,
637  HWND focus_window,
638  unsigned cur_mon_id);
639 
640 bool d3d9_reset(void *dev, void *d3dpp);
641 
643  LPDIRECT3DDEVICE9 dev,
644  unsigned idx, unsigned swapchain_idx,
645  unsigned backbuffer_type, void **data)
646 {
647  if (dev &&
648  SUCCEEDED(IDirect3DDevice9_GetBackBuffer(dev,
649  swapchain_idx, idx,
650  (D3DBACKBUFFER_TYPE)backbuffer_type,
652  return true;
653  return false;
654 }
655 
657 {
658  if (dev)
660  if (pd3d)
661  IDirect3D9_Release(pd3d);
662 }
663 
664 void *d3d9_create(void);
665 
667 
668 void d3d9_deinitialize_symbols(void);
669 
671  LPDIRECT3D9 d3d,
672  unsigned idx,
673  INT32 disp_format,
674  INT32 backbuffer_format,
675  bool windowed_mode)
676 {
677  if (d3d &&
678  SUCCEEDED(IDirect3D9_CheckDeviceType(d3d,
679  0,
681  (D3DFORMAT)disp_format,
682  (D3DFORMAT)backbuffer_format,
683  windowed_mode)))
684  return true;
685  return false;
686 }
687 
688 bool d3d9x_create_font_indirect(void *dev,
689  void *desc, void **font_data);
690 
691 void d3d9x_font_draw_text(void *data, void *sprite_data, void *string_data,
692  unsigned count, void *rect_data, unsigned format, unsigned color);
693 
694 void d3d9x_font_get_text_metrics(void *data, void *metrics);
695 
696 void d3d9x_buffer_release(void *data);
697 
698 void d3d9x_font_release(void *data);
699 
701  const char *src,
702  unsigned src_data_len,
703  const void *pdefines,
704  void *pinclude,
705  const char *pfunctionname,
706  const char *pprofile,
707  unsigned flags,
708  void *ppshader,
709  void *pperrormsgs,
710  void *ppconstanttable);
711 
713  const char *src,
714  const void *pdefines,
715  void *pinclude,
716  const char *pfunctionname,
717  const char *pprofile,
718  unsigned flags,
719  void *ppshader,
720  void *pperrormsgs,
721  void *ppconstanttable);
722 
724  void *p, void *_handle, const void *_pf, unsigned count);
725 
727  void *p);
728 
730  void *p, void *data, const void *matrix);
731 
732 const void *d3d9x_get_buffer_ptr(void *data);
733 
734 const bool d3d9x_constant_table_set_float(void *p,
735  void *a, void *b, float val);
736 
738  void *_handle, void *_name);
739 
741 {
742 #ifdef _XBOX
743  return D3DFMT_LIN_R5G6B5;
744 #else
745  return D3DFMT_R5G6B5;
746 #endif
747 }
748 
750 {
751 #ifdef _XBOX
752  return D3DFMT_LIN_A8R8G8B8;
753 #else
754  return D3DFMT_A8R8G8B8;
755 #endif
756 }
757 
759 {
760 #ifdef _XBOX
761  return D3DFMT_LIN_X8R8G8B8;
762 #else
763  return D3DFMT_X8R8G8B8;
764 #endif
765 }
766 
768  const struct LinkInfo *info,
769  unsigned *out_width,
770  unsigned *out_height,
771  unsigned width,
772  unsigned height,
773  D3DVIEWPORT9 *final_viewport)
774 {
775  if (!info)
776  return;
777 
778  switch (info->pass->fbo.type_x)
779  {
781  *out_width = info->pass->fbo.scale_x * final_viewport->Width;
782  break;
783 
785  *out_width = info->pass->fbo.abs_x;
786  break;
787 
788  case RARCH_SCALE_INPUT:
789  *out_width = info->pass->fbo.scale_x * width;
790  break;
791  }
792 
793  switch (info->pass->fbo.type_y)
794  {
796  *out_height = info->pass->fbo.scale_y * final_viewport->Height;
797  break;
798 
800  *out_height = info->pass->fbo.abs_y;
801  break;
802 
803  case RARCH_SCALE_INPUT:
804  *out_height = info->pass->fbo.scale_y * height;
805  break;
806  }
807 }
808 
810 
811 #endif
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:6559
bf_uint8_t ps
Definition: connect_ps4.c:82
static INLINE void d3d9_clear(LPDIRECT3DDEVICE9 dev, unsigned count, const D3DRECT *rects, unsigned flags, INT32 color, float z, unsigned stencil)
Definition: d3d9_common.h:282
Definition: d3d8types.h:1189
Definition: d3d_common.h:64
GLuint shader
Definition: glext.h:6670
Definition: d3d9types.h:516
enum _D3DPOOL D3DPOOL
static INLINE bool d3d9_device_get_render_target(LPDIRECT3DDEVICE9 dev, unsigned idx, void **data)
Definition: d3d9_common.h:538
enum _D3DPRIMITIVETYPE D3DPRIMITIVETYPE
void * buffer
Definition: d3d9_common.h:101
void * renderchain_data
Definition: d3d9_common.h:77
Definition: matrix_4x4.h:40
size_t overlays_size
Definition: d3d9_common.h:105
Definition: d3d9_common.h:62
static INLINE void d3d9_disable_blend_func(LPDIRECT3DDEVICE9 dev)
Definition: d3d9_common.h:476
enum _D3DTEXTURESTAGESTATETYPE D3DTEXTURESTAGESTATETYPE
GLuint GLfloat * val
Definition: glext.h:7847
bool d3d9x_create_font_indirect(void *dev, void *desc, void **font_data)
Definition: d3d9_common.c:435
Definition: d3d8types.h:77
Definition: video_shader_parse.h:62
static INLINE void d3d9_vertex_buffer_unlock(LPDIRECT3DVERTEXBUFFER9 vertbuf)
Definition: d3d9_common.h:138
#define INLINE
Definition: retro_inline.h:35
Definition: d3d8types.h:333
static INLINE void d3d9_set_sampler_minfilter(LPDIRECT3DDEVICE9 dev, unsigned sampler, unsigned value)
Definition: d3d9_common.h:224
bool d3d9x_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)
Definition: d3d9_common.c:520
#define RETRO_BEGIN_DECLS
Definition: retro_common_api.h:41
static INLINE bool d3d9_set_vertex_shader_constantf(LPDIRECT3DDEVICE9 dev, UINT start_register, const float *constant_data, unsigned vector4f_count)
Definition: d3d9_common.h:398
#define IDirect3DVertexDeclaration9_Release(p)
Definition: d3d9.h:842
RECT font_rect
Definition: d3d9_common.h:79
bool(* add_pass)(void *data, const struct LinkInfo *info)
Definition: d3d9_common.h:50
static INLINE bool d3d9_texture_get_surface_level(LPDIRECT3DTEXTURE9 tex, unsigned idx, void **_ppsurface_level)
Definition: d3d9_common.h:160
static INLINE bool d3d9_device_get_backbuffer(LPDIRECT3DDEVICE9 dev, unsigned idx, unsigned swapchain_idx, unsigned backbuffer_type, void **data)
Definition: d3d9_common.h:642
#define IDirect3DDevice9_SetViewport(p, a)
Definition: d3d9.h:492
const bool d3d9x_constant_table_set_float(void *p, void *a, void *b, float val)
Definition: d3d9_common.c:611
GLuint start
Definition: glext.h:6292
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:8418
Definition: ffmpeg_core.c:151
Definition: video_shader_parse.h:63
static INLINE void d3d9_set_vertex_declaration(LPDIRECT3DDEVICE9 dev, LPDIRECT3DVERTEXDECLARATION9 vertex_data)
Definition: d3d9_common.h:483
rotation
Definition: video_defines.h:62
Definition: libretro.h:2275
LPDIRECT3DDEVICE9 dev
Definition: d3d9_common.h:92
#define IDirect3DDevice9_GetRenderState(p, a, b)
Definition: d3d9.h:503
#define IDirect3DDevice9_DrawPrimitive(p, a, b, c)
Definition: d3d9.h:526
GLsizei const GLchar ** path
Definition: glext.h:7901
Definition: d3d9types.h:512
struct video_viewport vp
Definition: d3d9_common.h:86
interface IDirect3DVertexShader9 IDirect3DVertexShader9
Definition: d3d9.h:184
void * pBits
Definition: d3d8types.h:1509
bool overlays_enabled
Definition: d3d9_common.h:68
#define IDirect3DDevice9_SetSamplerState(p, a, b, c)
Definition: d3d9.h:514
struct IDirect3D9 * LPDIRECT3D9
Definition: d3d9.h:251
void(* set_final_viewport)(d3d9_video_t *d3d, void *renderchain_data, const D3DVIEWPORT9 *final_viewport)
Definition: d3d9_common.h:48
static INLINE bool d3d9_create_pixel_shader(LPDIRECT3DDEVICE9 dev, const DWORD *a, void **b)
Definition: d3d9_common.h:347
#define IDirect3DVertexBuffer9_Unlock(p)
Definition: d3d9.h:1289
bool keep_aspect
Definition: d3d9_common.h:64
GLenum GLuint id
Definition: glext.h:6233
static tesseract::TessBaseAPI * api
Definition: tess_get_text.cpp:7
#define IDirect3DDevice9_CreateVertexDeclaration(p, a, b)
Definition: d3d9.h:531
Definition: video_driver.h:80
void * d3d9_create(void)
Definition: d3d9_common.c:111
static INLINE bool d3d9_swap(void *data, LPDIRECT3DDEVICE9 dev)
Definition: d3d9_common.h:109
#define IDirect3DDevice9_EndScene(p)
Definition: d3d9.h:487
GLuint GLenum matrix
Definition: glext.h:10314
bool should_resize
Definition: d3d9_common.h:65
struct passwd out
Definition: missing_libc_functions.c:51
const struct retro_game_info * info
Definition: libretro.h:2121
GLdouble GLdouble z
Definition: glext.h:6514
const d3d9_renderchain_driver_t * renderchain_driver
Definition: d3d9_common.h:76
struct IDirect3DVertexDeclaration9 * LPDIRECT3DVERTEXDECLARATION9
Definition: d3d9.h:837
Definition: d3d8types.h:442
static INLINE void d3d9_texture_free(LPDIRECT3DTEXTURE9 tex)
Definition: d3d9_common.h:191
const char * ident
Definition: d3d9_common.h:59
#define IDirect3DDevice9_GetBackBuffer(p, a, b, c, d)
Definition: d3d9.h:463
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
#define IDirect3DDevice9_GetRenderTarget(p, a, b)
Definition: d3d9.h:483
struct IDirect3DSurface9 * LPDIRECT3DSURFACE9
Definition: d3d9.h:1399
Definition: d3d8types.h:218
static INLINE void d3d9_draw_primitive(LPDIRECT3DDEVICE9 dev, D3DPRIMITIVETYPE type, unsigned start, unsigned count)
Definition: d3d9_common.h:271
static INLINE void d3d9_enable_alpha_blend_texture_func(LPDIRECT3DDEVICE9 dev)
Definition: d3d9_common.h:505
Definition: ibxm.h:9
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
static INLINE void d3d9_set_sampler_mipfilter(LPDIRECT3DDEVICE9 dev, unsigned sampler, unsigned value)
Definition: d3d9_common.h:242
Definition: d3d9types.h:513
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:6303
interface IDirect3DPixelShader9 IDirect3DPixelShader9
Definition: d3d9.h:185
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
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
GLuint GLuint GLsizei count
Definition: glext.h:6292
typedef bool(RETRO_CALLCONV *retro_replace_image_index_t)(unsigned index
Definition: video_shader_parse.h:143
math_matrix_4x4 mvp_rotate
Definition: d3d9_common.h:82
unsigned cur_mon_id
Definition: d3d9_common.h:72
static INLINE bool d3d9_check_device_type(LPDIRECT3D9 d3d, unsigned idx, INT32 disp_format, INT32 backbuffer_format, bool windowed_mode)
Definition: d3d9_common.h:670
#define IDirect3DDevice9_Clear(p, a, b, c, d, e, f)
Definition: d3d9.h:488
void d3d9x_constant_table_set_defaults(LPDIRECT3DDEVICE9 dev, void *p)
Definition: d3d9_common.c:585
#define IDirect3DVertexShader9_Release(p)
Definition: d3d9.h:875
Definition: d3d8types.h:217
char * shader_path
Definition: d3d9_common.h:95
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:447
#define IDirect3DTexture9_UnlockRect(p, a)
Definition: d3d9.h:1048
#define IDirect3DPixelShader9_Release(p)
Definition: d3d9.h:908
#define IDirect3DTexture9_Release(p)
Definition: d3d9.h:1030
#define D3DERR_DEVICELOST
Definition: d3d8.h:1208
#define IDirect3D9_Release(p)
Definition: d3d9.h:256
static INLINE void d3d9_free_vertex_shader(LPDIRECT3DDEVICE9 dev, IDirect3DVertexShader9 *vs)
Definition: d3d9_common.h:357
enum _D3DFORMAT D3DFORMAT
#define IDirect3DDevice9_SetRenderTarget(p, a, b)
Definition: d3d9.h:482
static INLINE void d3d9_set_texture_stage_state(LPDIRECT3DDEVICE9 dev, unsigned sampler, D3DTEXTURESTAGESTATETYPE type, unsigned value)
Definition: d3d9_common.h:490
math_matrix_4x4 mvp
Definition: d3d9_common.h:81
void(* chain_free)(void *data)
Definition: d3d9_common.h:40
interface IDirect3DSurface9 IDirect3DSurface9
Definition: d3d9.h:193
#define NULL
Pointer to 0.
Definition: gctypes.h:65
GLenum type
Definition: glext.h:6233
Definition: video_driver.h:405
struct IDirect3DVertexBuffer9 * LPDIRECT3DVERTEXBUFFER9
Definition: d3d9.h:1274
int32_t INT32
Definition: coretypes.h:17
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
void d3d9x_buffer_release(void *data)
Definition: d3d9_common.c:449
#define IDirect3DDevice9_SetVertexDeclaration(p, a)
Definition: d3d9.h:532
static INLINE INT32 d3d9_get_rgb565_format(void)
Definition: d3d9_common.h:740
#define IDirect3DDevice9_BeginScene(p)
Definition: d3d9.h:486
bool(* add_lut)(void *data, const char *id, const char *path, bool smooth)
Definition: d3d9_common.h:51
DWORD Height
Definition: d3d9types.h:104
#define IDirect3DDevice9_CreatePixelShader(p, a, b)
Definition: d3d9.h:551
void d3d9x_font_get_text_metrics(void *data, void *metrics)
Definition: d3d9_common.c:511
struct d3d9_renderchain_driver d3d9_renderchain_driver_t
Definition: d3d8types.h:1259
static INLINE void d3d9_free_pixel_shader(LPDIRECT3DDEVICE9 dev, IDirect3DPixelShader9 *ps)
Definition: d3d9_common.h:364
Definition: d3d8types.h:1479
static INLINE void d3d9_set_render_state(LPDIRECT3DDEVICE9 dev, D3DRENDERSTATETYPE state, DWORD value)
Definition: d3d9_common.h:460
#define IDirect3DTexture9_GetLevelDesc(p, a, b)
Definition: d3d9.h:1045
static INLINE bool d3d9_surface_lock_rect(LPDIRECT3DSURFACE9 surf, D3DLOCKED_RECT *data2)
Definition: d3d9_common.h:594
void d3d9_vertex_buffer_free(void *vertex_data, void *vertex_declaration)
Definition: d3d9_common.c:316
#define IDirect3DSurface9_LockRect(p, a, b, c)
Definition: d3d9.h:1415
GLint level
Definition: glext.h:6293
struct IDirect3DVertexShader9 * LPDIRECT3DVERTEXSHADER9
Definition: d3d9.h:870
static INLINE void d3d9_surface_unlock_rect(LPDIRECT3DSURFACE9 surf)
Definition: d3d9_common.h:611
#define IDirect3DSurface9_UnlockRect(p)
Definition: d3d9.h:1416
#define IDirect3D9_GetAdapterDisplayMode(p, a, b)
Definition: d3d9.h:262
void d3d9x_font_release(void *data)
Definition: d3d9_common.c:502
static uint64_t state[MAX_PADS]
Definition: xenon360_input.c:33
interface IDirect3DVertexDeclaration9 IDirect3DVertexDeclaration9
Definition: d3d9.h:183
GLint GLfloat GLint stencil
Definition: glext.h:6900
GLint GLint GLint GLint GLint GLint y
Definition: glext.h:6295
Definition: video_driver.h:332
#define IDirect3DDevice9_GetRenderTargetData(p, a, b)
Definition: d3d9.h:477
D3DVIEWPORT9 final_viewport
Definition: d3d9_common.h:93
WNDCLASSEX windowClass
Definition: d3d9_common.h:90
GLenum src
Definition: glext.h:6980
void * d3d9x_constant_table_get_constant_by_name(void *_tbl, void *_handle, void *_name)
Definition: d3d9_common.c:558
bool d3d9_create_device(void *dev, void *d3dpp, void *d3d, HWND focus_window, unsigned cur_mon_id)
Definition: d3d9_common.c:380
GLuint in
Definition: glext.h:10523
bool needs_restore
Definition: d3d9_common.h:67
#define IDirect3DDevice9_SetPixelShader(p, a)
Definition: d3d9.h:552
void d3d9_deinitialize_symbols(void)
Definition: d3d9_common.c:221
#define IDirect3DDevice9_SetVertexShader(p, a)
Definition: d3d9.h:537
static INLINE bool d3d9_begin_scene(LPDIRECT3DDEVICE9 dev)
Definition: d3d9_common.h:251
RECT font_rect_shifted
Definition: d3d9_common.h:80
static INLINE void d3d9_unlock_rectangle(LPDIRECT3DTEXTURE9 tex)
Definition: d3d9_common.h:311
static INLINE void d3d9_device_set_render_target(LPDIRECT3DDEVICE9 dev, unsigned idx, LPDIRECT3DSURFACE9 surf)
Definition: d3d9_common.h:549
Definition: video_state_tracker.c:61
void * decl
Definition: d3d9_common.h:102
void d3d9x_font_draw_text(void *data, void *sprite_data, void *string_data, unsigned count, void *rect_data, unsigned format, unsigned color)
Definition: d3d9_common.c:490
struct IDirect3DPixelShader9 * LPDIRECT3DPIXELSHADER9
Definition: d3d9.h:903
#define D3DLOCK_READONLY
Definition: d3d8types.h:1447
GLfloat GLfloat p
Definition: glext.h:9809
DWORD Width
Definition: d3d9types.h:103
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 idx
Definition: pixman-arm-neon-asm.h:96
Definition: d3d8types.h:490
#define IDirect3DDevice9_Present(p, a, b, c, d)
Definition: d3d9.h:462
INT Pitch
Definition: d3d8types.h:1508
Definition: d3d8types.h:1261
struct IDirect3DTexture9 * LPDIRECT3DTEXTURE9
Definition: d3d9.h:1025
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:1404
static INLINE bool d3d9_device_create_offscreen_plain_surface(LPDIRECT3DDEVICE9 dev, unsigned width, unsigned height, unsigned format, unsigned pool, void **surf_data, void *data)
Definition: d3d9_common.h:574
#define RETRO_END_DECLS
Definition: retro_common_api.h:42
math_matrix_4x4 mvp_transposed
Definition: d3d9_common.h:83
bool d3d9x_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)
Definition: d3d9_common.c:460
static INLINE void d3d9_set_sampler_address_u(LPDIRECT3DDEVICE9 dev, unsigned sampler, unsigned value)
Definition: d3d9_common.h:208
struct d3d9_video::@200 menu_display
static INLINE bool d3d9_get_render_state(LPDIRECT3DDEVICE9 dev, INT32 state, DWORD *value)
Definition: d3d9_common.h:557
Definition: d3d9_common.h:38
gfx_ctx_api
Definition: video_driver.h:86
static INLINE void d3d9_device_free(LPDIRECT3DDEVICE9 dev, LPDIRECT3D9 pd3d)
Definition: d3d9_common.h:656
#define IDirect3DTexture9_GetSurfaceLevel(p, a, b)
Definition: d3d9.h:1046
Definition: d3d8types.h:67
Definition: d3d8types.h:1312
#define IDirect3DDevice9_CreateVertexShader(p, a, b)
Definition: d3d9.h:536
void d3d9x_constant_table_set_float_array(LPDIRECT3DDEVICE9 dev, void *p, void *_handle, const void *_pf, unsigned count)
Definition: d3d9_common.c:572
#define IDirect3DVertexBuffer9_Lock(p, a, b, c, d)
Definition: d3d9.h:1288
#define IDirect3DDevice9_SetStreamSource(p, a, b, c, d)
Definition: d3d9.h:545
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, PALETTEENTRY *palette, bool want_mipmap)
Definition: d3d9_common.c:257
struct IDirect3DDevice9 * LPDIRECT3DDEVICE9
Definition: d3d9.h:442
#define IDirect3DDevice9_SetTexture(p, a, b)
Definition: d3d9.h:510
bool resolution_hd_enable
Definition: d3d9_common.h:70
void d3d9_frame_postprocess(void *data)
Definition: video_driver.h:686
static INLINE bool d3d9_set_pixel_shader(LPDIRECT3DDEVICE9 dev, LPDIRECT3DPIXELSHADER9 shader)
Definition: d3d9_common.h:371
GLuint color
Definition: glext.h:6883
bool(* init)(d3d9_video_t *d3d, const video_info_t *video_info, LPDIRECT3DDEVICE9 dev, const D3DVIEWPORT9 *final_viewport, const struct LinkInfo *info, bool rgb32)
Definition: d3d9_common.h:42
#define D3DTA_TEXTURE
Definition: d3d8types.h:549
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glext.h:6293
Definition: d3d8types.h:1506
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7672
void d3d9x_constant_table_set_matrix(LPDIRECT3DDEVICE9 dev, void *p, void *data, const void *matrix)
Definition: d3d9_common.c:598
Definition: d3d9types.h:518
Definition: d3d8types.h:444
GLint GLint GLsizei width
Definition: glext.h:6293
Definition: d3d8types.h:332
Definition: d3d9types.h:761
static INLINE void d3d9_enable_blend_func(LPDIRECT3DDEVICE9 dev)
Definition: d3d9_common.h:466
static INLINE bool d3d9_device_get_render_target_data(LPDIRECT3DDEVICE9 dev, LPDIRECT3DSURFACE9 src, LPDIRECT3DSURFACE9 dst)
Definition: d3d9_common.h:524
Definition: glslang_tab.cpp:136
static INLINE void d3d9_set_sampler_address_v(LPDIRECT3DDEVICE9 dev, unsigned sampler, unsigned value)
Definition: d3d9_common.h:216
#define IDirect3DDevice9_SetTextureStageState(p, a, b, c)
Definition: d3d9.h:512
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_vertex_declaration_free(LPDIRECT3DVERTEXDECLARATION9 decl)
Definition: d3d9_common.h:446
#define D3D_OK
Definition: d3d8.h:1191
bool d3d9_reset(void *dev, void *d3dpp)
Definition: d3d9_common.c:401
static INLINE void d3d9_set_transform(LPDIRECT3DDEVICE9 dev, D3DTRANSFORMSTATETYPE state, CONST D3DMATRIX *matrix)
Definition: d3d9_common.h:197
Definition: glslang_tab.cpp:133
Definition: d3d8types.h:443
GLsizei const GLfloat * value
Definition: glext.h:6709
static INLINE void d3d9_set_texture(LPDIRECT3DDEVICE9 dev, unsigned sampler, LPDIRECT3DTEXTURE9 tex)
Definition: d3d9_common.h:328
bool quitting
Definition: d3d9_common.h:66
enum _D3DRENDERSTATETYPE D3DRENDERSTATETYPE
static INLINE bool d3d9_texture_get_level_desc(LPDIRECT3DTEXTURE9 tex, unsigned idx, D3DSURFACE_DESC *_ppsurface_level)
Definition: d3d9_common.h:146
static INLINE INT32 d3d9_get_argb8888_format(void)
Definition: d3d9_common.h:749
const void * d3d9x_get_buffer_ptr(void *data)
Definition: d3d9_common.c:548
static INLINE void d3d9_set_viewports(LPDIRECT3DDEVICE9 dev, void *vp)
Definition: d3d9_common.h:453
static INLINE void d3d9_end_scene(LPDIRECT3DDEVICE9 dev)
Definition: d3d9_common.h:265
GLsizei stride
Definition: glext.h:6488
GLenum GLenum dst
Definition: glext.h:6980
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
bool(* render)(d3d9_video_t *d3d, const video_frame_info_t *video_info, state_tracker_t *tracker, const void *frame, unsigned width, unsigned height, unsigned pitch, unsigned rotation)
Definition: d3d9_common.h:54
#define IDirect3DDevice9_SetVertexShaderConstantF(p, a, b, c)
Definition: d3d9.h:539
#define IDirect3D9_CheckDeviceType(p, a, b, c, d, e)
Definition: d3d9.h:263
interface IDirect3DBaseTexture9 IDirect3DBaseTexture9
Definition: d3d9.h:187
GLuint sampler
Definition: glext.h:7950
static INLINE bool d3d9_set_vertex_shader(LPDIRECT3DDEVICE9 dev, LPDIRECT3DVERTEXSHADER9 shader)
Definition: d3d9_common.h:385
static INLINE void d3d9_set_sampler_magfilter(LPDIRECT3DDEVICE9 dev, unsigned sampler, unsigned value)
Definition: d3d9_common.h:233
overlay_t * overlays
Definition: d3d9_common.h:106
int size
Definition: d3d9_common.h:99
int offset
Definition: d3d9_common.h:100
static INLINE void * d3d9_vertex_buffer_lock(LPDIRECT3DVERTEXBUFFER9 vertbuf)
Definition: d3d9_common.h:125
GLbitfield flags
Definition: glext.h:7828
static INLINE bool d3d9_vertex_declaration_new(LPDIRECT3DDEVICE9 dev, const void *vertex_data, void **decl_data)
Definition: d3d9_common.h:432
#define D3DTA_DIFFUSE
Definition: d3d8types.h:547
void * d3d9_vertex_buffer_new(void *dev, unsigned length, unsigned usage, unsigned fvf, INT32 pool, void *handle)
Definition: d3d9_common.c:294
#define IDirect3DDevice9_SetTransform(p, a, b)
Definition: d3d9.h:489
unsigned dev_rotation
Definition: d3d9_common.h:73
Definition: d3d8types.h:1260
static INLINE bool d3d9_create_vertex_shader(LPDIRECT3DDEVICE9 dev, const DWORD *a, void **b)
Definition: d3d9_common.h:338
static INLINE bool d3d9_get_adapter_display_mode(LPDIRECT3D9 d3d, unsigned idx, D3DDISPLAYMODE *display_mode)
Definition: d3d9_common.h:617
enum _D3DTRANSFORMSTATETYPE D3DTRANSFORMSTATETYPE
Definition: d3d9types.h:100
void * memset(void *b, int c, size_t len)
Definition: string.c:7
video_info_t video_info
Definition: d3d9_common.h:88
static INLINE INT32 d3d9_get_xrgb8888_format(void)
Definition: d3d9_common.h:758
GLenum GLuint GLenum GLsizei length
Definition: glext.h:6233
enum _D3DBACKBUFFER_TYPE D3DBACKBUFFER_TYPE
unsigned char uint8_t
Definition: stdint.h:124
Definition: d3d8types.h:339
#define IDirect3DDevice9_CreateOffscreenPlainSurface(p, a, b, c, d, e, f)
Definition: d3d9.h:481
static INLINE void d3d9_surface_free(LPDIRECT3DSURFACE9 surf)
Definition: d3d9_common.h:518
#define IDirect3DDevice9_SetRenderState(p, a, b)
Definition: d3d9.h:502
state_tracker_t * state_tracker
Definition: d3d9_common.h:85
Definition: d3d9types.h:517
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844
#define IDirect3DTexture9_LockRect(p, a, b, c, d)
Definition: d3d9.h:1047
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
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:12652
Definition: video_shader_parse.h:64
overlay_t * menu
Definition: d3d9_common.h:75
bool d3d9_initialize_symbols(enum gfx_ctx_api api)
Definition: d3d9_common.c:159