Torque3D Documentation / _generateds / gfxD3D11Target.h

gfxD3D11Target.h

Engine/source/gfx/D3D11/gfxD3D11Target.h

More...

Classes:

Detailed Description

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2015 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#ifndef _GFX_D3D_GFXD3D11TARGET_H_
 25#define _GFX_D3D_GFXD3D11TARGET_H_
 26
 27#include "gfx/D3D11/gfxD3D11Device.h"
 28#include "gfx/D3D11/gfxD3D11TextureObject.h"
 29#include "gfx/gfxTarget.h"
 30#include "math/mPoint3.h"
 31#include "math/mPoint2.h"
 32
 33class GFXD3D11TextureTarget : public GFXTextureTarget
 34{
 35   friend class GFXD3D11Device;
 36
 37   // Array of target surfaces, this is given to us by attachTexture
 38   ID3D11Texture2D* mTargets[MaxRenderSlotId];
 39
 40   // Array of shader resource views
 41   ID3D11ShaderResourceView* mTargetSRViews[MaxRenderSlotId];
 42   
 43   //ID3D11DepthStencilView* mDepthTargetView;
 44   ID3D11View* mTargetViews[MaxRenderSlotId];
 45   // Array of texture objects which correspond to the target surfaces above,
 46   // needed for copy from RenderTarget to texture situations.  Current only valid in those situations
 47   GFXD3D11TextureObject* mResolveTargets[MaxRenderSlotId];
 48
 49   Point2I mTargetSize;
 50
 51   GFXFormat mTargetFormat;
 52
 53public:
 54
 55   GFXD3D11TextureTarget();
 56   ~GFXD3D11TextureTarget();
 57
 58   // Public interface.
 59   virtual const Point2I getSize() { return mTargetSize; }
 60   virtual GFXFormat getFormat() { return mTargetFormat; }
 61   virtual void attachTexture(RenderSlot slot, GFXTextureObject *tex, U32 mipLevel=0, U32 zOffset = 0);
 62   virtual void attachTexture(RenderSlot slot, GFXCubemap *tex, U32 face, U32 mipLevel=0);
 63   virtual void resolve();
 64
 65   /// Note we always copy the Color0 RenderSlot.
 66   virtual void resolveTo( GFXTextureObject *tex );
 67
 68   virtual void activate();
 69   virtual void deactivate();
 70
 71   void zombify();
 72   void resurrect();
 73};
 74
 75class GFXD3D11WindowTarget : public GFXWindowTarget
 76{
 77   friend class GFXD3D11Device;
 78
 79   /// Our backbuffer
 80   ID3D11Texture2D *mBackbuffer;
 81
 82   /// Maximum size we can render to.
 83   Point2I mSize;
 84
 85   /// D3D presentation info.
 86   DXGI_SWAP_CHAIN_DESC mPresentationParams;
 87
 88   /// Internal interface that notifies us we need to reset our video mode.
 89   void resetMode();
 90
 91public:
 92
 93   GFXD3D11WindowTarget();
 94   ~GFXD3D11WindowTarget();
 95 
 96   virtual const Point2I getSize();
 97   virtual GFXFormat getFormat();
 98   virtual bool present();
 99
100   void initPresentationParams();
101   void setImplicitSwapChain();
102
103   virtual void activate();   
104
105   void zombify();
106   void resurrect();
107
108   virtual void resolveTo( GFXTextureObject *tex );
109};
110
111#endif
112