2742 lines
75 KiB
C++
2742 lines
75 KiB
C++
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
|
||
//
|
||
// Purpose:
|
||
//
|
||
// $NoKeywords: $
|
||
//
|
||
//===========================================================================//
|
||
|
||
#include "utlvector.h"
|
||
#include "materialsystem/imaterialsystem.h"
|
||
#include "IHardwareConfigInternal.h"
|
||
#include "shadersystem.h"
|
||
#include "shaderapi/ishaderutil.h"
|
||
#include "shaderapi/ishaderapi.h"
|
||
#include "materialsystem/imesh.h"
|
||
#include "tier0/dbg.h"
|
||
#include "materialsystem/idebugtextureinfo.h"
|
||
#include "materialsystem/deformations.h"
|
||
|
||
// NOTE: This has to be the last file included!
|
||
#include "tier0/memdbgon.h"
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// The empty mesh
|
||
//-----------------------------------------------------------------------------
|
||
class CEmptyMesh : public IMesh
|
||
{
|
||
public:
|
||
CEmptyMesh( bool bIsDynamic );
|
||
virtual ~CEmptyMesh();
|
||
|
||
// FIXME: Make this work! Unsupported methods of IIndexBuffer + IVertexBuffer
|
||
virtual bool Lock( int nMaxIndexCount, bool bAppend, IndexDesc_t& desc );
|
||
virtual void Unlock( int nWrittenIndexCount, IndexDesc_t& desc );
|
||
virtual void ModifyBegin( bool bReadOnly, int nFirstIndex, int nIndexCount, IndexDesc_t& desc );
|
||
virtual void ModifyEnd( IndexDesc_t& desc );
|
||
virtual void Spew( int nIndexCount, const IndexDesc_t & desc );
|
||
virtual void ValidateData( int nIndexCount, const IndexDesc_t &desc );
|
||
virtual bool Lock( int nVertexCount, bool bAppend, VertexDesc_t &desc );
|
||
virtual void Unlock( int nVertexCount, VertexDesc_t &desc );
|
||
virtual void Spew( int nVertexCount, const VertexDesc_t &desc );
|
||
virtual void ValidateData( int nVertexCount, const VertexDesc_t & desc );
|
||
virtual bool IsDynamic() const { return m_bIsDynamic; }
|
||
virtual void BeginCastBuffer( VertexFormat_t format ) {}
|
||
virtual void BeginCastBuffer( MaterialIndexFormat_t format ) {}
|
||
virtual void EndCastBuffer( ) {}
|
||
virtual int GetRoomRemaining() const { return 0; }
|
||
virtual MaterialIndexFormat_t IndexFormat() const { return MATERIAL_INDEX_FORMAT_UNKNOWN; }
|
||
|
||
void LockMesh( int numVerts, int numIndices, MeshDesc_t& desc, MeshBuffersAllocationSettings_t *pSettings = 0 );
|
||
void UnlockMesh( int numVerts, int numIndices, MeshDesc_t& desc );
|
||
|
||
void ModifyBeginEx( bool bReadOnly, int firstVertex, int numVerts, int firstIndex, int numIndices, MeshDesc_t& desc );
|
||
void ModifyBegin( int firstVertex, int numVerts, int firstIndex, int numIndices, MeshDesc_t& desc );
|
||
void ModifyEnd( MeshDesc_t& desc );
|
||
|
||
// returns the # of vertices (static meshes only)
|
||
int VertexCount() const;
|
||
|
||
// Sets the primitive type
|
||
void SetPrimitiveType( MaterialPrimitiveType_t type );
|
||
|
||
// Draws the entire mesh
|
||
void Draw(int firstIndex, int numIndices);
|
||
void DrawModulated( const Vector4D &vecDiffuseModulation, int firstIndex, int numIndices) {}
|
||
|
||
void Draw(CPrimList *pPrims, int nPrims);
|
||
|
||
// Copy verts and/or indices to a mesh builder. This only works for temp meshes!
|
||
virtual void CopyToMeshBuilder(
|
||
int iStartVert, // Which vertices to copy.
|
||
int nVerts,
|
||
int iStartIndex, // Which indices to copy.
|
||
int nIndices,
|
||
int indexOffset, // This is added to each index.
|
||
CMeshBuilder &builder );
|
||
|
||
// Spews the mesh data
|
||
void Spew( int numVerts, int numIndices, const MeshDesc_t & desc );
|
||
|
||
void ValidateData( int numVerts, int numIndices, const MeshDesc_t & desc );
|
||
|
||
// gets the associated material
|
||
IMaterial* GetMaterial();
|
||
|
||
void SetColorMesh( IMesh *pColorMesh, int nVertexOffset )
|
||
{
|
||
}
|
||
|
||
|
||
virtual int IndexCount() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
virtual void SetFlexMesh( IMesh *pMesh, int nVertexOffset ) {}
|
||
|
||
virtual void DisableFlexMesh() {}
|
||
|
||
virtual void MarkAsDrawn() {}
|
||
|
||
virtual VertexFormat_t GetVertexFormat() const { return VERTEX_POSITION; }
|
||
|
||
virtual IMesh *GetMesh()
|
||
{
|
||
return this;
|
||
}
|
||
|
||
virtual unsigned int ComputeMemoryUsed() { return 0; }
|
||
|
||
virtual void * AccessRawHardwareDataStream( uint8 nRawStreamIndex, uint32 numBytes, uint32 uiFlags, void *pvContext ) { return NULL; }
|
||
|
||
virtual ICachedPerFrameMeshData *GetCachedPerFrameMeshData() { return NULL; }
|
||
virtual void ReconstructFromCachedPerFrameMeshData( ICachedPerFrameMeshData *pData ) {}
|
||
|
||
private:
|
||
enum
|
||
{
|
||
VERTEX_BUFFER_SIZE = 1024 // * 1024
|
||
};
|
||
|
||
unsigned char* m_pVertexMemory;
|
||
bool m_bIsDynamic;
|
||
};
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// The empty shader shadow
|
||
//-----------------------------------------------------------------------------
|
||
class CShaderShadowEmpty : public IShaderShadow
|
||
{
|
||
public:
|
||
CShaderShadowEmpty();
|
||
virtual ~CShaderShadowEmpty();
|
||
|
||
// Sets the default *shadow* state
|
||
void SetDefaultState();
|
||
|
||
// Methods related to depth buffering
|
||
void DepthFunc( ShaderDepthFunc_t depthFunc );
|
||
void EnableDepthWrites( bool bEnable );
|
||
void EnableDepthTest( bool bEnable );
|
||
void EnablePolyOffset( PolygonOffsetMode_t nOffsetMode );
|
||
|
||
// Suppresses/activates color writing
|
||
void EnableColorWrites( bool bEnable );
|
||
void EnableAlphaWrites( bool bEnable );
|
||
|
||
// Methods related to alpha blending
|
||
void EnableBlending( bool bEnable );
|
||
void EnableBlendingForceOpaque( bool bEnable );
|
||
void BlendFunc( ShaderBlendFactor_t srcFactor, ShaderBlendFactor_t dstFactor );
|
||
|
||
// Alpha testing
|
||
void EnableAlphaTest( bool bEnable );
|
||
void AlphaFunc( ShaderAlphaFunc_t alphaFunc, float alphaRef /* [0-1] */ );
|
||
|
||
// Wireframe/filled polygons
|
||
void PolyMode( ShaderPolyModeFace_t face, ShaderPolyMode_t polyMode );
|
||
|
||
// Back face culling
|
||
void EnableCulling( bool bEnable );
|
||
|
||
// Indicates the vertex format for use with a vertex shader
|
||
// The flags to pass in here come from the VertexFormatFlags_t enum
|
||
// If pTexCoordDimensions is *not* specified, we assume all coordinates
|
||
// are 2-dimensional
|
||
void VertexShaderVertexFormat( unsigned int nFlags,
|
||
int nTexCoordCount, int* pTexCoordDimensions, int nUserDataSize );
|
||
|
||
// Per texture unit stuff
|
||
void EnableTexture( Sampler_t stage, bool bEnable ) {};
|
||
void EnableVertexTexture( VertexTextureSampler_t stage, bool bEnable ) {};
|
||
|
||
// Separate alpha blending
|
||
void EnableBlendingSeparateAlpha( bool bEnable );
|
||
void BlendFuncSeparateAlpha( ShaderBlendFactor_t srcFactor, ShaderBlendFactor_t dstFactor );
|
||
|
||
// Sets the vertex and pixel shaders
|
||
void SetVertexShader( const char *pFileName, int vshIndex );
|
||
void SetPixelShader( const char *pFileName, int pshIndex );
|
||
|
||
// Convert from linear to gamma color space on writes to frame buffer.
|
||
void EnableSRGBWrite( bool bEnable )
|
||
{
|
||
}
|
||
|
||
void EnableSRGBRead( Sampler_t stage, bool bEnable )
|
||
{
|
||
}
|
||
|
||
virtual void FogMode( ShaderFogMode_t fogMode, bool bVertexFog )
|
||
{
|
||
}
|
||
|
||
virtual void DisableFogGammaCorrection( bool bDisable )
|
||
{
|
||
}
|
||
|
||
virtual void ExecuteCommandBuffer( uint8 *pBuf )
|
||
{
|
||
}
|
||
|
||
// Alpha to coverage
|
||
void EnableAlphaToCoverage( bool bEnable );
|
||
|
||
virtual void SetShadowDepthFiltering( Sampler_t stage )
|
||
{
|
||
}
|
||
|
||
virtual void BlendOp( ShaderBlendOp_t blendOp )
|
||
{
|
||
}
|
||
|
||
virtual void BlendOpSeparateAlpha( ShaderBlendOp_t blendOp )
|
||
{
|
||
}
|
||
virtual float GetLightMapScaleFactor( void ) const
|
||
{
|
||
return 1.0;
|
||
}
|
||
|
||
|
||
bool m_IsTranslucent;
|
||
bool m_ForceOpaque;
|
||
bool m_IsAlphaTested;
|
||
bool m_bIsDepthWriteEnabled;
|
||
bool m_bUsesVertexAndPixelShaders;
|
||
};
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// The DX8 implementation of the shader device
|
||
//-----------------------------------------------------------------------------
|
||
class CShaderDeviceEmpty : public IShaderDevice
|
||
{
|
||
public:
|
||
CShaderDeviceEmpty() : m_DynamicMesh( true ), m_Mesh( false ) {}
|
||
|
||
// Methods of IShaderDevice
|
||
virtual int GetCurrentAdapter() const { return 0; }
|
||
virtual bool IsUsingGraphics() const { return false; }
|
||
virtual void SpewDriverInfo() const;
|
||
virtual ImageFormat GetBackBufferFormat() const { return IMAGE_FORMAT_RGB888; }
|
||
virtual void GetBackBufferDimensions( int& width, int& height ) const;
|
||
virtual const AspectRatioInfo_t &GetAspectRatioInfo( void ) const
|
||
{
|
||
static AspectRatioInfo_t dummy;
|
||
return dummy;
|
||
}
|
||
virtual int StencilBufferBits() const { return 0; }
|
||
virtual bool IsAAEnabled() const { return false; }
|
||
virtual void Present( ) {}
|
||
virtual void GetWindowSize( int &width, int &height ) const;
|
||
virtual bool AddView( void* hwnd );
|
||
virtual void RemoveView( void* hwnd );
|
||
virtual void SetView( void* hwnd );
|
||
virtual void ReleaseResources( bool bReleaseManagedResources = true );
|
||
virtual void ReacquireResources();
|
||
virtual IMesh* CreateStaticMesh( VertexFormat_t fmt, const char *pTextureBudgetGroup, IMaterial * pMaterial = NULL, VertexStreamSpec_t *pStreamSpec = NULL );
|
||
virtual void DestroyStaticMesh( IMesh* mesh );
|
||
virtual IShaderBuffer* CompileShader( const char *pProgram, size_t nBufLen, const char *pShaderVersion ) { return NULL; }
|
||
virtual VertexShaderHandle_t CreateVertexShader( IShaderBuffer* pShaderBuffer ) { return VERTEX_SHADER_HANDLE_INVALID; }
|
||
virtual void DestroyVertexShader( VertexShaderHandle_t hShader ) {}
|
||
virtual GeometryShaderHandle_t CreateGeometryShader( IShaderBuffer* pShaderBuffer ) { return GEOMETRY_SHADER_HANDLE_INVALID; }
|
||
virtual void DestroyGeometryShader( GeometryShaderHandle_t hShader ) {}
|
||
virtual PixelShaderHandle_t CreatePixelShader( IShaderBuffer* pShaderBuffer ) { return PIXEL_SHADER_HANDLE_INVALID; }
|
||
virtual void DestroyPixelShader( PixelShaderHandle_t hShader ) {}
|
||
virtual IVertexBuffer *CreateVertexBuffer( ShaderBufferType_t type, VertexFormat_t fmt, int nVertexCount, const char *pBudgetGroup );
|
||
virtual void DestroyVertexBuffer( IVertexBuffer *pVertexBuffer );
|
||
virtual IIndexBuffer *CreateIndexBuffer( ShaderBufferType_t bufferType, MaterialIndexFormat_t fmt, int nIndexCount, const char *pBudgetGroup );
|
||
virtual void DestroyIndexBuffer( IIndexBuffer *pIndexBuffer );
|
||
virtual IVertexBuffer *GetDynamicVertexBuffer( int streamID, VertexFormat_t vertexFormat, bool bBuffered );
|
||
virtual IIndexBuffer *GetDynamicIndexBuffer();
|
||
virtual void SetHardwareGammaRamp( float fGamma, float fGammaTVRangeMin, float fGammaTVRangeMax, float fGammaTVExponent, bool bTVEnabled ) {}
|
||
virtual void EnableNonInteractiveMode( MaterialNonInteractiveMode_t mode, ShaderNonInteractiveInfo_t *pInfo ) {}
|
||
virtual void RefreshFrontBufferNonInteractive( ) {}
|
||
virtual void HandleThreadEvent( uint32 threadEvent ) {}
|
||
|
||
#if defined( DX_TO_GL_ABSTRACTION )
|
||
virtual void DoStartupShaderPreloading( void ) {}
|
||
#endif
|
||
|
||
private:
|
||
CEmptyMesh m_Mesh;
|
||
CEmptyMesh m_DynamicMesh;
|
||
};
|
||
|
||
static CShaderDeviceEmpty s_ShaderDeviceEmpty;
|
||
|
||
// FIXME: Remove; it's for backward compat with the materialsystem only for now
|
||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CShaderDeviceEmpty, IShaderDevice,
|
||
SHADER_DEVICE_INTERFACE_VERSION, s_ShaderDeviceEmpty )
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// The DX8 implementation of the shader device
|
||
//-----------------------------------------------------------------------------
|
||
class CShaderDeviceMgrEmpty : public CBaseAppSystem< IShaderDeviceMgr >
|
||
{
|
||
public:
|
||
// Methods of IAppSystem
|
||
virtual bool Connect( CreateInterfaceFn factory );
|
||
virtual void Disconnect();
|
||
virtual void *QueryInterface( const char *pInterfaceName );
|
||
virtual InitReturnVal_t Init();
|
||
virtual void Shutdown();
|
||
|
||
public:
|
||
// Methods of IShaderDeviceMgr
|
||
virtual int GetAdapterCount() const;
|
||
virtual void GetAdapterInfo( int adapter, MaterialAdapterInfo_t& info ) const;
|
||
virtual bool GetRecommendedVideoConfig( int nAdapter, KeyValues *pKeyValues );
|
||
virtual bool GetRecommendedConfigurationInfo( int nAdapter, int nDXLevel, KeyValues *pKeyValues );
|
||
virtual int GetModeCount( int adapter ) const;
|
||
virtual void GetModeInfo( ShaderDisplayMode_t *pInfo, int nAdapter, int mode ) const;
|
||
virtual void GetCurrentModeInfo( ShaderDisplayMode_t* pInfo, int nAdapter ) const;
|
||
virtual bool SetAdapter( int nAdapter, int nFlags );
|
||
virtual CreateInterfaceFn SetMode( void *hWnd, int nAdapter, const ShaderDeviceInfo_t& mode );
|
||
virtual void AddModeChangeCallback( ShaderModeChangeCallbackFunc_t func ) {}
|
||
virtual void RemoveModeChangeCallback( ShaderModeChangeCallbackFunc_t func ) {}
|
||
virtual void AddDeviceDependentObject( IShaderDeviceDependentObject *pObject ) {}
|
||
virtual void RemoveDeviceDependentObject( IShaderDeviceDependentObject *pObject ) {}
|
||
};
|
||
|
||
static CShaderDeviceMgrEmpty s_ShaderDeviceMgrEmpty;
|
||
|
||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CShaderDeviceMgrEmpty, IShaderDeviceMgr,
|
||
SHADER_DEVICE_MGR_INTERFACE_VERSION, s_ShaderDeviceMgrEmpty )
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// The DX8 implementation of the shader API
|
||
//-----------------------------------------------------------------------------
|
||
class CShaderAPIEmpty : public IShaderAPI, public IHardwareConfigInternal, public IDebugTextureInfo
|
||
{
|
||
public:
|
||
// constructor, destructor
|
||
CShaderAPIEmpty( );
|
||
virtual ~CShaderAPIEmpty();
|
||
|
||
// IDebugTextureInfo implementation.
|
||
public:
|
||
|
||
virtual bool IsDebugTextureListFresh( int numFramesAllowed = 1 ) { return false; }
|
||
virtual bool SetDebugTextureRendering( bool bEnable ) { return false; }
|
||
virtual void EnableDebugTextureList( bool bEnable ) {}
|
||
virtual void EnableGetAllTextures( bool bEnable ) {}
|
||
virtual KeyValues* LockDebugTextureList( void ) { return NULL; }
|
||
virtual void UnlockDebugTextureList( void ) {}
|
||
virtual KeyValues* GetDebugTextureList() { return NULL; }
|
||
virtual int GetTextureMemoryUsed( TextureMemoryType eTextureMemory ) { return 0; }
|
||
virtual void SetVertexShaderViewProj() {}
|
||
virtual void UpdateVertexShaderMatrix( int m ) {}
|
||
virtual void SetVertexShaderModelViewProjAndModelView() {}
|
||
virtual void SetVertexShaderCameraPos() {}
|
||
virtual bool SetSkinningMatrices( const MeshInstanceData_t &instance ) { return false; }
|
||
virtual void BeginGeneratingCSMs() {}
|
||
virtual void EndGeneratingCSMs() {}
|
||
virtual void PerpareForCascadeDraw( int cascade, float fShadowSlopeScaleDepthBias, float fShadowDepthBias ) {}
|
||
|
||
// Methods of IShaderDynamicAPI
|
||
#ifdef _PS3
|
||
virtual void ExecuteSingleCommandBuffer( uint8 *pCmdBuffer, int size ) {}
|
||
|
||
|
||
virtual void ExecuteCommandBuffer( uint8 *pCmdBuffer1, int size1,
|
||
uint8 *pCmdBuffer2, int size2) {}
|
||
|
||
virtual void ExecuteCommandBuffer( uint8 *pCmdBuffer1, int size1,
|
||
uint8 *pCmdBuffer2, int size2,
|
||
uint8 *pCmdBuffer3, int size3) {}
|
||
#endif
|
||
virtual void GetBackBufferDimensions( int& width, int& height ) const
|
||
{
|
||
s_ShaderDeviceEmpty.GetBackBufferDimensions( width, height );
|
||
}
|
||
|
||
virtual const AspectRatioInfo_t &GetAspectRatioInfo( void ) const
|
||
{
|
||
static AspectRatioInfo_t dummy;
|
||
return dummy;
|
||
}
|
||
|
||
// Get the dimensions of the current render target
|
||
virtual void GetCurrentRenderTargetDimensions( int& nWidth, int& nHeight ) const
|
||
{
|
||
s_ShaderDeviceEmpty.GetBackBufferDimensions( nWidth, nHeight );
|
||
}
|
||
|
||
// Get the current viewport
|
||
virtual void GetCurrentViewport( int& nX, int& nY, int& nWidth, int& nHeight ) const
|
||
{
|
||
nX = 0;
|
||
nY = 0;
|
||
s_ShaderDeviceEmpty.GetBackBufferDimensions( nWidth, nHeight );
|
||
}
|
||
|
||
virtual void GetCurrentColorCorrection( ShaderColorCorrectionInfo_t* pInfo )
|
||
{
|
||
pInfo->m_bIsEnabled = false;
|
||
pInfo->m_nLookupCount = 0;
|
||
pInfo->m_flDefaultWeight = 0.0f;
|
||
}
|
||
|
||
// Methods of IShaderAPI
|
||
public:
|
||
virtual void SetViewports( int nCount, const ShaderViewport_t* pViewports, bool setImmediately = false );
|
||
virtual int GetViewports( ShaderViewport_t* pViewports, int nMax ) const;
|
||
virtual void ClearBuffers( bool bClearColor, bool bClearDepth, bool bClearStencil, int renderTargetWidth, int renderTargetHeight );
|
||
virtual void ClearBuffersEx( bool bClearRed, bool bClearGreen, bool bClearBlue, bool bClearAlpha,
|
||
unsigned char r, unsigned char g, unsigned char b, unsigned char a );
|
||
virtual void ClearColor3ub( unsigned char r, unsigned char g, unsigned char b );
|
||
virtual void ClearColor4ub( unsigned char r, unsigned char g, unsigned char b, unsigned char a );
|
||
virtual void BindVertexShader( VertexShaderHandle_t hVertexShader ) {}
|
||
virtual void BindGeometryShader( GeometryShaderHandle_t hGeometryShader ) {}
|
||
virtual void BindPixelShader( PixelShaderHandle_t hPixelShader ) {}
|
||
virtual void SetRasterState( const ShaderRasterState_t& state ) {}
|
||
virtual void MarkUnusedVertexFields( unsigned int nFlags, int nTexCoordCount, bool *pUnusedTexCoords ) {}
|
||
#if defined( _GAMECONSOLE )
|
||
virtual bool PostQueuedTexture( const void *pData, int nSize, ShaderAPITextureHandle_t *pHandles, int nHandles, int nWidth, int nHeight, int nDepth, int nMips, int *pRefCount )
|
||
{
|
||
return false;
|
||
}
|
||
#endif
|
||
virtual bool OwnGPUResources( bool bEnable ) { return false; }
|
||
virtual void OnPresent( void ) {}
|
||
|
||
virtual bool DoRenderTargetsNeedSeparateDepthBuffer() const;
|
||
|
||
// Used to clear the transition table when we know it's become invalid.
|
||
void ClearSnapshots();
|
||
|
||
// Sets the mode...
|
||
bool SetMode( void* hwnd, int nAdapter, const ShaderDeviceInfo_t &info )
|
||
{
|
||
return true;
|
||
}
|
||
|
||
void ChangeVideoMode( const ShaderDeviceInfo_t &info )
|
||
{
|
||
}
|
||
|
||
// Called when the dx support level has changed
|
||
virtual void DXSupportLevelChanged( int nDXLevel ) {}
|
||
|
||
virtual void EnableUserClipTransformOverride( bool bEnable ) {}
|
||
virtual void UserClipTransform( const VMatrix &worldToView ) {}
|
||
|
||
// Sets the default *dynamic* state
|
||
void SetDefaultState( );
|
||
|
||
// Returns the snapshot id for the shader state
|
||
StateSnapshot_t TakeSnapshot( );
|
||
|
||
// Returns true if the state snapshot is transparent
|
||
bool IsTranslucent( StateSnapshot_t id ) const;
|
||
bool IsAlphaTested( StateSnapshot_t id ) const;
|
||
bool UsesVertexAndPixelShaders( StateSnapshot_t id ) const;
|
||
virtual bool IsDepthWriteEnabled( StateSnapshot_t id ) const;
|
||
|
||
// Gets the vertex format for a set of snapshot ids
|
||
VertexFormat_t ComputeVertexFormat( int numSnapshots, StateSnapshot_t* pIds ) const;
|
||
|
||
// Gets the vertex format for a set of snapshot ids
|
||
VertexFormat_t ComputeVertexUsage( int numSnapshots, StateSnapshot_t* pIds ) const;
|
||
|
||
// Begins a rendering pass that uses a state snapshot
|
||
void BeginPass( StateSnapshot_t snapshot );
|
||
|
||
// Uses a state snapshot
|
||
void UseSnapshot( StateSnapshot_t snapshot );
|
||
|
||
// Use this to get the mesh builder that allows us to modify vertex data
|
||
CMeshBuilder* GetVertexModifyBuilder();
|
||
|
||
// Sets the lights
|
||
void SetLightingState( const MaterialLightingState_t &state ) {}
|
||
void SetLights( int nCount, const LightDesc_t *pDesc );
|
||
void SetLightingOrigin( Vector vLightingOrigin );
|
||
void SetAmbientLightCube( Vector4D cube[6] );
|
||
|
||
void CopyRenderTargetToTexture( ShaderAPITextureHandle_t texID ){}
|
||
|
||
void CopyRenderTargetToTextureEx( ShaderAPITextureHandle_t texID, int nRenderTargetID, Rect_t *pSrcRect, Rect_t *pDstRect ){}
|
||
void CopyRenderTargetToTextureEx( ShaderAPITextureHandle_t textureHandle, int nRenderTargetID, Rect_t *pSrcRect = NULL, Rect_t *pDstRect = NULL, bool bUseBackBuffer = false ) {}
|
||
|
||
void CopyTextureToRenderTargetEx( int nRenderTargetID, ShaderAPITextureHandle_t textureHandle, Rect_t *pSrcRect, Rect_t *pDstRect )
|
||
{
|
||
}
|
||
|
||
// Set the number of bone weights
|
||
void SetNumBoneWeights( int numBones );
|
||
void EnableHWMorphing( bool bEnable );
|
||
|
||
// Gets the dynamic mesh; note that you've got to render the mesh
|
||
// before calling this function a second time. Clients should *not*
|
||
// call DestroyStaticMesh on the mesh returned by this call.
|
||
IMesh* GetDynamicMesh( IMaterial* pMaterial, int nHWSkinBoneCount, bool buffered, IMesh* pVertexOverride, IMesh* pIndexOverride );
|
||
IMesh* GetDynamicMeshEx( IMaterial* pMaterial, VertexFormat_t fmt, int nHWSkinBoneCount, bool buffered, IMesh* pVertexOverride, IMesh* pIndexOverride );
|
||
|
||
IMesh* GetFlexMesh();
|
||
|
||
// Renders a single pass of a material
|
||
void RenderPass( const unsigned char *pInstanceCommandBuffer, int nPass, int nPassCount );
|
||
|
||
// stuff related to matrix stacks
|
||
void MatrixMode( MaterialMatrixMode_t matrixMode );
|
||
void PushMatrix();
|
||
void PopMatrix();
|
||
void LoadMatrix( float *m );
|
||
void LoadBoneMatrix( int boneIndex, const float *m ) {}
|
||
void MultMatrix( float *m );
|
||
void MultMatrixLocal( float *m );
|
||
void GetActualProjectionMatrix( float *pMatrix );
|
||
void GetMatrix( MaterialMatrixMode_t matrixMode, float *dst );
|
||
void LoadIdentity( void );
|
||
void LoadCameraToWorld( void );
|
||
void Ortho( double left, double top, double right, double bottom, double zNear, double zFar );
|
||
void PerspectiveX( double fovx, double aspect, double zNear, double zFar );
|
||
void PerspectiveOffCenterX( double fovx, double aspect, double zNear, double zFar, double bottom, double top, double left, double right );
|
||
void PickMatrix( int x, int y, int width, int height );
|
||
void Rotate( float angle, float x, float y, float z );
|
||
void Translate( float x, float y, float z );
|
||
void Scale( float x, float y, float z );
|
||
void ScaleXY( float x, float y );
|
||
|
||
// Fog methods...
|
||
void FogMode( MaterialFogMode_t fogMode );
|
||
void FogStart( float fStart );
|
||
void FogEnd( float fEnd );
|
||
void SetFogZ( float fogZ );
|
||
void FogMaxDensity( float flMaxDensity );
|
||
void GetFogDistances( float *fStart, float *fEnd, float *fFogZ );
|
||
void FogColor3f( float r, float g, float b );
|
||
void FogColor3fv( float const* rgb );
|
||
void FogColor3ub( unsigned char r, unsigned char g, unsigned char b );
|
||
void FogColor3ubv( unsigned char const* rgb );
|
||
|
||
virtual void SceneFogColor3ub( unsigned char r, unsigned char g, unsigned char b );
|
||
virtual void SceneFogMode( MaterialFogMode_t fogMode );
|
||
virtual void GetSceneFogColor( unsigned char *rgb );
|
||
virtual MaterialFogMode_t GetSceneFogMode( );
|
||
virtual int GetPixelFogCombo( );
|
||
|
||
void SetHeightClipZ( float z );
|
||
void SetHeightClipMode( enum MaterialHeightClipMode_t heightClipMode );
|
||
|
||
void SetClipPlane( int index, const float *pPlane );
|
||
void EnableClipPlane( int index, bool bEnable );
|
||
|
||
void SetFastClipPlane( const float *pPlane );
|
||
void EnableFastClip( bool bEnable );
|
||
|
||
// We use smaller dynamic VBs during level transitions, to free up memory
|
||
virtual int GetCurrentDynamicVBSize( void );
|
||
virtual int GetCurrentDynamicVBSize( int nIndex = 0 );
|
||
virtual void DestroyVertexBuffers( bool bExitingLevel = false );
|
||
|
||
// Get stats on GPU memory usage
|
||
virtual void GetGPUMemoryStats( GPUMemoryStats &stats );
|
||
|
||
// Sets the vertex and pixel shaders
|
||
void SetVertexShaderIndex( int vshIndex );
|
||
void SetPixelShaderIndex( int pshIndex );
|
||
|
||
// Sets the constant register for vertex and pixel shaders
|
||
void SetVertexShaderConstant( int var, float const* pVec, int numConst = 1, bool bForce = false );
|
||
void SetBooleanVertexShaderConstant( int var, BOOL const* pVec, int numConst = 1, bool bForce = false );
|
||
void SetIntegerVertexShaderConstant( int var, int const* pVec, int numConst = 1, bool bForce = false );
|
||
void SetPixelShaderConstant( int var, float const* pVec, int numConst = 1, bool bForce = false );
|
||
void SetBooleanPixelShaderConstant( int var, BOOL const* pVec, int numBools = 1, bool bForce = false );
|
||
void SetIntegerPixelShaderConstant( int var, int const* pVec, int numIntVecs = 1, bool bForce = false );
|
||
|
||
void InvalidateDelayedShaderConstants( void );
|
||
|
||
// Gamma<->Linear conversions according to the video hardware we're running on
|
||
float GammaToLinear_HardwareSpecific( float fGamma ) const;
|
||
float LinearToGamma_HardwareSpecific( float fLinear ) const;
|
||
|
||
//Set's the linear->gamma conversion textures to use for this hardware for both srgb writes enabled and disabled(identity)
|
||
void SetLinearToGammaConversionTextures( ShaderAPITextureHandle_t hSRGBWriteEnabledTexture, ShaderAPITextureHandle_t hIdentityTexture );
|
||
|
||
// Cull mode
|
||
void CullMode( MaterialCullMode_t cullMode );
|
||
void FlipCullMode( void );
|
||
|
||
// Force writes only when z matches. . . useful for stenciling things out
|
||
// by rendering the desired Z values ahead of time.
|
||
void ForceDepthFuncEquals( bool bEnable );
|
||
|
||
// Forces Z buffering on or off
|
||
void OverrideDepthEnable( bool bEnable, bool bDepthWriteEnable, bool bDepthTestEnable = true );
|
||
void OverrideAlphaWriteEnable( bool bOverrideEnable, bool bAlphaWriteEnable );
|
||
void OverrideColorWriteEnable( bool bOverrideEnable, bool bColorWriteEnable );
|
||
|
||
// Sets the shade mode
|
||
void ShadeMode( ShaderShadeMode_t mode );
|
||
|
||
// Binds a particular material to render with
|
||
void Bind( IMaterial* pMaterial );
|
||
|
||
// Returns the nearest supported format
|
||
ImageFormat GetNearestSupportedFormat( ImageFormat fmt, bool bFilteringRequired = true ) const;
|
||
ImageFormat GetNearestRenderTargetFormat( ImageFormat fmt ) const;
|
||
|
||
// Sets the texture state
|
||
void BindTexture( Sampler_t stage, TextureBindFlags_t nBindFlags, ShaderAPITextureHandle_t textureHandle );
|
||
|
||
void BindVertexTexture( VertexTextureSampler_t vtSampler, ShaderAPITextureHandle_t textureHandle );
|
||
|
||
void SetRenderTarget( ShaderAPITextureHandle_t colorTextureHandle, ShaderAPITextureHandle_t depthTextureHandle )
|
||
{
|
||
}
|
||
|
||
void SetRenderTargetEx( int nRenderTargetID, ShaderAPITextureHandle_t colorTextureHandle, ShaderAPITextureHandle_t depthTextureHandle )
|
||
{
|
||
}
|
||
|
||
// Indicates we're going to be modifying this texture
|
||
// TexImage2D, TexSubImage2D, TexWrap, TexMinFilter, and TexMagFilter
|
||
// all use the texture specified by this function.
|
||
void ModifyTexture( ShaderAPITextureHandle_t textureHandle );
|
||
|
||
// Texture management methods
|
||
void TexImage2D( int level, int cubeFace, ImageFormat dstFormat, int zOffset, int width, int height,
|
||
ImageFormat srcFormat, bool bSrcIsTiled, void *imageData );
|
||
void TexSubImage2D( int level, int cubeFace, int xOffset, int yOffset, int zOffset, int width, int height,
|
||
ImageFormat srcFormat, int srcStride, bool bSrcIsTiled, void *imageData );
|
||
|
||
bool TexLock( int level, int cubeFaceID, int xOffset, int yOffset,
|
||
int width, int height, CPixelWriter& writer );
|
||
void TexUnlock( );
|
||
|
||
void UpdateTexture( int xOffset, int yOffset, int w, int h, ShaderAPITextureHandle_t hDstTexture, ShaderAPITextureHandle_t hSrcTexture );
|
||
|
||
void *LockTex( ShaderAPITextureHandle_t hTexture );
|
||
void UnlockTex( ShaderAPITextureHandle_t hTexture );
|
||
|
||
void* GetD3DTexturePtr( ShaderAPITextureHandle_t hTexture ) { return NULL; }
|
||
bool IsStandardTextureHandleValid( StandardTextureId_t textureId ) { return false; }
|
||
|
||
// These are bound to the texture, not the texture environment
|
||
void TexMinFilter( ShaderTexFilterMode_t texFilterMode );
|
||
void TexMagFilter( ShaderTexFilterMode_t texFilterMode );
|
||
void TexWrap( ShaderTexCoordComponent_t coord, ShaderTexWrapMode_t wrapMode );
|
||
void TexSetPriority( int priority );
|
||
|
||
ShaderAPITextureHandle_t CreateTexture(
|
||
int width,
|
||
int height,
|
||
int depth,
|
||
ImageFormat dstImageFormat,
|
||
int numMipLevels,
|
||
int numCopies,
|
||
int flags,
|
||
const char *pDebugName,
|
||
const char *pTextureGroupName );
|
||
// Create a multi-frame texture (equivalent to calling "CreateTexture" multiple times, but more efficient)
|
||
void CreateTextures(
|
||
ShaderAPITextureHandle_t *pHandles,
|
||
int count,
|
||
int width,
|
||
int height,
|
||
int depth,
|
||
ImageFormat dstImageFormat,
|
||
int numMipLevels,
|
||
int numCopies,
|
||
int flags,
|
||
const char *pDebugName,
|
||
const char *pTextureGroupName );
|
||
ShaderAPITextureHandle_t CreateDepthTexture( ImageFormat renderFormat, int width, int height, const char *pDebugName, bool bTexture, bool bAliasDepthTextureOverSceneDepthX360 );
|
||
void DeleteTexture( ShaderAPITextureHandle_t textureHandle );
|
||
bool IsTexture( ShaderAPITextureHandle_t textureHandle );
|
||
bool IsTextureResident( ShaderAPITextureHandle_t textureHandle );
|
||
|
||
// stuff that isn't to be used from within a shader
|
||
void ClearBuffersObeyStencil( bool bClearColor, bool bClearDepth );
|
||
void ClearBuffersObeyStencilEx( bool bClearColor, bool bClearAlpha, bool bClearDepth );
|
||
void PerformFullScreenStencilOperation( void );
|
||
void ReadPixels( int x, int y, int width, int height, unsigned char *data, ImageFormat dstFormat, ITexture *pRenderTargetTexture = NULL );
|
||
void ReadPixelsAsync( int x, int y, int width, int height, unsigned char *data, ImageFormat dstFormat, ITexture *pRenderTargetTexture = NULL, CThreadEvent *pPixelsReadEvent = NULL );
|
||
void ReadPixelsAsyncGetResult( int x, int y, int width, int height, unsigned char *data, ImageFormat dstFormat, CThreadEvent *pGetResultEvent = NULL );
|
||
virtual void ReadPixels( Rect_t *pSrcRect, Rect_t *pDstRect, unsigned char *data, ImageFormat dstFormat, int nDstStride );
|
||
|
||
// Selection mode methods
|
||
int SelectionMode( bool selectionMode );
|
||
void SelectionBuffer( unsigned int* pBuffer, int size );
|
||
void ClearSelectionNames( );
|
||
void LoadSelectionName( int name );
|
||
void PushSelectionName( int name );
|
||
void PopSelectionName();
|
||
|
||
void FlushHardware();
|
||
void ResetRenderState( bool bFullReset = true );
|
||
|
||
void SetScissorRect( const int nLeft, const int nTop, const int nRight, const int nBottom, const bool bEnableScissor );
|
||
|
||
// Can we download textures?
|
||
virtual bool CanDownloadTextures() const;
|
||
|
||
// Board-independent calls, here to unify how shaders set state
|
||
// Implementations should chain back to IShaderUtil->BindTexture(), etc.
|
||
|
||
// Use this to begin and end the frame
|
||
void BeginFrame();
|
||
void EndFrame();
|
||
|
||
// returns current time
|
||
double CurrentTime() const;
|
||
|
||
// Get the current camera position in world space.
|
||
void GetWorldSpaceCameraPosition( float* pPos ) const;
|
||
void GetWorldSpaceCameraDirection( float* pDir ) const;
|
||
|
||
// Members of IMaterialSystemHardwareConfig
|
||
bool HasDestAlphaBuffer() const;
|
||
bool HasStencilBuffer() const;
|
||
virtual int MaxViewports() const;
|
||
virtual void OverrideStreamOffsetSupport( bool bOverrideEnabled, bool bEnableSupport ) {}
|
||
virtual ShadowFilterMode_t GetShadowFilterMode( bool bForceLowQualityShadows, bool bPS30 ) const;
|
||
int StencilBufferBits() const;
|
||
int GetFrameBufferColorDepth() const;
|
||
int GetSamplerCount() const;
|
||
int GetVertexSamplerCount() const;
|
||
bool HasSetDeviceGammaRamp() const;
|
||
bool SupportsCompressedTextures() const;
|
||
VertexCompressionType_t SupportsCompressedVertices() const;
|
||
bool SupportsStaticControlFlow() const;
|
||
int MaximumAnisotropicLevel() const;
|
||
int MaxTextureWidth() const;
|
||
int MaxTextureHeight() const;
|
||
int MaxTextureAspectRatio() const;
|
||
int GetDXSupportLevel() const;
|
||
int GetMinDXSupportLevel() const { return 90; }
|
||
bool SupportsShadowDepthTextures( void ) const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
ImageFormat GetShadowDepthTextureFormat( void ) const
|
||
{
|
||
return IMAGE_FORMAT_RGBA8888;
|
||
}
|
||
|
||
ImageFormat GetHighPrecisionShadowDepthTextureFormat( void ) const
|
||
{
|
||
return IMAGE_FORMAT_RGBA8888;
|
||
}
|
||
|
||
ImageFormat GetNullTextureFormat( void ) const
|
||
{
|
||
return IMAGE_FORMAT_RGBA8888;
|
||
}
|
||
|
||
const char *GetShaderDLLName() const
|
||
{
|
||
return "UNKNOWN";
|
||
}
|
||
int TextureMemorySize() const;
|
||
bool SupportsMipmappedCubemaps() const;
|
||
int GetTextureStageCount() const;
|
||
int NumVertexShaderConstants() const;
|
||
int NumBooleanVertexShaderConstants() const;
|
||
int NumIntegerVertexShaderConstants() const;
|
||
int NumPixelShaderConstants() const;
|
||
int MaxNumLights() const;
|
||
bool SupportsHardwareLighting() const;
|
||
int MaxBlendMatrices() const;
|
||
int MaxBlendMatrixIndices() const;
|
||
int MaxVertexShaderBlendMatrices() const;
|
||
int MaxUserClipPlanes() const;
|
||
bool UseFastClipping() const
|
||
{
|
||
return false;
|
||
}
|
||
bool SpecifiesFogColorInLinearSpace() const;
|
||
virtual bool SupportsSRGB() const;
|
||
virtual bool FakeSRGBWrite() const;
|
||
virtual bool CanDoSRGBReadFromRTs() const;
|
||
virtual bool SupportsGLMixedSizeTargets() const;
|
||
|
||
const char *GetHWSpecificShaderDLLName() const;
|
||
bool NeedsAAClamp() const
|
||
{
|
||
return false;
|
||
}
|
||
virtual int MaxHWMorphBatchCount() const { return 0; }
|
||
|
||
// This is the max dx support level supported by the card
|
||
virtual int GetMaxDXSupportLevel() const;
|
||
|
||
bool ReadPixelsFromFrontBuffer() const;
|
||
bool PreferDynamicTextures() const;
|
||
void ForceHardwareSync( void );
|
||
|
||
int GetCurrentNumBones( void ) const;
|
||
bool IsHWMorphingEnabled( void ) const;
|
||
void GetDX9LightState( LightState_t *state ) const;
|
||
MaterialFogMode_t GetCurrentFogType( void ) const;
|
||
|
||
void RecordString( const char *pStr );
|
||
|
||
void EvictManagedResources();
|
||
|
||
// Gets the lightmap dimensions
|
||
virtual void GetLightmapDimensions( int *w, int *h );
|
||
|
||
virtual void SyncToken( const char *pToken );
|
||
|
||
// Setup standard vertex shader constants (that don't change)
|
||
// This needs to be called anytime that overbright changes.
|
||
virtual void SetStandardVertexShaderConstants( float fOverbright )
|
||
{
|
||
}
|
||
|
||
// Level of anisotropic filtering
|
||
virtual void SetAnisotropicLevel( int nAnisotropyLevel );
|
||
|
||
#ifdef _GAMECONSOLE
|
||
// Vitaliy: need HDR to run with -noshaderapi on console
|
||
bool SupportsHDR() const
|
||
{
|
||
return true;
|
||
}
|
||
HDRType_t GetHDRType() const
|
||
{
|
||
return HDR_TYPE_INTEGER;
|
||
}
|
||
HDRType_t GetHardwareHDRType() const
|
||
{
|
||
return HDR_TYPE_INTEGER;
|
||
}
|
||
#else
|
||
bool SupportsHDR() const
|
||
{
|
||
return false;
|
||
}
|
||
HDRType_t GetHDRType() const
|
||
{
|
||
return HDR_TYPE_NONE;
|
||
}
|
||
HDRType_t GetHardwareHDRType() const
|
||
{
|
||
return HDR_TYPE_NONE;
|
||
}
|
||
#endif
|
||
virtual bool NeedsATICentroidHack() const
|
||
{
|
||
return false;
|
||
}
|
||
virtual bool SupportsColorOnSecondStream() const
|
||
{
|
||
return false;
|
||
}
|
||
virtual bool SupportsStaticPlusDynamicLighting() const
|
||
{
|
||
return false;
|
||
}
|
||
virtual bool SupportsStreamOffset() const
|
||
{
|
||
return false;
|
||
}
|
||
void SetDefaultDynamicState()
|
||
{
|
||
}
|
||
virtual void CommitPixelShaderLighting( int pshReg )
|
||
{
|
||
}
|
||
|
||
ShaderAPIOcclusionQuery_t CreateOcclusionQueryObject( void )
|
||
{
|
||
return INVALID_SHADERAPI_OCCLUSION_QUERY_HANDLE;
|
||
}
|
||
|
||
void DestroyOcclusionQueryObject( ShaderAPIOcclusionQuery_t handle )
|
||
{
|
||
}
|
||
|
||
void BeginOcclusionQueryDrawing( ShaderAPIOcclusionQuery_t handle )
|
||
{
|
||
}
|
||
|
||
void EndOcclusionQueryDrawing( ShaderAPIOcclusionQuery_t handle )
|
||
{
|
||
}
|
||
|
||
int OcclusionQuery_GetNumPixelsRendered( ShaderAPIOcclusionQuery_t handle, bool bFlush )
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
|
||
virtual void AcquireThreadOwnership() {}
|
||
virtual void ReleaseThreadOwnership() {}
|
||
|
||
virtual bool SupportsBorderColor() const { return false; }
|
||
virtual bool SupportsFetch4() const { return false; }
|
||
virtual void EnableBuffer2FramesAhead( bool bEnable ) {}
|
||
virtual float GetShadowDepthBias() const { return 0.0f; }
|
||
virtual float GetShadowSlopeScaleDepthBias() const { return 0.0f; }
|
||
virtual bool PreferZPrepass() const { return false; }
|
||
virtual bool SuppressPixelShaderCentroidHackFixup() const { return true; }
|
||
virtual bool PreferTexturesInHWMemory() const { return false; }
|
||
virtual bool PreferHardwareSync() const { return false; }
|
||
virtual bool IsUnsupported() const { return false; }
|
||
|
||
virtual void SetDepthFeatheringShaderConstants( int iConstant, float fDepthBlendScale ) {}
|
||
|
||
virtual TessellationMode_t GetTessellationMode() const { return TESSELLATION_MODE_DISABLED; }
|
||
|
||
void SetPixelShaderFogParams( int reg ) {}
|
||
|
||
virtual bool InFlashlightMode() const
|
||
{
|
||
return false;
|
||
}
|
||
virtual bool IsRenderingPaint() const
|
||
{
|
||
return false;
|
||
}
|
||
virtual bool InEditorMode() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
// Binds a standard texture
|
||
virtual void BindStandardTexture( Sampler_t stage, TextureBindFlags_t nBindFlags, StandardTextureId_t id )
|
||
{
|
||
}
|
||
|
||
virtual void BindStandardVertexTexture( VertexTextureSampler_t stage, StandardTextureId_t id )
|
||
{
|
||
}
|
||
|
||
virtual void GetStandardTextureDimensions( int *pWidth, int *pHeight, StandardTextureId_t id )
|
||
{
|
||
*pWidth = *pHeight = 0;
|
||
}
|
||
|
||
virtual float GetSubDHeight()
|
||
{
|
||
return 0.0f;
|
||
}
|
||
|
||
virtual bool IsStereoActiveThisFrame() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
virtual void SetFlashlightState( const FlashlightState_t &state, const VMatrix &worldToTexture )
|
||
{
|
||
}
|
||
|
||
virtual void SetFlashlightStateEx( const FlashlightState_t &state, const VMatrix &worldToTexture, ITexture *pFlashlightDepthTexture )
|
||
{
|
||
}
|
||
|
||
virtual bool IsCascadedShadowMapping() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
virtual void SetCascadedShadowMapping( bool bEnable )
|
||
{
|
||
bEnable;
|
||
}
|
||
|
||
virtual void SetCascadedShadowMappingState( const CascadedShadowMappingState_t &state, ITexture *pDepthTextureAtlas )
|
||
{
|
||
state, pDepthTextureAtlas;
|
||
}
|
||
|
||
virtual const CascadedShadowMappingState_t &GetCascadedShadowMappingState( ITexture **pDepthTextureAtlas, bool bLightMapScale = false ) const
|
||
{
|
||
static CascadedShadowMappingState_t dummyState;
|
||
return dummyState;
|
||
}
|
||
|
||
virtual const FlashlightState_t &GetFlashlightState( VMatrix &worldToTexture ) const
|
||
{
|
||
static FlashlightState_t blah;
|
||
return blah;
|
||
}
|
||
|
||
virtual const FlashlightState_t &GetFlashlightStateEx( VMatrix &worldToTexture, ITexture **pFlashlightDepthTexture ) const
|
||
{
|
||
static FlashlightState_t blah;
|
||
return blah;
|
||
}
|
||
|
||
virtual void GetFlashlightShaderInfo( bool *pShadowsEnabled, bool *pUberLight ) const
|
||
{
|
||
*pShadowsEnabled = false;
|
||
*pUberLight = false;
|
||
}
|
||
|
||
virtual float GetFlashlightAmbientOcclusion( ) const { return 1.0f; }
|
||
|
||
virtual void ClearVertexAndPixelShaderRefCounts()
|
||
{
|
||
}
|
||
|
||
virtual void PurgeUnusedVertexAndPixelShaders()
|
||
{
|
||
}
|
||
|
||
virtual void DrawInstances( int nCount, const MeshInstanceData_t *pInstanceData ) {}
|
||
|
||
virtual bool IsAAEnabled() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
virtual int GetVertexTextureCount() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
virtual int GetMaxVertexTextureDimension() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
virtual int MaxTextureDepth() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
// Sets morph target factors
|
||
virtual void SetFlexWeights( int nFirstWeight, int nCount, const MorphWeight_t* pWeights )
|
||
{
|
||
}
|
||
|
||
// NOTE: Stuff after this is added after shipping HL2.
|
||
ITexture *GetRenderTargetEx( int nRenderTargetID ) const
|
||
{
|
||
return NULL;
|
||
}
|
||
|
||
void SetToneMappingScaleLinear( const Vector &scale )
|
||
{
|
||
}
|
||
|
||
const Vector &GetToneMappingScaleLinear( void ) const
|
||
{
|
||
static Vector dummy;
|
||
return dummy;
|
||
}
|
||
|
||
// For dealing with device lost in cases where SwapBuffers isn't called all the time (Hammer)
|
||
virtual void HandleDeviceLost()
|
||
{
|
||
}
|
||
|
||
virtual void EnableLinearColorSpaceFrameBuffer( bool bEnable )
|
||
{
|
||
}
|
||
|
||
// Lets the shader know about the full-screen texture so it can
|
||
virtual void SetFullScreenTextureHandle( ShaderAPITextureHandle_t h )
|
||
{
|
||
}
|
||
|
||
void SetFloatRenderingParameter(int parm_number, float value)
|
||
{
|
||
}
|
||
|
||
void SetIntRenderingParameter(int parm_number, int value)
|
||
{
|
||
}
|
||
void SetTextureRenderingParameter(int parm_number, ITexture *pTexture)
|
||
{
|
||
}
|
||
void SetVectorRenderingParameter(int parm_number, Vector const &value)
|
||
{
|
||
}
|
||
|
||
float GetFloatRenderingParameter(int parm_number) const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
int GetIntRenderingParameter(int parm_number) const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
ITexture *GetTextureRenderingParameter(int parm_number) const
|
||
{
|
||
return NULL;
|
||
}
|
||
|
||
Vector GetVectorRenderingParameter(int parm_number) const
|
||
{
|
||
return Vector(0,0,0);
|
||
}
|
||
|
||
// Methods related to stencil
|
||
void SetStencilState( const ShaderStencilState_t &state )
|
||
{
|
||
}
|
||
|
||
void ClearStencilBufferRectangle( int xmin, int ymin, int xmax, int ymax,int value)
|
||
{
|
||
}
|
||
|
||
virtual void GetMaxToRender( IMesh *pMesh, bool bMaxUntilFlush, int *pMaxVerts, int *pMaxIndices )
|
||
{
|
||
*pMaxVerts = 32768;
|
||
*pMaxIndices = 32768;
|
||
}
|
||
|
||
// Returns the max possible vertices + indices to render in a single draw call
|
||
virtual int GetMaxVerticesToRender( IMaterial *pMaterial )
|
||
{
|
||
return 32768;
|
||
}
|
||
|
||
virtual int GetMaxIndicesToRender( )
|
||
{
|
||
return 32768;
|
||
}
|
||
virtual int CompareSnapshots( StateSnapshot_t snapshot0, StateSnapshot_t snapshot1 ) { return 0; }
|
||
|
||
virtual void DisableAllLocalLights() {}
|
||
|
||
virtual bool SupportsMSAAMode( int nMSAAMode ) { return false; }
|
||
|
||
virtual bool SupportsCSAAMode( int nNumSamples, int nQualityLevel ) { return false; }
|
||
|
||
// Hooks for firing PIX events from outside the Material System...
|
||
virtual void BeginPIXEvent( unsigned long color, const char *szName ) {}
|
||
virtual void EndPIXEvent() {}
|
||
virtual void SetPIXMarker( unsigned long color, const char *szName ) {}
|
||
|
||
virtual void ComputeVertexDescription( unsigned char* pBuffer, VertexFormat_t vertexFormat, MeshDesc_t& desc ) const {}
|
||
virtual int VertexFormatSize( VertexFormat_t vertexFormat ) const { return 0; }
|
||
|
||
virtual bool SupportsShadowDepthTextures() { return false; }
|
||
|
||
virtual bool SupportsFetch4() { return false; }
|
||
|
||
virtual int NeedsShaderSRGBConversion(void) const { return 0; }
|
||
virtual bool UsesSRGBCorrectBlending() const { return false; }
|
||
|
||
virtual bool HasFastVertexTextures() const { return false; }
|
||
virtual bool ActualHasFastVertexTextures() const { return false; }
|
||
|
||
virtual void SetShadowDepthBiasFactors( float fShadowSlopeScaleDepthBias, float fShadowDepthBias ) {}
|
||
|
||
virtual void SetDisallowAccess( bool ) {}
|
||
virtual void EnableShaderShaderMutex( bool ) {}
|
||
virtual void ShaderLock() {}
|
||
virtual void ShaderUnlock() {}
|
||
|
||
// ------------ New Vertex/Index Buffer interface ----------------------------
|
||
void BindVertexBuffer( int streamID, IVertexBuffer *pVertexBuffer, int nOffsetInBytes, int nFirstVertex, int nVertexCount, VertexFormat_t fmt, int nRepetitions1 )
|
||
{
|
||
}
|
||
void BindIndexBuffer( IIndexBuffer *pIndexBuffer, int nOffsetInBytes )
|
||
{
|
||
}
|
||
void Draw( MaterialPrimitiveType_t primitiveType, int firstIndex, int numIndices )
|
||
{
|
||
}
|
||
// ------------ End ----------------------------
|
||
|
||
virtual int GetVertexBufferCompression( void ) const { return 0; };
|
||
|
||
virtual bool ShouldWriteDepthToDestAlpha( void ) const { return false; };
|
||
#ifdef _GAMECONSOLE
|
||
// Vitaliy: need HDR to run with -noshaderapi on console
|
||
virtual bool SupportsHDRMode( HDRType_t nMode ) const { return nMode == HDR_TYPE_NONE || nMode == HDR_TYPE_INTEGER; }
|
||
#else
|
||
virtual bool SupportsHDRMode( HDRType_t nMode ) const { return false; }
|
||
#endif
|
||
virtual bool IsDX10Card() const { return false; };
|
||
|
||
void PushDeformation( const DeformationBase_t *pDeformation )
|
||
{
|
||
}
|
||
|
||
virtual void PopDeformation( )
|
||
{
|
||
}
|
||
|
||
int GetNumActiveDeformations( ) const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
// for shaders to set vertex shader constants. returns a packed state which can be used to set the dynamic combo
|
||
int GetPackedDeformationInformation( int nMaskOfUnderstoodDeformations,
|
||
float *pConstantValuesOut,
|
||
int nBufferSize,
|
||
int nMaximumDeformations,
|
||
int *pNumDefsOut ) const
|
||
{
|
||
*pNumDefsOut = 0;
|
||
return 0;
|
||
}
|
||
|
||
void SetStandardTextureHandle(StandardTextureId_t,ShaderAPITextureHandle_t)
|
||
{
|
||
}
|
||
|
||
virtual void ExecuteCommandBuffer( uint8 *pData )
|
||
{
|
||
}
|
||
virtual bool GetHDREnabled( void ) const { return true; }
|
||
virtual void SetHDREnabled( bool bEnable ) {}
|
||
|
||
virtual void SetTextureFilterMode( Sampler_t sampler, TextureFilterMode_t nMode )
|
||
{
|
||
}
|
||
|
||
virtual void SetScreenSizeForVPOS( int pshReg ) {}
|
||
virtual void SetVSNearAndFarZ( int vshReg ) {}
|
||
virtual float GetFarZ() { return 1000.0f; }
|
||
|
||
virtual void EnableSinglePassFlashlightMode( bool bEnable ) {}
|
||
virtual bool SinglePassFlashlightModeEnabled( void ) { return false; }
|
||
virtual void FlipCulling( bool bFlipCulling ) {}
|
||
|
||
virtual void UpdateGameTime( float flTime ) {}
|
||
|
||
virtual bool IsStereoSupported() const { return false; }
|
||
virtual void UpdateStereoTexture( ShaderAPITextureHandle_t texHandle, bool *pStereoActiveThisFrame ) {}
|
||
virtual void SetSRGBWrite( bool bState ) {}
|
||
|
||
void PrintfVA( char *fmt, va_list vargs ) {}
|
||
void Printf( char *fmt, ... ) {}
|
||
float Knob( char *knobname, float *setvalue = NULL ) { return 0.0f; };
|
||
void AddShaderComboInformation( const ShaderComboSemantics_t *pSemantics ) {}
|
||
|
||
virtual void SpinPresent( uint nFrames ){}
|
||
virtual void AntiAliasingHint( int nHint ) {}
|
||
|
||
virtual bool SupportsCascadedShadowMapping() const { return true; }
|
||
virtual CSMQualityMode_t GetCSMQuality() const { return CSMQUALITY_VERY_LOW; }
|
||
virtual bool SupportsBilinearPCFSampling() const { return true; }
|
||
virtual CSMShaderMode_t GetCSMShaderMode( CSMQualityMode_t nQualityLevel ) const { nQualityLevel; return CSMSHADERMODE_LOW_OR_VERY_LOW; }
|
||
virtual void SetCSMAccurateBlending( bool bEnable ) {}
|
||
virtual bool GetCSMAccurateBlending() const { return true; }
|
||
|
||
virtual bool SupportsResolveDepth() const { return false; }
|
||
virtual bool HasFullResolutionDepthTexture() const { return false; }
|
||
|
||
private:
|
||
enum
|
||
{
|
||
TRANSLUCENT = 0x1,
|
||
ALPHATESTED = 0x2,
|
||
VERTEX_AND_PIXEL_SHADERS = 0x4,
|
||
DEPTHWRITE = 0x8,
|
||
};
|
||
|
||
CEmptyMesh m_Mesh;
|
||
|
||
void EnableAlphaToCoverage() {} ;
|
||
void DisableAlphaToCoverage() {} ;
|
||
|
||
ImageFormat GetShadowDepthTextureFormat() { return IMAGE_FORMAT_UNKNOWN; };
|
||
ImageFormat GetHighPrecisionShadowDepthTextureFormat() { return IMAGE_FORMAT_UNKNOWN; };
|
||
ImageFormat GetNullTextureFormat() { return IMAGE_FORMAT_UNKNOWN; };
|
||
|
||
float GetLightMapScaleFactor() const { return 1.0f; }
|
||
ShaderAPITextureHandle_t FindTexture( const char *pDebugName ) { return INVALID_SHADERAPI_TEXTURE_HANDLE;};
|
||
void GetTextureDimensions( ShaderAPITextureHandle_t hTexture, int &nWidth, int &nHeight, int &nDepth ) {};
|
||
|
||
ShaderAPITextureHandle_t GetStandardTextureHandle(StandardTextureId_t id) { return INVALID_SHADERAPI_TEXTURE_HANDLE; }
|
||
};
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Class Factory
|
||
//-----------------------------------------------------------------------------
|
||
|
||
static CShaderAPIEmpty g_ShaderAPIEmpty;
|
||
static CShaderShadowEmpty g_ShaderShadow;
|
||
|
||
// FIXME: Remove; it's for backward compat with the materialsystem only for now
|
||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CShaderAPIEmpty, IShaderAPI,
|
||
SHADERAPI_INTERFACE_VERSION, g_ShaderAPIEmpty )
|
||
|
||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CShaderShadowEmpty, IShaderShadow,
|
||
SHADERSHADOW_INTERFACE_VERSION, g_ShaderShadow )
|
||
|
||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CShaderAPIEmpty, IMaterialSystemHardwareConfig,
|
||
MATERIALSYSTEM_HARDWARECONFIG_INTERFACE_VERSION, g_ShaderAPIEmpty )
|
||
|
||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CShaderAPIEmpty, IDebugTextureInfo,
|
||
DEBUG_TEXTURE_INFO_VERSION, g_ShaderAPIEmpty )
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// The main GL Shader util interface
|
||
//-----------------------------------------------------------------------------
|
||
IShaderUtil* g_pShaderUtil;
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Factory to return from SetMode
|
||
//-----------------------------------------------------------------------------
|
||
static void* ShaderInterfaceFactory( const char *pInterfaceName, int *pReturnCode )
|
||
{
|
||
if ( pReturnCode )
|
||
{
|
||
*pReturnCode = IFACE_OK;
|
||
}
|
||
if ( !Q_stricmp( pInterfaceName, SHADER_DEVICE_INTERFACE_VERSION ) )
|
||
return static_cast< IShaderDevice* >( &s_ShaderDeviceEmpty );
|
||
if ( !Q_stricmp( pInterfaceName, SHADERAPI_INTERFACE_VERSION ) )
|
||
return static_cast< IShaderAPI* >( &g_ShaderAPIEmpty );
|
||
if ( !Q_stricmp( pInterfaceName, SHADERSHADOW_INTERFACE_VERSION ) )
|
||
return static_cast< IShaderShadow* >( &g_ShaderShadow );
|
||
|
||
if ( pReturnCode )
|
||
{
|
||
*pReturnCode = IFACE_FAILED;
|
||
}
|
||
return NULL;
|
||
}
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
//
|
||
// CShaderDeviceMgrEmpty
|
||
//
|
||
//-----------------------------------------------------------------------------
|
||
bool CShaderDeviceMgrEmpty::Connect( CreateInterfaceFn factory )
|
||
{
|
||
// So others can access it
|
||
g_pShaderUtil = (IShaderUtil*)factory( SHADER_UTIL_INTERFACE_VERSION, NULL );
|
||
|
||
return true;
|
||
}
|
||
|
||
void CShaderDeviceMgrEmpty::Disconnect()
|
||
{
|
||
g_pShaderUtil = NULL;
|
||
}
|
||
|
||
void *CShaderDeviceMgrEmpty::QueryInterface( const char *pInterfaceName )
|
||
{
|
||
if ( !Q_stricmp( pInterfaceName, SHADER_DEVICE_MGR_INTERFACE_VERSION ) )
|
||
return static_cast< IShaderDeviceMgr* >( this );
|
||
if ( !Q_stricmp( pInterfaceName, MATERIALSYSTEM_HARDWARECONFIG_INTERFACE_VERSION ) )
|
||
return static_cast< IMaterialSystemHardwareConfig* >( &g_ShaderAPIEmpty );
|
||
return NULL;
|
||
}
|
||
|
||
InitReturnVal_t CShaderDeviceMgrEmpty::Init()
|
||
{
|
||
return INIT_OK;
|
||
}
|
||
|
||
void CShaderDeviceMgrEmpty::Shutdown()
|
||
{
|
||
|
||
}
|
||
|
||
// Sets the adapter
|
||
bool CShaderDeviceMgrEmpty::SetAdapter( int nAdapter, int nFlags )
|
||
{
|
||
return true;
|
||
}
|
||
|
||
// FIXME: Is this a public interface? Might only need to be private to shaderapi
|
||
CreateInterfaceFn CShaderDeviceMgrEmpty::SetMode( void *hWnd, int nAdapter, const ShaderDeviceInfo_t& mode )
|
||
{
|
||
return ShaderInterfaceFactory;
|
||
}
|
||
|
||
// Gets the number of adapters...
|
||
int CShaderDeviceMgrEmpty::GetAdapterCount() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
bool CShaderDeviceMgrEmpty::GetRecommendedVideoConfig( int nAdapter, KeyValues *pKeyValues )
|
||
{
|
||
return true;
|
||
}
|
||
|
||
bool CShaderDeviceMgrEmpty::GetRecommendedConfigurationInfo( int nAdapter, int nDXLevel, KeyValues *pKeyValues )
|
||
{
|
||
return true;
|
||
}
|
||
|
||
// Returns info about each adapter
|
||
void CShaderDeviceMgrEmpty::GetAdapterInfo( int adapter, MaterialAdapterInfo_t& info ) const
|
||
{
|
||
memset( &info, 0, sizeof( info ) );
|
||
info.m_nDXSupportLevel = 90;
|
||
}
|
||
|
||
// Returns the number of modes
|
||
int CShaderDeviceMgrEmpty::GetModeCount( int nAdapter ) const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
// Returns mode information..
|
||
void CShaderDeviceMgrEmpty::GetModeInfo( ShaderDisplayMode_t *pInfo, int nAdapter, int nMode ) const
|
||
{
|
||
}
|
||
|
||
void CShaderDeviceMgrEmpty::GetCurrentModeInfo( ShaderDisplayMode_t* pInfo, int nAdapter ) const
|
||
{
|
||
}
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
//
|
||
// Shader device empty
|
||
//
|
||
//-----------------------------------------------------------------------------
|
||
void CShaderDeviceEmpty::GetWindowSize( int &width, int &height ) const
|
||
{
|
||
if ( IsPC() )
|
||
{
|
||
width = 0;
|
||
height = 0;
|
||
}
|
||
else
|
||
{
|
||
width = 640;
|
||
height = 480;
|
||
}
|
||
}
|
||
|
||
void CShaderDeviceEmpty::GetBackBufferDimensions( int& width, int& height ) const
|
||
{
|
||
if ( IsPC() )
|
||
{
|
||
width = 1024;
|
||
height = 768;
|
||
}
|
||
else
|
||
{
|
||
width = 640;
|
||
height = 480;
|
||
}
|
||
}
|
||
|
||
// Use this to spew information about the 3D layer
|
||
void CShaderDeviceEmpty::SpewDriverInfo() const
|
||
{
|
||
Warning("Empty shader\n");
|
||
}
|
||
|
||
// Creates/ destroys a child window
|
||
bool CShaderDeviceEmpty::AddView( void* hwnd )
|
||
{
|
||
return true;
|
||
}
|
||
|
||
void CShaderDeviceEmpty::RemoveView( void* hwnd )
|
||
{
|
||
}
|
||
|
||
// Activates a view
|
||
void CShaderDeviceEmpty::SetView( void* hwnd )
|
||
{
|
||
}
|
||
|
||
void CShaderDeviceEmpty::ReleaseResources( bool bReleaseManagedResources /*= true*/ )
|
||
{
|
||
}
|
||
|
||
void CShaderDeviceEmpty::ReacquireResources()
|
||
{
|
||
}
|
||
|
||
// Creates/destroys Mesh
|
||
IMesh* CShaderDeviceEmpty::CreateStaticMesh( VertexFormat_t fmt, const char *pTextureBudgetGroup, IMaterial * pMaterial, VertexStreamSpec_t *pStreamSpec )
|
||
{
|
||
return &m_Mesh;
|
||
}
|
||
|
||
void CShaderDeviceEmpty::DestroyStaticMesh( IMesh* mesh )
|
||
{
|
||
}
|
||
|
||
// Creates/destroys static vertex + index buffers
|
||
IVertexBuffer *CShaderDeviceEmpty::CreateVertexBuffer( ShaderBufferType_t type, VertexFormat_t fmt, int nVertexCount, const char *pTextureBudgetGroup )
|
||
{
|
||
return ( type == SHADER_BUFFER_TYPE_STATIC || type == SHADER_BUFFER_TYPE_STATIC_TEMP ) ? &m_Mesh : &m_DynamicMesh;
|
||
}
|
||
|
||
void CShaderDeviceEmpty::DestroyVertexBuffer( IVertexBuffer *pVertexBuffer )
|
||
{
|
||
|
||
}
|
||
|
||
IIndexBuffer *CShaderDeviceEmpty::CreateIndexBuffer( ShaderBufferType_t bufferType, MaterialIndexFormat_t fmt, int nIndexCount, const char *pTextureBudgetGroup )
|
||
{
|
||
switch( bufferType )
|
||
{
|
||
case SHADER_BUFFER_TYPE_STATIC:
|
||
case SHADER_BUFFER_TYPE_STATIC_TEMP:
|
||
return &m_Mesh;
|
||
default:
|
||
Assert( 0 );
|
||
case SHADER_BUFFER_TYPE_DYNAMIC:
|
||
case SHADER_BUFFER_TYPE_DYNAMIC_TEMP:
|
||
return &m_DynamicMesh;
|
||
}
|
||
}
|
||
|
||
void CShaderDeviceEmpty::DestroyIndexBuffer( IIndexBuffer *pIndexBuffer )
|
||
{
|
||
|
||
}
|
||
|
||
IVertexBuffer *CShaderDeviceEmpty::GetDynamicVertexBuffer( int streamID, VertexFormat_t vertexFormat, bool bBuffered )
|
||
{
|
||
return &m_DynamicMesh;
|
||
}
|
||
|
||
IIndexBuffer *CShaderDeviceEmpty::GetDynamicIndexBuffer()
|
||
{
|
||
return &m_Mesh;
|
||
}
|
||
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
//
|
||
// The empty mesh...
|
||
//
|
||
//-----------------------------------------------------------------------------
|
||
CEmptyMesh::CEmptyMesh( bool bIsDynamic ) : m_bIsDynamic( bIsDynamic )
|
||
{
|
||
m_pVertexMemory = new unsigned char[VERTEX_BUFFER_SIZE];
|
||
}
|
||
|
||
CEmptyMesh::~CEmptyMesh()
|
||
{
|
||
delete[] m_pVertexMemory;
|
||
}
|
||
|
||
bool CEmptyMesh::Lock( int nMaxIndexCount, bool bAppend, IndexDesc_t& desc )
|
||
{
|
||
static int s_BogusIndex;
|
||
desc.m_pIndices = (unsigned short*)&s_BogusIndex;
|
||
desc.m_nIndexSize = 0;
|
||
desc.m_nFirstIndex = 0;
|
||
desc.m_nOffset = 0;
|
||
return true;
|
||
}
|
||
|
||
void CEmptyMesh::Unlock( int nWrittenIndexCount, IndexDesc_t& desc )
|
||
{
|
||
}
|
||
|
||
void CEmptyMesh::ModifyBegin( bool bReadOnly, int nFirstIndex, int nIndexCount, IndexDesc_t& desc )
|
||
{
|
||
Lock( nIndexCount, false, desc );
|
||
}
|
||
|
||
void CEmptyMesh::ModifyEnd( IndexDesc_t& desc )
|
||
{
|
||
}
|
||
|
||
void CEmptyMesh::Spew( int nIndexCount, const IndexDesc_t & desc )
|
||
{
|
||
}
|
||
|
||
void CEmptyMesh::ValidateData( int nIndexCount, const IndexDesc_t &desc )
|
||
{
|
||
}
|
||
|
||
bool CEmptyMesh::Lock( int nVertexCount, bool bAppend, VertexDesc_t &desc )
|
||
{
|
||
// Who cares about the data?
|
||
desc.m_pPosition = (float*)m_pVertexMemory;
|
||
desc.m_pNormal = (float*)m_pVertexMemory;
|
||
desc.m_pColor = m_pVertexMemory;
|
||
|
||
int i;
|
||
for ( i = 0; i < VERTEX_MAX_TEXTURE_COORDINATES; ++i)
|
||
{
|
||
desc.m_pTexCoord[i] = (float*)m_pVertexMemory;
|
||
}
|
||
|
||
desc.m_pBoneWeight = (float*)m_pVertexMemory;
|
||
desc.m_pBoneMatrixIndex = (unsigned char*)m_pVertexMemory;
|
||
desc.m_pTangentS = (float*)m_pVertexMemory;
|
||
desc.m_pTangentT = (float*)m_pVertexMemory;
|
||
desc.m_pUserData = (float*)m_pVertexMemory;
|
||
desc.m_pSpecular = m_pVertexMemory;
|
||
desc.m_pWrinkle = (float*)m_pVertexMemory;
|
||
desc.m_NumBoneWeights = 2;
|
||
|
||
desc.m_VertexSize_Position = 0;
|
||
desc.m_VertexSize_BoneWeight = 0;
|
||
desc.m_VertexSize_BoneMatrixIndex = 0;
|
||
desc.m_VertexSize_Normal = 0;
|
||
desc.m_VertexSize_Color = 0;
|
||
for( i=0; i < VERTEX_MAX_TEXTURE_COORDINATES; i++ )
|
||
{
|
||
desc.m_VertexSize_TexCoord[i] = 0;
|
||
}
|
||
desc.m_VertexSize_TangentS = 0;
|
||
desc.m_VertexSize_TangentT = 0;
|
||
desc.m_VertexSize_UserData = 0;
|
||
desc.m_VertexSize_Specular = 0;
|
||
desc.m_VertexSize_Wrinkle = 0;
|
||
desc.m_ActualVertexSize = 0; // Size of the vertices.. Some of the m_VertexSize_ elements above
|
||
|
||
desc.m_nFirstVertex = 0;
|
||
desc.m_nOffset = 0;
|
||
return true;
|
||
}
|
||
|
||
void CEmptyMesh::Unlock( int nVertexCount, VertexDesc_t &desc )
|
||
{
|
||
}
|
||
|
||
void CEmptyMesh::Spew( int nVertexCount, const VertexDesc_t &desc )
|
||
{
|
||
}
|
||
|
||
void CEmptyMesh::ValidateData( int nVertexCount, const VertexDesc_t & desc )
|
||
{
|
||
}
|
||
|
||
void CEmptyMesh::LockMesh( int numVerts, int numIndices, MeshDesc_t& desc, MeshBuffersAllocationSettings_t *pSettings )
|
||
{
|
||
Lock( numVerts, false, *static_cast<VertexDesc_t*>( &desc ) );
|
||
Lock( numIndices, false, *static_cast<IndexDesc_t*>( &desc ) );
|
||
}
|
||
|
||
void CEmptyMesh::UnlockMesh( int numVerts, int numIndices, MeshDesc_t& desc )
|
||
{
|
||
}
|
||
|
||
void CEmptyMesh::ModifyBeginEx( bool bReadOnly, int firstVertex, int numVerts, int firstIndex, int numIndices, MeshDesc_t& desc )
|
||
{
|
||
Lock( numVerts, false, *static_cast<VertexDesc_t*>( &desc ) );
|
||
Lock( numIndices, false, *static_cast<IndexDesc_t*>( &desc ) );
|
||
}
|
||
|
||
void CEmptyMesh::ModifyBegin( int firstVertex, int numVerts, int firstIndex, int numIndices, MeshDesc_t& desc )
|
||
{
|
||
ModifyBeginEx( false, firstVertex, numVerts, firstIndex, numIndices, desc );
|
||
}
|
||
|
||
void CEmptyMesh::ModifyEnd( MeshDesc_t& desc )
|
||
{
|
||
}
|
||
|
||
// returns the # of vertices (static meshes only)
|
||
int CEmptyMesh::VertexCount() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
// Sets the primitive type
|
||
void CEmptyMesh::SetPrimitiveType( MaterialPrimitiveType_t type )
|
||
{
|
||
}
|
||
|
||
// Draws the entire mesh
|
||
void CEmptyMesh::Draw( int firstIndex, int numIndices )
|
||
{
|
||
}
|
||
|
||
void CEmptyMesh::Draw(CPrimList *pPrims, int nPrims)
|
||
{
|
||
}
|
||
|
||
// Copy verts and/or indices to a mesh builder. This only works for temp meshes!
|
||
void CEmptyMesh::CopyToMeshBuilder(
|
||
int iStartVert, // Which vertices to copy.
|
||
int nVerts,
|
||
int iStartIndex, // Which indices to copy.
|
||
int nIndices,
|
||
int indexOffset, // This is added to each index.
|
||
CMeshBuilder &builder )
|
||
{
|
||
}
|
||
|
||
// Spews the mesh data
|
||
void CEmptyMesh::Spew( int numVerts, int numIndices, const MeshDesc_t & desc )
|
||
{
|
||
}
|
||
|
||
void CEmptyMesh::ValidateData( int numVerts, int numIndices, const MeshDesc_t & desc )
|
||
{
|
||
}
|
||
|
||
// gets the associated material
|
||
IMaterial* CEmptyMesh::GetMaterial()
|
||
{
|
||
// umm. this don't work none
|
||
Assert(0);
|
||
return 0;
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// The shader shadow interface
|
||
//-----------------------------------------------------------------------------
|
||
CShaderShadowEmpty::CShaderShadowEmpty()
|
||
{
|
||
m_IsTranslucent = false;
|
||
m_ForceOpaque = false;
|
||
m_IsAlphaTested = false;
|
||
m_bIsDepthWriteEnabled = true;
|
||
m_bUsesVertexAndPixelShaders = false;
|
||
}
|
||
|
||
CShaderShadowEmpty::~CShaderShadowEmpty()
|
||
{
|
||
}
|
||
|
||
// Sets the default *shadow* state
|
||
void CShaderShadowEmpty::SetDefaultState()
|
||
{
|
||
m_IsTranslucent = false;
|
||
m_ForceOpaque = false;
|
||
m_IsAlphaTested = false;
|
||
m_bIsDepthWriteEnabled = true;
|
||
m_bUsesVertexAndPixelShaders = false;
|
||
}
|
||
|
||
// Methods related to depth buffering
|
||
void CShaderShadowEmpty::DepthFunc( ShaderDepthFunc_t depthFunc )
|
||
{
|
||
}
|
||
|
||
void CShaderShadowEmpty::EnableDepthWrites( bool bEnable )
|
||
{
|
||
m_bIsDepthWriteEnabled = bEnable;
|
||
}
|
||
|
||
void CShaderShadowEmpty::EnableDepthTest( bool bEnable )
|
||
{
|
||
}
|
||
|
||
void CShaderShadowEmpty::EnablePolyOffset( PolygonOffsetMode_t nOffsetMode )
|
||
{
|
||
}
|
||
|
||
// Suppresses/activates color writing
|
||
void CShaderShadowEmpty::EnableColorWrites( bool bEnable )
|
||
{
|
||
}
|
||
|
||
// Suppresses/activates alpha writing
|
||
void CShaderShadowEmpty::EnableAlphaWrites( bool bEnable )
|
||
{
|
||
}
|
||
|
||
// Methods related to alpha blending
|
||
void CShaderShadowEmpty::EnableBlending( bool bEnable )
|
||
{
|
||
m_IsTranslucent = bEnable;
|
||
m_ForceOpaque = false;
|
||
}
|
||
|
||
void CShaderShadowEmpty::EnableBlendingForceOpaque( bool bEnable )
|
||
{
|
||
m_IsTranslucent = bEnable;
|
||
m_ForceOpaque = true;
|
||
}
|
||
|
||
void CShaderShadowEmpty::BlendFunc( ShaderBlendFactor_t srcFactor, ShaderBlendFactor_t dstFactor )
|
||
{
|
||
}
|
||
|
||
// Alpha testing
|
||
void CShaderShadowEmpty::EnableAlphaTest( bool bEnable )
|
||
{
|
||
m_IsAlphaTested = bEnable;
|
||
}
|
||
|
||
void CShaderShadowEmpty::AlphaFunc( ShaderAlphaFunc_t alphaFunc, float alphaRef /* [0-1] */ )
|
||
{
|
||
}
|
||
|
||
|
||
// Wireframe/filled polygons
|
||
void CShaderShadowEmpty::PolyMode( ShaderPolyModeFace_t face, ShaderPolyMode_t polyMode )
|
||
{
|
||
}
|
||
|
||
|
||
// Back face culling
|
||
void CShaderShadowEmpty::EnableCulling( bool bEnable )
|
||
{
|
||
}
|
||
|
||
|
||
// Alpha to coverage
|
||
void CShaderShadowEmpty::EnableAlphaToCoverage( bool bEnable )
|
||
{
|
||
}
|
||
|
||
// Indicates the vertex format for use with a vertex shader
|
||
// The flags to pass in here come from the VertexFormatFlags_t enum
|
||
// If pTexCoordDimensions is *not* specified, we assume all coordinates
|
||
// are 2-dimensional
|
||
void CShaderShadowEmpty::VertexShaderVertexFormat( unsigned int nFlags,
|
||
int nTexCoordCount,
|
||
int* pTexCoordDimensions,
|
||
int nUserDataSize )
|
||
{
|
||
}
|
||
|
||
// Sets the vertex and pixel shaders
|
||
void CShaderShadowEmpty::SetVertexShader( const char *pShaderName, int vshIndex )
|
||
{
|
||
m_bUsesVertexAndPixelShaders = ( pShaderName != NULL );
|
||
}
|
||
|
||
void CShaderShadowEmpty::EnableBlendingSeparateAlpha( bool bEnable )
|
||
{
|
||
}
|
||
void CShaderShadowEmpty::SetPixelShader( const char *pShaderName, int pshIndex )
|
||
{
|
||
m_bUsesVertexAndPixelShaders = ( pShaderName != NULL );
|
||
}
|
||
|
||
void CShaderShadowEmpty::BlendFuncSeparateAlpha( ShaderBlendFactor_t srcFactor, ShaderBlendFactor_t dstFactor )
|
||
{
|
||
}
|
||
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
//
|
||
// Shader API Empty
|
||
//
|
||
//-----------------------------------------------------------------------------
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Constructor, destructor
|
||
//-----------------------------------------------------------------------------
|
||
|
||
CShaderAPIEmpty::CShaderAPIEmpty() : m_Mesh( false )
|
||
{
|
||
}
|
||
|
||
CShaderAPIEmpty::~CShaderAPIEmpty()
|
||
{
|
||
}
|
||
|
||
|
||
bool CShaderAPIEmpty::DoRenderTargetsNeedSeparateDepthBuffer() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
// Can we download textures?
|
||
bool CShaderAPIEmpty::CanDownloadTextures() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
// Used to clear the transition table when we know it's become invalid.
|
||
void CShaderAPIEmpty::ClearSnapshots()
|
||
{
|
||
}
|
||
|
||
// Members of IMaterialSystemHardwareConfig
|
||
bool CShaderAPIEmpty::HasDestAlphaBuffer() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::HasStencilBuffer() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
int CShaderAPIEmpty::MaxViewports() const
|
||
{
|
||
return 1;
|
||
}
|
||
|
||
ShadowFilterMode_t CShaderAPIEmpty::GetShadowFilterMode( bool bForceLowQualityShadows, bool bPS30 ) const
|
||
{
|
||
bForceLowQualityShadows;
|
||
bPS30;
|
||
return SHADOWFILTERMODE_DEFAULT;
|
||
}
|
||
|
||
int CShaderAPIEmpty::StencilBufferBits() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
int CShaderAPIEmpty::GetFrameBufferColorDepth() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
int CShaderAPIEmpty::GetSamplerCount() const
|
||
{
|
||
return 4;
|
||
}
|
||
|
||
|
||
int CShaderAPIEmpty::GetVertexSamplerCount() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
|
||
bool CShaderAPIEmpty::HasSetDeviceGammaRamp() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::SupportsCompressedTextures() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::SupportsStaticControlFlow() const
|
||
{
|
||
// Yes, unconditionally unless we're on POSIX
|
||
return !IsOpenGL();
|
||
}
|
||
|
||
VertexCompressionType_t CShaderAPIEmpty::SupportsCompressedVertices() const
|
||
{
|
||
return VERTEX_COMPRESSION_NONE;
|
||
}
|
||
|
||
int CShaderAPIEmpty::MaximumAnisotropicLevel() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetAnisotropicLevel( int nAnisotropyLevel )
|
||
{
|
||
}
|
||
|
||
int CShaderAPIEmpty::MaxTextureWidth() const
|
||
{
|
||
// Should be big enough to cover all cases
|
||
return 16384;
|
||
}
|
||
|
||
int CShaderAPIEmpty::MaxTextureHeight() const
|
||
{
|
||
// Should be big enough to cover all cases
|
||
return 16384;
|
||
}
|
||
|
||
int CShaderAPIEmpty::MaxTextureAspectRatio() const
|
||
{
|
||
// Should be big enough to cover all cases
|
||
return 16384;
|
||
}
|
||
|
||
|
||
int CShaderAPIEmpty::TextureMemorySize() const
|
||
{
|
||
// fake it
|
||
return 1024 * 1024 * 1024;
|
||
}
|
||
|
||
int CShaderAPIEmpty::GetDXSupportLevel() const
|
||
{
|
||
return 95;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::SupportsMipmappedCubemaps() const
|
||
{
|
||
return true;
|
||
}
|
||
|
||
int CShaderAPIEmpty::NumVertexShaderConstants() const
|
||
{
|
||
return 128;
|
||
}
|
||
|
||
int CShaderAPIEmpty::NumBooleanVertexShaderConstants() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
int CShaderAPIEmpty::NumIntegerVertexShaderConstants() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
int CShaderAPIEmpty::NumPixelShaderConstants() const
|
||
{
|
||
return 8;
|
||
}
|
||
|
||
int CShaderAPIEmpty::MaxNumLights() const
|
||
{
|
||
return 4;
|
||
}
|
||
|
||
// This is the max dx support level supported by the card
|
||
int CShaderAPIEmpty::GetMaxDXSupportLevel() const
|
||
{
|
||
return 90;
|
||
}
|
||
|
||
int CShaderAPIEmpty::MaxVertexShaderBlendMatrices() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
int CShaderAPIEmpty::MaxUserClipPlanes() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::SpecifiesFogColorInLinearSpace() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::SupportsSRGB() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::FakeSRGBWrite() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::CanDoSRGBReadFromRTs() const
|
||
{
|
||
return true;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::SupportsGLMixedSizeTargets() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
const char *CShaderAPIEmpty::GetHWSpecificShaderDLLName() const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
// Sets the default *dynamic* state
|
||
void CShaderAPIEmpty::SetDefaultState()
|
||
{
|
||
}
|
||
|
||
|
||
// Returns the snapshot id for the shader state
|
||
StateSnapshot_t CShaderAPIEmpty::TakeSnapshot( )
|
||
{
|
||
StateSnapshot_t id = 0;
|
||
if (g_ShaderShadow.m_IsTranslucent && !g_ShaderShadow.m_ForceOpaque)
|
||
id |= TRANSLUCENT;
|
||
if (g_ShaderShadow.m_IsAlphaTested)
|
||
id |= ALPHATESTED;
|
||
if (g_ShaderShadow.m_bUsesVertexAndPixelShaders)
|
||
id |= VERTEX_AND_PIXEL_SHADERS;
|
||
if (g_ShaderShadow.m_bIsDepthWriteEnabled)
|
||
id |= DEPTHWRITE;
|
||
return id;
|
||
}
|
||
|
||
// Returns true if the state snapshot is transparent
|
||
bool CShaderAPIEmpty::IsTranslucent( StateSnapshot_t id ) const
|
||
{
|
||
return (id & TRANSLUCENT) != 0;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::IsAlphaTested( StateSnapshot_t id ) const
|
||
{
|
||
return (id & ALPHATESTED) != 0;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::IsDepthWriteEnabled( StateSnapshot_t id ) const
|
||
{
|
||
return (id & DEPTHWRITE) != 0;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::UsesVertexAndPixelShaders( StateSnapshot_t id ) const
|
||
{
|
||
return (id & VERTEX_AND_PIXEL_SHADERS) != 0;
|
||
}
|
||
|
||
// Gets the vertex format for a set of snapshot ids
|
||
VertexFormat_t CShaderAPIEmpty::ComputeVertexFormat( int numSnapshots, StateSnapshot_t* pIds ) const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
// Gets the vertex format for a set of snapshot ids
|
||
VertexFormat_t CShaderAPIEmpty::ComputeVertexUsage( int numSnapshots, StateSnapshot_t* pIds ) const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
// Uses a state snapshot
|
||
void CShaderAPIEmpty::UseSnapshot( StateSnapshot_t snapshot )
|
||
{
|
||
}
|
||
|
||
// The shade mode
|
||
void CShaderAPIEmpty::ShadeMode( ShaderShadeMode_t mode )
|
||
{
|
||
}
|
||
|
||
// Binds a particular material to render with
|
||
void CShaderAPIEmpty::Bind( IMaterial* pMaterial )
|
||
{
|
||
}
|
||
|
||
// Cull mode
|
||
void CShaderAPIEmpty::CullMode( MaterialCullMode_t cullMode )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::FlipCullMode( void )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::ForceDepthFuncEquals( bool bEnable )
|
||
{
|
||
}
|
||
|
||
// Forces Z buffering on or off
|
||
void CShaderAPIEmpty::OverrideDepthEnable( bool bEnable, bool bDepthWriteEnable, bool bDepthTestEnable )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::OverrideAlphaWriteEnable( bool bOverrideEnable, bool bAlphaWriteEnable )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::OverrideColorWriteEnable( bool bOverrideEnable, bool bColorWriteEnable )
|
||
{
|
||
}
|
||
|
||
//legacy fast clipping linkage
|
||
void CShaderAPIEmpty::SetHeightClipZ( float z )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetHeightClipMode( enum MaterialHeightClipMode_t heightClipMode )
|
||
{
|
||
}
|
||
|
||
// Sets the lights
|
||
void CShaderAPIEmpty::SetLights( int nCount, const LightDesc_t *pDesc )
|
||
{
|
||
}
|
||
|
||
// Sets lighting origin for the current model
|
||
void CShaderAPIEmpty::SetLightingOrigin( Vector vLightingOrigin )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetAmbientLightCube( Vector4D cube[6] )
|
||
{
|
||
}
|
||
|
||
// Gets the lightmap dimensions
|
||
void CShaderAPIEmpty::GetLightmapDimensions( int *w, int *h )
|
||
{
|
||
g_pShaderUtil->GetLightmapDimensions( w, h );
|
||
}
|
||
|
||
// Gets the dynamic mesh; note that you've got to render the mesh
|
||
// before calling this function a second time. Clients should *not*
|
||
// call DestroyStaticMesh on the mesh returned by this call.
|
||
IMesh* CShaderAPIEmpty::GetDynamicMesh( IMaterial* pMaterial, int nHWSkinBoneCount, bool buffered, IMesh* pVertexOverride, IMesh* pIndexOverride )
|
||
{
|
||
return &m_Mesh;
|
||
}
|
||
|
||
IMesh* CShaderAPIEmpty::GetDynamicMeshEx( IMaterial* pMaterial, VertexFormat_t fmt, int nHWSkinBoneCount, bool buffered, IMesh* pVertexOverride, IMesh* pIndexOverride )
|
||
{
|
||
return &m_Mesh;
|
||
}
|
||
|
||
IMesh* CShaderAPIEmpty::GetFlexMesh()
|
||
{
|
||
return &m_Mesh;
|
||
}
|
||
|
||
// Begins a rendering pass that uses a state snapshot
|
||
void CShaderAPIEmpty::BeginPass( StateSnapshot_t snapshot )
|
||
{
|
||
}
|
||
|
||
// Renders a single pass of a material
|
||
void CShaderAPIEmpty::RenderPass( const unsigned char *pInstanceCommandBuffer, int nPass, int nPassCount )
|
||
{
|
||
}
|
||
|
||
// stuff related to matrix stacks
|
||
void CShaderAPIEmpty::MatrixMode( MaterialMatrixMode_t matrixMode )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::PushMatrix()
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::PopMatrix()
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::LoadMatrix( float *m )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::MultMatrix( float *m )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::MultMatrixLocal( float *m )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::GetActualProjectionMatrix( float *pMatrix )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::GetMatrix( MaterialMatrixMode_t matrixMode, float *dst )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::LoadIdentity( void )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::LoadCameraToWorld( void )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::Ortho( double left, double top, double right, double bottom, double zNear, double zFar )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::PerspectiveX( double fovx, double aspect, double zNear, double zFar )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::PerspectiveOffCenterX( double fovx, double aspect, double zNear, double zFar, double bottom, double top, double left, double right )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::PickMatrix( int x, int y, int width, int height )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::Rotate( float angle, float x, float y, float z )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::Translate( float x, float y, float z )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::Scale( float x, float y, float z )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::ScaleXY( float x, float y )
|
||
{
|
||
}
|
||
|
||
// Fog methods...
|
||
void CShaderAPIEmpty::FogMode( MaterialFogMode_t fogMode )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::FogStart( float fStart )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::FogEnd( float fEnd )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetFogZ( float fogZ )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::FogMaxDensity( float flMaxDensity )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::GetFogDistances( float *fStart, float *fEnd, float *fFogZ )
|
||
{
|
||
}
|
||
|
||
|
||
void CShaderAPIEmpty::SceneFogColor3ub( unsigned char r, unsigned char g, unsigned char b )
|
||
{
|
||
}
|
||
|
||
|
||
void CShaderAPIEmpty::SceneFogMode( MaterialFogMode_t fogMode )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::GetSceneFogColor( unsigned char *rgb )
|
||
{
|
||
}
|
||
|
||
MaterialFogMode_t CShaderAPIEmpty::GetSceneFogMode( )
|
||
{
|
||
return MATERIAL_FOG_NONE;
|
||
}
|
||
|
||
int CShaderAPIEmpty::GetPixelFogCombo( )
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
void CShaderAPIEmpty::FogColor3f( float r, float g, float b )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::FogColor3fv( float const* rgb )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::FogColor3ub( unsigned char r, unsigned char g, unsigned char b )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::FogColor3ubv( unsigned char const* rgb )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetViewports( int nCount, const ShaderViewport_t* pViewports, bool setImmediately /* = false*/ )
|
||
{
|
||
}
|
||
|
||
int CShaderAPIEmpty::GetViewports( ShaderViewport_t* pViewports, int nMax ) const
|
||
{
|
||
return 1;
|
||
}
|
||
|
||
// Sets the vertex and pixel shaders
|
||
void CShaderAPIEmpty::SetVertexShaderIndex( int vshIndex )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetPixelShaderIndex( int pshIndex )
|
||
{
|
||
}
|
||
|
||
// Sets the constant registers for vertex and pixel shaders
|
||
void CShaderAPIEmpty::SetVertexShaderConstant( int var, float const* pVec, int numConst, bool bForce )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetBooleanVertexShaderConstant( int var, BOOL const* pVec, int numConst, bool bForce )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetIntegerVertexShaderConstant( int var, int const* pVec, int numConst, bool bForce )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetPixelShaderConstant( int var, float const* pVec, int numConst, bool bForce )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetBooleanPixelShaderConstant( int var, BOOL const* pVec, int numBools, bool bForce )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetIntegerPixelShaderConstant( int var, int const* pVec, int numIntVecs, bool bForce )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::InvalidateDelayedShaderConstants( void )
|
||
{
|
||
}
|
||
|
||
float CShaderAPIEmpty::GammaToLinear_HardwareSpecific( float fGamma ) const
|
||
{
|
||
return 0.0f;
|
||
}
|
||
|
||
float CShaderAPIEmpty::LinearToGamma_HardwareSpecific( float fLinear ) const
|
||
{
|
||
return 0.0f;
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetLinearToGammaConversionTextures( ShaderAPITextureHandle_t hSRGBWriteEnabledTexture, ShaderAPITextureHandle_t hIdentityTexture )
|
||
{
|
||
}
|
||
|
||
|
||
// Returns the nearest supported format
|
||
ImageFormat CShaderAPIEmpty::GetNearestSupportedFormat( ImageFormat fmt, bool bFilteringRequired /* = true */ ) const
|
||
{
|
||
return fmt;
|
||
}
|
||
|
||
ImageFormat CShaderAPIEmpty::GetNearestRenderTargetFormat( ImageFormat fmt ) const
|
||
{
|
||
return fmt;
|
||
}
|
||
|
||
// Sets the texture state
|
||
void CShaderAPIEmpty::BindTexture( Sampler_t stage, TextureBindFlags_t nBindFlags, ShaderAPITextureHandle_t textureHandle )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::BindVertexTexture( VertexTextureSampler_t vtSampler, ShaderAPITextureHandle_t textureHandle )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::ClearColor3ub( unsigned char r, unsigned char g, unsigned char b )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::ClearColor4ub( unsigned char r, unsigned char g, unsigned char b, unsigned char a )
|
||
{
|
||
}
|
||
|
||
// Indicates we're going to be modifying this texture
|
||
// TexImage2D, TexSubImage2D, TexWrap, TexMinFilter, and TexMagFilter
|
||
// all use the texture specified by this function.
|
||
void CShaderAPIEmpty::ModifyTexture( ShaderAPITextureHandle_t textureHandle )
|
||
{
|
||
}
|
||
|
||
// Texture management methods
|
||
void CShaderAPIEmpty::TexImage2D( int level, int cubeFace, ImageFormat dstFormat, int zOffset, int width, int height,
|
||
ImageFormat srcFormat, bool bSrcIsTiled, void *imageData )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::TexSubImage2D( int level, int cubeFace, int xOffset, int yOffset, int zOffset, int width, int height,
|
||
ImageFormat srcFormat, int srcStride, bool bSrcIsTiled, void *imageData )
|
||
{
|
||
}
|
||
|
||
bool CShaderAPIEmpty::TexLock( int level, int cubeFaceID, int xOffset, int yOffset,
|
||
int width, int height, CPixelWriter& writer )
|
||
{
|
||
return false;
|
||
}
|
||
|
||
void CShaderAPIEmpty::TexUnlock( )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::UpdateTexture( int xOffset, int yOffset, int w, int h, ShaderAPITextureHandle_t hDstTexture, ShaderAPITextureHandle_t hSrcTexture )
|
||
{
|
||
}
|
||
void *CShaderAPIEmpty::LockTex( ShaderAPITextureHandle_t hTexture )
|
||
{
|
||
return NULL;
|
||
}
|
||
void CShaderAPIEmpty::UnlockTex( ShaderAPITextureHandle_t hTexture )
|
||
{
|
||
}
|
||
|
||
// These are bound to the texture, not the texture environment
|
||
void CShaderAPIEmpty::TexMinFilter( ShaderTexFilterMode_t texFilterMode )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::TexMagFilter( ShaderTexFilterMode_t texFilterMode )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::TexWrap( ShaderTexCoordComponent_t coord, ShaderTexWrapMode_t wrapMode )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::TexSetPriority( int priority )
|
||
{
|
||
}
|
||
|
||
ShaderAPITextureHandle_t CShaderAPIEmpty::CreateTexture(
|
||
int width,
|
||
int height,
|
||
int depth,
|
||
ImageFormat dstImageFormat,
|
||
int numMipLevels,
|
||
int numCopies,
|
||
int flags,
|
||
const char *pDebugName,
|
||
const char *pTextureGroupName )
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
// Create a multi-frame texture (equivalent to calling "CreateTexture" multiple times, but more efficient)
|
||
void CShaderAPIEmpty::CreateTextures(
|
||
ShaderAPITextureHandle_t *pHandles,
|
||
int count,
|
||
int width,
|
||
int height,
|
||
int depth,
|
||
ImageFormat dstImageFormat,
|
||
int numMipLevels,
|
||
int numCopies,
|
||
int flags,
|
||
const char *pDebugName,
|
||
const char *pTextureGroupName )
|
||
{
|
||
for ( int k = 0; k < count; ++ k )
|
||
pHandles[ k ] = 0;
|
||
}
|
||
|
||
|
||
ShaderAPITextureHandle_t CShaderAPIEmpty::CreateDepthTexture( ImageFormat renderFormat, int width, int height, const char *pDebugName, bool bTexture, bool bAliasDepthTextureOverSceneDepthX360 )
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
void CShaderAPIEmpty::DeleteTexture( ShaderAPITextureHandle_t textureHandle )
|
||
{
|
||
}
|
||
|
||
bool CShaderAPIEmpty::IsTexture( ShaderAPITextureHandle_t textureHandle )
|
||
{
|
||
return true;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::IsTextureResident( ShaderAPITextureHandle_t textureHandle )
|
||
{
|
||
return false;
|
||
}
|
||
|
||
// stuff that isn't to be used from within a shader
|
||
void CShaderAPIEmpty::ClearBuffers( bool bClearColor, bool bClearDepth, bool bClearStencil, int renderTargetWidth, int renderTargetHeight )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::ClearBuffersEx( bool bClearRed, bool bClearGreen, bool bClearBlue, bool bClearAlpha,
|
||
unsigned char r, unsigned char g, unsigned char b, unsigned char a )
|
||
{
|
||
|
||
}
|
||
|
||
void CShaderAPIEmpty::ClearBuffersObeyStencil( bool bClearColor, bool bClearDepth )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::ClearBuffersObeyStencilEx( bool bClearColor, bool bClearAlpha, bool bClearDepth )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::PerformFullScreenStencilOperation( void )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetScissorRect( const int nLeft, const int nTop, const int nRight, const int nBottom, const bool bEnableScissor )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::ReadPixels( int x, int y, int width, int height, unsigned char *data, ImageFormat dstFormat, ITexture *pRenderTargetTexture )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::ReadPixelsAsync( int x, int y, int width, int height, unsigned char *data, ImageFormat dstFormat, ITexture *pRenderTargetTexture, CThreadEvent *pPixelsReadEvent )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::ReadPixelsAsyncGetResult( int x, int y, int width, int height, unsigned char *data, ImageFormat dstFormat, CThreadEvent *pGetResultEvent )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::ReadPixels( Rect_t *pSrcRect, Rect_t *pDstRect, unsigned char *data, ImageFormat dstFormat, int nDstStride )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::FlushHardware()
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::ResetRenderState( bool bFullReset )
|
||
{
|
||
}
|
||
|
||
// Set the number of bone weights
|
||
void CShaderAPIEmpty::SetNumBoneWeights( int numBones )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::EnableHWMorphing( bool bEnable )
|
||
{
|
||
}
|
||
|
||
// Selection mode methods
|
||
int CShaderAPIEmpty::SelectionMode( bool selectionMode )
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
void CShaderAPIEmpty::SelectionBuffer( unsigned int* pBuffer, int size )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::ClearSelectionNames( )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::LoadSelectionName( int name )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::PushSelectionName( int name )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::PopSelectionName()
|
||
{
|
||
}
|
||
|
||
|
||
// Use this to get the mesh builder that allows us to modify vertex data
|
||
CMeshBuilder* CShaderAPIEmpty::GetVertexModifyBuilder()
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
// Board-independent calls, here to unify how shaders set state
|
||
// Implementations should chain back to IShaderUtil->BindTexture(), etc.
|
||
|
||
// Use this to begin and end the frame
|
||
void CShaderAPIEmpty::BeginFrame()
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::EndFrame()
|
||
{
|
||
}
|
||
|
||
// returns the current time in seconds....
|
||
double CShaderAPIEmpty::CurrentTime() const
|
||
{
|
||
return Sys_FloatTime();
|
||
}
|
||
|
||
// Get the current camera position in world space.
|
||
void CShaderAPIEmpty::GetWorldSpaceCameraPosition( float* pPos ) const
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::GetWorldSpaceCameraDirection( float* pDir ) const
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::ForceHardwareSync( void )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetClipPlane( int index, const float *pPlane )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::EnableClipPlane( int index, bool bEnable )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SetFastClipPlane( const float *pPlane )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::EnableFastClip( bool bEnable )
|
||
{
|
||
}
|
||
|
||
int CShaderAPIEmpty::GetCurrentNumBones( void ) const
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::IsHWMorphingEnabled( void ) const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
void CShaderAPIEmpty::GetDX9LightState( LightState_t *state ) const
|
||
{
|
||
state->m_nNumLights = 0;
|
||
state->m_bAmbientLight = false;
|
||
state->m_bStaticLight = false;
|
||
state->m_bStaticLightIndirectOnly = false;
|
||
}
|
||
|
||
MaterialFogMode_t CShaderAPIEmpty::GetCurrentFogType( void ) const
|
||
{
|
||
Assert( 0 ); // deprecated
|
||
return MATERIAL_FOG_NONE;
|
||
}
|
||
|
||
void CShaderAPIEmpty::RecordString( const char *pStr )
|
||
{
|
||
}
|
||
|
||
bool CShaderAPIEmpty::ReadPixelsFromFrontBuffer() const
|
||
{
|
||
return true;
|
||
}
|
||
|
||
bool CShaderAPIEmpty::PreferDynamicTextures() const
|
||
{
|
||
return false;
|
||
}
|
||
|
||
int CShaderAPIEmpty::GetCurrentDynamicVBSize( void )
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
int CShaderAPIEmpty::GetCurrentDynamicVBSize( int nIndex )
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
void CShaderAPIEmpty::DestroyVertexBuffers( bool bExitingLevel )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::EvictManagedResources()
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::GetGPUMemoryStats( GPUMemoryStats &stats )
|
||
{
|
||
}
|
||
|
||
void CShaderAPIEmpty::SyncToken( const char *pToken )
|
||
{
|
||
}
|