Torque3D Documentation / _generateds / gfxD3D11StateBlock.h

gfxD3D11StateBlock.h

Engine/source/gfx/D3D11/gfxD3D11StateBlock.h

More...

Classes:

Namespaces:

namespace

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