ReactOS  0.4.15-dev-2344-g8ddbfde
render.c File Reference
#include "d3dx9_private.h"
Include dependency graph for render.c:

Go to the source code of this file.

Classes

struct  device_state
 
struct  render_to_surface
 
struct  render_to_envmap
 

Enumerations

enum  render_state { INITIAL, CUBE_BEGIN, CUBE_FACE }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3dx)
 
static HRESULT device_state_init (IDirect3DDevice9 *device, struct device_state *state)
 
static void device_state_capture (IDirect3DDevice9 *device, struct device_state *state)
 
static void device_state_restore (IDirect3DDevice9 *device, struct device_state *state)
 
static void device_state_release (struct device_state *state)
 
static struct render_to_surfaceimpl_from_ID3DXRenderToSurface (ID3DXRenderToSurface *iface)
 
static HRESULT WINAPI D3DXRenderToSurface_QueryInterface (ID3DXRenderToSurface *iface, REFIID riid, void **out)
 
static ULONG WINAPI D3DXRenderToSurface_AddRef (ID3DXRenderToSurface *iface)
 
static ULONG WINAPI D3DXRenderToSurface_Release (ID3DXRenderToSurface *iface)
 
static HRESULT WINAPI D3DXRenderToSurface_GetDevice (ID3DXRenderToSurface *iface, IDirect3DDevice9 **device)
 
static HRESULT WINAPI D3DXRenderToSurface_GetDesc (ID3DXRenderToSurface *iface, D3DXRTS_DESC *desc)
 
static HRESULT WINAPI D3DXRenderToSurface_BeginScene (ID3DXRenderToSurface *iface, IDirect3DSurface9 *surface, const D3DVIEWPORT9 *viewport)
 
static HRESULT WINAPI D3DXRenderToSurface_EndScene (ID3DXRenderToSurface *iface, DWORD filter)
 
static HRESULT WINAPI D3DXRenderToSurface_OnLostDevice (ID3DXRenderToSurface *iface)
 
static HRESULT WINAPI D3DXRenderToSurface_OnResetDevice (ID3DXRenderToSurface *iface)
 
HRESULT WINAPI D3DXCreateRenderToSurface (IDirect3DDevice9 *device, UINT width, UINT height, D3DFORMAT format, BOOL depth_stencil, D3DFORMAT depth_stencil_format, ID3DXRenderToSurface **out)
 
static void copy_render_target_to_cube_texture_face (IDirect3DCubeTexture9 *cube_texture, D3DCUBEMAP_FACES face, IDirect3DSurface9 *render_target, DWORD filter)
 
static struct render_to_envmapimpl_from_ID3DXRenderToEnvMap (ID3DXRenderToEnvMap *iface)
 
static HRESULT WINAPI D3DXRenderToEnvMap_QueryInterface (ID3DXRenderToEnvMap *iface, REFIID riid, void **out)
 
static ULONG WINAPI D3DXRenderToEnvMap_AddRef (ID3DXRenderToEnvMap *iface)
 
static ULONG WINAPI D3DXRenderToEnvMap_Release (ID3DXRenderToEnvMap *iface)
 
static HRESULT WINAPI D3DXRenderToEnvMap_GetDevice (ID3DXRenderToEnvMap *iface, IDirect3DDevice9 **device)
 
static HRESULT WINAPI D3DXRenderToEnvMap_GetDesc (ID3DXRenderToEnvMap *iface, D3DXRTE_DESC *desc)
 
static HRESULT WINAPI D3DXRenderToEnvMap_BeginCube (ID3DXRenderToEnvMap *iface, IDirect3DCubeTexture9 *texture)
 
static HRESULT WINAPI D3DXRenderToEnvMap_BeginSphere (ID3DXRenderToEnvMap *iface, IDirect3DTexture9 *texture)
 
static HRESULT WINAPI D3DXRenderToEnvMap_BeginHemisphere (ID3DXRenderToEnvMap *iface, IDirect3DTexture9 *pos_z_texture, IDirect3DTexture9 *neg_z_texture)
 
static HRESULT WINAPI D3DXRenderToEnvMap_BeginParabolic (ID3DXRenderToEnvMap *iface, IDirect3DTexture9 *pos_z_texture, IDirect3DTexture9 *neg_z_texture)
 
static HRESULT WINAPI D3DXRenderToEnvMap_Face (ID3DXRenderToEnvMap *iface, D3DCUBEMAP_FACES face, DWORD filter)
 
static HRESULT WINAPI D3DXRenderToEnvMap_End (ID3DXRenderToEnvMap *iface, DWORD filter)
 
static HRESULT WINAPI D3DXRenderToEnvMap_OnLostDevice (ID3DXRenderToEnvMap *iface)
 
static HRESULT WINAPI D3DXRenderToEnvMap_OnResetDevice (ID3DXRenderToEnvMap *iface)
 
HRESULT WINAPI D3DXCreateRenderToEnvMap (IDirect3DDevice9 *device, UINT size, UINT mip_levels, D3DFORMAT format, BOOL depth_stencil, D3DFORMAT depth_stencil_format, ID3DXRenderToEnvMap **out)
 

Variables

static const ID3DXRenderToSurfaceVtbl render_to_surface_vtbl
 
static const ID3DXRenderToEnvMapVtbl render_to_envmap_vtbl
 

Enumeration Type Documentation

◆ render_state

Enumerator
INITIAL 
CUBE_BEGIN 
CUBE_FACE 

Definition at line 423 of file render.c.

424 {
425  INITIAL,
426 
427  CUBE_BEGIN,
428  CUBE_FACE
429 };

Function Documentation

◆ copy_render_target_to_cube_texture_face()

static void copy_render_target_to_cube_texture_face ( IDirect3DCubeTexture9 *  cube_texture,
D3DCUBEMAP_FACES  face,
IDirect3DSurface9 *  render_target,
DWORD  filter 
)
static

Definition at line 451 of file render.c.

