Torque3D Documentation / _generateds / gfxD3D11StateBlock.h

gfxD3D11StateBlock.h

Engine/source/gfx/D3D11/gfxD3D11StateBlock.h

More...

Classes:

Public Typedefs

GFXD3D11StateBlockRef 

Detailed Description

Public Typedefs

typedef StrongRefPtr< GFXD3D11StateBlock > GFXD3D11StateBlockRef 
 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 _GFXD3D11STATEBLOCK_H_
25#define _GFXD3D11STATEBLOCK_H_
26
27#include "gfx/D3D11/gfxD3D11Device.h"
28#include "gfx/gfxStateBlock.h"
29
30class GFXD3D11StateBlock : public GFXStateBlock
31{   
32public:
33
34   GFXD3D11StateBlock(const GFXStateBlockDesc& desc);
35   virtual ~GFXD3D11StateBlock();
36
37   /// Called by D3D11 device to active this state block.
38   /// @param oldState  The current state, used to make sure we don't set redundant states on the device.  Pass NULL to reset all states.
39   void activate(GFXD3D11StateBlock* oldState);
40
41   // 
42   // GFXStateBlock interface
43   //
44
45   /// Returns the hash value of the desc that created this block
46   virtual U32 getHashValue() const;
47
48   /// Returns a GFXStateBlockDesc that this block represents
49   virtual const GFXStateBlockDesc& getDesc() const;
50
51   //
52   // GFXResource
53   //
54   virtual void zombify() { }
55   /// When called the resource should restore all device sensitive information destroyed by zombify()
56   virtual void resurrect() { }
57private:
58
59   D3D11_BLEND_DESC mBlendDesc;
60   D3D11_RASTERIZER_DESC mRasterizerDesc;
61   D3D11_DEPTH_STENCIL_DESC mDepthStencilDesc; 
62   D3D11_SAMPLER_DESC mSamplerDesc[TEXTURE_STAGE_COUNT];
63
64   ID3D11BlendState* mBlendState;
65   ID3D11DepthStencilState* mDepthStencilState;
66   ID3D11RasterizerState* mRasterizerState;
67   ID3D11SamplerState* mSamplerStates[TEXTURE_STAGE_COUNT];
68
69   GFXStateBlockDesc mDesc;
70   U32 mCachedHashValue;
71   // Cached D3D specific things, these are "calculated" from GFXStateBlock
72   U32 mColorMask; 
73};
74
75typedef StrongRefPtr<GFXD3D11StateBlock> GFXD3D11StateBlockRef;
76
77#endif
78