gfxGLStateBlock.h
Engine/source/gfx/gl/gfxGLStateBlock.h
Classes:
class
Namespaces:
namespace
Public Typedefs
GFXGLStateBlockRef
Detailed Description
Public Typedefs
typedef StrongRefPtr< GFXGLStateBlock > GFXGLStateBlockRef
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 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 _GFXGLSTATEBLOCK_H_ 25#define _GFXGLSTATEBLOCK_H_ 26 27#include "gfx/gfxStateBlock.h" 28 29namespace DictHash 30{ 31 U32 hash(const GFXSamplerStateDesc &data); 32} 33 34class GFXGLStateBlock : public GFXStateBlock 35{ 36public: 37 // 38 // GFXGLStateBlock interface 39 // 40 GFXGLStateBlock(const GFXStateBlockDesc& desc); 41 virtual ~GFXGLStateBlock(); 42 43 /// Called by OpenGL device to active this state block. 44 /// @param oldState The current state, used to make sure we don't set redundant states on the device. Pass NULL to reset all states. 45 void activate(const GFXGLStateBlock* oldState); 46 47 48 // 49 // GFXStateBlock interface 50 // 51 52 /// Returns the hash value of the desc that created this block 53 virtual U32 getHashValue() const; 54 55 /// Returns a GFXStateBlockDesc that this block represents 56 virtual const GFXStateBlockDesc& getDesc() const; 57 58 // 59 // GFXResource 60 // 61 virtual void zombify() { } 62 /// When called the resource should restore all device sensitive information destroyed by zombify() 63 virtual void resurrect() { } 64private: 65 GFXStateBlockDesc mDesc; 66 U32 mCachedHashValue; 67 U32 mSamplerObjects[GFX_TEXTURE_STAGE_COUNT]; 68}; 69 70typedef StrongRefPtr<GFXGLStateBlock> GFXGLStateBlockRef; 71 72#endif 73