453 {
454  HRESULT hr;
455  IDirect3DSurface9 *cube_surface;
456 
457  IDirect3DCubeTexture9_GetCubeMapSurface(cube_texture, face, 0, &cube_surface);
458 
459  hr = D3DXLoadSurfaceFromSurface(cube_surface, NULL, NULL, render_target, NULL, NULL, filter, 0);
460  if (FAILED(hr)) ERR("Copying render target data to surface failed %#x\n", hr);
461 
462  IDirect3DSurface9_Release(cube_surface);
463 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI D3DXLoadSurfaceFromSurface(IDirect3DSurface9 *dst_surface, const PALETTEENTRY *dst_palette, const RECT *dst_rect, IDirect3DSurface9 *src_surface, const PALETTEENTRY *src_palette, const RECT *src_rect, DWORD filter, D3DCOLOR color_key)
Definition: surface.c:2233
LONG HRESULT
Definition: typedefs.h:79
#define IDirect3DCubeTexture9_GetCubeMapSurface(p, a, b, c)
Definition: d3d9.h:938
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

Referenced by D3DXRenderToEnvMap_End(), and D3DXRenderToEnvMap_Face().

◆ D3DXCreateRenderToEnvMap()

HRESULT WINAPI D3DXCreateRenderToEnvMap ( IDirect3DDevice9 *  device,
UINT  size,
UINT  mip_levels,
D3DFORMAT  format,
BOOL  depth_stencil,
D3DFORMAT  depth_stencil_format,
ID3DXRenderToEnvMap **  out 
)

Definition at line 749 of file render.c.

756 {
757  HRESULT hr;
758  struct render_to_envmap *render;
759 
760  TRACE("(%p, %u, %u, %#x, %d, %#x, %p)\n", device, size, mip_levels,
761  format, depth_stencil, depth_stencil_format, out);
762 
763  if (!device || !out) return D3DERR_INVALIDCALL;
764 
765  hr = D3DXCheckTextureRequirements(device, &size, &size, &mip_levels,
767  if (FAILED(hr)) return hr;
768 
769  render = HeapAlloc(GetProcessHeap(), 0, sizeof(struct render_to_envmap));
770  if (!render) return E_OUTOFMEMORY;
771 
772  render->ID3DXRenderToEnvMap_iface.lpVtbl = &render_to_envmap_vtbl;
773  render->ref = 1;
774 
775  render->desc.Size = size;
776  render->desc.MipLevels = mip_levels;
777  render->desc.Format = format;
778  render->desc.DepthStencil = depth_stencil;
779  render->desc.DepthStencilFormat = depth_stencil_format;
780 
781  render->state = INITIAL;
782  render->render_target = NULL;
783  render->depth_stencil = NULL;
784  render->dst_cube_texture = NULL;
785 
786  hr = device_state_init(device, &render->previous_device_state);
787  if (FAILED(hr))
788  {
790  return hr;
791  }
792 
794  render->device = device;
795 
796  *out = &render->ID3DXRenderToEnvMap_iface;
797  return D3D_OK;
798 }
HRESULT hr
Definition: shlfolder.c:183
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
FxDevice * device
IDirect3DSurface9 * depth_stencil
Definition: render.c:446
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
static const ID3DXRenderToEnvMapVtbl render_to_envmap_vtbl
Definition: render.c:730
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:79
#define D3DUSAGE_RENDERTARGET
Definition: d3d8types.h:91
static void render(void)
Definition: ssstars.c:272
static FILE * out
Definition: regtests2xml.c:44
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
static HRESULT device_state_init(IDirect3DDevice9 *device, struct device_state *state)
Definition: render.c:37
#define D3D_OK
Definition: d3d.h:106
#define NULL
Definition: types.h:112
HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:412
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by test_D3DXCreateRenderToEnvMap(), test_ID3DXRenderToEnvMap(), and test_ID3DXRenderToEnvMap_cube_map().

◆ D3DXCreateRenderToSurface()

HRESULT WINAPI D3DXCreateRenderToSurface ( IDirect3DDevice9 *  device,
UINT  width,
UINT  height,
D3DFORMAT  format,
BOOL  depth_stencil,
D3DFORMAT  depth_stencil_format,
ID3DXRenderToSurface **  out 
)

Definition at line 376 of file render.c.

383 {
384  HRESULT hr;
385  struct render_to_surface *render;
386 
387  TRACE("(%p, %u, %u, %#x, %d, %#x, %p)\n", device, width, height, format,
388  depth_stencil, depth_stencil_format, out);
389 
390  if (!device || !out) return D3DERR_INVALIDCALL;
391 
392  render = HeapAlloc(GetProcessHeap(), 0, sizeof(struct render_to_surface));
393  if (!render) return E_OUTOFMEMORY;
394 
395  render->ID3DXRenderToSurface_iface.lpVtbl = &render_to_surface_vtbl;
396  render->ref = 1;
397 
398  render->desc.Width = width;
399  render->desc.Height = height;
400  render->desc.Format = format;
401  render->desc.DepthStencil = depth_stencil;
402  render->desc.DepthStencilFormat = depth_stencil_format;
403 
404  render->dst_surface = NULL;
405  render->render_target = NULL;
406  render->depth_stencil = NULL;
407 
408  hr = device_state_init(device, &render->previous_state);
409  if (FAILED(hr))
410  {
412  return hr;
413  }
414 
416  render->device = device;
417 
418  *out = &render->ID3DXRenderToSurface_iface;
419  return D3D_OK;
420 }
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT hr
Definition: shlfolder.c:183
static const ID3DXRenderToSurfaceVtbl render_to_surface_vtbl
Definition: render.c:361
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
FxDevice * device
IDirect3DSurface9 * depth_stencil
Definition: render.c:123
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:79
static void render(void)
Definition: ssstars.c:272
static FILE * out
Definition: regtests2xml.c:44
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
static HRESULT device_state_init(IDirect3DDevice9 *device, struct device_state *state)
Definition: render.c:37
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define D3D_OK
Definition: d3d.h:106
#define NULL
Definition: types.h:112
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by check_ID3DXRenderToSurface(), test_D3DXCreateRenderToSurface(), test_ID3DXRenderToSurface(), and test_ID3DXRenderToSurface_device_state().

◆ D3DXRenderToEnvMap_AddRef()

static ULONG WINAPI D3DXRenderToEnvMap_AddRef ( ID3DXRenderToEnvMap *  iface)
static

Definition at line 490 of file render.c.

491 {
494 
495  TRACE("%p increasing refcount to %u\n", iface, ref);
496 
497  return ref;
498 }
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
static void render(void)
Definition: ssstars.c:272
static struct render_to_envmap * impl_from_ID3DXRenderToEnvMap(ID3DXRenderToEnvMap *iface)
Definition: render.c:465
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ D3DXRenderToEnvMap_BeginCube()

static HRESULT WINAPI D3DXRenderToEnvMap_BeginCube ( ID3DXRenderToEnvMap *  iface,
IDirect3DCubeTexture9 *  texture 
)
static

Definition at line 551 of file render.c.

553 {
555  HRESULT hr;
556  D3DSURFACE_DESC level_desc;
557 
558  TRACE("(%p)->(%p)\n", iface, texture);
559 
560  if (!texture) return D3DERR_INVALIDCALL;
561 
562  if (render->state != INITIAL) return D3DERR_INVALIDCALL;
563 
565  if (level_desc.Format != render->desc.Format || level_desc.Width != render->desc.Size)
566  return D3DERR_INVALIDCALL;
567 
568  if (!(level_desc.Usage & D3DUSAGE_RENDERTARGET))
569  {
570  hr = IDirect3DDevice9_CreateRenderTarget(render->device, level_desc.Width, level_desc.Height,
571  level_desc.Format, level_desc.MultiSampleType, level_desc.MultiSampleQuality,
572  TRUE, &render->render_target, NULL);
573  if (FAILED(hr)) goto cleanup;
575  }
576 
577  if (render->desc.DepthStencil)
578  {
579  hr = IDirect3DDevice9_CreateDepthStencilSurface(render->device, level_desc.Width, level_desc.Height,
580  render->desc.DepthStencilFormat, level_desc.MultiSampleType, level_desc.MultiSampleQuality,
581  TRUE, &render->depth_stencil, NULL);
582  if (FAILED(hr)) goto cleanup;
583  }
584 
586  render->dst_cube_texture = texture;
587  render->state = CUBE_BEGIN;
588  return D3D_OK;
589 
590 cleanup:
591  if (render->dst_cube_texture) IDirect3DSurface9_Release(render->dst_cube_texture);
592  render->dst_cube_texture = NULL;
593 
594  if (render->render_target) IDirect3DSurface9_Release(render->render_target);
595  render->render_target = NULL;
596  if (render->depth_stencil) IDirect3DSurface9_Release(render->depth_stencil);
597  render->depth_stencil = NULL;
598 
599  return hr;
600 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
#define IDirect3DCubeTexture9_GetLevelDesc(p, a, b)
Definition: d3d9.h:937
HRESULT hr
Definition: shlfolder.c:183
D3DFORMAT Format
Definition: d3d8types.h:1170
#define D3DERR_INVALIDCALL
#define IDirect3DDevice9_CreateRenderTarget(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1535
DWORD MultiSampleQuality
Definition: d3d9types.h:1486
#define IDirect3DDevice9_CreateDepthStencilSurface(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1536
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:79
#define D3DUSAGE_RENDERTARGET
Definition: d3d8types.h:91
static void render(void)
Definition: ssstars.c:272
#define TRUE
Definition: render.c:43
static struct render_to_envmap * impl_from_ID3DXRenderToEnvMap(ID3DXRenderToEnvMap *iface)
Definition: render.c:465
D3DMULTISAMPLE_TYPE MultiSampleType
Definition: d3d8types.h:1175
#define D3D_OK
Definition: d3d.h:106
#define NULL
Definition: types.h:112
char * cleanup(char *str)
Definition: wpickclick.c:99
#define IDirect3DCubeTexture9_AddRef(p)
Definition: d3d9.h:918

◆ D3DXRenderToEnvMap_BeginHemisphere()

static HRESULT WINAPI D3DXRenderToEnvMap_BeginHemisphere ( ID3DXRenderToEnvMap *  iface,
IDirect3DTexture9 *  pos_z_texture,
IDirect3DTexture9 *  neg_z_texture 
)
static

Definition at line 609 of file render.c.

612 {
613  FIXME("(%p)->(%p, %p): stub\n", iface, pos_z_texture, neg_z_texture);
614  return E_NOTIMPL;
615 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ D3DXRenderToEnvMap_BeginParabolic()

static HRESULT WINAPI D3DXRenderToEnvMap_BeginParabolic ( ID3DXRenderToEnvMap *  iface,
IDirect3DTexture9 *  pos_z_texture,
IDirect3DTexture9 *  neg_z_texture 
)
static

Definition at line 617 of file render.c.

620 {
621  FIXME("(%p)->(%p, %p): stub\n", iface, pos_z_texture, neg_z_texture);
622  return E_NOTIMPL;
623 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ D3DXRenderToEnvMap_BeginSphere()

static HRESULT WINAPI D3DXRenderToEnvMap_BeginSphere ( ID3DXRenderToEnvMap *  iface,
IDirect3DTexture9 *  texture 
)
static

Definition at line 602 of file render.c.

604 {
605  FIXME("(%p)->(%p): stub\n", iface, texture);
606  return E_NOTIMPL;
607 }
#define FIXME(fmt,...)
Definition: debug.h:111
GLenum GLuint texture
Definition: glext.h:6295
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ D3DXRenderToEnvMap_End()

static HRESULT WINAPI D3DXRenderToEnvMap_End ( ID3DXRenderToEnvMap *  iface,
DWORD  filter 
)
static

Definition at line 678 of file render.c.

680 {
682 
683  TRACE("(%p)->(%#x)\n", iface, filter);
684 
685  if (render->state == INITIAL) return D3DERR_INVALIDCALL;
686 
687  if (render->state == CUBE_FACE)
688  {
690  if (render->render_target)
691  copy_render_target_to_cube_texture_face(render->dst_cube_texture, render->face,
692  render->render_target, render->filter);
693 
694  device_state_restore(render->device, &render->previous_device_state);
695  }
696 
697  D3DXFilterTexture((IDirect3DBaseTexture9 *)render->dst_cube_texture, NULL, 0, filter);
698 
699  if (render->render_target)
700  {
701  IDirect3DSurface9_Release(render->render_target);
702  render->render_target = NULL;
703  }
704 
705  if (render->depth_stencil)
706  {
707  IDirect3DSurface9_Release(render->depth_stencil);
708  render->depth_stencil = NULL;
709  }
710 
711  IDirect3DSurface9_Release(render->dst_cube_texture);
712  render->dst_cube_texture = NULL;
713 
714  render->state = INITIAL;
715  return D3D_OK;
716 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
static void copy_render_target_to_cube_texture_face(IDirect3DCubeTexture9 *cube_texture, D3DCUBEMAP_FACES face, IDirect3DSurface9 *render_target, DWORD filter)
Definition: render.c:451
#define D3DERR_INVALIDCALL
HRESULT WINAPI D3DXFilterTexture(IDirect3DBaseTexture9 *texture, const PALETTEENTRY *palette, UINT srclevel, DWORD filter)
Definition: texture.c:52
static void device_state_restore(IDirect3DDevice9 *device, struct device_state *state)
Definition: render.c:75
#define IDirect3DDevice9_EndScene(p)
Definition: d3d9.h:1549
#define TRACE(s)
Definition: solgame.cpp:4
static void render(void)
Definition: ssstars.c:272
static struct render_to_envmap * impl_from_ID3DXRenderToEnvMap(ID3DXRenderToEnvMap *iface)
Definition: render.c:465
#define D3D_OK
Definition: d3d.h:106
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

◆ D3DXRenderToEnvMap_Face()

static HRESULT WINAPI D3DXRenderToEnvMap_Face ( ID3DXRenderToEnvMap *  iface,
D3DCUBEMAP_FACES  face,
DWORD  filter 
)
static

Definition at line 625 of file render.c.

628 {
630  HRESULT hr;
631  unsigned int i;
632 
633  TRACE("(%p)->(%u, %#x)\n", iface, face, filter);
634 
635  if (render->state == CUBE_FACE)
636  {
638  if (render->render_target)
639  copy_render_target_to_cube_texture_face(render->dst_cube_texture, render->face,
640  render->render_target, render->filter);
641 
642  device_state_restore(render->device, &render->previous_device_state);
643 
644  render->state = CUBE_BEGIN;
645  }
646  else if (render->state != CUBE_BEGIN)
647  return D3DERR_INVALIDCALL;
648 
649  device_state_capture(render->device, &render->previous_device_state);
650 
651  for (i = 1; i < render->previous_device_state.num_render_targets; i++)
653 
654  if (!render->render_target)
655  {
656  IDirect3DSurface9 *render_target;
660  }
661  else hr = IDirect3DDevice9_SetRenderTarget(render->device, 0, render->render_target);
662 
663  if (FAILED(hr)) goto cleanup;
664 
665  hr = IDirect3DDevice9_SetDepthStencilSurface(render->device, render->depth_stencil);
666  if (FAILED(hr)) goto cleanup;
667 
668  render->state = CUBE_FACE;
669  render->face = face;
670  render->filter = filter;
671  return IDirect3DDevice9_BeginScene(render->device);
672 
673 cleanup:
674  device_state_restore(render->device, &render->previous_device_state);
675  return hr;
676 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
HRESULT hr
Definition: shlfolder.c:183
static void copy_render_target_to_cube_texture_face(IDirect3DCubeTexture9 *cube_texture, D3DCUBEMAP_FACES face, IDirect3DSurface9 *render_target, DWORD filter)
Definition: render.c:451
#define D3DERR_INVALIDCALL
#define IDirect3DDevice9_SetDepthStencilSurface(p, a)
Definition: d3d9.h:1546
IDirect3DSurface9 * render_target
Definition: render.c:445
#define IDirect3DDevice9_SetRenderTarget(p, a, b)
Definition: d3d9.h:1544
static void device_state_restore(IDirect3DDevice9 *device, struct device_state *state)
Definition: render.c:75
#define IDirect3DDevice9_EndScene(p)
Definition: d3d9.h:1549
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
static void render(void)
Definition: ssstars.c:272
WORD face[3]
Definition: mesh.c:4747
static struct render_to_envmap * impl_from_ID3DXRenderToEnvMap(ID3DXRenderToEnvMap *iface)
Definition: render.c:465
#define IDirect3DCubeTexture9_GetCubeMapSurface(p, a, b, c)
Definition: d3d9.h:938
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
char * cleanup(char *str)
Definition: wpickclick.c:99
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define IDirect3DDevice9_BeginScene(p)
Definition: d3d9.h:1548
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
static void device_state_capture(IDirect3DDevice9 *device, struct device_state *state)
Definition: render.c:58

◆ D3DXRenderToEnvMap_GetDesc()

static HRESULT WINAPI D3DXRenderToEnvMap_GetDesc ( ID3DXRenderToEnvMap *  iface,
D3DXRTE_DESC desc 
)
static

Definition at line 538 of file render.c.

540 {
542 
543  TRACE("(%p)->(%p)\n", iface, desc);
544 
545  if (!desc) return D3DERR_INVALIDCALL;
546 
547  *desc = render->desc;
548  return D3D_OK;
549 }
#define D3DERR_INVALIDCALL
static const WCHAR desc[]
Definition: protectdata.c:36
#define TRACE(s)
Definition: solgame.cpp:4
static void render(void)
Definition: ssstars.c:272
static struct render_to_envmap * impl_from_ID3DXRenderToEnvMap(ID3DXRenderToEnvMap *iface)
Definition: render.c:465
#define D3D_OK
Definition: d3d.h:106

◆ D3DXRenderToEnvMap_GetDevice()

static HRESULT WINAPI D3DXRenderToEnvMap_GetDevice ( ID3DXRenderToEnvMap *  iface,
IDirect3DDevice9 **  device 
)
static

Definition at line 524 of file render.c.

526 {
528 
529  TRACE("(%p)->(%p)\n", iface, device);
530 
531  if (!device) return D3DERR_INVALIDCALL;
532 
534  *device = render->device;
535  return D3D_OK;
536 }
#define D3DERR_INVALIDCALL
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
static void render(void)
Definition: ssstars.c:272
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
static struct render_to_envmap * impl_from_ID3DXRenderToEnvMap(ID3DXRenderToEnvMap *iface)
Definition: render.c:465
#define D3D_OK
Definition: d3d.h:106

◆ D3DXRenderToEnvMap_OnLostDevice()

static HRESULT WINAPI D3DXRenderToEnvMap_OnLostDevice ( ID3DXRenderToEnvMap *  iface)
static

Definition at line 718 of file render.c.

719 {
720  FIXME("(%p)->(): stub\n", iface);
721  return D3D_OK;
722 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define D3D_OK
Definition: d3d.h:106

◆ D3DXRenderToEnvMap_OnResetDevice()

static HRESULT WINAPI D3DXRenderToEnvMap_OnResetDevice ( ID3DXRenderToEnvMap *  iface)
static

Definition at line 724 of file render.c.

725 {
726  FIXME("(%p)->(): stub\n", iface);
727  return D3D_OK;
728 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define D3D_OK
Definition: d3d.h:106

◆ D3DXRenderToEnvMap_QueryInterface()

static HRESULT WINAPI D3DXRenderToEnvMap_QueryInterface ( ID3DXRenderToEnvMap *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 470 of file render.c.

473 {
474  TRACE("iface %p, riid %s, out %p\n", iface, debugstr_guid(riid), out);
475 
476  if (IsEqualGUID(riid, &IID_ID3DXRenderToEnvMap)
478  {
479  IUnknown_AddRef(iface);
480  *out = iface;
481  return S_OK;
482  }
483 
484  WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
485 
486  *out = NULL;
487  return E_NOINTERFACE;
488 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static FILE * out
Definition: regtests2xml.c:44
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ D3DXRenderToEnvMap_Release()

static ULONG WINAPI D3DXRenderToEnvMap_Release ( ID3DXRenderToEnvMap *  iface)
static

Definition at line 500 of file render.c.

501 {
504 
505  TRACE("%p decreasing refcount to %u\n", iface, ref);
506 
507  if (!ref)
508  {
509  if (render->dst_cube_texture) IDirect3DSurface9_Release(render->dst_cube_texture);
510 
511  if (render->render_target) IDirect3DSurface9_Release(render->render_target);
512  if (render->depth_stencil) IDirect3DSurface9_Release(render->depth_stencil);
513 
514  device_state_release(&render->previous_device_state);
515 
517 
519  }
520 
521  return ref;
522 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
Definition: send.c:48
static void device_state_release(struct device_state *state)
Definition: render.c:97
GLenum GLint ref
Definition: glext.h:6028
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:1508
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
static void render(void)
Definition: ssstars.c:272
static struct render_to_envmap * impl_from_ID3DXRenderToEnvMap(ID3DXRenderToEnvMap *iface)
Definition: render.c:465
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ D3DXRenderToSurface_AddRef()

static ULONG WINAPI D3DXRenderToSurface_AddRef ( ID3DXRenderToSurface *  iface)
static

Definition at line 153 of file render.c.

154 {
157 
158  TRACE("%p increasing refcount to %u\n", iface, ref);
159 
160  return ref;
161 }
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
static void render(void)
Definition: ssstars.c:272
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1
static struct render_to_surface * impl_from_ID3DXRenderToSurface(ID3DXRenderToSurface *iface)
Definition: render.c:128

◆ D3DXRenderToSurface_BeginScene()

static HRESULT WINAPI D3DXRenderToSurface_BeginScene ( ID3DXRenderToSurface *  iface,
IDirect3DSurface9 *  surface,
const D3DVIEWPORT9 viewport 
)
static

Definition at line 214 of file render.c.

217 {
219  unsigned int i;
220  IDirect3DDevice9 *device;
221  D3DSURFACE_DESC surface_desc;
223  D3DMULTISAMPLE_TYPE multi_sample_type = D3DMULTISAMPLE_NONE;
224  DWORD multi_sample_quality = 0;
225 
226  TRACE("(%p)->(%p, %p)\n", iface, surface, viewport);
227 
228  if (!surface || render->dst_surface) return D3DERR_INVALIDCALL;
229 
230  IDirect3DSurface9_GetDesc(surface, &surface_desc);
231  if (surface_desc.Format != render->desc.Format
232  || surface_desc.Width != render->desc.Width
233  || surface_desc.Height != render->desc.Height)
234  return D3DERR_INVALIDCALL;
235 
236  if (viewport)
237  {
238  if (viewport->X > render->desc.Width || viewport->Y > render->desc.Height
239  || viewport->X + viewport->Width > render->desc.Width
240  || viewport->Y + viewport->Height > render->desc.Height)
241  return D3DERR_INVALIDCALL;
242 
243  if (!(surface_desc.Usage & D3DUSAGE_RENDERTARGET)
244  && (viewport->X != 0 || viewport->Y != 0
245  || viewport->Width != render->desc.Width
246  || viewport->Height != render->desc.Height))
247  return D3DERR_INVALIDCALL;
248  }
249 
250  device = render->device;
251 
252  device_state_capture(device, &render->previous_state);
253 
254  /* prepare for rendering to surface */
255  for (i = 1; i < render->previous_state.num_render_targets; i++)
257 
258  if (surface_desc.Usage & D3DUSAGE_RENDERTARGET)
259  {
261  multi_sample_type = surface_desc.MultiSampleType;
262  multi_sample_quality = surface_desc.MultiSampleQuality;
263  }
264  else
265  {
266  hr = IDirect3DDevice9_CreateRenderTarget(device, render->desc.Width, render->desc.Height,
267  render->desc.Format, multi_sample_type, multi_sample_quality, FALSE,
268  &render->render_target, NULL);
269  if (FAILED(hr)) goto cleanup;
270  hr = IDirect3DDevice9_SetRenderTarget(device, 0, render->render_target);
271  }
272 
273  if (FAILED(hr)) goto cleanup;
274 
275  if (render->desc.DepthStencil)
276  {
278  render->desc.DepthStencilFormat, multi_sample_type, multi_sample_quality, TRUE,
279  &render->depth_stencil, NULL);
280  }
281  else render->depth_stencil = NULL;
282 
283  if (FAILED(hr)) goto cleanup;
284 
286  if (FAILED(hr)) goto cleanup;
287 
288  if (viewport) IDirect3DDevice9_SetViewport(device, viewport);
289 
290  IDirect3DSurface9_AddRef(surface);
291  render->dst_surface = surface;
293 
294 cleanup:
295  device_state_restore(device, &render->previous_state);
296 
297  if (render->dst_surface) IDirect3DSurface9_Release(render->dst_surface);
298  render->dst_surface = NULL;
299 
300  if (render->render_target) IDirect3DSurface9_Release(render->render_target);
301  render->render_target = NULL;
302  if (render->depth_stencil) IDirect3DSurface9_Release(render->depth_stencil);
303  render->depth_stencil = NULL;
304 
305  return hr;
306 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
HRESULT hr
Definition: shlfolder.c:183
D3DFORMAT Format
Definition: d3d8types.h:1170
#define IDirect3DDevice9_SetViewport(p, a)
Definition: d3d9.h:1554
#define D3DERR_INVALIDCALL
#define IDirect3DDevice9_CreateRenderTarget(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1535
#define IDirect3DDevice9_SetDepthStencilSurface(p, a)
Definition: d3d9.h:1546
DWORD MultiSampleQuality
Definition: d3d9types.h:1486
#define IDirect3DDevice9_CreateDepthStencilSurface(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1536
FxDevice * device
#define IDirect3DDevice9_SetRenderTarget(p, a, b)
Definition: d3d9.h:1544
Definition: devices.h:37
static void device_state_restore(IDirect3DDevice9 *device, struct device_state *state)
Definition: render.c:75
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define D3DUSAGE_RENDERTARGET
Definition: d3d8types.h:91
static void render(void)
Definition: ssstars.c:272
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TRUE
Definition: render.c:43
D3DMULTISAMPLE_TYPE MultiSampleType
Definition: d3d8types.h:1175
#define FALSE
Definition: render.c:46
#define IDirect3DSurface9_AddRef(p)
Definition: d3d9.h:621
#define IDirect3DSurface9_GetDesc(p, a)
Definition: d3d9.h:634
enum _D3DMULTISAMPLE_TYPE D3DMULTISAMPLE_TYPE
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
char * cleanup(char *str)
Definition: wpickclick.c:99
static struct render_to_surface * impl_from_ID3DXRenderToSurface(ID3DXRenderToSurface *iface)
Definition: render.c:128
#define IDirect3DDevice9_BeginScene(p)
Definition: d3d9.h:1548
static void device_state_capture(IDirect3DDevice9 *device, struct device_state *state)
Definition: render.c:58

◆ D3DXRenderToSurface_EndScene()

static HRESULT WINAPI D3DXRenderToSurface_EndScene ( ID3DXRenderToSurface *  iface,
DWORD  filter 
)
static

Definition at line 308 of file render.c.

310 {
312  HRESULT hr;
313 
314  TRACE("(%p)->(%#x)\n", iface, filter);
315 
316  if (!render->dst_surface) return D3DERR_INVALIDCALL;
317 
319 
320  /* copy render target data to destination surface, if needed */
321  if (render->render_target)
322  {
323  hr = D3DXLoadSurfaceFromSurface(render->dst_surface, NULL, NULL,
324  render->render_target, NULL, NULL, filter, 0);
325  if (FAILED(hr)) ERR("Copying render target data to surface failed %#x\n", hr);
326  }
327 
328  device_state_restore(render->device, &render->previous_state);
329 
330  /* release resources */
331  if (render->render_target)
332  {
333  IDirect3DSurface9_Release(render->render_target);
334  render->render_target = NULL;
335  }
336 
337  if (render->depth_stencil)
338  {
339  IDirect3DSurface9_Release(render->depth_stencil);
340  render->depth_stencil = NULL;
341  }
342 
343  IDirect3DSurface9_Release(render->dst_surface);
344  render->dst_surface = NULL;
345 
346  return hr;
347 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI D3DXLoadSurfaceFromSurface(IDirect3DSurface9 *dst_surface, const PALETTEENTRY *dst_palette, const RECT *dst_rect, IDirect3DSurface9 *src_surface, const PALETTEENTRY *src_palette, const RECT *src_rect, DWORD filter, D3DCOLOR color_key)
Definition: surface.c:2233
#define D3DERR_INVALIDCALL
static void device_state_restore(IDirect3DDevice9 *device, struct device_state *state)
Definition: render.c:75
#define IDirect3DDevice9_EndScene(p)
Definition: d3d9.h:1549
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
static void render(void)
Definition: ssstars.c:272
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
static struct render_to_surface * impl_from_ID3DXRenderToSurface(ID3DXRenderToSurface *iface)
Definition: render.c:128
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

◆ D3DXRenderToSurface_GetDesc()

static HRESULT WINAPI D3DXRenderToSurface_GetDesc ( ID3DXRenderToSurface *  iface,
D3DXRTS_DESC desc 
)
static

Definition at line 201 of file render.c.

203 {
205 
206  TRACE("(%p)->(%p)\n", iface, desc);
207 
208  if (!desc) return D3DERR_INVALIDCALL;
209 
210  *desc = render->desc;
211  return D3D_OK;
212 }
#define D3DERR_INVALIDCALL
static const WCHAR desc[]
Definition: protectdata.c:36
#define TRACE(s)
Definition: solgame.cpp:4
static void render(void)
Definition: ssstars.c:272
#define D3D_OK
Definition: d3d.h:106
static struct render_to_surface * impl_from_ID3DXRenderToSurface(ID3DXRenderToSurface *iface)
Definition: render.c:128

◆ D3DXRenderToSurface_GetDevice()

static HRESULT WINAPI D3DXRenderToSurface_GetDevice ( ID3DXRenderToSurface *  iface,
IDirect3DDevice9 **  device 
)
static

Definition at line 187 of file render.c.

189 {
191 
192  TRACE("(%p)->(%p)\n", iface, device);
193 
194  if (!device) return D3DERR_INVALIDCALL;
195 
197  *device = render->device;
198  return D3D_OK;
199 }
#define D3DERR_INVALIDCALL
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
static void render(void)
Definition: ssstars.c:272
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
#define D3D_OK
Definition: d3d.h:106
static struct render_to_surface * impl_from_ID3DXRenderToSurface(ID3DXRenderToSurface *iface)
Definition: render.c:128

◆ D3DXRenderToSurface_OnLostDevice()

static HRESULT WINAPI D3DXRenderToSurface_OnLostDevice ( ID3DXRenderToSurface *  iface)
static

Definition at line 349 of file render.c.

350 {
351  FIXME("(%p)->(): stub\n", iface);
352  return D3D_OK;
353 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define D3D_OK
Definition: d3d.h:106

◆ D3DXRenderToSurface_OnResetDevice()

static HRESULT WINAPI D3DXRenderToSurface_OnResetDevice ( ID3DXRenderToSurface *  iface)
static

Definition at line 355 of file render.c.

356 {
357  FIXME("(%p)->(): stub\n", iface);
358  return D3D_OK;
359 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define D3D_OK
Definition: d3d.h:106

◆ D3DXRenderToSurface_QueryInterface()

static HRESULT WINAPI D3DXRenderToSurface_QueryInterface ( ID3DXRenderToSurface *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 133 of file render.c.

136 {
137  TRACE("iface %p, riid %s, out %p\n", iface, debugstr_guid(riid), out);
138 
139  if (IsEqualGUID(riid, &IID_ID3DXRenderToSurface)
141  {
142  IUnknown_AddRef(iface);
143  *out = iface;
144  return S_OK;
145  }
146 
147  WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
148 
149  *out = NULL;
150  return E_NOINTERFACE;
151 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static FILE * out
Definition: regtests2xml.c:44
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ D3DXRenderToSurface_Release()

static ULONG WINAPI D3DXRenderToSurface_Release ( ID3DXRenderToSurface *  iface)
static

Definition at line 163 of file render.c.

164 {
167 
168  TRACE("%p decreasing refcount to %u\n", iface, ref);
169 
170  if (!ref)
171  {
172  if (render->dst_surface) IDirect3DSurface9_Release(render->dst_surface);
173 
174  if (render->render_target) IDirect3DSurface9_Release(render->render_target);
175  if (render->depth_stencil) IDirect3DSurface9_Release(render->depth_stencil);
176 
177  device_state_release(&render->previous_state);
178 
180 
182  }
183 
184  return ref;
185 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
Definition: send.c:48
static void device_state_release(struct device_state *state)
Definition: render.c:97
GLenum GLint ref
Definition: glext.h:6028
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:1508
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
static void render(void)
Definition: ssstars.c:272
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
static struct render_to_surface * impl_from_ID3DXRenderToSurface(ID3DXRenderToSurface *iface)
Definition: render.c:128
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ device_state_capture()

static void device_state_capture ( IDirect3DDevice9 *  device,
struct device_state state 
)
static

Definition at line 58 of file render.c.

59 {
60  HRESULT hr;
61  unsigned int i;
62 
64 
65  for (i = 0; i < state->num_render_targets; i++)
66  {
67  hr = IDirect3DDevice9_GetRenderTarget(device, i, &state->render_targets[i]);
68  if (FAILED(hr)) state->render_targets[i] = NULL;
69  }
70 
72  if (FAILED(hr)) state->depth_stencil = NULL;
73 }
HRESULT hr
Definition: shlfolder.c:183
#define IDirect3DDevice9_GetDepthStencilSurface(p, a)
Definition: d3d9.h:1547
Definition: devices.h:37
#define IDirect3DDevice9_GetRenderTarget(p, a, b)
Definition: d3d9.h:1545
#define IDirect3DDevice9_GetViewport(p, a)
Definition: d3d9.h:1555
LONG HRESULT
Definition: typedefs.h:79
static int state
Definition: maze.c:121
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112

Referenced by D3DXRenderToEnvMap_Face(), and D3DXRenderToSurface_BeginScene().

◆ device_state_init()

static HRESULT device_state_init ( IDirect3DDevice9 *  device,
struct device_state state 
)
static

Definition at line 37 of file render.c.

38 {
39  HRESULT hr;
40  D3DCAPS9 caps;
41  unsigned int i;
42 
44  if (FAILED(hr)) return hr;
45 
46  state->num_render_targets = caps.NumSimultaneousRTs;
47  state->render_targets = HeapAlloc(GetProcessHeap(), 0,
48  state->num_render_targets * sizeof(IDirect3DSurface9 *));
49  if (!state->render_targets)
50  return E_OUTOFMEMORY;
51 
52  for (i = 0; i < state->num_render_targets; i++)
53  state->render_targets[i] = NULL;
54  state->depth_stencil = NULL;
55  return D3D_OK;
56 }
HRESULT hr
Definition: shlfolder.c:183
DWORD NumSimultaneousRTs
Definition: d3d9caps.h:324
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:79
static int state
Definition: maze.c:121
#define D3D_OK
Definition: d3d.h:106
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1514
#define NULL
Definition: types.h:112

Referenced by D3DXCreateRenderToEnvMap(), and D3DXCreateRenderToSurface().

◆ device_state_release()

static void device_state_release ( struct device_state state)
static

Definition at line 97 of file render.c.

98 {
99  unsigned int i;
100 
101  for (i = 0; i < state->num_render_targets; i++)
102  {
103  if (state->render_targets[i])
104  IDirect3DSurface9_Release(state->render_targets[i]);
105  }
106 
107  HeapFree(GetProcessHeap(), 0, state->render_targets);
108 
109  if (state->depth_stencil) IDirect3DSurface9_Release(state->depth_stencil);
110 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
#define GetProcessHeap()
Definition: compat.h:595
static int state
Definition: maze.c:121
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by D3DXRenderToEnvMap_Release(), and D3DXRenderToSurface_Release().

◆ device_state_restore()

static void device_state_restore ( IDirect3DDevice9 *  device,
struct device_state state 
)
static

Definition at line 75 of file render.c.

76 {
77  unsigned int i;
78 
79  for (i = 0; i < state->num_render_targets; i++)
80  {
81  IDirect3DDevice9_SetRenderTarget(device, i, state->render_targets[i]);
82  if (state->render_targets[i])
83  IDirect3DSurface9_Release(state->render_targets[i]);
84  state->render_targets[i] = NULL;
85  }
86 
88  if (state->depth_stencil)
89  {
90  IDirect3DSurface9_Release(state->depth_stencil);
91  state->depth_stencil = NULL;
92  }
93 
95 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
#define IDirect3DDevice9_SetViewport(p, a)
Definition: d3d9.h:1554
#define IDirect3DDevice9_SetDepthStencilSurface(p, a)
Definition: d3d9.h:1546
#define IDirect3DDevice9_SetRenderTarget(p, a, b)
Definition: d3d9.h:1544
Definition: devices.h:37
static int state
Definition: maze.c:121
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112

Referenced by D3DXRenderToEnvMap_End(), D3DXRenderToEnvMap_Face(), D3DXRenderToSurface_BeginScene(), and D3DXRenderToSurface_EndScene().

◆ impl_from_ID3DXRenderToEnvMap()

static struct render_to_envmap* impl_from_ID3DXRenderToEnvMap ( ID3DXRenderToEnvMap *  iface)
inlinestatic

Definition at line 465 of file render.c.

466 {
467  return CONTAINING_RECORD(iface, struct render_to_envmap, ID3DXRenderToEnvMap_iface);
468 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by D3DXRenderToEnvMap_AddRef(), D3DXRenderToEnvMap_BeginCube(), D3DXRenderToEnvMap_End(), D3DXRenderToEnvMap_Face(), D3DXRenderToEnvMap_GetDesc(), D3DXRenderToEnvMap_GetDevice(), and D3DXRenderToEnvMap_Release().

◆ impl_from_ID3DXRenderToSurface()

static struct render_to_surface* impl_from_ID3DXRenderToSurface ( ID3DXRenderToSurface *  iface)
inlinestatic

Definition at line 128 of file render.c.

129 {
131 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
ID3DXRenderToSurface ID3DXRenderToSurface_iface
Definition: render.c:114

Referenced by D3DXRenderToSurface_AddRef(), D3DXRenderToSurface_BeginScene(), D3DXRenderToSurface_EndScene(), D3DXRenderToSurface_GetDesc(), D3DXRenderToSurface_GetDevice(), and D3DXRenderToSurface_Release().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3dx  )

Variable Documentation

◆ render_to_envmap_vtbl

const ID3DXRenderToEnvMapVtbl render_to_envmap_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI D3DXRenderToEnvMap_BeginSphere(ID3DXRenderToEnvMap *iface, IDirect3DTexture9 *texture)
Definition: render.c:602
static HRESULT WINAPI D3DXRenderToEnvMap_BeginHemisphere(ID3DXRenderToEnvMap *iface, IDirect3DTexture9 *pos_z_texture, IDirect3DTexture9 *neg_z_texture)
Definition: render.c:609
static HRESULT WINAPI D3DXRenderToEnvMap_Face(ID3DXRenderToEnvMap *iface, D3DCUBEMAP_FACES face, DWORD filter)
Definition: render.c:625
static HRESULT WINAPI D3DXRenderToEnvMap_QueryInterface(ID3DXRenderToEnvMap *iface, REFIID riid, void **out)
Definition: render.c:470
static HRESULT WINAPI D3DXRenderToEnvMap_GetDesc(ID3DXRenderToEnvMap *iface, D3DXRTE_DESC *desc)
Definition: render.c:538
static HRESULT WINAPI D3DXRenderToEnvMap_OnLostDevice(ID3DXRenderToEnvMap *iface)
Definition: render.c:718
static HRESULT WINAPI D3DXRenderToEnvMap_OnResetDevice(ID3DXRenderToEnvMap *iface)
Definition: render.c:724
static HRESULT WINAPI D3DXRenderToEnvMap_GetDevice(ID3DXRenderToEnvMap *iface, IDirect3DDevice9 **device)
Definition: render.c:524
static ULONG WINAPI D3DXRenderToEnvMap_AddRef(ID3DXRenderToEnvMap *iface)
Definition: render.c:490
static HRESULT WINAPI D3DXRenderToEnvMap_End(ID3DXRenderToEnvMap *iface, DWORD filter)
Definition: render.c:678
static ULONG WINAPI D3DXRenderToEnvMap_Release(ID3DXRenderToEnvMap *iface)
Definition: render.c:500
static HRESULT WINAPI D3DXRenderToEnvMap_BeginParabolic(ID3DXRenderToEnvMap *iface, IDirect3DTexture9 *pos_z_texture, IDirect3DTexture9 *neg_z_texture)
Definition: render.c:617
static HRESULT WINAPI D3DXRenderToEnvMap_BeginCube(ID3DXRenderToEnvMap *iface, IDirect3DCubeTexture9 *texture)
Definition: render.c:551

Definition at line 730 of file render.c.

Referenced by D3DXCreateRenderToEnvMap().

◆ render_to_surface_vtbl

const ID3DXRenderToSurfaceVtbl render_to_surface_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI D3DXRenderToSurface_OnResetDevice(ID3DXRenderToSurface *iface)
Definition: render.c:355
static HRESULT WINAPI D3DXRenderToSurface_OnLostDevice(ID3DXRenderToSurface *iface)
Definition: render.c:349
static HRESULT WINAPI D3DXRenderToSurface_GetDevice(ID3DXRenderToSurface *iface, IDirect3DDevice9 **device)
Definition: render.c:187
static ULONG WINAPI D3DXRenderToSurface_Release(ID3DXRenderToSurface *iface)
Definition: render.c:163
static HRESULT WINAPI D3DXRenderToSurface_EndScene(ID3DXRenderToSurface *iface, DWORD filter)
Definition: render.c:308
static HRESULT WINAPI D3DXRenderToSurface_GetDesc(ID3DXRenderToSurface *iface, D3DXRTS_DESC *desc)
Definition: render.c:201
static HRESULT WINAPI D3DXRenderToSurface_QueryInterface(ID3DXRenderToSurface *iface, REFIID riid, void **out)
Definition: render.c:133
static ULONG WINAPI D3DXRenderToSurface_AddRef(ID3DXRenderToSurface *iface)
Definition: render.c:153
static HRESULT WINAPI D3DXRenderToSurface_BeginScene(ID3DXRenderToSurface *iface, IDirect3DSurface9 *surface, const D3DVIEWPORT9 *viewport)
Definition: render.c:214

Definition at line 361 of file render.c.

Referenced by D3DXCreateRenderToSurface().