diff --git a/lib/mac/interfaces_i486.a b/lib/mac/interfaces_i486.a index c56453fc..cf2219e4 100644 Binary files a/lib/mac/interfaces_i486.a and b/lib/mac/interfaces_i486.a differ diff --git a/lib/mac/libtier0.dylib b/lib/mac/libtier0.dylib new file mode 100755 index 00000000..9f0df3c0 Binary files /dev/null and b/lib/mac/libtier0.dylib differ diff --git a/lib/mac/libvstdlib.dylib b/lib/mac/libvstdlib.dylib new file mode 100755 index 00000000..cf1cc163 Binary files /dev/null and b/lib/mac/libvstdlib.dylib differ diff --git a/lib/mac/mathlib_i486.a b/lib/mac/mathlib_i486.a index deebb8cc..49b50a47 100644 Binary files a/lib/mac/mathlib_i486.a and b/lib/mac/mathlib_i486.a differ diff --git a/lib/mac/tier1_i486.a b/lib/mac/tier1_i486.a index 9bd9f84e..c9199c9d 100644 Binary files a/lib/mac/tier1_i486.a and b/lib/mac/tier1_i486.a differ diff --git a/linux_sdk/Makefile b/linux_sdk/Makefile index fcce185b..7971bbed 100644 --- a/linux_sdk/Makefile +++ b/linux_sdk/Makefile @@ -19,7 +19,7 @@ MOD_CONFIG = Server\(SDK\)_ReleaseWin32 # the directory the base binaries (tier0_i486.so, etc) are located # this should point to your orange box subfolder of where you have srcds installed. -SRCDS_DIR = ~/srcds/orangebox +SRCDS_DIR = ~/srcds/csgo # the path to your mods directory # set this so that 'make install' or 'make installrelease' will copy your binary over automatically. @@ -30,12 +30,13 @@ ifeq "$(OS)" "Darwin" CC = /usr/bin/clang CPLUS = /usr/bin/clang++ CLINK = /usr/bin/clang +CPP_LIB = else CC = /usr/bin/gcc CPLUS = /usr/bin/g++ CLINK = /usr/bin/gcc +CPP_LIB = "$(SRCDS_DIR)/bin/libstdc++.so.6 $(SRCDS_DIR)/bin/libgcc_s.so.1" endif -CPP_LIB = "libstdc++.a libgcc_eh.a" # put any compiler flags you want passed here USER_CFLAGS = @@ -81,8 +82,12 @@ ARCH_CFLAGS = -mtune=i686 -march=pentium3 -mmmx -msse -msse2 -m32 ifeq "$(OS)" "Darwin" DEFINES = -D_OSX -DOSX +SHLIBEXT = dylib +SHLIBLDFLAGS = -dynamiclib -mmacosx-version-min=10.5 else DEFINES = -D_LINUX -DLINUX +SHLIBEXT = so +SHLIBLDFLAGS = -shared -Wl,-Map,$@_map.txt -Wl endif DEFINES += -DCOMPILER_GCC -DPOSIX -DVPROF_LEVEL=1 -DSWDS -D_finite=finite -Dstricmp=strcasecmp -D_stricmp=strcasecmp \ @@ -90,9 +95,7 @@ DEFINES += -DCOMPILER_GCC -DPOSIX -DVPROF_LEVEL=1 -DSWDS -D_finite=finite -Dstri UNDEF = -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE BASE_CFLAGS = -fno-strict-aliasing -Wall -Werror -Wno-conversion -Wno-overloaded-virtual -Wno-non-virtual-dtor -Wno-invalid-offsetof -SHLIBEXT = so SHLIBCFLAGS = -fPIC -SHLIBLDFLAGS = -shared -Wl,-Map,$@_map.txt -Wl # Flags passed to the c compiler CFLAGS = $(DEFINES) $(ARCH_CFLAGS) -O3 $(BASE_CFLAGS) @@ -108,7 +111,7 @@ DBG_CFLAGS = "$(DEFINES) $(ARCH_CFLAGS) -g -ggdb $(BASE_CFLAGS) $(UNDEF)" # define list passed to make for the sub makefile BASE_DEFINES = CC=$(CC) AR=$(AR) CPLUS=$(CPLUS) CPP_LIB=$(CPP_LIB) DEBUG=$(DEBUG) \ BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SRC_DIR=$(SRC_DIR) \ - LIB_DIR=$(LIB_DIR) SHLIBLDFLAGS=$(SHLIBLDFLAGS) SHLIBEXT=$(SHLIBEXT) \ + LIB_DIR=$(LIB_DIR) SHLIBLDFLAGS="$(SHLIBLDFLAGS)" SHLIBEXT=$(SHLIBEXT) \ CLINK=$(CLINK) CFLAGS="$(CFLAGS)" DBG_CFLAGS=$(DBG_CFLAGS) LDFLAGS=$(LDFLAGS) \ DEFINES="$(DEFINES)" DBG_DEFINES=$(DBG_DEFINES) \ ARCH=$(ARCH) SRCDS_DIR=$(SRCDS_DIR) MOD_CONFIG=$(MOD_CONFIG) NAME=$(NAME) \ @@ -118,6 +121,7 @@ BASE_DEFINES = CC=$(CC) AR=$(AR) CPLUS=$(CPLUS) CPP_LIB=$(CPP_LIB) DEBUG=$(DEBUG MAKE_SERVER = Makefile.server MAKE_VCPM = Makefile.vcpm MAKE_PLUGIN = Makefile.plugin +MAKE_SHADERAPIEMPTY = Makefile.shaderapiempty MAKE_TIER1 = Makefile.tier1 MAKE_MATH = Makefile.mathlib MAKE_IFACE = Makefile.interfaces @@ -131,10 +135,8 @@ check: cd $(BUILD_DIR) if [ ! -e "$(LIB_DIR)/tier1_i486.a" ]; then $(MAKE) tier1;fi if [ ! -e "$(LIB_DIR)/mathlib_i486.a" ]; then $(MAKE) mathlib;fi - if [ ! -e "$(LIB_DIR)/choreoobjects_i486.a" ]; then $(MAKE) choreo;fi - if [ ! -f "tier0_i486.so" ]; then ln -s $(SRCDS_DIR)/bin/tier0_i486.so .; fi - if [ ! -f "vstdlib_i486.so" ]; then ln -s $(SRCDS_DIR)/bin/vstdlib_i486.so .; fi - if [ ! -f "steam_api_i486.so" ]; then ln -s $(SRCDS_DIR)/bin/steam_api_i486.so .; fi + if [ ! -f "libtier0.$(SHLIBEXT)" ]; then ln -s $(LIB_DIR)/libtier0.$(SHLIBEXT) .; fi + if [ ! -f "libvstdlib.$(SHLIBEXT)" ]; then ln -s $(LIB_DIR)/libvstdlib.$(SHLIBEXT) .; fi vcpm: check if [ ! -e "vcpm" ]; then $(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES);fi @@ -145,6 +147,9 @@ mod: check vcpm plugin: check $(MAKE) -f $(MAKE_PLUGIN) $(BASE_DEFINES) + +shaderapiempty: check + $(MAKE) -f $(MAKE_SHADERAPIEMPTY) $(BASE_DEFINES) tier1: $(MAKE) -f $(MAKE_TIER1) $(BASE_DEFINES) @@ -169,6 +174,7 @@ clean: $(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_PLUGIN) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_SERVER) $(BASE_DEFINES) clean + $(MAKE) -f $(MAKE_SHADERAPIEMPTY) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_TIER1) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_MATH) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_IFACE) $(BASE_DEFINES) clean diff --git a/linux_sdk/Makefile.shaderapiempty b/linux_sdk/Makefile.shaderapiempty new file mode 100644 index 00000000..d8eaf58e --- /dev/null +++ b/linux_sdk/Makefile.shaderapiempty @@ -0,0 +1,55 @@ +# +# Empty Shader API Library Makefile +# + +override NAME = shaderapiempty + +SHADER_SRC_DIR = $(SRC_DIR)/materialsystem/$(NAME) +MAT_SRC_DIR = $(SRC_DIR)/materialsystem +PUBLIC_SRC_DIR = $(SRC_DIR)/public +MAT_PUBLIC_SRC_DIR = $(SRC_DIR)/public/materialsystem +SHADERAPI_PUBLIC_SRC_DIR = $(SRC_DIR)/public/shaderapi +TIER0_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier0 +TIER1_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier1 + +SHADER_OBJ_DIR = $(BUILD_OBJ_DIR)/materialsystem/$(NAME) + +INCLUDEDIRS = -I$(PUBLIC_SRC_DIR) -I$(MAT_SRC_DIR) -I$(MAT_PUBLIC_SRC_DIR) \ + -I $(SHADERAPI_PUBLIC_SRC_DIR) -I$(TIER0_PUBLIC_SRC_DIR) -I$(TIER1_PUBLIC_SRC_DIR) +LDFLAGS_SHADER = -m32 -lm -ldl libtier0.$(SHLIBEXT) libvstdlib.$(SHLIBEXT) \ + $(LIB_DIR)/tier1_i486.a $(LIB_DIR)/interfaces_i486.a + +DO_CC = $(CPLUS) $(INCLUDEDIRS) -DARCH=$(ARCH) + +ifeq "$(DEBUG)" "true" + DO_CC += $(DBG_DEFINES) $(DBG_CFLAGS) +else + DO_CC += -DNDEBUG $(CFLAGS) +endif + +DO_CC += -o $@ -c $< + +##################################################################### + +SHADER_OBJS= \ + $(SHADER_OBJ_DIR)/shaderapiempty.o \ + +all: dirs $(NAME).$(SHLIBEXT) + +dirs: + -mkdir -p $(BUILD_OBJ_DIR) + -mkdir -p $(SHADER_OBJ_DIR) + +$(NAME).$(SHLIBEXT): $(SHADER_OBJS) + $(CPLUS) $(SHLIBLDFLAGS) -o $(BUILD_DIR)/$@ $(SHADER_OBJS) $(LDFLAGS_SHADER) $(CPP_LIB) + +$(SHADER_OBJ_DIR)/%.o: $(SHADER_SRC_DIR)/%.cpp + $(DO_CC) + +install: + cp -f $(NAME).$(SHLIBEXT) $(LIB_DIR)/$(NAME).$(SHLIBEXT) + +clean: + -rm -rf $(SHADER_OBJ_DIR) + -rm -rf $(NAME).$(SHLIBEXT) + diff --git a/materialsystem/IHardwareConfigInternal.h b/materialsystem/IHardwareConfigInternal.h new file mode 100644 index 00000000..74d6dae2 --- /dev/null +++ b/materialsystem/IHardwareConfigInternal.h @@ -0,0 +1,28 @@ +//========= Copyright © 1996-2005, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $Header: $ +// $NoKeywords: $ +//============================================================================= + +#ifndef IHARDWARECONFIGINTERNAL_H +#define IHARDWARECONFIGINTERNAL_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "materialsystem/imaterialsystemhardwareconfig.h" + +//----------------------------------------------------------------------------- +// Material system configuration +//----------------------------------------------------------------------------- +class IHardwareConfigInternal : public IMaterialSystemHardwareConfig +{ +public: + // Gets at the HW specific shader DLL name + virtual const char *GetHWSpecificShaderDLLName() const = 0; +}; + +#endif // IHARDWARECONFIGINTERNAL_H diff --git a/materialsystem/shaderapiempty/shaderapiempty.cpp b/materialsystem/shaderapiempty/shaderapiempty.cpp new file mode 100644 index 00000000..4034471a --- /dev/null +++ b/materialsystem/shaderapiempty/shaderapiempty.cpp @@ -0,0 +1,3159 @@ +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +// +// Purpose: Empty implementation of shader API +// +//===========================================================================// + +/* This is totally reverse-engineered code and may be wrong */ + +#include "interfaces/interfaces.h" +#include "shaderapi/shareddefs.h" +#include "materialsystem/imaterialsystem.h" +#include "materialsystem/imesh.h" +#include "materialsystem/idebugtextureinfo.h" +#include "ishaderutil.h" +#include "ishadershadow.h" +#include "ishaderapi.h" +#include "IHardwareConfigInternal.h" +#include "tier0/dbg.h" + +//----------------------------------------------------------------------------- +// Empty mesh +//----------------------------------------------------------------------------- +class CEmptyMesh : public IMesh +{ +public: + CEmptyMesh( bool bIsDynamic ); + virtual ~CEmptyMesh(); + + bool Lock( int nMaxIndexCount, bool bAppend, IndexDesc_t &desc ); + bool Lock( int nVertexCount, bool bAppend, VertexDesc_t &desc ); + void Unlock( int nWrittenIndexCount, IndexDesc_t &desc ); + void Unlock( int nVertexCount, VertexDesc_t &desc ); + void ModifyBegin( bool bReadOnly, int nFirstIndex, int nIndexCount, IndexDesc_t &desc ); + void ModifyBegin( int firstVertex, int numVerts, int firstIndex, int numIndices, MeshDesc_t &desc ); + void ModifyEnd( IndexDesc_t &desc ); + void ModifyEnd( MeshDesc_t &desc ); + void Spew( int nIndexCount, const IndexDesc_t &desc ); + void Spew( int nVertexCount, const VertexDesc_t &desc ); + void Spew( int numVerts, int numIndices, const MeshDesc_t &desc ); + void ValidateData( int nIndexCount, const IndexDesc_t &desc ); + void ValidateData( int nVertexCount, const VertexDesc_t &desc ); + void ValidateData( int numVerts, int numIndices, const MeshDesc_t &desc ); + bool IsDynamic() const; + void BeginCastBuffer( VertexFormat_t format ); + void BeginCastBuffer( MaterialIndexFormat_t format ); + void EndCastBuffer(); + int GetRoomRemaining() const; + MaterialIndexFormat_t IndexFormat() const; + void LockMesh( int numVerts, int numIndices, MeshDesc_t &desc, MeshBuffersAllocationSettings_t *pSettings ); + void UnlockMesh( int numVerts, int numIndices, MeshDesc_t &desc ); + void ModifyBeginEx( bool bReadOnly, int firstVertex, int numVerts, int firstIndex, int numIndices, MeshDesc_t &desc ); + int VertexCount() const; + void SetPrimitiveType( MaterialPrimitiveType_t type ); + void Draw( int firstIndex, int numIndices ); + void Draw( CPrimList *pLists, int nLists ); + void DrawModulated( const Vector4D &vecDiffuseModulation, int firstIndex, int numIndices ); + void CopyToMeshBuilder(int iStartVert, int nVerts, int iStartIndex, int nIndices, int indexOffset, CMeshBuilder &builder); + IMaterial *GetMaterial(); + void SetColorMesh( IMesh *pColorMesh, int nVertexOffset ); + int IndexCount() const; + void SetFlexMesh( IMesh *pMesh, int nVertexOffset ); + void DisableFlexMesh(); + void MarkAsDrawn(); + VertexFormat_t GetVertexFormat() const; + IMesh *GetMesh(); + unsigned int ComputeMemoryUsed(); + void *AccessRawHardwareDataStream( uint8 nRawStreamIndex, uint32 numBytes, uint32 uiFlags, void *pvContext ); + ICachedPerFrameMeshData *GetCachedPerFrameMeshData(); + void ReconstructFromCachedPerFrameMeshData( ICachedPerFrameMeshData *pData ); +private: + unsigned char *m_pVertexMemory; + bool m_bIsDynamic; +}; + +//----------------------------------------------------------------------------- +// Empty shader device manager +//----------------------------------------------------------------------------- +class CShaderDeviceMgrEmpty : public CBaseAppSystem +{ +public: + bool Connect( CreateInterfaceFn factory ); + void Disconnect(); + + void *QueryInterface( const char *pInterfaceName ); + + InitReturnVal_t Init(); + void Shutdown(); + + int GetAdapterCount() const; + void GetAdapterInfo( int nAdapter, MaterialAdapterInfo_t &info ) const; + bool GetRecommendedVideoConfig( int nAdapter, KeyValues *pConfiguration ); + bool GetRecommendedConfigurationInfo( int nAdapter, int nDXLevel, KeyValues *pConfiguration ); + int GetModeCount( int nAdapter ) const; + void GetModeInfo( ShaderDisplayMode_t *pInfo, int nAdapter, int nMode ) const; + void GetCurrentModeInfo( ShaderDisplayMode_t *pInfo, int nAdapter ) const; + bool SetAdapter( int nAdapter, int nFlags ); + CreateInterfaceFn SetMode( void *hWnd, int nAdapter, const ShaderDeviceInfo_t &mode ); + void AddModeChangeCallback( ShaderModeChangeCallbackFunc_t func ); + void RemoveModeChangeCallback( ShaderModeChangeCallbackFunc_t func ); + void AddDeviceDependentObject( IShaderDeviceDependentObject *pObject ); + void RemoveDeviceDependentObject( IShaderDeviceDependentObject *pObject ); +}; + +//----------------------------------------------------------------------------- +// Empty shader device +//----------------------------------------------------------------------------- +class CShaderDeviceEmpty : public IShaderDevice +{ +public: + CShaderDeviceEmpty(); + + int GetCurrentAdapter() const; + bool IsUsingGraphics() const; + void SpewDriverInfo() const; + ImageFormat GetBackBufferFormat() const; + void GetBackBufferDimensions( int &width, int &height ) const; + const AspectRatioInfo_t &GetAspectRatioInfo() const; + int StencilBufferBits() const; + bool IsAAEnabled() const; + void Present(); + void GetWindowSize( int &nWidth, int &nHeight ) const; + bool AddView( void *hWnd ); + void RemoveView( void *hWnd ); + void SetView( void *hWnd ); + void ReleaseResources( bool bReleaseManagedResources ); + void ReacquireResources(); + IMesh *CreateStaticMesh( VertexFormat_t vertexFormat, const char *pTextureBudgetGroup, IMaterial *pMaterial, VertexStreamSpec_t *pStreamSpec ); + void DestroyStaticMesh( IMesh *mesh ); + IShaderBuffer *CompileShader( const char *pProgram, size_t nBufLen, const char *pShaderVersion ); + VertexShaderHandle_t CreateVertexShader( IShaderBuffer *pShaderBuffer ); + void DestroyVertexShader( VertexShaderHandle_t hShader ); + GeometryShaderHandle_t CreateGeometryShader( IShaderBuffer *pShaderBuffer ); + void DestroyGeometryShader( GeometryShaderHandle_t hShader ); + PixelShaderHandle_t CreatePixelShader( IShaderBuffer *pShaderBuffer ); + void DestroyPixelShader( PixelShaderHandle_t hShader ); + IVertexBuffer *CreateVertexBuffer( ShaderBufferType_t type, VertexFormat_t fmt, int nVertexCount, const char *pBudgetGroup ); + void DestroyVertexBuffer( IVertexBuffer *pVertexBuffer ); + IIndexBuffer *CreateIndexBuffer( ShaderBufferType_t bufferType, MaterialIndexFormat_t fmt, int nIndexCount, const char *pBudgetGroup ); + void DestroyIndexBuffer( IIndexBuffer *pIndexBuffer ); + IVertexBuffer *GetDynamicVertexBuffer( int nStreamID, VertexFormat_t vertexFormat, bool bBuffered ); + IIndexBuffer *GetDynamicIndexBuffer(); + void SetHardwareGammaRamp( float fGamma, float fGammaTVRangeMin, float fGammaTVRangeMax, float fGammaTVExponent, bool bTVEnabled ); + void EnableNonInteractiveMode( MaterialNonInteractiveMode_t mode, ShaderNonInteractiveInfo_t *pInfo ); + void RefreshFrontBufferNonInteractive(); + void HandleThreadEvent( uint32 threadEvent ); + void DoStartupShaderPreloading(); +private: + CEmptyMesh m_Mesh; + CEmptyMesh m_DynamicMesh; +}; + +//----------------------------------------------------------------------------- +// Empty shader shadow +//----------------------------------------------------------------------------- +class CShaderShadowEmpty : public IShaderShadow +{ +public: + CShaderShadowEmpty(); + virtual ~CShaderShadowEmpty(); + + void SetDefaultState(); + void DepthFunc( ShaderDepthFunc_t depthFunc ); + void EnableDepthWrites( bool bEnable ); + void EnableDepthTest( bool bEnable ); + void EnablePolyOffset( PolygonOffsetMode_t nOffsetMode ); + void EnableColorWrites( bool bEnable ); + void EnableAlphaWrites( bool bEnable ); + void EnableBlending( bool bEnable ); + void EnableBlendingForceOpaque( bool bEnable ); + void BlendFunc( ShaderBlendFactor_t srcFactor, ShaderBlendFactor_t dstFactor ); + void EnableAlphaTest( bool bEnable ); + void AlphaFunc( ShaderAlphaFunc_t alphaFunc, float alphaRef ); + void PolyMode( ShaderPolyModeFace_t face, ShaderPolyMode_t polyMode ); + void EnableCulling( bool bEnable ); + void VertexShaderVertexFormat( unsigned int nFlags, int nTexCoordCount, int *pTexCoordDimensions, int nUserDataSize ); + void EnableTexture( Sampler_t sampler, bool bEnable ); + void EnableVertexTexture( VertexTextureSampler_t sampler, bool bEnable ); + void EnableBlendingSeparateAlpha( bool bEnable ); + void BlendFuncSeparateAlpha( ShaderBlendFactor_t srcFactor, ShaderBlendFactor_t dstFactor ); + void SetVertexShader( const char *pFileName, int nStaticVshIndex ); + void SetPixelShader( const char *pFileName, int nStaticPshIndex ); + void EnableSRGBWrite( bool bEnable ); + void EnableSRGBRead( Sampler_t sampler, bool bEnable ); + void FogMode( ShaderFogMode_t fogMode, bool bEnable ); + void DisableFogGammaCorrection( bool bDisable ); + virtual void ExecuteCommandBuffer( uint8 *pBuf ); + void EnableAlphaToCoverage( bool bEnable ); + virtual void SetShadowDepthFiltering( Sampler_t stage ); + void BlendOp( ShaderBlendOp_t blendOp ); + void BlendOpSeparateAlpha( ShaderBlendOp_t blendOp ); + float GetLightMapScaleFactor() const; +public: + bool m_IsTranslucent; + bool m_ForceOpaque; + bool m_IsAlphaTested; + bool m_bIsDepthWriteEnabled; + bool m_bUsesVertexAndPixelShaders; +}; + +//----------------------------------------------------------------------------- +// Empty implementation of shader API +//----------------------------------------------------------------------------- +class CShaderAPIEmpty : public IShaderAPI, public IHardwareConfigInternal, public IDebugTextureInfo +{ +public: + CShaderAPIEmpty(); + virtual ~CShaderAPIEmpty(); + + virtual bool IsDebugTextureListFresh( int numFramesAllowed ); + virtual bool SetDebugTextureRendering( bool bEnable ); + virtual void EnableDebugTextureList( bool bEnable ); + virtual void EnableGetAllTextures( bool bEnable ); + virtual KeyValues *LockDebugTextureList(); + virtual void UnlockDebugTextureList(); + virtual KeyValues *GetDebugTextureList(); + virtual int GetTextureMemoryUsed( TextureMemoryType eTextureMemory ); + + virtual void GetBackBufferDimensions( int &width, int &height ) const; + virtual const AspectRatioInfo_t &GetAspectRatioInfo() const; + virtual void GetCurrentRenderTargetDimensions( int &nWidth, int &nHeight ) const; + virtual void GetCurrentViewport( int &nX, int &nY, int &nWidth, int &nHeight ) const; + virtual void GetCurrentColorCorrection( ShaderColorCorrectionInfo_t *pInfo ); + virtual void SetViewports( int nCount, const ShaderViewport_t *pViewports, bool setImmediately ); + 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 b, unsigned char g, 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 ); + virtual bool OwnGPUResources( bool bEnable ); + virtual void OnPresent(); + virtual bool DoRenderTargetsNeedSeparateDepthBuffer() const; + virtual void ClearSnapshots(); + virtual bool SetMode( void *hwnd, int nAdapter, const ShaderDeviceInfo_t &info ); + virtual void ChangeVideoMode( const ShaderDeviceInfo_t &info ); + virtual void DXSupportLevelChanged( int nDXLevel ); + virtual void EnableUserClipTransformOverride( bool bEnable ); + virtual void UserClipTransform( const VMatrix &worldToView ); + virtual void SetDefaultState(); + virtual StateSnapshot_t TakeSnapshot(); + virtual bool IsTranslucent( StateSnapshot_t id ) const; + virtual bool IsAlphaTested( StateSnapshot_t id ) const; + virtual bool UsesVertexAndPixelShaders( StateSnapshot_t id ) const; + virtual bool IsDepthWriteEnabled( StateSnapshot_t id ) const; + virtual VertexFormat_t ComputeVertexFormat( int numSnapshots, StateSnapshot_t *pIds ) const; + virtual VertexFormat_t ComputeVertexUsage( int numSnapshots, StateSnapshot_t *pIds ) const; + virtual void BeginPass( StateSnapshot_t snapshot ); + void UseSnapshot( StateSnapshot_t snapshot ); + CMeshBuilder *GetVertexModifyBuilder(); + virtual void SetLightingState( const MaterialLightingState_t &state ); + virtual void SetLights( int nCount, const LightDesc_t *pDesc ); + virtual void SetLightingOrigin( Vector vLightingOrigin ); + virtual void SetAmbientLightCube( Vector4D cube[6] ); + virtual void CopyRenderTargetToTexture( ShaderAPITextureHandle_t textureHandle ); + virtual void CopyRenderTargetToTextureEx( ShaderAPITextureHandle_t textureHandle, int nRenderTargetID, Rect_t *pSrcRect, Rect_t *pDstRect ); + virtual void SetNumBoneWeights( int numBones ); + virtual void EnableHWMorphing( bool bEnable ); + virtual IMesh *GetDynamicMesh( IMaterial *pMaterial, int nHWSkinBoneCount, bool bBuffered, IMesh *pVertexOverride, IMesh *pIndexOverride); + virtual IMesh *GetDynamicMeshEx( IMaterial *pMaterial, VertexFormat_t vertexFormat, int nHWSkinBoneCount, bool bBuffered, IMesh *pVertexOverride, IMesh *pIndexOverride ); + virtual IMesh *GetFlexMesh(); + virtual void RenderPass( const unsigned char *pInstanceCommandBuffer, int nPass, int nPassCount ); + virtual void MatrixMode( MaterialMatrixMode_t matrixMode ); + virtual void PushMatrix(); + virtual void PopMatrix(); + virtual void LoadMatrix( float *m ); + virtual void LoadBoneMatrix( int boneIndex, const float *m ); + virtual void MultMatrix( float *m ); + virtual void MultMatrixLocal( float *m ); + virtual void GetActualProjectionMatrix( float *m ); + virtual void GetMatrix( MaterialMatrixMode_t matrixMode, float *dst ); + virtual void LoadIdentity(); + virtual void LoadCameraToWorld(); + virtual void Ortho( double left, double right, double bottom, double top, double zNear, double zFar ); + virtual void PerspectiveX( double fovx, double aspect, double zNear, double zFar ); + virtual void PerspectiveOffCenterX( double fovx, double aspect, double zNear, double zFar, double bottom, double top, double left, double right ); + virtual void PickMatrix( int x, int y, int width, int height ); + virtual void Rotate( float angle, float x, float y, float z ); + virtual void Translate( float x, float y, float z ); + virtual void Scale( float x, float y, float z ); + virtual void ScaleXY( float x, float y ); + void FogMode( MaterialFogMode_t fogMode ); + virtual void FogStart( float fStart ); + virtual void FogEnd( float fEnd ); + virtual void SetFogZ( float fogZ ); + virtual void FogMaxDensity( float flMaxDensity ); + virtual 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(); + virtual void SetHeightClipZ( float z ); + virtual void SetHeightClipMode( enum MaterialHeightClipMode_t heightClipMode ); + virtual void SetClipPlane( int index, const float *pPlane ); + virtual void EnableClipPlane( int index, bool bEnable ); + virtual void SetFastClipPlane( const float *pPlane ); + virtual void EnableFastClip( bool bEnable ); + virtual int GetCurrentDynamicVBSize(); + virtual int GetCurrentDynamicVBSize( int nIndex ); + virtual void DestroyVertexBuffers( bool bExitingLevel ); + virtual void GetGPUMemoryStats( GPUMemoryStats &stats ); + virtual void SetVertexShaderIndex( int vshIndex ); + virtual void SetPixelShaderIndex( int pshIndex ); + virtual void SetVertexShaderConstant( int var, float const *pVec, int numConst, bool bForce ); + virtual void SetBooleanVertexShaderConstant( int var, BOOL const *pVec, int numBools, bool bForce ); + virtual void SetIntegerVertexShaderConstant( int var, int const *pVec, int numIntVecs, bool bForce ); + virtual void SetPixelShaderConstant( int var, float const *pVec, int numConst, bool bForce ); + virtual void SetBooleanPixelShaderConstant( int var, BOOL const *pVec, int numBools, bool bForce); + virtual void SetIntegerPixelShaderConstant( int var, int const *pVec, int numIntVecs, bool bForce); + virtual void InvalidateDelayedShaderConstants(); + virtual float GammaToLinear_HardwareSpecific( float fGamma ) const; + virtual float LinearToGamma_HardwareSpecific( float fLinear ) const; + virtual void SetLinearToGammaConversionTextures( ShaderAPITextureHandle_t hSRGBWriteEnabledTexture, ShaderAPITextureHandle_t hIdentityTexture ); + virtual void CullMode( MaterialCullMode_t cullMode ); + virtual void FlipCullMode(); + virtual void ForceDepthFuncEquals( bool bEnable ); + virtual void OverrideDepthEnable( bool bEnable, bool bDepthEnable, bool bDepthTestEnable ); + virtual void OverrideAlphaWriteEnable( bool bOverrideEnable, bool bAlphaWriteEnable ); + virtual void OverrideColorWriteEnable( bool bOverrideEnable, bool bColorWriteEnable ); + virtual void ShadeMode( ShaderShadeMode_t mode ); + virtual void Bind( IMaterial *pMaterial ); + virtual ImageFormat GetNearestSupportedFormat( ImageFormat fmt, bool bFilteringRequired ) const; + virtual ImageFormat GetNearestRenderTargetFormat( ImageFormat fmt ) const; + virtual void BindTexture( Sampler_t stage, TextureBindFlags_t nBindFlags, ShaderAPITextureHandle_t textureHandle ); + virtual void BindVertexTexture( VertexTextureSampler_t nSampler, ShaderAPITextureHandle_t textureHandle ); + virtual void SetRenderTarget( ShaderAPITextureHandle_t colorTextureHandle, ShaderAPITextureHandle_t depthTextureHandle ); + virtual void SetRenderTargetEx( int nRenderTargetID, ShaderAPITextureHandle_t colorTextureHandle, ShaderAPITextureHandle_t depthTextureHandle ); + virtual void ModifyTexture( ShaderAPITextureHandle_t textureHandle ); + virtual void TexImage2D( int level, int cubeFaceID, ImageFormat dstFormat, int zOffset, int width, int height, ImageFormat srcFormat, bool bSrcIsTiled, void *imageData ); + virtual void TexSubImage2D( int level, int cubeFaceID, int xOffset, int yOffset, int zOffset, int width, int height, ImageFormat srcFormat, int srcStride, bool bSrcIsTiled, void *imageData ); + virtual bool TexLock( int level, int cubeFaceID, int xOffset, int yOffset, int width, int height, CPixelWriter &writer ); + virtual void TexUnlock(); + virtual void UpdateTexture( int xOffset, int yOffset, int w, int h, ShaderAPITextureHandle_t hDstTexture, ShaderAPITextureHandle_t hSrcTexture ); + virtual void *LockTex( ShaderAPITextureHandle_t hTexture ); + virtual void UnlockTex( ShaderAPITextureHandle_t hTexture ); + virtual void *GetD3DTexturePtr( ShaderAPITextureHandle_t hTexture ); + virtual void TexMinFilter( ShaderTexFilterMode_t texFilterMode ); + virtual void TexMagFilter( ShaderTexFilterMode_t texFilterMode ); + virtual void TexWrap( ShaderTexCoordComponent_t coord, ShaderTexWrapMode_t wrapMode ); + virtual void TexSetPriority( int priority ); + virtual ShaderAPITextureHandle_t CreateTexture( int width, int height, int depth, ImageFormat dstImageFormat, int numMipLevels, int numCopies, int flags, const char *pDebugName, const char *pTextureGroupName ); + virtual 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 ); + virtual ShaderAPITextureHandle_t CreateDepthTexture( ImageFormat renderTargetFormat, int width, int height, const char *pDebugName, bool bTexture, bool bAliasDepthTextureOverSceneDepthX360 ); + virtual void DeleteTexture( ShaderAPITextureHandle_t textureHandle ); + virtual bool IsTexture( ShaderAPITextureHandle_t textureHandle ); + virtual bool IsTextureResident( ShaderAPITextureHandle_t textureHandle ); + virtual void ClearBuffersObeyStencil( bool bClearColor, bool bClearDepth ); + virtual void ClearBuffersObeyStencilEx( bool bClearColor, bool bClearAlpha, bool bClearDepth ); + virtual void PerformFullScreenStencilOperation(); + virtual void ReadPixels( int x, int y, int width, int height, unsigned char *data, ImageFormat dstFormat ); + virtual void ReadPixels( Rect_t *pSrcRect, Rect_t *pDstRect, unsigned char *data, ImageFormat dstFormat, int nDstStride ); + virtual int SelectionMode( bool selectionMode ); + virtual void SelectionBuffer( unsigned int *pBuffer, int size ); + virtual void ClearSelectionNames(); + virtual void LoadSelectionName( int name ); + virtual void PushSelectionName( int name ); + virtual void PopSelectionName(); + virtual void FlushHardware(); + virtual void ResetRenderState( bool bFullReset ); + virtual void SetScissorRect( int nLeft, int nTop, int nRight, int nBottom, bool bEnableScissor ); + virtual bool CanDownloadTextures() const; + virtual void BeginFrame(); + virtual void EndFrame(); + virtual double CurrentTime() const; + virtual void GetWorldSpaceCameraPosition( float *pPos ) const; + virtual void GetWorldSpaceCameraDirection( float *pDir ) const; + 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; + virtual int StencilBufferBits() const; + virtual int GetFrameBufferColorDepth() const; + virtual int GetSamplerCount() const; + virtual int GetVertexSamplerCount() const; + virtual bool HasSetDeviceGammaRamp() const; + bool SupportsCompressedTextures() const; + virtual VertexCompressionType_t SupportsCompressedVertices() const; + virtual bool SupportsStaticControlFlow() const; + virtual int MaximumAnisotropicLevel() const; + virtual int MaxTextureWidth() const; + virtual int MaxTextureHeight() const; + virtual int MaxTextureAspectRatio() const; + virtual int GetDXSupportLevel() const; + virtual int GetMinDXSupportLevel() const; + virtual bool SupportsShadowDepthTextures() const; + virtual ImageFormat GetShadowDepthTextureFormat() const; + virtual ImageFormat GetHighPrecisionShadowDepthTextureFormat() const; + virtual ImageFormat GetNullTextureFormat() const; + virtual const char *GetShaderDLLName() const; + virtual int TextureMemorySize() const; + virtual bool SupportsMipmappedCubemaps() const; + virtual int NumVertexShaderConstants() const; + int NumBooleanVertexShaderConstants() const; + int NumIntegerVertexShaderConstants() const; + virtual int NumPixelShaderConstants() const; + virtual int MaxNumLights() const; + virtual int MaxVertexShaderBlendMatrices() const; + virtual int MaxUserClipPlanes() const; + virtual bool UseFastClipping() const; + virtual bool SpecifiesFogColorInLinearSpace() const; + virtual bool SupportsSRGB() const; + virtual bool FakeSRGBWrite() const; + virtual bool CanDoSRGBReadFromRTs() const; + virtual bool SupportsGLMixedSizeTargets() const; + virtual const char *GetHWSpecificShaderDLLName() const; + virtual bool NeedsAAClamp() const; + virtual int MaxHWMorphBatchCount() const; + virtual int GetMaxDXSupportLevel() const; + virtual bool ReadPixelsFromFrontBuffer() const; + virtual bool PreferDynamicTextures() const; + virtual void ForceHardwareSync(); + virtual int GetCurrentNumBones() const; + virtual bool IsHWMorphingEnabled() const; + virtual void GetDX9LightState( LightState_t *state ) const; + virtual MaterialFogMode_t GetCurrentFogType() const; + void RecordString( const char *pStr ); + virtual void EvictManagedResources(); + virtual void GetLightmapDimensions( int *w, int *h ); + virtual void SyncToken( const char *pToken ); + virtual void SetStandardVertexShaderConstants( float fOverbright ); + virtual void SetAnisotropicLevel( int nAnisotropyLevel ); + virtual bool SupportsHDR() const; + virtual HDRType_t GetHDRType() const; + virtual HDRType_t GetHardwareHDRType() const; + virtual bool NeedsATICentroidHack() const; + virtual bool SupportsColorOnSecondStream() const; + virtual bool SupportsStaticPlusDynamicLighting() const; + virtual bool SupportsStreamOffset() const; + virtual void CommitPixelShaderLighting( int pshReg ); + virtual ShaderAPIOcclusionQuery_t CreateOcclusionQueryObject(); + virtual void DestroyOcclusionQueryObject( ShaderAPIOcclusionQuery_t ); + virtual void BeginOcclusionQueryDrawing( ShaderAPIOcclusionQuery_t ); + virtual void EndOcclusionQueryDrawing( ShaderAPIOcclusionQuery_t ); + virtual int OcclusionQuery_GetNumPixelsRendered( ShaderAPIOcclusionQuery_t hQuery, bool bFlush ); + virtual void AcquireThreadOwnership(); + virtual void ReleaseThreadOwnership(); + virtual bool SupportsBorderColor() const; + virtual bool SupportsFetch4() const; + virtual void EnableBuffer2FramesAhead( bool bEnable ); + virtual float GetShadowDepthBias() const; + virtual float GetShadowSlopeScaleDepthBias() const; + virtual bool PreferZPrepass() const; + virtual bool SuppressPixelShaderCentroidHackFixup() const; + virtual bool PreferTexturesInHWMemory() const; + virtual bool PreferHardwareSync() const; + virtual bool IsUnsupported() const; + virtual void SetDepthFeatheringPixelShaderConstant( int iConstant, float fDepthBlendScale ); + virtual TessellationMode_t GetTessellationMode() const; + virtual void SetPixelShaderFogParams( int reg ); + virtual bool InFlashlightMode() const; + virtual bool IsRenderingPaint() const; + virtual bool InEditorMode() const; + virtual void BindStandardTexture( Sampler_t stage, TextureBindFlags_t nBindFlags, StandardTextureId_t id ); + virtual void BindStandardVertexTexture( VertexTextureSampler_t sampler, StandardTextureId_t id ); + virtual void GetStandardTextureDimensions( int *pWidth, int *pHeight, StandardTextureId_t id ); + virtual float GetSubDHeight(); + virtual bool IsStereoActiveThisFrame() const; + 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; + virtual void SetCascadedShadowMapping( bool bEnable ); + virtual void SetCascadedShadowMappingState( const CascadedShadowMappingState_t &state, ITexture *pDepthTextureAtlas ); + virtual const CascadedShadowMappingState_t &GetCascadedShadowMappingState( ITexture **pDepthTextureAtlas ) const; + virtual const FlashlightState_t &GetFlashlightState( VMatrix &worldToTexture ) const; + virtual const FlashlightState_t &GetFlashlightStateEx( VMatrix &worldToTexture, ITexture **pFlashlightDepthTexture ) const; + virtual void GetFlashlightShaderInfo( bool *pShadowsEnabled, bool *pUberLight ) const; + virtual float GetFlashlightAmbientOcclusion() const; + virtual void ClearVertexAndPixelShaderRefCounts(); + virtual void PurgeUnusedVertexAndPixelShaders(); + virtual void DrawInstances( int nInstanceCount, const MeshInstanceData_t *pInstance ); + virtual bool IsAAEnabled() const; + virtual int GetVertexTextureCount() const; + virtual int GetMaxVertexTextureDimension() const; + virtual int MaxTextureDepth() const; + virtual void SetFlexWeights( int nFirstWeight, int nCount, const MorphWeight_t *pWeights ); + virtual ITexture *GetRenderTargetEx( int nRenderTargetID ) const; + virtual void SetToneMappingScaleLinear( const Vector &scale ); + virtual const Vector &GetToneMappingScaleLinear( void ) const; + virtual void HandleDeviceLost(); + virtual void EnableLinearColorSpaceFrameBuffer( bool bEnable ); + virtual void SetFullScreenTextureHandle( ShaderAPITextureHandle_t h ); + virtual void SetFloatRenderingParameter(int parm_number, float value); + virtual void SetIntRenderingParameter(int parm_number, int value); + virtual void SetTextureRenderingParameter(int parm_number, ITexture *pTexture); + virtual void SetVectorRenderingParameter(int parm_number, Vector const &value); + virtual float GetFloatRenderingParameter(int parm_number) const; + virtual int GetIntRenderingParameter(int parm_number) const; + virtual ITexture *GetTextureRenderingParameter(int parm_number) const; + virtual Vector GetVectorRenderingParameter(int parm_number) const; + virtual void SetStencilState( const ShaderStencilState_t &state ); + virtual void ClearStencilBufferRectangle( int xmin, int ymin, int xmax, int ymax, int value ); + virtual void GetMaxToRender( IMesh *pMesh, bool bMaxUntilFlush, int *pMaxVerts, int *pMaxIndices ); + virtual int GetMaxVerticesToRender( IMaterial *pMaterial ); + virtual int GetMaxIndicesToRender(); + virtual int CompareSnapshots( StateSnapshot_t snapshot0, StateSnapshot_t snapshot1 ); + virtual void DisableAllLocalLights(); + virtual bool SupportsMSAAMode( int nMSAAMode ); + virtual bool SupportsCSAAMode( int nNumSamples, int nQualityLevel ); + 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; + virtual bool SupportsShadowDepthTextures(); + virtual bool SupportsFetch4(); + virtual int NeedsShaderSRGBConversion() const; + virtual bool UsesSRGBCorrectBlending() const; + virtual bool HasFastVertexTextures() const; + virtual bool ActualHasFastVertexTextures() const; + virtual void SetShadowDepthBiasFactors( float fShadowSlopeScaleDepthBias, float fShadowDepthBias ); + virtual void SetDisallowAccess( bool ); + virtual void EnableShaderShaderMutex( bool ); + virtual void ShaderLock(); + virtual void ShaderUnlock(); + virtual void BindVertexBuffer( int nStreamID, IVertexBuffer *pVertexBuffer, int nOffsetInBytes, int nFirstVertex, int nVertexCount, VertexFormat_t fmt, int nRepetitions ) ; + virtual void BindIndexBuffer( IIndexBuffer *pIndexBuffer, int nOffsetInBytes ) ; + virtual void Draw( MaterialPrimitiveType_t primitiveType, int nFirstIndex, int nIndexCount ); + virtual int GetVertexBufferCompression() const; + virtual bool ShouldWriteDepthToDestAlpha() const; + virtual bool SupportsHDRMode( HDRType_t nHDRMode ) const; + virtual bool IsDX10Card() const; + virtual void PushDeformation( const DeformationBase_t *Deformation ); + virtual void PopDeformation(); + virtual int GetNumActiveDeformations() const; + virtual int GetPackedDeformationInformation( int nMaskOfUnderstoodDeformations, float *pConstantValuesOut, int nBufferSize, int nMaximumDeformations, int *pNumDefsOut ) const; + virtual void SetStandardTextureHandle( StandardTextureId_t nId, ShaderAPITextureHandle_t nHandle ); + virtual void ExecuteCommandBuffer( uint8 *pCmdBuffer ); + virtual bool GetHDREnabled() const; + 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(); + virtual void EnableSinglePassFlashlightMode( bool bEnable ); + virtual bool SinglePassFlashlightModeEnabled(); + virtual void FlipCulling( bool bFlipCulling ); + virtual void UpdateGameTime( float flTime ); + virtual bool IsStereoSupported( void ) const; + virtual void UpdateStereoTexture( ShaderAPITextureHandle_t texHandle, bool *pStereoActiveThisFrame ); + virtual void SetSRGBWrite( bool bState ); + virtual void PrintfVA( char *fmt, va_list vargs ); + virtual void Printf( char *fmt, ... ); + virtual float Knob( char *knobname, float *setvalue ); + virtual void AddShaderComboInformation( const ShaderComboSemantics_t *pSemantics ); + virtual void SpinPresent( unsigned int nFrames ); + virtual void AntiAliasingHint( int a1 ); + virtual bool SupportsCascadedShadowMapping() const; + virtual CSMQualityMode_t GetCSMQuality() const; + virtual bool SupportsBilinearPCFSampling() const; + virtual CSMShaderMode_t GetCSMShaderMode( CSMQualityMode_t nQualityLevel ) const; + virtual void EnableAlphaToCoverage(); + virtual void DisableAlphaToCoverage(); + virtual float GetLightMapScaleFactor( void ) const; + virtual ShaderAPITextureHandle_t FindTexture( const char *pDebugName ); + virtual void GetTextureDimensions( ShaderAPITextureHandle_t hTexture, int &nWidth, int &nHeight, int &nDepth ); +private: + enum + { + TRANSLUCENT = 0x01, + ALPHATESTED = 0x02, + VERTEX_AND_PIXEL_SHADERS = 0x04, + DEPTH_WRITE_ENABLED = 0x08 + }; + + CEmptyMesh m_Mesh; +}; + +//----------------------------------------------------------------------------- +// Globals +//----------------------------------------------------------------------------- +IShaderUtil *g_pShaderUtil; + +static CShaderDeviceMgrEmpty s_ShaderDeviceMgrEmpty; +static CShaderDeviceEmpty s_ShaderDeviceEmpty; + +static CShaderAPIEmpty g_ShaderAPIEmpty; +static CShaderShadowEmpty g_ShaderShadow; + +EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CShaderDeviceMgrEmpty, IShaderDeviceMgr, SHADER_DEVICE_MGR_INTERFACE_VERSION, s_ShaderDeviceMgrEmpty ); +EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CShaderDeviceEmpty, IShaderDevice, SHADER_DEVICE_INTERFACE_VERSION, s_ShaderDeviceEmpty ); +EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CShaderShadowEmpty, IShaderShadow, SHADERSHADOW_INTERFACE_VERSION, g_ShaderShadow ); +EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CShaderAPIEmpty, IShaderAPI, SHADERAPI_INTERFACE_VERSION, g_ShaderAPIEmpty ); +EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CShaderAPIEmpty, IMaterialSystemHardwareConfig, MATERIALSYSTEM_HARDWARECONFIG_INTERFACE_VERSION, g_ShaderAPIEmpty ); +EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CShaderAPIEmpty, IDebugTextureInfo, DEBUG_TEXTURE_INFO_VERSION, g_ShaderAPIEmpty ); + +//----------------------------------------------------------------------------- +// Shader interface factory +//----------------------------------------------------------------------------- +void *ShaderInterfaceFactory(const char *pName, int *pReturnCode) +{ + void *pInterface = NULL; + + if (V_strcmp(pName, SHADER_DEVICE_INTERFACE_VERSION) == 0) + pInterface = &s_ShaderDeviceEmpty; + else if (V_strcmp(pName, SHADERAPI_INTERFACE_VERSION) == 0) + pInterface = &g_ShaderAPIEmpty; + else if (V_strcmp(pName, SHADERSHADOW_INTERFACE_VERSION) == 0) + pInterface = &g_ShaderShadow; + + if (pReturnCode) + *pReturnCode = pInterface ? IFACE_OK : IFACE_FAILED; + + return pInterface; +} + +//----------------------------------------------------------------------------- +// Empty mesh +//----------------------------------------------------------------------------- +CEmptyMesh::CEmptyMesh( bool bIsDynamic ) +{ + m_bIsDynamic = bIsDynamic; + m_pVertexMemory = new unsigned char[1024]; +} + +CEmptyMesh::~CEmptyMesh() +{ + delete[] m_pVertexMemory; +} + +bool CEmptyMesh::Lock( int nMaxIndexCount, bool bAppend, IndexDesc_t &desc ) +{ + static unsigned short s_BogusIndex; + + desc.m_pIndices = &s_BogusIndex; + desc.m_nIndexSize = 0; + desc.m_nFirstIndex = 0; + desc.m_nOffset = 0; + + return true; +} + +bool CEmptyMesh::Lock( int nVertexCount, bool bAppend, VertexDesc_t &desc ) +{ + desc.m_pPosition = (float *)m_pVertexMemory; + desc.m_pNormal = (float *)m_pVertexMemory; + desc.m_pColor = m_pVertexMemory; + + for (int 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_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 (int 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_ActualVertexSize = 0; + desc.m_nFirstVertex = 0; + desc.m_nOffset = 0; + + return true; +} + +void CEmptyMesh::Unlock( int nWrittenIndexCount, IndexDesc_t &desc ) +{ + +} + +void CEmptyMesh::Unlock( int nVertexCount, VertexDesc_t &desc ) +{ + +} + +void CEmptyMesh::ModifyBegin( bool bReadOnly, int nFirstIndex, int nIndexCount, IndexDesc_t &desc ) +{ + Lock(nIndexCount, false, 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( IndexDesc_t &desc ) +{ + +} + +void CEmptyMesh::ModifyEnd( MeshDesc_t &desc ) +{ + +} + +void CEmptyMesh::Spew( int nIndexCount, const IndexDesc_t &desc ) +{ + +} + +void CEmptyMesh::Spew( int nVertexCount, const VertexDesc_t &desc ) +{ + +} + +void CEmptyMesh::Spew( int numVerts, int numIndices, const MeshDesc_t &desc ) +{ + +} + +void CEmptyMesh::ValidateData( int nIndexCount, const IndexDesc_t &desc ) +{ + +} + +void CEmptyMesh::ValidateData( int nVertexCount, const VertexDesc_t &desc ) +{ + +} + +void CEmptyMesh::ValidateData( int numVerts, int numIndices, const MeshDesc_t &desc ) +{ + +} + +bool CEmptyMesh::IsDynamic() const +{ + return m_bIsDynamic; +} + +void CEmptyMesh::BeginCastBuffer( VertexFormat_t format ) +{ + +} + +void CEmptyMesh::BeginCastBuffer( MaterialIndexFormat_t format ) +{ + +} + +void CEmptyMesh::EndCastBuffer() +{ + +} + +int CEmptyMesh::GetRoomRemaining() const +{ + return 0; +} + +MaterialIndexFormat_t CEmptyMesh::IndexFormat() const +{ + return MATERIAL_INDEX_FORMAT_UNKNOWN; +} + +void CEmptyMesh::LockMesh( int numVerts, int numIndices, MeshDesc_t &desc, MeshBuffersAllocationSettings_t *pSettings ) +{ + Lock(numVerts, false, (VertexDesc_t &)desc); + Lock(numIndices, false, (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, (VertexDesc_t &)desc); + Lock(numIndices, false, (IndexDesc_t &)desc); +} + +int CEmptyMesh::VertexCount() const +{ + return 0; +} + +void CEmptyMesh::SetPrimitiveType( MaterialPrimitiveType_t type ) +{ + +} + +void CEmptyMesh::Draw( int firstIndex, int numIndices ) +{ + +} + +void CEmptyMesh::Draw( CPrimList *pLists, int nLists ) +{ + +} + +void CEmptyMesh::DrawModulated( const Vector4D &vecDiffuseModulation, int firstIndex, int numIndices ) +{ + +} + +void CEmptyMesh::CopyToMeshBuilder( int iStartVert, int nVerts, int iStartIndex, int nIndices, int indexOffset, CMeshBuilder &builder ) +{ + +} + +IMaterial *CEmptyMesh::GetMaterial() +{ + return NULL; +} + +void CEmptyMesh::SetColorMesh( IMesh *pColorMesh, int nVertexOffset ) +{ + +} + +int CEmptyMesh::IndexCount() const +{ + return 0; +} + +void CEmptyMesh::SetFlexMesh( IMesh *pMesh, int nVertexOffset ) +{ + +} + +void CEmptyMesh::DisableFlexMesh() +{ + +} + +void CEmptyMesh::MarkAsDrawn() +{ + +} + +VertexFormat_t CEmptyMesh::GetVertexFormat() const +{ + return 1; +} + +IMesh *CEmptyMesh::GetMesh() +{ + return this; +} + +unsigned int CEmptyMesh::ComputeMemoryUsed() +{ + return 0; +} + +void *CEmptyMesh::AccessRawHardwareDataStream( uint8 nRawStreamIndex, uint32 numBytes, uint32 uiFlags, void *pvContext ) +{ + return NULL; +} + +ICachedPerFrameMeshData *CEmptyMesh::GetCachedPerFrameMeshData() +{ + return NULL; +} + +void CEmptyMesh::ReconstructFromCachedPerFrameMeshData( ICachedPerFrameMeshData *pData ) +{ + +} + +//----------------------------------------------------------------------------- +// Empty shader device manager +//----------------------------------------------------------------------------- +bool CShaderDeviceMgrEmpty::Connect( CreateInterfaceFn factory ) +{ + g_pShaderUtil = (IShaderUtil *)factory(SHADER_UTIL_INTERFACE_VERSION, NULL); + return true; +} + +void CShaderDeviceMgrEmpty::Disconnect() +{ + g_pShaderUtil = NULL; +} + +void *CShaderDeviceMgrEmpty::QueryInterface( const char *pInterfaceName ) +{ + if (V_strcmp(pInterfaceName, SHADER_DEVICE_MGR_INTERFACE_VERSION) == 0) + return this; + else if (V_strcmp(pInterfaceName, MATERIALSYSTEM_HARDWARECONFIG_INTERFACE_VERSION) == 0) + return (IHardwareConfigInternal *)&g_ShaderAPIEmpty; + + return NULL; +} + +InitReturnVal_t CShaderDeviceMgrEmpty::Init() +{ + return INIT_OK; +} + +void CShaderDeviceMgrEmpty::Shutdown() +{ + +} + +int CShaderDeviceMgrEmpty::GetAdapterCount() const +{ + return 0; +} + +void CShaderDeviceMgrEmpty::GetAdapterInfo( int nAdapter, MaterialAdapterInfo_t &info ) const +{ + memset(&info, 0, sizeof(MaterialAdapterInfo_t)); + info.m_nDXSupportLevel = 90; +} + +bool CShaderDeviceMgrEmpty::GetRecommendedConfigurationInfo( int nAdapter, int nDXLevel, KeyValues *pConfiguration ) +{ + return true; +} + +int CShaderDeviceMgrEmpty::GetModeCount( int nAdapter ) const +{ + return 0; +} + +void CShaderDeviceMgrEmpty::GetModeInfo( ShaderDisplayMode_t *pInfo, int nAdapter, int nMode ) const +{ + +} + +void CShaderDeviceMgrEmpty::GetCurrentModeInfo( ShaderDisplayMode_t *pInfo, int nAdapter ) const +{ + +} + +bool CShaderDeviceMgrEmpty::SetAdapter( int nAdapter, int nFlags ) +{ + return true; +} + +CreateInterfaceFn CShaderDeviceMgrEmpty::SetMode( void *hWnd, int nAdapter, const ShaderDeviceInfo_t &mode ) +{ + return ShaderInterfaceFactory; +} + +void CShaderDeviceMgrEmpty::AddModeChangeCallback( ShaderModeChangeCallbackFunc_t func ) +{ + +} + +void CShaderDeviceMgrEmpty::RemoveModeChangeCallback( ShaderModeChangeCallbackFunc_t func ) +{ + +} + +bool CShaderDeviceMgrEmpty::GetRecommendedVideoConfig( int nAdapter, KeyValues *pConfiguration ) +{ + return true; +} + +void CShaderDeviceMgrEmpty::AddDeviceDependentObject( IShaderDeviceDependentObject *pObject ) +{ + +} + +void CShaderDeviceMgrEmpty::RemoveDeviceDependentObject( IShaderDeviceDependentObject *pObject ) +{ + +} + +//----------------------------------------------------------------------------- +// Empty shader device +//----------------------------------------------------------------------------- +CShaderDeviceEmpty::CShaderDeviceEmpty() : m_Mesh(false), m_DynamicMesh(true) +{ + +} + +int CShaderDeviceEmpty::GetCurrentAdapter() const +{ + return 0; +} + +bool CShaderDeviceEmpty::IsUsingGraphics() const +{ + return false; +} + +void CShaderDeviceEmpty::SpewDriverInfo() const +{ + Warning("Empty shader\n"); +} + +ImageFormat CShaderDeviceEmpty::GetBackBufferFormat() const +{ + return IMAGE_FORMAT_RGB888; +} + +void CShaderDeviceEmpty::GetBackBufferDimensions( int &width, int &height ) const +{ + width = 1024; + height = 768; +} + +const AspectRatioInfo_t &CShaderDeviceEmpty::GetAspectRatioInfo() const +{ + static const AspectRatioInfo_t dummy = { false, false, (4.0f / 3.0f), (4.0f / 3.0f), 1.0f, 1.0f, false }; + return dummy; +} + +int CShaderDeviceEmpty::StencilBufferBits() const +{ + return 0; +} + +bool CShaderDeviceEmpty::IsAAEnabled() const +{ + return false; +} + +void CShaderDeviceEmpty::Present() +{ + +} + +void CShaderDeviceEmpty::GetWindowSize( int &nWidth, int &nHeight ) const +{ + nWidth = 0; + nHeight = 0; +} + +bool CShaderDeviceEmpty::AddView( void *hWnd ) +{ + return true; +} + +void CShaderDeviceEmpty::RemoveView( void *hWnd ) +{ + +} + +void CShaderDeviceEmpty::SetView( void *hWnd ) +{ + +} + +void CShaderDeviceEmpty::ReleaseResources( bool bReleaseManagedResources ) +{ + +} + +void CShaderDeviceEmpty::ReacquireResources() +{ + +} + +IMesh *CShaderDeviceEmpty::CreateStaticMesh( VertexFormat_t vertexFormat, const char *pTextureBudgetGroup, IMaterial *pMaterial, VertexStreamSpec_t *pStreamSpec ) +{ + return &m_Mesh; +} + +void CShaderDeviceEmpty::DestroyStaticMesh( IMesh *mesh ) +{ + +} + +IShaderBuffer *CShaderDeviceEmpty::CompileShader( const char *pProgram, size_t nBufLen, const char *pShaderVersion ) +{ + return NULL; +} + +VertexShaderHandle_t CShaderDeviceEmpty::CreateVertexShader( IShaderBuffer *pShaderBuffer ) +{ + return VERTEX_SHADER_HANDLE_INVALID; +} + +void CShaderDeviceEmpty::DestroyVertexShader( VertexShaderHandle_t hShader ) +{ + +} + +GeometryShaderHandle_t CShaderDeviceEmpty::CreateGeometryShader( IShaderBuffer *pShaderBuffer ) +{ + return GEOMETRY_SHADER_HANDLE_INVALID; +} + +void CShaderDeviceEmpty::DestroyGeometryShader( GeometryShaderHandle_t hShader ) +{ + +} + +PixelShaderHandle_t CShaderDeviceEmpty::CreatePixelShader( IShaderBuffer *pShaderBuffer ) +{ + return PIXEL_SHADER_HANDLE_INVALID; +} + +void CShaderDeviceEmpty::DestroyPixelShader( PixelShaderHandle_t hShader ) +{ + +} + +IVertexBuffer *CShaderDeviceEmpty::CreateVertexBuffer( ShaderBufferType_t type, VertexFormat_t fmt, int nVertexCount, const char *pBudgetGroup ) +{ + if (IsDynamicBufferType(type)) + return &m_DynamicMesh; + else + return &m_Mesh; +} + +void CShaderDeviceEmpty::DestroyVertexBuffer( IVertexBuffer *pVertexBuffer ) +{ + +} + +IIndexBuffer *CShaderDeviceEmpty::CreateIndexBuffer( ShaderBufferType_t bufferType, MaterialIndexFormat_t fmt, int nIndexCount, const char *pBudgetGroup ) +{ + if (IsDynamicBufferType(bufferType)) + return &m_DynamicMesh; + else + return &m_Mesh; +} + +void CShaderDeviceEmpty::DestroyIndexBuffer( IIndexBuffer *pIndexBuffer ) +{ + +} + +IVertexBuffer *CShaderDeviceEmpty::GetDynamicVertexBuffer( int nStreamID, VertexFormat_t vertexFormat, bool bBuffered ) +{ + return &m_DynamicMesh; +} + +IIndexBuffer *CShaderDeviceEmpty::GetDynamicIndexBuffer() +{ + return &m_Mesh; +} + +void CShaderDeviceEmpty::SetHardwareGammaRamp( float fGamma, float fGammaTVRangeMin, float fGammaTVRangeMax, float fGammaTVExponent, bool bTVEnabled ) +{ + +} + +void CShaderDeviceEmpty::EnableNonInteractiveMode( MaterialNonInteractiveMode_t mode, ShaderNonInteractiveInfo_t *pInfo ) +{ + +} + +void CShaderDeviceEmpty::RefreshFrontBufferNonInteractive() +{ + +} + +void CShaderDeviceEmpty::HandleThreadEvent( uint32 threadEvent ) +{ + +} + +void CShaderDeviceEmpty::DoStartupShaderPreloading() +{ + +} + +//----------------------------------------------------------------------------- +// Empty shader shadow +//----------------------------------------------------------------------------- +CShaderShadowEmpty::CShaderShadowEmpty() +{ + m_IsTranslucent = false; + m_ForceOpaque = false; + m_IsAlphaTested = false; + m_bIsDepthWriteEnabled = true; + m_bUsesVertexAndPixelShaders = false; +} + +CShaderShadowEmpty::~CShaderShadowEmpty() +{ + +} + +void CShaderShadowEmpty::SetDefaultState() +{ + m_IsTranslucent = false; + m_ForceOpaque = false; + m_IsAlphaTested = false; + m_bIsDepthWriteEnabled = true; + m_bUsesVertexAndPixelShaders = false; +} + +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 ) +{ + +} + +void CShaderShadowEmpty::EnableColorWrites( bool bEnable ) +{ + +} + +void CShaderShadowEmpty::EnableAlphaWrites( bool bEnable ) +{ + +} + +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 ) +{ + +} + +void CShaderShadowEmpty::EnableAlphaTest( bool bEnable ) +{ + m_IsAlphaTested = bEnable; +} + +void CShaderShadowEmpty::AlphaFunc( ShaderAlphaFunc_t alphaFunc, float alphaRef ) +{ + +} + +void CShaderShadowEmpty::PolyMode( ShaderPolyModeFace_t face, ShaderPolyMode_t polyMode ) +{ + +} + +void CShaderShadowEmpty::EnableCulling( bool bEnable ) +{ + +} + +void CShaderShadowEmpty::VertexShaderVertexFormat( unsigned int nFlags, int nTexCoordCount, int *pTexCoordDimensions, int nUserDataSize ) +{ + +} + +void CShaderShadowEmpty::EnableTexture( Sampler_t sampler, bool bEnable ) +{ + +} + +void CShaderShadowEmpty::EnableVertexTexture( VertexTextureSampler_t sampler, bool bEnable ) +{ + +} + +void CShaderShadowEmpty::EnableBlendingSeparateAlpha( bool bEnable ) +{ + +} + +void CShaderShadowEmpty::BlendFuncSeparateAlpha( ShaderBlendFactor_t srcFactor, ShaderBlendFactor_t dstFactor ) +{ + +} + +void CShaderShadowEmpty::SetVertexShader( const char *pFileName, int nStaticVshIndex ) +{ + m_bUsesVertexAndPixelShaders = (pFileName != NULL); +} + +void CShaderShadowEmpty::SetPixelShader( const char *pFileName, int nStaticPshIndex ) +{ + m_bUsesVertexAndPixelShaders = (pFileName != NULL); +} + +void CShaderShadowEmpty::EnableSRGBWrite( bool bEnable ) +{ + +} + +void CShaderShadowEmpty::EnableSRGBRead( Sampler_t sampler, bool bEnable ) +{ + +} + +void CShaderShadowEmpty::FogMode( ShaderFogMode_t fogMode, bool bEnable ) +{ + +} + +void CShaderShadowEmpty::DisableFogGammaCorrection( bool bDisable ) +{ + +} + +void CShaderShadowEmpty::ExecuteCommandBuffer( uint8 *pBuf ) +{ + +} + +void CShaderShadowEmpty::EnableAlphaToCoverage( bool bEnable ) +{ + +} + +void CShaderShadowEmpty::SetShadowDepthFiltering( Sampler_t stage ) +{ + +} + +void CShaderShadowEmpty::BlendOp( ShaderBlendOp_t blendOp ) +{ + +} + +void CShaderShadowEmpty::BlendOpSeparateAlpha( ShaderBlendOp_t blendOp ) +{ + +} + +float CShaderShadowEmpty::GetLightMapScaleFactor() const +{ + return 1.0f; +} + +//----------------------------------------------------------------------------- +// Empty implementation of shader API +//----------------------------------------------------------------------------- +CShaderAPIEmpty::CShaderAPIEmpty() : m_Mesh(false) +{ + +} + +CShaderAPIEmpty::~CShaderAPIEmpty() +{ + +} + +bool CShaderAPIEmpty::IsDebugTextureListFresh( int numFramesAllowed ) +{ + return false; +} + +bool CShaderAPIEmpty::SetDebugTextureRendering( bool bEnable ) +{ + return false; +} + +void CShaderAPIEmpty::EnableDebugTextureList( bool bEnable ) +{ + +} + +void CShaderAPIEmpty::EnableGetAllTextures( bool bEnable ) +{ + +} + +KeyValues *CShaderAPIEmpty::LockDebugTextureList() +{ + return NULL; +} + +void CShaderAPIEmpty::UnlockDebugTextureList() +{ + +} + +KeyValues *CShaderAPIEmpty::GetDebugTextureList() +{ + return NULL; +} + +int CShaderAPIEmpty::GetTextureMemoryUsed( TextureMemoryType eTextureMemory ) +{ + return 0; +} + +void CShaderAPIEmpty::GetBackBufferDimensions( int &width, int &height ) const +{ + width = 1024; + height = 768; +} + +const AspectRatioInfo_t &CShaderAPIEmpty::GetAspectRatioInfo() const +{ + static const AspectRatioInfo_t dummy = { false, false, (4.0f / 3.0f), (4.0f / 3.0f), 1.0f, 1.0f, false }; + return dummy; +} + +void CShaderAPIEmpty::GetCurrentRenderTargetDimensions( int &nWidth, int &nHeight ) const +{ + nWidth = 1024; + nHeight = 768; +} + +void CShaderAPIEmpty::GetCurrentViewport( int &nX, int &nY, int &nWidth, int &nHeight ) const +{ + nX = 0; + nY = 0; + nWidth = 1024; + nHeight = 768; +} + +void CShaderAPIEmpty::GetCurrentColorCorrection( ShaderColorCorrectionInfo_t *pInfo ) +{ + pInfo->m_bIsEnabled = false; + pInfo->m_nLookupCount = 0; + pInfo->m_flDefaultWeight = 0.0f; +} + +void CShaderAPIEmpty::SetViewports( int nCount, const ShaderViewport_t *pViewports, bool setImmediately ) +{ + +} + +int CShaderAPIEmpty::GetViewports( ShaderViewport_t *pViewports, int nMax ) const +{ + return 1; +} + +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 b, unsigned char g, unsigned char a ) +{ + +} + +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 ) +{ + +} + +void CShaderAPIEmpty::BindVertexShader( VertexShaderHandle_t hVertexShader ) +{ + +} + +void CShaderAPIEmpty::BindGeometryShader( GeometryShaderHandle_t hGeometryShader ) +{ + +} + +void CShaderAPIEmpty::BindPixelShader( PixelShaderHandle_t hPixelShader ) +{ + +} + +void CShaderAPIEmpty::SetRasterState( const ShaderRasterState_t &state ) +{ + +} + +void CShaderAPIEmpty::MarkUnusedVertexFields( unsigned int nFlags, int nTexCoordCount, bool *pUnusedTexCoords ) +{ + +} + +bool CShaderAPIEmpty::OwnGPUResources( bool bEnable ) +{ + return false; +} + +void CShaderAPIEmpty::OnPresent() +{ + +} + +bool CShaderAPIEmpty::DoRenderTargetsNeedSeparateDepthBuffer() const +{ + return false; +} + +void CShaderAPIEmpty::ClearSnapshots() +{ + +} + +bool CShaderAPIEmpty::SetMode( void *hwnd, int nAdapter, const ShaderDeviceInfo_t &info ) +{ + return true; +} + +void CShaderAPIEmpty::ChangeVideoMode( const ShaderDeviceInfo_t &info ) +{ + +} + +void CShaderAPIEmpty::DXSupportLevelChanged( int nDXLevel ) +{ + +} + +void CShaderAPIEmpty::EnableUserClipTransformOverride( bool bEnable ) +{ + +} + +void CShaderAPIEmpty::UserClipTransform( const VMatrix &worldToView ) +{ + +} + +void CShaderAPIEmpty::SetDefaultState() +{ + +} + +StateSnapshot_t CShaderAPIEmpty::TakeSnapshot() +{ + StateSnapshot_t id = 0; + if (g_ShaderShadow.m_IsTranslucent) + 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 |= DEPTH_WRITE_ENABLED; + return id; +} + +bool CShaderAPIEmpty::IsTranslucent( StateSnapshot_t id ) const +{ + return (id & TRANSLUCENT) != 0; +} + +bool CShaderAPIEmpty::IsAlphaTested( StateSnapshot_t id ) const +{ + return (id & ALPHATESTED) != 0; +} + +bool CShaderAPIEmpty::UsesVertexAndPixelShaders( StateSnapshot_t id ) const +{ + return (id & VERTEX_AND_PIXEL_SHADERS) != 0; +} + +bool CShaderAPIEmpty::IsDepthWriteEnabled( StateSnapshot_t id ) const +{ + return (id & DEPTH_WRITE_ENABLED) != 0; +} + +VertexFormat_t CShaderAPIEmpty::ComputeVertexFormat( int numSnapshots, StateSnapshot_t *pIds ) const +{ + return 0; +} + +VertexFormat_t CShaderAPIEmpty::ComputeVertexUsage( int numSnapshots, StateSnapshot_t *pIds ) const +{ + return 0; +} + +void CShaderAPIEmpty::BeginPass( StateSnapshot_t snapshot ) +{ + +} + +void CShaderAPIEmpty::UseSnapshot( StateSnapshot_t snapshot ) +{ + +} + +CMeshBuilder *CShaderAPIEmpty::GetVertexModifyBuilder() +{ + return NULL; +} + +void CShaderAPIEmpty::SetLightingState( const MaterialLightingState_t &state ) +{ + +} + +void CShaderAPIEmpty::SetLights( int nCount, const LightDesc_t *pDesc ) +{ + +} + +void CShaderAPIEmpty::SetLightingOrigin( Vector vLightingOrigin ) +{ + +} + +void CShaderAPIEmpty::SetAmbientLightCube( Vector4D cube[6] ) +{ + +} + +void CShaderAPIEmpty::CopyRenderTargetToTexture( ShaderAPITextureHandle_t textureHandle ) +{ + +} + +void CShaderAPIEmpty::CopyRenderTargetToTextureEx( ShaderAPITextureHandle_t textureHandle, int nRenderTargetID, Rect_t *pSrcRect, Rect_t *pDstRect ) +{ + +} + +void CShaderAPIEmpty::SetNumBoneWeights( int numBones ) +{ + +} + +void CShaderAPIEmpty::EnableHWMorphing( bool bEnable ) +{ + +} + +IMesh *CShaderAPIEmpty::GetDynamicMesh( IMaterial *pMaterial, int nHWSkinBoneCount, bool bBuffered, IMesh *pVertexOverride, IMesh *pIndexOverride ) +{ + return &m_Mesh; +} + +IMesh *CShaderAPIEmpty::GetDynamicMeshEx( IMaterial *pMaterial, VertexFormat_t vertexFormat, int nHWSkinBoneCount, bool bBuffered, IMesh *pVertexOverride, IMesh *pIndexOverride ) +{ + return &m_Mesh; +} + +IMesh *CShaderAPIEmpty::GetFlexMesh() +{ + return &m_Mesh; +} + +void CShaderAPIEmpty::RenderPass( const unsigned char *pInstanceCommandBuffer, int nPass, int nPassCount ) +{ + +} + +void CShaderAPIEmpty::MatrixMode( MaterialMatrixMode_t matrixMode ) +{ + +} + +void CShaderAPIEmpty::PushMatrix() +{ + +} + +void CShaderAPIEmpty::PopMatrix() +{ + +} + +void CShaderAPIEmpty::LoadMatrix( float *m ) +{ + +} + +void CShaderAPIEmpty::LoadBoneMatrix( int boneIndex, const float *m ) +{ + +} + +void CShaderAPIEmpty::MultMatrix( float *m ) +{ + +} + +void CShaderAPIEmpty::MultMatrixLocal( float *m ) +{ + +} + +void CShaderAPIEmpty::GetActualProjectionMatrix( float *m ) +{ + +} + +void CShaderAPIEmpty::GetMatrix( MaterialMatrixMode_t matrixMode, float *dst ) +{ + +} + +void CShaderAPIEmpty::LoadIdentity() +{ + +} + +void CShaderAPIEmpty::LoadCameraToWorld() +{ + +} + +void CShaderAPIEmpty::Ortho( double left, double right, double bottom, double top, 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 ) +{ + +} + +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::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::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::SetHeightClipZ( float z ) +{ + +} + +void CShaderAPIEmpty::SetHeightClipMode( enum MaterialHeightClipMode_t heightClipMode ) +{ + +} + +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::GetCurrentDynamicVBSize() +{ + return 0; +} + +int CShaderAPIEmpty::GetCurrentDynamicVBSize( int nIndex ) +{ + return 0; +} + +void CShaderAPIEmpty::DestroyVertexBuffers( bool bExitingLevel ) +{ + +} + +void CShaderAPIEmpty::GetGPUMemoryStats( GPUMemoryStats &stats ) +{ + +} + +void CShaderAPIEmpty::SetVertexShaderIndex( int vshIndex ) +{ + +} + +void CShaderAPIEmpty::SetPixelShaderIndex( int pshIndex ) +{ + +} + +void CShaderAPIEmpty::SetVertexShaderConstant( int var, float const *pVec, int numConst, bool bForce ) +{ + +} + +void CShaderAPIEmpty::SetBooleanVertexShaderConstant( int var, BOOL const *pVec, int numBools, bool bForce ) +{ + +} + +void CShaderAPIEmpty::SetIntegerVertexShaderConstant( int var, int const *pVec, int numIntVecs, 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() +{ + +} + +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 ) +{ + +} + +void CShaderAPIEmpty::CullMode( MaterialCullMode_t cullMode ) +{ + +} + +void CShaderAPIEmpty::FlipCullMode() +{ + +} + +void CShaderAPIEmpty::ForceDepthFuncEquals( bool bEnable ) +{ + +} + +void CShaderAPIEmpty::OverrideDepthEnable( bool bEnable, bool bDepthEnable, bool bDepthTestEnable ) +{ + +} + +void CShaderAPIEmpty::OverrideAlphaWriteEnable( bool bOverrideEnable, bool bAlphaWriteEnable ) +{ + +} + +void CShaderAPIEmpty::OverrideColorWriteEnable( bool bOverrideEnable, bool bColorWriteEnable ) +{ + +} + +void CShaderAPIEmpty::ShadeMode( ShaderShadeMode_t mode ) +{ + +} + +void CShaderAPIEmpty::Bind( IMaterial *pMaterial ) +{ + +} + +ImageFormat CShaderAPIEmpty::GetNearestSupportedFormat( ImageFormat fmt, bool bFilteringRequired ) const +{ + return fmt; +} + +ImageFormat CShaderAPIEmpty::GetNearestRenderTargetFormat( ImageFormat fmt ) const +{ + return fmt; +} + +void CShaderAPIEmpty::BindTexture( Sampler_t stage, TextureBindFlags_t nBindFlags, ShaderAPITextureHandle_t textureHandle ) +{ + +} + +void CShaderAPIEmpty::BindVertexTexture( VertexTextureSampler_t nSampler, ShaderAPITextureHandle_t textureHandle ) +{ + +} + +void CShaderAPIEmpty::SetRenderTarget( ShaderAPITextureHandle_t colorTextureHandle, ShaderAPITextureHandle_t depthTextureHandle ) +{ + +} + +void CShaderAPIEmpty::SetRenderTargetEx( int nRenderTargetID, ShaderAPITextureHandle_t colorTextureHandle, ShaderAPITextureHandle_t depthTextureHandle ) +{ + +} + +void CShaderAPIEmpty::ModifyTexture( ShaderAPITextureHandle_t textureHandle ) +{ + +} + +void CShaderAPIEmpty::TexImage2D( int level, int cubeFaceID, ImageFormat dstFormat, int zOffset, int width, int height, ImageFormat srcFormat, bool bSrcIsTiled, void *imageData ) +{ + +} + +void CShaderAPIEmpty::TexSubImage2D( int level, int cubeFaceID, 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 ) +{ + +} + +void *CShaderAPIEmpty::GetD3DTexturePtr( ShaderAPITextureHandle_t hTexture ) +{ + return NULL; +} + +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 INVALID_SHADERAPI_TEXTURE_HANDLE; +} + +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 ) +{ + if (count > 0) + { + memset(pHandles, 0, sizeof(ShaderAPITextureHandle_t) * count); + } +} + +ShaderAPITextureHandle_t CShaderAPIEmpty::CreateDepthTexture( ImageFormat renderTargetFormat, int width, int height, const char *pDebugName, bool bTexture, bool bAliasDepthTextureOverSceneDepthX360 ) +{ + return INVALID_SHADERAPI_TEXTURE_HANDLE; +} + +void CShaderAPIEmpty::DeleteTexture( ShaderAPITextureHandle_t textureHandle ) +{ + +} + +bool CShaderAPIEmpty::IsTexture( ShaderAPITextureHandle_t textureHandle ) +{ + return true; +} + +bool CShaderAPIEmpty::IsTextureResident( ShaderAPITextureHandle_t textureHandle ) +{ + return false; +} + +void CShaderAPIEmpty::ClearBuffersObeyStencil( bool bClearColor, bool bClearDepth ) +{ + +} + +void CShaderAPIEmpty::ClearBuffersObeyStencilEx( bool bClearColor, bool bClearAlpha, bool bClearDepth ) +{ + +} + +void CShaderAPIEmpty::PerformFullScreenStencilOperation() +{ + +} + +void CShaderAPIEmpty::ReadPixels( int x, int y, int width, int height, unsigned char *data, ImageFormat dstFormat ) +{ + +} + +void CShaderAPIEmpty::ReadPixels( Rect_t *pSrcRect, Rect_t *pDstRect, unsigned char *data, ImageFormat dstFormat, int nDstStride ) +{ + +} + +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() +{ + +} + +void CShaderAPIEmpty::FlushHardware() +{ + +} + +void CShaderAPIEmpty::ResetRenderState( bool bFullReset ) +{ + +} + +void CShaderAPIEmpty::SetScissorRect( int nLeft, int nTop, int nRight, int nBottom, bool bEnableScissor ) +{ + +} + +bool CShaderAPIEmpty::CanDownloadTextures() const +{ + return false; +} + +void CShaderAPIEmpty::BeginFrame() +{ + +} + +void CShaderAPIEmpty::EndFrame() +{ + +} + +double CShaderAPIEmpty::CurrentTime() const +{ + return Plat_FloatTime(); +} + +void CShaderAPIEmpty::GetWorldSpaceCameraPosition( float *pPos ) const +{ + +} + +void CShaderAPIEmpty::GetWorldSpaceCameraDirection( float *pDir ) const +{ + +} + +bool CShaderAPIEmpty::HasDestAlphaBuffer() const +{ + return false; +} + +bool CShaderAPIEmpty::HasStencilBuffer() const +{ + return false; +} + +int CShaderAPIEmpty::MaxViewports() const +{ + return 1; +} + +void CShaderAPIEmpty::OverrideStreamOffsetSupport( bool bOverrideEnabled, bool bEnableSupport ) +{ + +} + +ShadowFilterMode_t CShaderAPIEmpty::GetShadowFilterMode( bool bForceLowQualityShadows, bool bPS30 ) const +{ + 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; +} + +VertexCompressionType_t CShaderAPIEmpty::SupportsCompressedVertices() const +{ + return VERTEX_COMPRESSION_NONE; +} + +bool CShaderAPIEmpty::SupportsStaticControlFlow() const +{ + return false; +} + +int CShaderAPIEmpty::MaximumAnisotropicLevel() const +{ + return 0; +} + +int CShaderAPIEmpty::MaxTextureWidth() const +{ + return 16384; +} + +int CShaderAPIEmpty::MaxTextureHeight() const +{ + return 16384; +} + +int CShaderAPIEmpty::MaxTextureAspectRatio() const +{ + return 16384; +} + +int CShaderAPIEmpty::GetDXSupportLevel() const +{ + return 90; +} + +int CShaderAPIEmpty::GetMinDXSupportLevel() const +{ + return 90; +} + +bool CShaderAPIEmpty::SupportsShadowDepthTextures() const +{ + return false; +} + +bool CShaderAPIEmpty::SupportsShadowDepthTextures() +{ + return false; +} + +ImageFormat CShaderAPIEmpty::GetShadowDepthTextureFormat() const +{ + return IMAGE_FORMAT_RGBA8888; +} + +ImageFormat CShaderAPIEmpty::GetHighPrecisionShadowDepthTextureFormat() const +{ + return IMAGE_FORMAT_RGBA8888; +} + +ImageFormat CShaderAPIEmpty::GetNullTextureFormat() const +{ + return IMAGE_FORMAT_RGBA8888; +} + +const char *CShaderAPIEmpty::GetShaderDLLName() const +{ + return "UNKNOWN"; +} + +int CShaderAPIEmpty::TextureMemorySize() const +{ + return 0x4000000; +} + +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; +} + +int CShaderAPIEmpty::MaxVertexShaderBlendMatrices() const +{ + return 0; +} + +int CShaderAPIEmpty::MaxUserClipPlanes() const +{ + return 0; +} + +bool CShaderAPIEmpty::UseFastClipping() const +{ + return false; +} + +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 NULL; +} + +bool CShaderAPIEmpty::NeedsAAClamp() const +{ + return false; +} + +int CShaderAPIEmpty::MaxHWMorphBatchCount() const +{ + return 0; +} + +int CShaderAPIEmpty::GetMaxDXSupportLevel() const +{ + return 90; +} + +bool CShaderAPIEmpty::ReadPixelsFromFrontBuffer() const +{ + return true; +} + +bool CShaderAPIEmpty::PreferDynamicTextures() const +{ + return false; +} + +void CShaderAPIEmpty::ForceHardwareSync() +{ + +} + +int CShaderAPIEmpty::GetCurrentNumBones() const +{ + return 0; +} + +bool CShaderAPIEmpty::IsHWMorphingEnabled() const +{ + return false; +} + +void CShaderAPIEmpty::GetDX9LightState( LightState_t *state ) const +{ + state->m_nNumLights = 0; + state->m_bAmbientLight = false; + state->m_bStaticLight = false; +} + +MaterialFogMode_t CShaderAPIEmpty::GetCurrentFogType() const +{ + return MATERIAL_FOG_NONE; +} + +void CShaderAPIEmpty::RecordString( const char *pStr ) +{ + +} + +void CShaderAPIEmpty::EvictManagedResources() +{ + +} + +void CShaderAPIEmpty::GetLightmapDimensions( int *w, int *h ) +{ + g_pShaderUtil->GetLightmapDimensions(w, h); +} + +void CShaderAPIEmpty::SyncToken( const char *pToken ) +{ + +} + +void CShaderAPIEmpty::SetStandardVertexShaderConstants( float fOverbright ) +{ + +} + +void CShaderAPIEmpty::SetAnisotropicLevel( int nAnisotropyLevel ) +{ + +} + +bool CShaderAPIEmpty::SupportsHDR() const +{ + return false; +} + +HDRType_t CShaderAPIEmpty::GetHDRType() const +{ + return HDR_TYPE_NONE; +} + +HDRType_t CShaderAPIEmpty::GetHardwareHDRType() const +{ + return HDR_TYPE_NONE; +} + +bool CShaderAPIEmpty::NeedsATICentroidHack() const +{ + return false; +} + +bool CShaderAPIEmpty::SupportsColorOnSecondStream() const +{ + return false; +} + +bool CShaderAPIEmpty::SupportsStaticPlusDynamicLighting() const +{ + return false; +} + +bool CShaderAPIEmpty::SupportsStreamOffset() const +{ + return false; +} + +void CShaderAPIEmpty::CommitPixelShaderLighting( int pshReg ) +{ + +} + +ShaderAPIOcclusionQuery_t CShaderAPIEmpty::CreateOcclusionQueryObject() +{ + return INVALID_SHADERAPI_OCCLUSION_QUERY_HANDLE; +} + +void CShaderAPIEmpty::DestroyOcclusionQueryObject( ShaderAPIOcclusionQuery_t ) +{ + +} + +void CShaderAPIEmpty::BeginOcclusionQueryDrawing( ShaderAPIOcclusionQuery_t ) +{ + +} + +void CShaderAPIEmpty::EndOcclusionQueryDrawing( ShaderAPIOcclusionQuery_t ) +{ + +} + +int CShaderAPIEmpty::OcclusionQuery_GetNumPixelsRendered( ShaderAPIOcclusionQuery_t hQuery, bool bFlush ) +{ + return 0; +} + +void CShaderAPIEmpty::AcquireThreadOwnership() +{ + +} + +void CShaderAPIEmpty::ReleaseThreadOwnership() +{ + +} + +bool CShaderAPIEmpty::SupportsBorderColor() const +{ + return false; +} + +bool CShaderAPIEmpty::SupportsFetch4() const +{ + return false; +} + +bool CShaderAPIEmpty::SupportsFetch4() +{ + return false; +} + +void CShaderAPIEmpty::EnableBuffer2FramesAhead( bool bEnable ) +{ + +} + +float CShaderAPIEmpty::GetShadowDepthBias() const +{ + return 0.0f; +} + +float CShaderAPIEmpty::GetShadowSlopeScaleDepthBias() const +{ + return 0.0f; +} + +bool CShaderAPIEmpty::PreferZPrepass() const +{ + return false; +} + +bool CShaderAPIEmpty::SuppressPixelShaderCentroidHackFixup() const +{ + return true; +} + +bool CShaderAPIEmpty::PreferTexturesInHWMemory() const +{ + return false; +} + +bool CShaderAPIEmpty::PreferHardwareSync() const +{ + return false; +} + +bool CShaderAPIEmpty::IsUnsupported() const +{ + return false; +} + +void CShaderAPIEmpty::SetDepthFeatheringPixelShaderConstant( int iConstant, float fDepthBlendScale ) +{ + +} + +TessellationMode_t CShaderAPIEmpty::GetTessellationMode() const +{ + return TESSELLATION_MODE_DISABLED; +} + +void CShaderAPIEmpty::SetPixelShaderFogParams( int reg ) +{ + +} + +bool CShaderAPIEmpty::InFlashlightMode() const +{ + return false; +} + +bool CShaderAPIEmpty::IsRenderingPaint() const +{ + return false; +} + +bool CShaderAPIEmpty::InEditorMode() const +{ + return false; +} + +void CShaderAPIEmpty::BindStandardTexture( Sampler_t stage, TextureBindFlags_t nBindFlags, StandardTextureId_t id ) +{ + +} + +void CShaderAPIEmpty::BindStandardVertexTexture( VertexTextureSampler_t sampler, StandardTextureId_t id ) +{ + +} + +void CShaderAPIEmpty::GetStandardTextureDimensions( int *pWidth, int *pHeight, StandardTextureId_t id ) +{ + *pWidth = 0; + *pHeight = 0; +} + +float CShaderAPIEmpty::GetSubDHeight() +{ + return 0.0f; +} + +bool CShaderAPIEmpty::IsStereoActiveThisFrame() const +{ + return false; +} + +void CShaderAPIEmpty::SetFlashlightState( const FlashlightState_t &state, const VMatrix &worldToTexture ) +{ + +} + +void CShaderAPIEmpty::SetFlashlightStateEx( const FlashlightState_t &state, const VMatrix &worldToTexture, ITexture *pFlashlightDepthTexture ) +{ + +} + +bool CShaderAPIEmpty::IsCascadedShadowMapping() const +{ + return false; +} + +void CShaderAPIEmpty::SetCascadedShadowMapping( bool bEnable ) +{ + +} + +void CShaderAPIEmpty::SetCascadedShadowMappingState( const CascadedShadowMappingState_t &state, ITexture *pDepthTextureAtlas ) +{ + +} + +const CascadedShadowMappingState_t &CShaderAPIEmpty::GetCascadedShadowMappingState( ITexture **pDepthTextureAtlas ) const +{ + static CascadedShadowMappingState_t dummy; + return dummy; +} + +const FlashlightState_t &CShaderAPIEmpty::GetFlashlightState( VMatrix &worldToTexture ) const +{ + static const FlashlightState_t blah; + return blah; +} + +const FlashlightState_t &CShaderAPIEmpty::GetFlashlightStateEx( VMatrix &worldToTexture, ITexture **pFlashlightDepthTexture ) const +{ + static const FlashlightState_t blah; + return blah; +} + +void CShaderAPIEmpty::GetFlashlightShaderInfo( bool *pShadowsEnabled, bool *pUberLight ) const +{ + *pShadowsEnabled = false; + *pUberLight = false; +} + +float CShaderAPIEmpty::GetFlashlightAmbientOcclusion() const +{ + return 1.0f; +} + +void CShaderAPIEmpty::ClearVertexAndPixelShaderRefCounts() +{ + +} + +void CShaderAPIEmpty::PurgeUnusedVertexAndPixelShaders() +{ + +} + +void CShaderAPIEmpty::DrawInstances( int nInstanceCount, const MeshInstanceData_t *pInstance ) +{ + +} + +bool CShaderAPIEmpty::IsAAEnabled() const +{ + return false; +} + +int CShaderAPIEmpty::GetVertexTextureCount() const +{ + return 0; +} + +int CShaderAPIEmpty::GetMaxVertexTextureDimension() const +{ + return 0; +} + +int CShaderAPIEmpty::MaxTextureDepth() const +{ + return 0; +} + +void CShaderAPIEmpty::SetFlexWeights( int nFirstWeight, int nCount, const MorphWeight_t *pWeights ) +{ + +} + +ITexture *CShaderAPIEmpty::GetRenderTargetEx( int nRenderTargetID ) const +{ + return NULL; +} + +void CShaderAPIEmpty::SetToneMappingScaleLinear( const Vector &scale ) +{ + +} + +const Vector &CShaderAPIEmpty::GetToneMappingScaleLinear( void ) const +{ + static const Vector dummy; + return dummy; +} + +void CShaderAPIEmpty::HandleDeviceLost() +{ + +} + +void CShaderAPIEmpty::EnableLinearColorSpaceFrameBuffer( bool bEnable ) +{ + +} + +void CShaderAPIEmpty::SetFullScreenTextureHandle( ShaderAPITextureHandle_t h ) +{ + +} + +void CShaderAPIEmpty::SetFloatRenderingParameter( int parm_number, float value ) +{ + +} + +void CShaderAPIEmpty::SetIntRenderingParameter( int parm_number, int value ) +{ + +} + +void CShaderAPIEmpty::SetTextureRenderingParameter( int parm_number, ITexture *pTexture ) +{ + +} + +void CShaderAPIEmpty::SetVectorRenderingParameter( int parm_number, Vector const &value ) +{ + +} + +float CShaderAPIEmpty::GetFloatRenderingParameter( int parm_number ) const +{ + return 0.0f; +} + +int CShaderAPIEmpty::GetIntRenderingParameter( int parm_number ) const +{ + return 0; +} + +ITexture *CShaderAPIEmpty::GetTextureRenderingParameter( int parm_number ) const +{ + return NULL; +} + +Vector CShaderAPIEmpty::GetVectorRenderingParameter( int parm_number ) const +{ + return Vector(0.0f, 0.0f, 0.0f); +} + +void CShaderAPIEmpty::SetStencilState( const ShaderStencilState_t &state ) +{ + +} + +void CShaderAPIEmpty::ClearStencilBufferRectangle( int xmin, int ymin, int xmax, int ymax, int value ) +{ + +} + +void CShaderAPIEmpty::GetMaxToRender( IMesh *pMesh, bool bMaxUntilFlush, int *pMaxVerts, int *pMaxIndices ) +{ + *pMaxVerts = 32768; + *pMaxIndices = 32768; +} + +int CShaderAPIEmpty::GetMaxVerticesToRender( IMaterial *pMaterial ) +{ + return 32768; +} + +int CShaderAPIEmpty::GetMaxIndicesToRender() +{ + return 32768; +} + +int CShaderAPIEmpty::CompareSnapshots( StateSnapshot_t snapshot0, StateSnapshot_t snapshot1 ) +{ + return 0; +} + +void CShaderAPIEmpty::DisableAllLocalLights() +{ + +} + +bool CShaderAPIEmpty::SupportsMSAAMode( int nMSAAMode ) +{ + return false; +} + +bool CShaderAPIEmpty::SupportsCSAAMode( int nNumSamples, int nQualityLevel ) +{ + return false; +} + +void CShaderAPIEmpty::BeginPIXEvent( unsigned long color, const char *szName ) +{ + +} + +void CShaderAPIEmpty::EndPIXEvent() +{ + +} + +void CShaderAPIEmpty::SetPIXMarker( unsigned long color, const char *szName ) +{ + +} + +void CShaderAPIEmpty::ComputeVertexDescription( unsigned char *pBuffer, VertexFormat_t vertexFormat, MeshDesc_t &desc ) const +{ + +} + +int CShaderAPIEmpty::VertexFormatSize( VertexFormat_t vertexFormat ) const +{ + return 0; +} + +int CShaderAPIEmpty::NeedsShaderSRGBConversion() const +{ + return 0; +} + +bool CShaderAPIEmpty::UsesSRGBCorrectBlending() const +{ + return false; +} + +bool CShaderAPIEmpty::HasFastVertexTextures() const +{ + return false; +} + +bool CShaderAPIEmpty::ActualHasFastVertexTextures() const +{ + return false; +} + +void CShaderAPIEmpty::SetShadowDepthBiasFactors( float fShadowSlopeScaleDepthBias, float fShadowDepthBias ) +{ + +} + +void CShaderAPIEmpty::SetDisallowAccess( bool ) +{ + +} + +void CShaderAPIEmpty::EnableShaderShaderMutex( bool ) +{ + +} + +void CShaderAPIEmpty::ShaderLock() +{ + +} + +void CShaderAPIEmpty::ShaderUnlock() +{ + +} + +void CShaderAPIEmpty::BindVertexBuffer( int nStreamID, IVertexBuffer *pVertexBuffer, int nOffsetInBytes, int nFirstVertex, int nVertexCount, VertexFormat_t fmt, int nRepetitions ) +{ + +} + +void CShaderAPIEmpty::BindIndexBuffer( IIndexBuffer *pIndexBuffer, int nOffsetInBytes ) +{ + +} + +void CShaderAPIEmpty::Draw( MaterialPrimitiveType_t primitiveType, int nFirstIndex, int nIndexCount ) +{ + +} + +int CShaderAPIEmpty::GetVertexBufferCompression() const +{ + return 0; +} + +bool CShaderAPIEmpty::ShouldWriteDepthToDestAlpha() const +{ + return false; +} + +bool CShaderAPIEmpty::SupportsHDRMode( HDRType_t nHDRMode ) const +{ + return false; +} + +bool CShaderAPIEmpty::IsDX10Card() const +{ + return false; +} + +void CShaderAPIEmpty::PushDeformation( const DeformationBase_t *Deformation ) +{ + +} + +void CShaderAPIEmpty::PopDeformation() +{ + +} + +int CShaderAPIEmpty::GetNumActiveDeformations() const +{ + return 0; +} + +int CShaderAPIEmpty::GetPackedDeformationInformation( int nMaskOfUnderstoodDeformations, float *pConstantValuesOut, int nBufferSize, int nMaximumDeformations, int *pNumDefsOut ) const +{ + *pNumDefsOut = 0; + return 0; +} + +void CShaderAPIEmpty::SetStandardTextureHandle( StandardTextureId_t nId, ShaderAPITextureHandle_t nHandle ) +{ + +} + +void CShaderAPIEmpty::ExecuteCommandBuffer( uint8 *pCmdBuffer ) +{ + +} + +bool CShaderAPIEmpty::GetHDREnabled() const +{ + return true; +} + +void CShaderAPIEmpty::SetHDREnabled( bool bEnable ) +{ + +} + +void CShaderAPIEmpty::SetTextureFilterMode( Sampler_t sampler, TextureFilterMode_t nMode ) +{ + +} + +void CShaderAPIEmpty::SetScreenSizeForVPOS( int pshReg ) +{ + +} + +void CShaderAPIEmpty::SetVSNearAndFarZ( int vshReg ) +{ + +} + +float CShaderAPIEmpty::GetFarZ() +{ + return 1000.0f; +} + +void CShaderAPIEmpty::EnableSinglePassFlashlightMode( bool bEnable ) +{ + +} + +bool CShaderAPIEmpty::SinglePassFlashlightModeEnabled() +{ + return false; +} + +void CShaderAPIEmpty::FlipCulling( bool bFlipCulling ) +{ + +} + +void CShaderAPIEmpty::UpdateGameTime( float flTime ) +{ + +} + +bool CShaderAPIEmpty::IsStereoSupported( void ) const +{ + return false; +} + +void CShaderAPIEmpty::UpdateStereoTexture( ShaderAPITextureHandle_t texHandle, bool *pStereoActiveThisFrame ) +{ + +} + +void CShaderAPIEmpty::SetSRGBWrite( bool bState ) +{ + +} + +void CShaderAPIEmpty::PrintfVA( char *fmt, va_list vargs ) +{ + +} + +void CShaderAPIEmpty::Printf( char *fmt, ... ) +{ + +} + +float CShaderAPIEmpty::Knob( char *knobname, float *setvalue ) +{ + return 0.0f; +} + +void CShaderAPIEmpty::AddShaderComboInformation( const ShaderComboSemantics_t *pSemantics ) +{ + +} + +void CShaderAPIEmpty::SpinPresent( unsigned int nFrames ) +{ + +} + +void CShaderAPIEmpty::AntiAliasingHint( int a1 ) +{ + +} + +bool CShaderAPIEmpty::SupportsCascadedShadowMapping() const +{ + return false; +} + +CSMQualityMode_t CShaderAPIEmpty::GetCSMQuality() const +{ + return CSMQUALITY_VERY_LOW; +} + +bool CShaderAPIEmpty::SupportsBilinearPCFSampling() const +{ + return true; +} + +CSMShaderMode_t CShaderAPIEmpty::GetCSMShaderMode( CSMQualityMode_t nQualityLevel ) const +{ + return CSMSHADERMODE_LOW_OR_VERY_LOW; +} + +void CShaderAPIEmpty::EnableAlphaToCoverage() +{ + +} + +void CShaderAPIEmpty::DisableAlphaToCoverage() +{ + +} + +float CShaderAPIEmpty::GetLightMapScaleFactor( void ) const +{ + return 1.0f; +} + +ShaderAPITextureHandle_t CShaderAPIEmpty::FindTexture( const char *pDebugName ) +{ + return INVALID_SHADERAPI_TEXTURE_HANDLE; +} + +void CShaderAPIEmpty::GetTextureDimensions( ShaderAPITextureHandle_t hTexture, int &nWidth, int &nHeight, int &nDepth ) +{ + +} diff --git a/materialsystem/shaderapiempty/shaderapiempty.sln b/materialsystem/shaderapiempty/shaderapiempty.sln new file mode 100644 index 00000000..86c74f54 --- /dev/null +++ b/materialsystem/shaderapiempty/shaderapiempty.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaderapiempty", "shaderapiempty.vcxproj", "{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Debug|Win32.ActiveCfg = Debug|Win32 + {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Debug|Win32.Build.0 = Debug|Win32 + {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Release|Win32.ActiveCfg = Release|Win32 + {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/materialsystem/shaderapiempty/shaderapiempty.vcxproj b/materialsystem/shaderapiempty/shaderapiempty.vcxproj new file mode 100644 index 00000000..2bde64ce --- /dev/null +++ b/materialsystem/shaderapiempty/shaderapiempty.vcxproj @@ -0,0 +1,138 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + shaderapiempty + {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} + tier1 + + + + DynamicLibrary + + + DynamicLibrary + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + AllRules.ruleset + + + AllRules.ruleset + + + false + false + + + + + + + + Disabled + ..;..\..;..\..\public;..\..\public\tier0;..\..\public\tier1;..\..\public\interfaces;..\..\public\shaderapi;%(AdditionalIncludeDirectories) + WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebug + false + + + + + + + Level3 + StreamingSIMDExtensions2 + false + Fast + + + + + + + + + + + true + + + + ..\..\lib\public\interfaces.lib;..\..\lib\public\tier0.lib;..\..\lib\public\tier1.lib;..\..\lib\public\vstdlib.lib;%(AdditionalDependencies) + libc;libcd;libcmt + true + + + + + + + + + ..;..\..;..\..\public;..\..\public\tier0;..\..\public\tier1;..\..\public\interfaces;..\..\public\shaderapi;%(AdditionalIncludeDirectories) + WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + + + + + + + Level3 + AnySuitable + true + Speed + StreamingSIMDExtensions2 + false + Fast + + + + + + + + + + + true + + + + ..\..\lib\public\interfaces.lib;..\..\lib\public\tier0.lib;..\..\lib\public\tier1.lib;..\..\lib\public\vstdlib.lib;%(AdditionalDependencies) + libc;libcd;libcmtd + + + + + + \ No newline at end of file diff --git a/materialsystem/shaderapiempty/shaderapiempty.vcxproj.filters b/materialsystem/shaderapiempty/shaderapiempty.vcxproj.filters new file mode 100644 index 00000000..72a63845 --- /dev/null +++ b/materialsystem/shaderapiempty/shaderapiempty.vcxproj.filters @@ -0,0 +1,14 @@ + + + + + {f1ed3caa-29ea-4ac3-b9cd-4b1e2ecd2269} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + + + Source Files + + + \ No newline at end of file diff --git a/public/materialsystem/idebugtextureinfo.h b/public/materialsystem/idebugtextureinfo.h index eb462a55..d114b11d 100644 --- a/public/materialsystem/idebugtextureinfo.h +++ b/public/materialsystem/idebugtextureinfo.h @@ -38,7 +38,9 @@ public: // Width - Width of the texture // Height - Height of the texture // It is required to enable debug texture list to get this. - virtual KeyValues* GetDebugTextureList() = 0; + virtual KeyValues* LockDebugTextureList() = 0; + + virtual void UnlockDebugTextureList() = 0; // Texture memory usage enum TextureMemoryType diff --git a/public/materialsystem/imaterial.h b/public/materialsystem/imaterial.h index 49afbd92..d87e77d8 100644 --- a/public/materialsystem/imaterial.h +++ b/public/materialsystem/imaterial.h @@ -585,7 +585,7 @@ public: // the material can't be found. virtual bool IsErrorMaterial() const = 0; - virtual void SetUseFixedFunctionBakedLighting( bool bEnable ) = 0; + virtual void Unused() = 0; // Gets the current alpha modulation virtual float GetAlphaModulation() = 0; @@ -610,6 +610,10 @@ public: virtual void RefreshPreservingMaterialVars() = 0; virtual bool WasReloadedFromWhitelist() = 0; + + virtual bool SetTempExcluded( bool bSet , int nExcludedDimensionLimit ) = 0; + + virtual int GetReferenceCount() const = 0; }; diff --git a/public/materialsystem/imaterialsystem.h b/public/materialsystem/imaterialsystem.h index 61d3201b..16f968a7 100644 --- a/public/materialsystem/imaterialsystem.h +++ b/public/materialsystem/imaterialsystem.h @@ -63,7 +63,9 @@ class IClientMaterialSystem; class CPaintMaterial; class IPaintMapDataManager; class IPaintMapTextureManager; - +class GPUMemoryStats; +struct AspectRatioInfo_t; +struct CascadedShadowMappingState_t; //----------------------------------------------------------------------------- // The vertex format type @@ -414,11 +416,8 @@ struct FlashlightState_t m_fBrightnessScale = 1.0f; m_pSpotlightTexture = NULL; m_pProjectedMaterial = NULL; - m_bGlobalLight = false; - m_bSimpleProjection = false; - m_flProjectionSize = 500.0f; - m_flProjectionRotation = 0.0f; + m_bShareBetweenSplitscreenPlayers = false; } Vector m_vecLightOrigin; @@ -443,7 +442,6 @@ struct FlashlightState_t ITexture *m_pSpotlightTexture; IMaterial *m_pProjectedMaterial; int m_nSpotlightTextureFrame; - bool m_bGlobalLight; // Shadow depth mapping parameters bool m_bEnableShadows; @@ -459,7 +457,6 @@ struct FlashlightState_t bool m_bShadowHighRes; // simple projection - bool m_bSimpleProjection; float m_flProjectionSize; float m_flProjectionRotation; @@ -473,6 +470,7 @@ struct FlashlightState_t int m_nNumPlanes; float m_flPlaneOffset; float m_flVolumetricIntensity; + bool m_bShareBetweenSplitscreenPlayers; // Getters for scissor members bool DoScissor() const { return m_bScissor; } @@ -547,6 +545,8 @@ typedef void (*MaterialBufferReleaseFunc_t)( int nChangeFlags ); // see RestoreC typedef void (*MaterialBufferRestoreFunc_t)( int nChangeFlags ); // see RestoreChangeFlags_t typedef void (*ModeChangeCallbackFunc_t)( void ); typedef void (*EndFrameCleanupFunc_t)( void ); +typedef bool (*EndFramePriorToNextContextFunc_t)( void ); +typedef void (*OnLevelShutdownFunc_t)( void *pUserData ); //typedef int VertexBufferHandle_t; typedef unsigned short MaterialHandle_t; @@ -575,6 +575,21 @@ struct MaterialTextureInfo_t }; +struct ApplicationPerformanceCountersInfo_t +{ + float msMain; + float msMST; + float msGPU; + float msFlip; + float msTotal; +}; + +struct ApplicationInstantCountersInfo_t +{ + uint m_nCpuActivityMask; + uint m_nDeferredWordsAllocated; +}; + //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- @@ -620,6 +635,8 @@ public: virtual MaterialThreadMode_t GetThreadMode() = 0; virtual void ExecuteQueued() = 0; + virtual void OnDebugEvent( const char *pEvent ) = 0; + //--------------------------------------------------------- // Config management //--------------------------------------------------------- @@ -690,6 +707,8 @@ public: virtual void GetBackBufferDimensions( int &width, int &height) const = 0; virtual ImageFormat GetBackBufferFormat() const = 0; + virtual const AspectRatioInfo_t &GetAspectRatioInfo() const = 0; + virtual bool SupportsHDRMode( HDRType_t nHDRModede ) = 0; @@ -713,6 +732,8 @@ public: virtual void EndFrame( ) = 0; virtual void Flush( bool flushHardware = false ) = 0; + virtual unsigned int GetCurrentFrameCount( ) = 0; + /// FIXME: This stuff needs to be cleaned up and abstracted. // Stuff that gets exported to the launcher through the engine virtual void SwapBuffers( ) = 0; @@ -721,7 +742,7 @@ public: virtual void EvictManagedResources() = 0; virtual void ReleaseResources(void) = 0; - virtual void ReacquireResources(void ) = 0; + virtual void ReacquireResources(void) = 0; // ----------------------------------------------------------- @@ -740,6 +761,11 @@ public: virtual void AddEndFrameCleanupFunc( EndFrameCleanupFunc_t func ) = 0; virtual void RemoveEndFrameCleanupFunc( EndFrameCleanupFunc_t func ) = 0; + virtual void OnLevelShutdown() = 0; + virtual bool AddOnLevelShutdownFunc( OnLevelShutdownFunc_t func, void *pUserData ) = 0; + virtual bool RemoveOnLevelShutdownFunc( OnLevelShutdownFunc_t func, void *pUserData ) = 0; + virtual void OnLevelLoadingComplete() = 0; + // Release temporary HW memory... virtual void ResetTempHWMemory( bool bExitingLevel = false ) = 0; @@ -945,6 +971,8 @@ public: virtual void BeginLightmapAllocation( ) = 0; virtual void EndLightmapAllocation( ) = 0; + virtual void CleanupLightmaps( ) = 0; + // returns the sorting id for this surface virtual int AllocateLightmap( int width, int height, int offsetIntoLightmapPage[2], @@ -972,7 +1000,9 @@ public: virtual void ResetMaterialLightmapPageInfo() = 0; - + virtual bool IsStereoSupported() = 0; + virtual bool IsStereoActiveThisFrame() const = 0; + virtual void NVStereoUpdate() = 0; virtual void ClearBuffers( bool bClearColor, bool bClearDepth, bool bClearStencil = false ) = 0; @@ -994,6 +1024,8 @@ public: virtual bool OwnGPUResources( bool bEnable ) = 0; #endif + virtual void SpinPresent( unsigned int nFrames ) = 0; + // ----------------------------------------------------------- // Access the render contexts // ----------------------------------------------------------- @@ -1029,13 +1061,15 @@ public: // being used to draw in the previous frame virtual int AllocateDynamicLightmap( int lightmapSize[2], int *pOutOffsetIntoPage, int frameID ) = 0; - virtual void SetExcludedTextures( const char *pScriptName ) = 0; + virtual void SetExcludedTextures( const char *pScriptName, bool bUsingWeaponModelCache ) = 0; virtual void UpdateExcludedTextures( void ) = 0; virtual bool IsInFrame( ) const = 0; virtual void CompactMemory() = 0; + virtual void GetGPUMemoryStats( GPUMemoryStats &stats ) = 0; + // For sv_pure mode. The filesystem figures out which files the client needs to reload to be "pure" ala the server's preferences. virtual void ReloadFilesInList( IFileList *pFilesToReload ) = 0; @@ -1056,6 +1090,22 @@ public: virtual int GetNumLightmapPages() const = 0; virtual IPaintMapTextureManager *RegisterPaintMapDataManager( IPaintMapDataManager *pDataManager ) = 0; //You supply an interface we can query for bits, it gives back an interface you can use to drive updates + + virtual void BeginUpdatePaintmaps() = 0; + virtual void EndUpdatePaintmaps() = 0; + virtual void UpdatePaintmap( int paintmap, unsigned char *pPaintData, int numRects, Rect_t *pRects ) = 0; + + virtual ITexture *CreateNamedMultiRenderTargetTexture( const char *pRTName, int w, int h, RenderTargetSizeMode_t sizeMode, + ImageFormat format, MaterialRenderTargetDepth_t depth, unsigned int textureFlags, unsigned int renderTargetFlags ) = 0; + + virtual void RefreshFrontBufferNonInteractive() = 0; + + virtual uint32 GetFrameTimestamps( ApplicationPerformanceCountersInfo_t &apci, ApplicationInstantCountersInfo_t &aici ) = 0; + + virtual void DoStartupShaderPreloading() = 0; + + virtual void AddEndFramePriorToNextContextFunc( EndFramePriorToNextContextFunc_t func ) = 0; + virtual void RemoveEndFramePriorToNextContextFunc( EndFramePriorToNextContextFunc_t func ) = 0; }; @@ -1258,6 +1308,10 @@ public: virtual void SetFlashlightState( const FlashlightState_t &state, const VMatrix &worldToTexture ) = 0; + virtual bool IsCascadedShadowMapping( ) const = 0; + virtual void SetCascadedShadowMapping( bool bEnable ) = 0; + virtual void SetCascadedShadowMappingState( const CascadedShadowMappingState_t &state, ITexture *pDepthTextureAtlas ) = 0; + // Gets the current height clip mode virtual MaterialHeightClipMode_t GetHeightClipMode( ) = 0; @@ -1274,6 +1328,9 @@ public: virtual bool GetFlashlightMode() const = 0; + virtual bool IsCullingEnabledForSinglePassFlashlight() const = 0; + virtual void EnableCullingForSinglePassFlashlight( bool bEnable ) = 0; + // Used to make the handle think it's never had a successful query before virtual void ResetOcclusionQueryObject( OcclusionQueryObjectHandle_t ) = 0; @@ -1353,9 +1410,6 @@ public: // Special off-center perspective matrix for DoF, MSAA jitter and poster rendering virtual void PerspectiveOffCenterX( double fovx, double aspect, double zNear, double zFar, double bottom, double top, double left, double right ) = 0; - // Sets the ambient light color - virtual void SetAmbientLightColor( float r, float g, float b ) = 0; - // Rendering parameters control special drawing modes withing the material system, shader // system, shaders, and engine. renderparm.h has their definitions. virtual void SetFloatRenderingParameter(int parm_number, float value) = 0; @@ -1390,7 +1444,6 @@ public: virtual IMesh *GetFlexMesh() = 0; virtual void SetFlashlightStateEx( const FlashlightState_t &state, const VMatrix &worldToTexture, ITexture *pFlashlightDepthTexture ) = 0; - virtual void SetFlashlightStateExDeRef( const FlashlightState_t &state, ITexture *pFlashlightDepthTexture ) = 0; // Returns the currently bound local cubemap virtual ITexture *GetLocalCubemap( ) = 0; @@ -1414,7 +1467,7 @@ public: // - replaced obtuse material system batch usage with an explicit and easier to thread API virtual void BeginBatch( IMesh* pIndices ) = 0; virtual void BindBatch( IMesh* pVertices, IMaterial *pAutoBind = NULL ) = 0; - virtual void DrawBatch(int firstIndex, int numIndices ) = 0; + virtual void DrawBatch( MaterialPrimitiveType_t primType, int firstIndex, int numIndices ) = 0; virtual void EndBatch() = 0; // Raw access to the call queue, which can be NULL if not in a queued mode @@ -1437,8 +1490,8 @@ public: // Sets lighting origin for the current model (needed to convert directional lights to points) virtual void SetLightingOrigin( Vector vLightingOrigin ) = 0; - // Set scissor rect for rendering - virtual void SetScissorRect( const int nLeft, const int nTop, const int nRight, const int nBottom, const bool bEnableScissor ) = 0; + virtual void PushScissorRect( int nLeft, int nTop, int nRight, int nBottom ) = 0; + virtual void PopScissorRect( void ) = 0; // Methods used to build the morph accumulator that is read from when HW morphing is enabled. virtual void BeginMorphAccumulation() = 0; @@ -1468,6 +1521,8 @@ public: virtual void End360ZPass() = 0; #endif + virtual void AntiAliasingHint( int a1 ) = 0; + virtual IMaterial *GetCurrentMaterial() = 0; virtual int GetCurrentNumBones() const = 0; virtual void *GetCurrentProxy() = 0; @@ -1489,6 +1544,8 @@ public: //Use this to mark it as invalid and use a dummy texture for depth reads. virtual void SetFullScreenDepthTextureValidityFlag( bool bIsValid ) = 0; + virtual void SetNonInteractiveLogoTexture( ITexture *pTexture, float flNormalizedX, float flNormalizedY, float flNormalizedW, float flNormalizedH ) = 0; + // A special path used to tick the front buffer while loading on the 360 virtual void SetNonInteractivePacifierTexture( ITexture *pTexture, float flNormalizedX, float flNormalizedY, float flNormalizedSize ) = 0; virtual void SetNonInteractiveTempFullscreenBuffer( ITexture *pTexture, MaterialNonInteractiveMode_t mode ) = 0; @@ -1502,6 +1559,7 @@ public: //only actually sets a bool that can be read in from shaders, doesn't do any of the legwork virtual void EnableSinglePassFlashlightMode( bool bEnable ) = 0; + virtual bool SinglePassFlashlightModeEnabled() const = 0; // Draws instances with different meshes virtual void DrawInstances( int nInstanceCount, const MeshInstanceData_t *pInstance ) = 0; @@ -1523,6 +1581,16 @@ public: virtual void PrintfVA( char *fmt, va_list vargs ) = 0; virtual void Printf( char *fmt, ... ) = 0; virtual float Knob( char *knobname, float *setvalue = NULL ) = 0; + + virtual void SetScaleformSlotViewport( int slot, int x, int y, int w, int h ) = 0; + virtual void RenderScaleformSlot( int slot ) = 0; + virtual void ForkRenderScaleformSlot( int slot ) = 0; + virtual void JoinRenderScaleformSlot( int slot ) = 0; + virtual void SetScaleformCursorViewport( int x, int y, int w, int h ) = 0; + virtual void RenderScaleformCursor() = 0; + + virtual void SetRenderingPaint( bool bEnable ) = 0; + virtual ColorCorrectionHandle_t FindLookup( const char *a1 ) = 0; }; diff --git a/public/materialsystem/imaterialsystemhardwareconfig.h b/public/materialsystem/imaterialsystemhardwareconfig.h index 50b51742..992edd30 100644 --- a/public/materialsystem/imaterialsystemhardwareconfig.h +++ b/public/materialsystem/imaterialsystemhardwareconfig.h @@ -53,6 +53,35 @@ enum VertexCompressionType_t VERTEX_COMPRESSION_ON = 1 }; +enum CSMQualityMode_t +{ + CSMQUALITY_VERY_LOW, + CSMQUALITY_LOW, + CSMQUALITY_MEDIUM, + CSMQUALITY_HIGH, + CSMQUALITY_TOTAL_MODES +}; + +enum CSMShaderMode_t +{ + CSMSHADERMODE_LOW_OR_VERY_LOW, + CSMSHADERMODE_MEDIUM, + CSMSHADERMODE_HIGH, + CSMSHADERMODE_ATIFETCH4, + CSMSHADERMODE_TOTAL_MODES +}; + +enum ShadowFilterMode_t +{ + SHADOWFILTERMODE_DEFAULT, + NVIDIA_PCF = 0, + ATI_NO_PCF_FETCH4, + NVIDIA_PCF_CHEAP, + ATI_NOPCF, + GAMECONSOLE_NINE_TAP_PCF = 0, + GAMECONSOLE_SINGLE_TAP_PCF, + SHADOWFILTERMODE_FIRST_CHEAP_MODE +}; // use DEFCONFIGMETHOD to define time-critical methods that we want to make just return constants // on the 360, so that the checks will happen at compile time. Not all methods are defined this way @@ -81,6 +110,7 @@ public: virtual int GetFrameBufferColorDepth() const = 0; virtual int GetSamplerCount() const = 0; virtual bool HasSetDeviceGammaRamp() const = 0; + virtual bool SupportsStaticControlFlow() const = 0; virtual VertexCompressionType_t SupportsCompressedVertices() const = 0; virtual int MaximumAnisotropicLevel() const = 0; // 0 means no anisotropic filtering virtual int MaxTextureWidth() const = 0; @@ -120,6 +150,12 @@ public: // Does the card support sRGB reads/writes? DEFCONFIGMETHOD( bool, SupportsSRGB(), true ); + virtual bool FakeSRGBWrite() const = 0; + + virtual bool CanDoSRGBReadFromRTs() const = 0; + + virtual bool SupportsGLMixedSizeTargets() const = 0; + virtual bool IsAAEnabled() const = 0; // Is antialiasing being used? // NOTE: Anything after this was added after shipping HL2. @@ -138,7 +174,7 @@ public: virtual void OverrideStreamOffsetSupport( bool bOverrideEnabled, bool bEnableSupport ) = 0; - virtual int GetShadowFilterMode() const = 0; + virtual ShadowFilterMode_t GetShadowFilterMode( bool bForceLowQualityShadows, bool bPS30 ) const = 0; virtual int NeedsShaderSRGBConversion() const = 0; @@ -167,6 +203,7 @@ public: virtual bool SupportsShadowDepthTextures( void ) const = 0; virtual ImageFormat GetShadowDepthTextureFormat( void ) const = 0; + virtual ImageFormat GetHighPrecisionShadowDepthTextureFormat( void ) const = 0; virtual ImageFormat GetNullTextureFormat( void ) const = 0; virtual int GetMinDXSupportLevel() const = 0; virtual bool IsUnsupported() const = 0; @@ -175,6 +212,12 @@ public: #if defined ( STDSHADER_DBG_DLL_EXPORT ) || defined( STDSHADER_DX9_DLL_EXPORT ) inline bool SupportsPixelShaders_2_b() const { return GetDXSupportLevel() >= 92; } #endif + + virtual float GetLightMapScaleFactor() const = 0; + virtual bool SupportsCascadedShadowMapping() const = 0; + virtual CSMQualityMode_t GetCSMQuality() const = 0; + virtual bool SupportsBilinearPCFSampling() const = 0; + virtual CSMShaderMode_t GetCSMShaderMode( CSMQualityMode_t nQualityLevel ) const = 0; }; #endif // IMATERIALSYSTEMHARDWARECONFIG_H diff --git a/public/materialsystem/imesh.h b/public/materialsystem/imesh.h index 16fce7b1..06b2365c 100644 --- a/public/materialsystem/imesh.h +++ b/public/materialsystem/imesh.h @@ -221,6 +221,10 @@ struct MeshInstanceData_t Vector4D m_DiffuseModulation; }; +struct MeshBuffersAllocationSettings_t +{ + uint32 m_uiIbUsageFlags; +}; //----------------------------------------------------------------------------- // Utility methods for buffer builders @@ -335,6 +339,11 @@ public: virtual IMesh* GetMesh() = 0; }; +abstract_class ICachedPerFrameMeshData +{ +public: + virtual void Free() = 0; +}; //----------------------------------------------------------------------------- // Interface to the mesh - needs to contain an IVertexBuffer and an IIndexBuffer to emulate old mesh behavior @@ -348,7 +357,7 @@ public: virtual void SetPrimitiveType( MaterialPrimitiveType_t type ) = 0; // Draws the mesh - virtual void Draw( int nFirstIndex = -1, int nIndexCount = 0 ) = 0; + virtual void Draw( int firstIndex = -1, int numIndices = 0 ) = 0; virtual void SetColorMesh( IMesh *pColorMesh, int nVertexOffset ) = 0; @@ -368,20 +377,20 @@ public: CMeshBuilder &builder ) = 0; // Spews the mesh data - virtual void Spew( int nVertexCount, int nIndexCount, const MeshDesc_t &desc ) = 0; + virtual void Spew( int numVerts, int numIndices, const MeshDesc_t &desc ) = 0; // Call this in debug mode to make sure our data is good. - virtual void ValidateData( int nVertexCount, int nIndexCount, const MeshDesc_t &desc ) = 0; + virtual void ValidateData( int numVerts, int numIndices, const MeshDesc_t &desc ) = 0; // New version - // Locks/unlocks the mesh, providing space for nVertexCount and nIndexCount. - // nIndexCount of -1 means don't lock the index buffer... - virtual void LockMesh( int nVertexCount, int nIndexCount, MeshDesc_t &desc ) = 0; - virtual void ModifyBegin( int nFirstVertex, int nVertexCount, int nFirstIndex, int nIndexCount, MeshDesc_t& desc ) = 0; + // Locks/unlocks the mesh, providing space for numVerts and numIndices. + // numIndices of -1 means don't lock the index buffer... + virtual void LockMesh( int numVerts, int numIndices, MeshDesc_t &desc, MeshBuffersAllocationSettings_t *pSettings ) = 0; + virtual void ModifyBegin( int firstVertex, int numVerts, int firstIndex, int numIndices, MeshDesc_t& desc ) = 0; virtual void ModifyEnd( MeshDesc_t& desc ) = 0; - virtual void UnlockMesh( int nVertexCount, int nIndexCount, MeshDesc_t &desc ) = 0; + virtual void UnlockMesh( int numVerts, int numIndices, MeshDesc_t &desc ) = 0; - virtual void ModifyBeginEx( bool bReadOnly, int nFirstVertex, int nVertexCount, int nFirstIndex, int nIndexCount, MeshDesc_t &desc ) = 0; + virtual void ModifyBeginEx( bool bReadOnly, int firstVertex, int numVerts, int firstIndex, int numIndices, MeshDesc_t &desc ) = 0; virtual void SetFlexMesh( IMesh *pMesh, int nVertexOffset ) = 0; @@ -392,11 +401,14 @@ public: // NOTE: I chose to create this method strictly because it's 2 days to code lock // and I could use the DrawInstances technique without a larger code change // Draws the mesh w/ modulation. - virtual void DrawModulated( const Vector4D &diffuseModulation, int nFirstIndex = -1, int nIndexCount = 0 ) = 0; + virtual void DrawModulated( const Vector4D &vecDiffuseModulation, int firstIndex = -1, int numIndices = 0 ) = 0; -#if defined( _X360 ) - virtual unsigned ComputeMemoryUsed() = 0; -#endif + virtual unsigned int ComputeMemoryUsed() = 0; + + virtual void *AccessRawHardwareDataStream( uint8 nRawStreamIndex, uint32 numBytes, uint32 uiFlags, void *pvContext ) = 0; + + virtual ICachedPerFrameMeshData *GetCachedPerFrameMeshData() = 0; + virtual void ReconstructFromCachedPerFrameMeshData( ICachedPerFrameMeshData *pData ) = 0; }; @@ -988,7 +1000,7 @@ inline void CVertexBuilder::Reset() m_pCurrPosition = m_pPosition; m_pCurrNormal = m_pNormal; - for ( int i = 0; i < NELEMS( m_pCurrTexCoord ); i++ ) + for ( size_t i = 0; i < NELEMS( m_pCurrTexCoord ); i++ ) { m_pCurrTexCoord[i] = m_pTexCoord[i]; } @@ -2274,8 +2286,8 @@ public: // Locks the index buffer to modify existing data // Passing nVertexCount == -1 says to lock all the vertices for modification. - // Pass 0 for nIndexCount to not lock the index buffer. - void BeginModify( IIndexBuffer *pIndexBuffer, int nFirstIndex = 0, int nIndexCount = 0, int nIndexOffset = 0 ); + // Pass 0 for numIndices to not lock the index buffer. + void BeginModify( IIndexBuffer *pIndexBuffer, int firstIndex = 0, int numIndices = 0, int nIndexOffset = 0 ); void EndModify( bool bSpewData = false ); // returns the number of indices @@ -2292,7 +2304,7 @@ public: // Advances the current index by one void AdvanceIndex(); - void AdvanceIndices( int nIndexCount ); + void AdvanceIndices( int numIndices ); int GetCurrentIndex(); int GetFirstIndex() const; @@ -2310,12 +2322,12 @@ public: void FastIndex2( unsigned short nIndex1, unsigned short nIndex2 ); // Generates indices for a particular primitive type - void GenerateIndices( MaterialPrimitiveType_t primitiveType, int nIndexCount ); + void GenerateIndices( MaterialPrimitiveType_t primitiveType, int numIndices ); // FIXME: Remove! Backward compat so we can use this from a CMeshBuilder. void AttachBegin( IMesh* pMesh, int nMaxIndexCount, const MeshDesc_t &desc ); void AttachEnd(); - void AttachBeginModify( IMesh* pMesh, int nFirstIndex, int nIndexCount, const MeshDesc_t &desc ); + void AttachBeginModify( IMesh* pMesh, int firstIndex, int numIndices, const MeshDesc_t &desc ); void AttachEndModify(); void FastTriangle( int startVert ); @@ -2361,8 +2373,8 @@ private: //----------------------------------------------------------------------------- // Constructor //----------------------------------------------------------------------------- -inline CIndexBuilder::CIndexBuilder() : m_pIndexBuffer(0), m_nIndexCount(0), - m_nCurrentIndex(0), m_nMaxIndexCount(0) +inline CIndexBuilder::CIndexBuilder() : m_pIndexBuffer(0), m_nMaxIndexCount(0), + m_nIndexCount(0), m_nCurrentIndex(0) { m_nTotalIndexCount = 0; m_nBufferOffset = INVALID_BUFFER_OFFSET; @@ -3295,7 +3307,7 @@ inline void CMeshBuilder::Begin( IMesh *pMesh, MaterialPrimitiveType_t type, int } // Lock the mesh - m_pMesh->LockMesh( nMaxVertexCount, nMaxIndexCount, *this ); + m_pMesh->LockMesh( nMaxVertexCount, nMaxIndexCount, *this, NULL ); m_IndexBuilder.AttachBegin( pMesh, nMaxIndexCount, *this ); m_VertexBuilder.AttachBegin( pMesh, nMaxVertexCount, *this ); @@ -3332,7 +3344,7 @@ inline void CMeshBuilder::Begin( IMesh* pMesh, MaterialPrimitiveType_t type, int m_pMesh->SetPrimitiveType( type ); // Lock the vertex and index buffer - m_pMesh->LockMesh( nVertexCount, nIndexCount, *this ); + m_pMesh->LockMesh( nVertexCount, nIndexCount, *this, NULL ); m_IndexBuilder.AttachBegin( pMesh, nIndexCount, *this ); m_VertexBuilder.AttachBegin( pMesh, nVertexCount, *this ); diff --git a/public/shaderapi/IShaderDevice.h b/public/shaderapi/IShaderDevice.h index 5b153488..35053a2a 100644 --- a/public/shaderapi/IShaderDevice.h +++ b/public/shaderapi/IShaderDevice.h @@ -27,7 +27,7 @@ struct MaterialAdapterInfo_t; class IMesh; class KeyValues; - +class IShaderDeviceDependentObject; //----------------------------------------------------------------------------- // Describes how to set the mode @@ -179,6 +179,9 @@ public: virtual void RemoveModeChangeCallback( ShaderModeChangeCallbackFunc_t func ) = 0; virtual bool GetRecommendedVideoConfig( int nAdapter, KeyValues *pConfiguration ) = 0; + + virtual void AddDeviceDependentObject( IShaderDeviceDependentObject *pObject ) = 0; + virtual void RemoveDeviceDependentObject( IShaderDeviceDependentObject *pObject ) = 0; }; @@ -197,6 +200,8 @@ public: virtual ImageFormat GetBackBufferFormat() const = 0; virtual void GetBackBufferDimensions( int& width, int& height ) const = 0; + virtual const AspectRatioInfo_t& GetAspectRatioInfo() const = 0; + // Returns the current adapter in use virtual int GetCurrentAdapter() const = 0; @@ -269,6 +274,12 @@ public: virtual void EnableNonInteractiveMode( MaterialNonInteractiveMode_t mode, ShaderNonInteractiveInfo_t *pInfo = NULL ) = 0; virtual void RefreshFrontBufferNonInteractive( ) = 0; virtual void HandleThreadEvent( uint32 threadEvent ) = 0; + +#ifdef PLATFORM_POSIX + virtual void DoStartupShaderPreloading() = 0; +#endif + + virtual void OnDebugEvent( const char *pEvent ) {}; }; diff --git a/public/shaderapi/ishaderapi.h b/public/shaderapi/ishaderapi.h index 039b601d..fa75f12c 100644 --- a/public/shaderapi/ishaderapi.h +++ b/public/shaderapi/ishaderapi.h @@ -245,6 +245,21 @@ struct ShaderStencilState_t } }; +struct ShaderComboInformation_t +{ + const char *m_pComboName; + int m_nComboMin; + int m_nComboMax; +}; + +struct ShaderComboSemantics_t +{ + const char *pShaderName; + const ShaderComboInformation_t *pDynamicShaderComboArray; + int nDynamicShaderComboArrayCount; + const ShaderComboInformation_t *pStaticShaderComboArray; + int nStaticShaderComboArrayCount; +}; //----------------------------------------------------------------------------- // Used for occlusion queries @@ -272,7 +287,7 @@ public: // // Viewport methods - virtual void SetViewports( int nCount, const ShaderViewport_t* pViewports ) = 0; + virtual void SetViewports( int nCount, const ShaderViewport_t* pViewports, bool setImmediately ) = 0; virtual int GetViewports( ShaderViewport_t* pViewports, int nMax ) const = 0; // Buffer clearing @@ -309,9 +324,6 @@ public: // Binds a particular material to render with virtual void Bind( IMaterial* pMaterial ) = 0; - // Flushes any primitives that are buffered - virtual void FlushBufferedPrimitives() = 0; - // 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. @@ -362,7 +374,7 @@ public: virtual void ForceDepthFuncEquals( bool bEnable ) = 0; // Forces Z buffering to be on or off - virtual void OverrideDepthEnable( bool bEnable, bool bDepthEnable ) = 0; + virtual void OverrideDepthEnable( bool bEnable, bool bDepthEnable, bool bDepthTestEnable ) = 0; virtual void SetHeightClipZ( float z ) = 0; virtual void SetHeightClipMode( enum MaterialHeightClipMode_t heightClipMode ) = 0; @@ -371,7 +383,7 @@ public: virtual void EnableClipPlane( int index, bool bEnable ) = 0; // Returns the nearest supported format - virtual ImageFormat GetNearestSupportedFormat( ImageFormat fmt ) const = 0; + virtual ImageFormat GetNearestSupportedFormat( ImageFormat fmt, bool bFilteringRequired ) const = 0; virtual ImageFormat GetNearestRenderTargetFormat( ImageFormat fmt ) const = 0; // When AA is enabled, render targets are not AA and require a separate @@ -398,7 +410,8 @@ public: int width, int height, const char *pDebugName, - bool bTexture ) = 0; + bool bTexture, + bool bAliasDepthTextureOverSceneDepthX360 ) = 0; virtual bool IsTexture( ShaderAPITextureHandle_t textureHandle ) = 0; virtual bool IsTextureResident( ShaderAPITextureHandle_t textureHandle ) = 0; @@ -449,7 +462,7 @@ public: virtual void TexSetPriority( int priority ) = 0; // Sets the texture state - virtual void BindTexture( Sampler_t sampler, ShaderAPITextureHandle_t textureHandle ) = 0; + virtual void BindTexture( Sampler_t stage, TextureBindFlags_t nBindFlags, ShaderAPITextureHandle_t textureHandle ) = 0; // Set the render target to a texID. // Set to SHADER_RENDERTARGET_BACKBUFFER if you want to use the regular framebuffer. @@ -501,6 +514,8 @@ public: virtual void EvictManagedResources() = 0; + virtual void GetGPUMemoryStats(GPUMemoryStats &) = 0; + // Level of anisotropic filtering virtual void SetAnisotropicLevel( int nAnisotropyLevel ) = 0; @@ -535,6 +550,10 @@ public: virtual int OcclusionQuery_GetNumPixelsRendered( ShaderAPIOcclusionQuery_t hQuery, bool bFlush = false ) = 0; virtual void SetFlashlightState( const FlashlightState_t &state, const VMatrix &worldToTexture ) = 0; + + virtual bool IsCascadedShadowMapping() const = 0; + virtual void SetCascadedShadowMappingState( const CascadedShadowMappingState_t &state, ITexture *pDepthTextureAtlas ) = 0; + virtual const CascadedShadowMappingState_t& GetCascadedShadowMappingState(ITexture **pDepthTextureAtlas) const = 0; virtual void ClearVertexAndPixelShaderRefCounts() = 0; virtual void PurgeUnusedVertexAndPixelShaders() = 0; @@ -571,9 +590,6 @@ public: // Lets the shader know about the full-screen texture so it can virtual void SetFullScreenTextureHandle( ShaderAPITextureHandle_t h ) = 0; - // Sets the ambient light color - virtual void SetAmbientLightColor( float r, float g, float b ) = 0; - // Rendering parameters control special drawing modes withing the material system, shader // system, shaders, and engine. renderparm.h has their definitions. virtual void SetFloatRenderingParameter(int parm_number, float value) = 0; @@ -613,6 +629,8 @@ public: virtual bool SupportsMSAAMode( int nMSAAMode ) = 0; + virtual void AntiAliasingHint( int a1 ) = 0; + #if defined( _X360 ) virtual HXUIFONT OpenTrueTypeFont( const char *pFontname, int tall, int style ) = 0; virtual void CloseTrueTypeFont( HXUIFONT hFont ) = 0; @@ -656,6 +674,7 @@ public: // Computes the vertex buffer pointers virtual void ComputeVertexDescription( unsigned char* pBuffer, VertexFormat_t vertexFormat, MeshDesc_t& desc ) const = 0; + virtual int VertexFormatSize( VertexFormat_t vertexFormat ) const = 0; virtual void SetDisallowAccess( bool ) = 0; virtual void EnableShaderShaderMutex( bool ) = 0; @@ -674,7 +693,7 @@ public: // Apply stencil operations to every pixel on the screen without disturbing depth or color buffers virtual void PerformFullScreenStencilOperation( void ) = 0; - virtual void SetScissorRect( const int nLeft, const int nTop, const int nRight, const int nBottom, const bool bEnableScissor ) = 0; + virtual void SetScissorRect( int nLeft, int nTop, int nRight, int nBottom, bool bEnableScissor ) = 0; // nVidia CSAA modes, different from SupportsMSAAMode() virtual bool SupportsCSAAMode( int nNumSamples, int nQualityLevel ) = 0; @@ -699,6 +718,8 @@ public: virtual void FogMaxDensity( float flMaxDensity ) = 0; + virtual void *GetD3DTexturePtr( ShaderAPITextureHandle_t hTexture ) = 0; + // Create a multi-frame texture (equivalent to calling "CreateTexture" multiple times, but more efficient) virtual void CreateTextures( ShaderAPITextureHandle_t *pHandles, @@ -761,6 +782,21 @@ public: virtual void OnPresent( void ) = 0; virtual void UpdateGameTime( float flTime ) = 0; + + virtual bool IsStereoSupported( void ) const = 0; + virtual void UpdateStereoTexture( ShaderAPITextureHandle_t texHandle, bool *pStereoActiveThisFrame ) = 0; + + virtual void SetSRGBWrite( bool bState ) = 0; + + virtual void PrintfVA( char *fmt, va_list vargs ) = 0; + virtual void Printf( char *fmt, ... ) = 0; + + virtual float Knob( char *knobname, float *setvalue ) = 0; + + virtual void AddShaderComboInformation( const ShaderComboSemantics_t *pSemantics ) = 0; + virtual float GetLightMapScaleFactor( void ) const = 0; + virtual ShaderAPITextureHandle_t FindTexture( const char * pDebugName ) = 0; + virtual void GetTextureDimensions(ShaderAPITextureHandle_t hTexture, int &nWidth, int &nHeight, int &nDepth) = 0; }; diff --git a/public/shaderapi/ishaderdynamic.h b/public/shaderapi/ishaderdynamic.h index db87e22d..894e44c6 100644 --- a/public/shaderapi/ishaderdynamic.h +++ b/public/shaderapi/ishaderdynamic.h @@ -170,6 +170,8 @@ public: // Get the dimensions of the back buffer. virtual void GetBackBufferDimensions( int& width, int& height ) const = 0; + virtual const AspectRatioInfo_t &GetAspectRatioInfo ( void ) const = 0; + // Get the dimensions of the current render target virtual void GetCurrentRenderTargetDimensions( int& nWidth, int& nHeight ) const = 0; @@ -186,17 +188,17 @@ public: virtual const FlashlightState_t &GetFlashlightState( VMatrix &worldToTexture ) const = 0; virtual bool InEditorMode() const = 0; + virtual bool IsCascadedShadowMapping( void ) const = 0; + virtual const CascadedShadowMappingState_t& GetCascadedShadowMappingState(ITexture **pDepthTextureAtlas) const = 0; + // Binds a standard texture - virtual void BindStandardTexture( Sampler_t sampler, StandardTextureId_t id ) = 0; + virtual void BindStandardTexture( Sampler_t stage, TextureBindFlags_t nBindFlags, StandardTextureId_t id ) = 0; virtual ITexture *GetRenderTargetEx( int nRenderTargetID ) const = 0; virtual void SetToneMappingScaleLinear( const Vector &scale ) = 0; virtual const Vector &GetToneMappingScaleLinear( void ) const = 0; - // Sets the ambient light color - virtual void SetAmbientLightColor( float r, float g, float b ) = 0; - virtual void SetFloatRenderingParameter(int parm_number, float value) = 0; virtual void SetIntRenderingParameter(int parm_number, int value) = 0 ; virtual void SetVectorRenderingParameter(int parm_number, Vector const &value) = 0 ; @@ -263,6 +265,8 @@ public: virtual bool SinglePassFlashlightModeEnabled( void ) = 0; + virtual void GetActualProjectionMatrix( float *m ) = 0; + virtual void SetDepthFeatheringPixelShaderConstant( int iConstant, float fDepthBlendScale ) = 0; virtual void GetFlashlightShaderInfo( bool *pShadowsEnabled, bool *pUberLight ) const = 0; @@ -283,6 +287,9 @@ public: virtual void EnablePredication( bool bZPass, bool bRenderPass ) = 0; virtual void DisablePredication() = 0; #endif // _X360 + + virtual bool IsRenderingPaint() const = 0; + virtual bool IsStereoActiveThisFrame() const = 0; }; // end class IShaderDynamicAPI diff --git a/public/shaderapi/ishadershadow.h b/public/shaderapi/ishadershadow.h index d2880328..14f8d95d 100644 --- a/public/shaderapi/ishadershadow.h +++ b/public/shaderapi/ishadershadow.h @@ -146,6 +146,7 @@ public: // Methods related to alpha blending virtual void EnableBlending( bool bEnable ) = 0; + virtual void EnableBlendingForceOpaque( bool bEnable ) = 0; virtual void BlendFunc( ShaderBlendFactor_t srcFactor, ShaderBlendFactor_t dstFactor ) = 0; virtual void EnableBlendingSeparateAlpha( bool bEnable ) = 0; virtual void BlendFuncSeparateAlpha( ShaderBlendFactor_t srcFactor, ShaderBlendFactor_t dstFactor ) = 0; @@ -188,9 +189,6 @@ public: // Alpha to coverage virtual void EnableAlphaToCoverage( bool bEnable ) = 0; - // Shadow map filtering - virtual void SetShadowDepthFiltering( Sampler_t stage ) = 0; - // Per vertex texture unit stuff virtual void EnableVertexTexture( VertexTextureSampler_t sampler, bool bEnable ) = 0; diff --git a/public/shaderapi/ishaderutil.h b/public/shaderapi/ishaderutil.h index 40338f47..9cd7b572 100644 --- a/public/shaderapi/ishaderutil.h +++ b/public/shaderapi/ishaderutil.h @@ -61,7 +61,7 @@ public: virtual const ImageFormatInfo_t& ImageFormatInfo( ImageFormat fmt ) const = 0; // Bind standard textures - virtual void BindStandardTexture( Sampler_t sampler, StandardTextureId_t id ) = 0; + virtual void BindStandardTexture( Sampler_t sampler, TextureBindFlags_t nBindFlags, StandardTextureId_t id ) = 0; // What are the lightmap dimensions? virtual void GetLightmapDimensions( int *w, int *h ) = 0; @@ -74,6 +74,8 @@ public: virtual bool IsInStubMode() = 0; virtual bool InFlashlightMode() const = 0; + virtual bool IsCascadedShadowMapping() const = 0; + // For the shader API to shove the current version of aniso level into the // "definitive" place (g_config) when the shader API decides to change it. // Eventually, we should have a better system of who owns the definitive @@ -100,8 +102,6 @@ public: virtual bool OnSetFlexMesh( IMesh *pStaticMesh, IMesh *pMesh, int nVertexOffsetInBytes ) = 0; virtual bool OnSetColorMesh( IMesh *pStaticMesh, IMesh *pMesh, int nVertexOffsetInBytes ) = 0; virtual bool OnSetPrimitiveType( IMesh *pMesh, MaterialPrimitiveType_t type ) = 0; - virtual bool OnFlushBufferedPrimitives() = 0; - virtual void SyncMatrices() = 0; virtual void SyncMatrix( MaterialMatrixMode_t ) = 0; @@ -131,6 +131,12 @@ public: virtual void UncacheUnusedMaterials( bool bRecomputeStateSnapshots = false ) = 0; virtual bool IsInFrame( ) const = 0; + + virtual ShaderAPITextureHandle_t GetLightmapTexture( int a1 ) = 0; + + virtual bool IsRenderingPaint() const = 0; + + virtual ShaderAPITextureHandle_t GetPaintmapTexture( int a1 ) = 0; }; #endif // ISHADERUTIL_H diff --git a/public/shaderapi/shareddefs.h b/public/shaderapi/shareddefs.h index 2c5a1eeb..b5322958 100644 --- a/public/shaderapi/shareddefs.h +++ b/public/shaderapi/shareddefs.h @@ -16,6 +16,9 @@ #pragma once #endif +#include "mathlib/vector.h" +#include "mathlib/vector4d.h" +#include "mathlib/vmatrix.h" //----------------------------------------------------------------------------- // Important enumerations @@ -52,6 +55,54 @@ enum ShaderTexWrapMode_t // MIRROR? - probably don't need it. }; +enum TextureBindFlags_t +{ + TEXTURE_BINDFLAGS_SRGBREAD = 0x80000000, + TEXTURE_BINDFLAGS_SHADOWDEPTH = 0x40000000, + TEXTURE_BINDFLAGS_NONE = 0 +}; + +struct AspectRatioInfo_t +{ + bool m_bIsWidescreen; + bool m_bIsHidef; + float m_flFrameBufferAspectRatio; + float m_flPhysicalAspectRatio; + float m_flFrameBuffertoPhysicalScalar; + float m_flPhysicalToFrameBufferScalar; + bool m_bInitialized; +}; + +struct CascadedShadowMappingState_t +{ + uint m_nNumCascades; + bool m_bIsRenderingViewModels; + Vector m_vLightColor; + float m_flPadding0; + Vector m_vLightDir; + float m_flPadding1; + struct { + float m_flInvShadowTextureWidth; + float m_flInvShadowTextureHeight; + float m_flHalfInvShadowTextureWidth; + float m_flHalfInvShadowTextureHeight; + } m_TexParams; + struct { + float m_flShadowTextureWidth; + float m_flShadowTextureHeight; + float m_flSplitLerpFactorBase; + float m_flSplitLerpFactorInvRange; + } m_TexParams2; + struct { + float m_flDistLerpFactorBase; + float m_flDistLerpFactorInvRange; + float m_flUnused0; + float m_flUnused1; + } m_TexParams3; + VMatrix m_matWorldToShadowTexMatrices[4]; + Vector4D m_vCascadeAtlasUVOffsets[4]; + Vector4D m_vCamPosition; +}; //----------------------------------------------------------------------------- // Sampler identifiers