ReactOS  0.4.15-dev-1177-g6cb3b62
render.c File Reference
#include "config.h"
#include "wine/port.h"
#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 421 of file render.c.

422 {
423  INITIAL,
424 
425  CUBE_BEGIN,
426  CUBE_FACE
427 };

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 449 of file render.c.

451 {
452  HRESULT hr;
453  IDirect3DSurface9 *cube_surface;
454 
455  IDirect3DCubeTexture9_GetCubeMapSurface(cube_texture, face, 0, &cube_surface);
456 
457  hr = D3DXLoadSurfaceFromSurface(cube_surface, NULL, NULL, render_target, NULL, NULL, filter, 0);
458  if (FAILED(hr)) ERR("Copying render target data to surface failed %#x\n", hr);
459 
460  IDirect3DSurface9_Release(cube_surface);
461 }
#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:2138
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:79
#define IDirect3DCubeTexture9_GetCubeMapSurface(p, a, b, c)
Definition: d3d9.h:938
#define ERR(fmt,...)
Definition: debug.h:110
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 747 of file render.c.

754 {
755  HRESULT hr;
756  struct render_to_envmap *render;
757 
758  TRACE("(%p, %u, %u, %#x, %d, %#x, %p)\n", device, size, mip_levels,
759  format, depth_stencil, depth_stencil_format, out);
760 
761  if (!device || !out) return D3DERR_INVALIDCALL;
762 
763  hr = D3DXCheckTextureRequirements(device, &size, &size, &mip_levels,
765  if (FAILED(hr)) return hr;
766 
767  render = HeapAlloc(GetProcessHeap(), 0, sizeof(struct render_to_envmap));
768  if (!render) return E_OUTOFMEMORY;
769 
770  render->ID3DXRenderToEnvMap_iface.lpVtbl = &render_to_envmap_vtbl;
771  render->ref = 1;
772 
773  render->desc.Size = size;
774  render->desc.MipLevels = mip_levels;
775  render->desc.Format = format;
776  render->desc.DepthStencil = depth_stencil;
777  render->desc.DepthStencilFormat = depth_stencil_format;
778 
779  render->state = INITIAL;
780  render->render_target = NULL;
781  render->depth_stencil = NULL;
782  render->dst_cube_texture = NULL;
783 
784  hr = device_state_init(device, &render->previous_device_state);
785  if (FAILED(hr))
786  {
788  return hr;
789  }
790 
792  render->device = device;
793 
794  *out = &render->ID3DXRenderToEnvMap_iface;
795  return D3D_OK;
796 }
HRESULT hr
Definition: shlfolder.c:183
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
IDirect3DSurface9 * depth_stencil
Definition: render.c:444
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
static const ID3DXRenderToEnvMapVtbl render_to_envmap_vtbl
Definition: render.c:728
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:484
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:35
#define D3D_OK
Definition: d3d.h:106
IDirect3DDevice9 * device
Definition: render.c:434
HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:209
#define HeapFree(x, y, z)
Definition: compat.h:483

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 374 of file render.c.

381 {
382  HRESULT hr;
383  struct render_to_surface *render;
384 
385  TRACE("(%p, %u, %u, %#x, %d, %#x, %p)\n", device, width, height, format,
386  depth_stencil, depth_stencil_format, out);
387 
388  if (!device || !out) return D3DERR_INVALIDCALL;
389 
390  render = HeapAlloc(GetProcessHeap(), 0, sizeof(struct render_to_surface));
391  if (!render) return E_OUTOFMEMORY;
392 
393  render->ID3DXRenderToSurface_iface.lpVtbl = &render_to_surface_vtbl;
394  render->ref = 1;
395 
396  render->desc.Width = width;
397  render->desc.Height = height;
398  render->desc.Format = format;
399  render->desc.DepthStencil = depth_stencil;
400  render->desc.DepthStencilFormat = depth_stencil_format;
401 
402  render->dst_surface = NULL;
403  render->render_target = NULL;
404  render->depth_stencil = NULL;
405 
406  hr = device_state_init(device, &render->previous_state);
407  if (FAILED(hr))
408  {
410  return hr;
411  }
412 
414  render->device = device;
415 
416  *out = &render->ID3DXRenderToSurface_iface;
417  return D3D_OK;
418 }
IDirect3DDevice9 * device
Definition: render.c:115
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT hr
Definition: shlfolder.c:183
static const ID3DXRenderToSurfaceVtbl render_to_surface_vtbl
Definition: render.c:359
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
IDirect3DSurface9 * depth_stencil
Definition: render.c:121
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:484
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:35
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define D3D_OK
Definition: d3d.h:106
#define HeapFree(x, y, z)
Definition: compat.h:483

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 488 of file render.c.

489 {
492 
493  TRACE("%p increasing refcount to %u\n", iface, ref);
494 
495  return ref;
496 }
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:463
#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 549 of file render.c.

551 {
553  HRESULT hr;
554  D3DSURFACE_DESC level_desc;
555 
556  TRACE("(%p)->(%p)\n", iface, texture);
557 
558  if (!texture) return D3DERR_INVALIDCALL;
559 
560  if (render->state != INITIAL) return D3DERR_INVALIDCALL;
561 
563  if (level_desc.Format != render->desc.Format || level_desc.Width != render->desc.Size)
564  return D3DERR_INVALIDCALL;
565 
566  if (!(level_desc.Usage & D3DUSAGE_RENDERTARGET))
567  {
568  hr = IDirect3DDevice9_CreateRenderTarget(render->device, level_desc.Width, level_desc.Height,
569  level_desc.Format, level_desc.MultiSampleType, level_desc.MultiSampleQuality,
570  TRUE, &render->render_target, NULL);
571  if (FAILED(hr)) goto cleanup;
573  }
574 
575  if (render->desc.DepthStencil)
576  {
577  hr = IDirect3DDevice9_CreateDepthStencilSurface(render->device, level_desc.Width, level_desc.Height,
578  render->desc.DepthStencilFormat, level_desc.MultiSampleType, level_desc.MultiSampleQuality,
579  TRUE, &render->depth_stencil, NULL);
580  if (FAILED(hr)) goto cleanup;
581  }
582 
584  render->dst_cube_texture = texture;
585  render->state = CUBE_BEGIN;
586  return D3D_OK;
587 
588 cleanup:
589  if (render->dst_cube_texture) IDirect3DSurface9_Release(render->dst_cube_texture);
590  render->dst_cube_texture = NULL;
591 
592  if (render->render_target) IDirect3DSurface9_Release(render->render_target);
593  render->render_target = NULL;
594  if (render->depth_stencil) IDirect3DSurface9_Release(render->depth_stencil);
595  render->depth_stencil = NULL;
596 
597  return hr;
598 }
#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
smooth NULL
Definition: ftsmooth.c:416
#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:463
D3DMULTISAMPLE_TYPE MultiSampleType
Definition: d3d8types.h:1175
#define D3D_OK
Definition: d3d.h:106
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 607 of file render.c.

610 {
611  FIXME("(%p)->(%p, %p): stub\n", iface, pos_z_texture, neg_z_texture);
612  return E_NOTIMPL;
613 }
#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 615 of file render.c.

618 {
619  FIXME("(%p)->(%p, %p): stub\n", iface, pos_z_texture, neg_z_texture);
620  return E_NOTIMPL;
621 }
#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 600 of file render.c.

602 {
603  FIXME("(%p)->(%p): stub\n", iface, texture);
604  return E_NOTIMPL;
605 }
#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 676 of file render.c.

678 {
680 
681  TRACE("(%p)->(%#x)\n", iface, filter);
682 
683  if (render->state == INITIAL) return D3DERR_INVALIDCALL;
684 
685  if (render->state == CUBE_FACE)
686  {
688  if (render->render_target)
689  copy_render_target_to_cube_texture_face(render->dst_cube_texture, render->face,
690  render->render_target, render->filter);
691 
692  device_state_restore(render->device, &render->previous_device_state);
693  }
694 
695  D3DXFilterTexture((IDirect3DBaseTexture9 *)render->dst_cube_texture, NULL, 0, filter);
696 
697  if (render->render_target)
698  {
699  IDirect3DSurface9_Release(render->render_target);
700  render->render_target = NULL;
701  }
702 
703  if (render->depth_stencil)
704  {
705  IDirect3DSurface9_Release(render->depth_stencil);
706  render->depth_stencil = NULL;
707  }
708 
709  IDirect3DSurface9_Release(render->dst_cube_texture);
710  render->dst_cube_texture = NULL;
711 
712  render->state = INITIAL;
713  return D3D_OK;
714 }
#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:449
#define D3DERR_INVALIDCALL
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI D3DXFilterTexture(IDirect3DBaseTexture9 *texture, const PALETTEENTRY *palette, UINT srclevel, DWORD filter)
Definition: texture.c:65
static void device_state_restore(IDirect3DDevice9 *device, struct device_state *state)
Definition: render.c:73
#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:463
#define D3D_OK
Definition: d3d.h:106
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 623 of file render.c.

626 {
628  HRESULT hr;
629  unsigned int i;
630 
631  TRACE("(%p)->(%u, %#x)\n", iface, face, filter);
632 
633  if (render->state == CUBE_FACE)
634  {
636  if (render->render_target)
637  copy_render_target_to_cube_texture_face(render->dst_cube_texture, render->face,
638  render->render_target, render->filter);
639 
640  device_state_restore(render->device, &render->previous_device_state);
641 
642  render->state = CUBE_BEGIN;
643  }
644  else if (render->state != CUBE_BEGIN)
645  return D3DERR_INVALIDCALL;
646 
647  device_state_capture(render->device, &render->previous_device_state);
648 
649  for (i = 1; i < render->previous_device_state.num_render_targets; i++)
651 
652  if (!render->render_target)
653  {
654  IDirect3DSurface9 *render_target;
658  }
659  else hr = IDirect3DDevice9_SetRenderTarget(render->device, 0, render->render_target);
660 
661  if (FAILED(hr)) goto cleanup;
662 
663  hr = IDirect3DDevice9_SetDepthStencilSurface(render->device, render->depth_stencil);
664  if (FAILED(hr)) goto cleanup;
665 
666  render->state = CUBE_FACE;
667  render->face = face;
668  render->filter = filter;
669  return IDirect3DDevice9_BeginScene(render->device);
670 
671 cleanup:
672  device_state_restore(render->device, &render->previous_device_state);
673  return hr;
674 }
#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:449
#define D3DERR_INVALIDCALL
#define IDirect3DDevice9_SetDepthStencilSurface(p, a)
Definition: d3d9.h:1546
IDirect3DSurface9 * render_target
Definition: render.c:443
#define IDirect3DDevice9_SetRenderTarget(p, a, b)
Definition: d3d9.h:1544
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
smooth NULL
Definition: ftsmooth.c:416
static void device_state_restore(IDirect3DDevice9 *device, struct device_state *state)
Definition: render.c:73
#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:463
#define IDirect3DCubeTexture9_GetCubeMapSurface(p, a, b, c)
Definition: d3d9.h:938
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:56

◆ D3DXRenderToEnvMap_GetDesc()

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

Definition at line 536 of file render.c.

538 {
540 
541  TRACE("(%p)->(%p)\n", iface, desc);
542 
543  if (!desc) return D3DERR_INVALIDCALL;
544 
545  *desc = render->desc;
546  return D3D_OK;
547 }
#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:463
#define D3D_OK
Definition: d3d.h:106

◆ D3DXRenderToEnvMap_GetDevice()

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

Definition at line 522 of file render.c.

524 {
526 
527  TRACE("(%p)->(%p)\n", iface, device);
528 
529  if (!device) return D3DERR_INVALIDCALL;
530 
532  *device = render->device;
533  return D3D_OK;
534 }
#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:463
#define D3D_OK
Definition: d3d.h:106

◆ D3DXRenderToEnvMap_OnLostDevice()

static HRESULT WINAPI D3DXRenderToEnvMap_OnLostDevice ( ID3DXRenderToEnvMap *  iface)
static

Definition at line 716 of file render.c.

717 {
718  FIXME("(%p)->(): stub\n", iface);
719  return D3D_OK;
720 }
#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 722 of file render.c.

723 {
724  FIXME("(%p)->(): stub\n", iface);
725  return D3D_OK;
726 }
#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 468 of file render.c.

471 {
472  TRACE("iface %p, riid %s, out %p\n", iface, debugstr_guid(riid), out);
473 
474  if (IsEqualGUID(riid, &IID_ID3DXRenderToEnvMap)
476  {
477  IUnknown_AddRef(iface);
478  *out = iface;
479  return S_OK;
480  }
481 
482  WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
483 
484  *out = NULL;
485  return E_NOINTERFACE;
486 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
smooth NULL
Definition: ftsmooth.c:416
#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
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ D3DXRenderToEnvMap_Release()

static ULONG WINAPI D3DXRenderToEnvMap_Release ( ID3DXRenderToEnvMap *  iface)
static

Definition at line 498 of file render.c.

499 {
502 
503  TRACE("%p decreasing refcount to %u\n", iface, ref);
504 
505  if (!ref)
506  {
507  if (render->dst_cube_texture) IDirect3DSurface9_Release(render->dst_cube_texture);
508 
509  if (render->render_target) IDirect3DSurface9_Release(render->render_target);
510  if (render->depth_stencil) IDirect3DSurface9_Release(render->depth_stencil);
511 
512  device_state_release(&render->previous_device_state);
513 
515 
517  }
518 
519  return ref;
520 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
Definition: send.c:48
static void device_state_release(struct device_state *state)
Definition: render.c:95
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:484
static void render(void)
Definition: ssstars.c:272
static struct render_to_envmap * impl_from_ID3DXRenderToEnvMap(ID3DXRenderToEnvMap *iface)
Definition: render.c:463
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:483

◆ D3DXRenderToSurface_AddRef()

static ULONG WINAPI D3DXRenderToSurface_AddRef ( ID3DXRenderToSurface *  iface)
static

Definition at line 151 of file render.c.

152 {
155 
156  TRACE("%p increasing refcount to %u\n", iface, ref);
157 
158  return ref;
159 }
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:126

◆ D3DXRenderToSurface_BeginScene()

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

Definition at line 212 of file render.c.

215 {
217  unsigned int i;
218  IDirect3DDevice9 *device;
219  D3DSURFACE_DESC surface_desc;
221  D3DMULTISAMPLE_TYPE multi_sample_type = D3DMULTISAMPLE_NONE;
222  DWORD multi_sample_quality = 0;
223 
224  TRACE("(%p)->(%p, %p)\n", iface, surface, viewport);
225 
226  if (!surface || render->dst_surface) return D3DERR_INVALIDCALL;
227 
228  IDirect3DSurface9_GetDesc(surface, &surface_desc);
229  if (surface_desc.Format != render->desc.Format
230  || surface_desc.Width != render->desc.Width
231  || surface_desc.Height != render->desc.Height)
232  return D3DERR_INVALIDCALL;
233 
234  if (viewport)
235  {
236  if (viewport->X > render->desc.Width || viewport->Y > render->desc.Height
237  || viewport->X + viewport->Width > render->desc.Width
238  || viewport->Y + viewport->Height > render->desc.Height)
239  return D3DERR_INVALIDCALL;
240 
241  if (!(surface_desc.Usage & D3DUSAGE_RENDERTARGET)
242  && (viewport->X != 0 || viewport->Y != 0
243  || viewport->Width != render->desc.Width
244  || viewport->Height != render->desc.Height))
245  return D3DERR_INVALIDCALL;
246  }
247 
248  device = render->device;
249 
250  device_state_capture(device, &render->previous_state);
251 
252  /* prepare for rendering to surface */
253  for (i = 1; i < render->previous_state.num_render_targets; i++)
255 
256  if (surface_desc.Usage & D3DUSAGE_RENDERTARGET)
257  {
259  multi_sample_type = surface_desc.MultiSampleType;
260  multi_sample_quality = surface_desc.MultiSampleQuality;
261  }
262  else
263  {
264  hr = IDirect3DDevice9_CreateRenderTarget(device, render->desc.Width, render->desc.Height,
265  render->desc.Format, multi_sample_type, multi_sample_quality, FALSE,
266  &render->render_target, NULL);
267  if (FAILED(hr)) goto cleanup;
268  hr = IDirect3DDevice9_SetRenderTarget(device, 0, render->render_target);
269  }
270 
271  if (FAILED(hr)) goto cleanup;
272 
273  if (render->desc.DepthStencil)
274  {
276  render->desc.DepthStencilFormat, multi_sample_type, multi_sample_quality, TRUE,
277  &render->depth_stencil, NULL);
278  }
279  else render->depth_stencil = NULL;
280 
281  if (FAILED(hr)) goto cleanup;
282 
284  if (FAILED(hr)) goto cleanup;
285 
286  if (viewport) IDirect3DDevice9_SetViewport(device, viewport);
287 
288  IDirect3DSurface9_AddRef(surface);
289  render->dst_surface = surface;
291 
292 cleanup:
293  device_state_restore(device, &render->previous_state);
294 
295  if (render->dst_surface) IDirect3DSurface9_Release(render->dst_surface);
296  render->dst_surface = NULL;
297 
298  if (render->render_target) IDirect3DSurface9_Release(render->render_target);
299  render->render_target = NULL;
300  if (render->depth_stencil) IDirect3DSurface9_Release(render->depth_stencil);
301  render->depth_stencil = NULL;
302 
303  return hr;
304 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
IDirect3DDevice9 * device
Definition: render.c:115
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
#define IDirect3DDevice9_SetRenderTarget(p, a, b)
Definition: d3d9.h:1544
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
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
static void device_state_restore(IDirect3DDevice9 *device, struct device_state *state)
Definition: render.c:73
#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
char * cleanup(char *str)
Definition: wpickclick.c:99
static struct render_to_surface * impl_from_ID3DXRenderToSurface(ID3DXRenderToSurface *iface)
Definition: render.c:126
#define IDirect3DDevice9_BeginScene(p)
Definition: d3d9.h:1548
static void device_state_capture(IDirect3DDevice9 *device, struct device_state *state)
Definition: render.c:56

◆ D3DXRenderToSurface_EndScene()

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

Definition at line 306 of file render.c.

308 {
310  HRESULT hr;
311 
312  TRACE("(%p)->(%#x)\n", iface, filter);
313 
314  if (!render->dst_surface) return D3DERR_INVALIDCALL;
315 
317 
318  /* copy render target data to destination surface, if needed */
319  if (render->render_target)
320  {
321  hr = D3DXLoadSurfaceFromSurface(render->dst_surface, NULL, NULL,
322  render->render_target, NULL, NULL, filter, 0);
323  if (FAILED(hr)) ERR("Copying render target data to surface failed %#x\n", hr);
324  }
325 
326  device_state_restore(render->device, &render->previous_state);
327 
328  /* release resources */
329  if (render->render_target)
330  {
331  IDirect3DSurface9_Release(render->render_target);
332  render->render_target = NULL;
333  }
334 
335  if (render->depth_stencil)
336  {
337  IDirect3DSurface9_Release(render->depth_stencil);
338  render->depth_stencil = NULL;
339  }
340 
341  IDirect3DSurface9_Release(render->dst_surface);
342  render->dst_surface = NULL;
343 
344  return hr;
345 }
#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:2138
#define D3DERR_INVALIDCALL
smooth NULL
Definition: ftsmooth.c:416
static void device_state_restore(IDirect3DDevice9 *device, struct device_state *state)
Definition: render.c:73
#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
static struct render_to_surface * impl_from_ID3DXRenderToSurface(ID3DXRenderToSurface *iface)
Definition: render.c:126
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 199 of file render.c.

201 {
203 
204  TRACE("(%p)->(%p)\n", iface, desc);
205 
206  if (!desc) return D3DERR_INVALIDCALL;
207 
208  *desc = render->desc;
209  return D3D_OK;
210 }
#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:126

◆ D3DXRenderToSurface_GetDevice()

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

Definition at line 185 of file render.c.

187 {
189 
190  TRACE("(%p)->(%p)\n", iface, device);
191 
192  if (!device) return D3DERR_INVALIDCALL;
193 
195  *device = render->device;
196  return D3D_OK;
197 }
#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:126

◆ D3DXRenderToSurface_OnLostDevice()

static HRESULT WINAPI D3DXRenderToSurface_OnLostDevice ( ID3DXRenderToSurface *  iface)
static

Definition at line 347 of file render.c.

348 {
349  FIXME("(%p)->(): stub\n", iface);
350  return D3D_OK;
351 }
#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 353 of file render.c.

354 {
355  FIXME("(%p)->(): stub\n", iface);
356  return D3D_OK;
357 }
#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 131 of file render.c.

134 {
135  TRACE("iface %p, riid %s, out %p\n", iface, debugstr_guid(riid), out);
136 
137  if (IsEqualGUID(riid, &IID_ID3DXRenderToSurface)
139  {
140  IUnknown_AddRef(iface);
141  *out = iface;
142  return S_OK;
143  }
144 
145  WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
146 
147  *out = NULL;
148  return E_NOINTERFACE;
149 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
smooth NULL
Definition: ftsmooth.c:416
#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
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ D3DXRenderToSurface_Release()

static ULONG WINAPI D3DXRenderToSurface_Release ( ID3DXRenderToSurface *  iface)
static

Definition at line 161 of file render.c.

162 {
165 
166  TRACE("%p decreasing refcount to %u\n", iface, ref);
167 
168  if (!ref)
169  {
170  if (render->dst_surface) IDirect3DSurface9_Release(render->dst_surface);
171 
172  if (render->render_target) IDirect3DSurface9_Release(render->render_target);
173  if (render->depth_stencil) IDirect3DSurface9_Release(render->depth_stencil);
174 
175  device_state_release(&render->previous_state);
176 
178 
180  }
181 
182  return ref;
183 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
Definition: send.c:48
static void device_state_release(struct device_state *state)
Definition: render.c:95
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:484
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:126
#define HeapFree(x, y, z)
Definition: compat.h:483

◆ device_state_capture()

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

Definition at line 56 of file render.c.

57 {
58  HRESULT hr;
59  unsigned int i;
60 
62 
63  for (i = 0; i < state->num_render_targets; i++)
64  {
65  hr = IDirect3DDevice9_GetRenderTarget(device, i, &state->render_targets[i]);
66  if (FAILED(hr)) state->render_targets[i] = NULL;
67  }
68 
70  if (FAILED(hr)) state->depth_stencil = NULL;
71 }
HRESULT hr
Definition: shlfolder.c:183
#define IDirect3DDevice9_GetDepthStencilSurface(p, a)
Definition: d3d9.h:1547
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
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
#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

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 35 of file render.c.

36 {
37  HRESULT hr;
38  D3DCAPS9 caps;
39  unsigned int i;
40 
42  if (FAILED(hr)) return hr;
43 
44  state->num_render_targets = caps.NumSimultaneousRTs;
45  state->render_targets = HeapAlloc(GetProcessHeap(), 0,
46  state->num_render_targets * sizeof(IDirect3DSurface9 *));
47  if (!state->render_targets)
48  return E_OUTOFMEMORY;
49 
50  for (i = 0; i < state->num_render_targets; i++)
51  state->render_targets[i] = NULL;
52  state->depth_stencil = NULL;
53  return D3D_OK;
54 }
HRESULT hr
Definition: shlfolder.c:183
DWORD NumSimultaneousRTs
Definition: d3d9caps.h:324
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 E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:484
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
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1514

Referenced by D3DXCreateRenderToEnvMap(), and D3DXCreateRenderToSurface().

◆ device_state_release()

static void device_state_release ( struct device_state state)
static

Definition at line 95 of file render.c.

96 {
97  unsigned int i;
98 
99  for (i = 0; i < state->num_render_targets; i++)
100  {
101  if (state->render_targets[i])
102  IDirect3DSurface9_Release(state->render_targets[i]);
103  }
104 
105  HeapFree(GetProcessHeap(), 0, state->render_targets);
106 
107  if (state->depth_stencil) IDirect3DSurface9_Release(state->depth_stencil);
108 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
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 GetProcessHeap()
Definition: compat.h:484
static int state
Definition: maze.c:121
#define HeapFree(x, y, z)
Definition: compat.h:483

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 73 of file render.c.

74 {
75  unsigned int i;
76 
77  for (i = 0; i < state->num_render_targets; i++)
78  {
79  IDirect3DDevice9_SetRenderTarget(device, i, state->render_targets[i]);
80  if (state->render_targets[i])
81  IDirect3DSurface9_Release(state->render_targets[i]);
82  state->render_targets[i] = NULL;
83  }
84 
86  if (state->depth_stencil)
87  {
88  IDirect3DSurface9_Release(state->depth_stencil);
89  state->depth_stencil = NULL;
90  }
91 
93 }
#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
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
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
static int state
Definition: maze.c:121

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 463 of file render.c.

464 {
465  return CONTAINING_RECORD(iface, struct render_to_envmap, ID3DXRenderToEnvMap_iface);
466 }
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 126 of file render.c.

127 {
129 }
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:112

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:600
static HRESULT WINAPI D3DXRenderToEnvMap_BeginHemisphere(ID3DXRenderToEnvMap *iface, IDirect3DTexture9 *pos_z_texture, IDirect3DTexture9 *neg_z_texture)
Definition: render.c:607
static HRESULT WINAPI D3DXRenderToEnvMap_Face(ID3DXRenderToEnvMap *iface, D3DCUBEMAP_FACES face, DWORD filter)
Definition: render.c:623
static HRESULT WINAPI D3DXRenderToEnvMap_QueryInterface(ID3DXRenderToEnvMap *iface, REFIID riid, void **out)
Definition: render.c:468
static HRESULT WINAPI D3DXRenderToEnvMap_GetDesc(ID3DXRenderToEnvMap *iface, D3DXRTE_DESC *desc)
Definition: render.c:536
static HRESULT WINAPI D3DXRenderToEnvMap_OnLostDevice(ID3DXRenderToEnvMap *iface)
Definition: render.c:716
static HRESULT WINAPI D3DXRenderToEnvMap_OnResetDevice(ID3DXRenderToEnvMap *iface)
Definition: render.c:722
static HRESULT WINAPI D3DXRenderToEnvMap_GetDevice(ID3DXRenderToEnvMap *iface, IDirect3DDevice9 **device)
Definition: render.c:522
static ULONG WINAPI D3DXRenderToEnvMap_AddRef(ID3DXRenderToEnvMap *iface)
Definition: render.c:488
static HRESULT WINAPI D3DXRenderToEnvMap_End(ID3DXRenderToEnvMap *iface, DWORD filter)
Definition: render.c:676
static ULONG WINAPI D3DXRenderToEnvMap_Release(ID3DXRenderToEnvMap *iface)
Definition: render.c:498
static HRESULT WINAPI D3DXRenderToEnvMap_BeginParabolic(ID3DXRenderToEnvMap *iface, IDirect3DTexture9 *pos_z_texture, IDirect3DTexture9 *neg_z_texture)
Definition: render.c:615
static HRESULT WINAPI D3DXRenderToEnvMap_BeginCube(ID3DXRenderToEnvMap *iface, IDirect3DCubeTexture9 *texture)
Definition: render.c:549

Definition at line 728 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:353
static HRESULT WINAPI D3DXRenderToSurface_OnLostDevice(ID3DXRenderToSurface *iface)
Definition: render.c:347
static HRESULT WINAPI D3DXRenderToSurface_GetDevice(ID3DXRenderToSurface *iface, IDirect3DDevice9 **device)
Definition: render.c:185
static ULONG WINAPI D3DXRenderToSurface_Release(ID3DXRenderToSurface *iface)
Definition: render.c:161
static HRESULT WINAPI D3DXRenderToSurface_EndScene(ID3DXRenderToSurface *iface, DWORD filter)
Definition: render.c:306
static HRESULT WINAPI D3DXRenderToSurface_GetDesc(ID3DXRenderToSurface *iface, D3DXRTS_DESC *desc)
Definition: render.c:199
static HRESULT WINAPI D3DXRenderToSurface_QueryInterface(ID3DXRenderToSurface *iface, REFIID riid, void **out)
Definition: render.c:131
static ULONG WINAPI D3DXRenderToSurface_AddRef(ID3DXRenderToSurface *iface)
Definition: render.c:151
static HRESULT WINAPI D3DXRenderToSurface_BeginScene(ID3DXRenderToSurface *iface, IDirect3DSurface9 *surface, const D3DVIEWPORT9 *viewport)
Definition: render.c:212

Definition at line 359 of file render.c.

Referenced by D3DXCreateRenderToSurface().