1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-19 20:16:10 +08:00

Updated some materialsystem and shaderapi headers.

This commit is contained in:
Scott Ehlert
2012-08-19 02:08:41 -05:00
parent 4ec04d2830
commit 29bd9fe263
11 changed files with 299 additions and 62 deletions

View File

@ -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

View File

@ -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;
};

View File

@ -63,6 +63,7 @@ class IClientMaterialSystem;
class CPaintMaterial;
class IPaintMapDataManager;
class IPaintMapTextureManager;
class GPUMemoryStats;
//-----------------------------------------------------------------------------
@ -414,11 +415,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 +441,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 +456,6 @@ struct FlashlightState_t
bool m_bShadowHighRes;
// simple projection
bool m_bSimpleProjection;
float m_flProjectionSize;
float m_flProjectionRotation;
@ -473,6 +469,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 +544,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 +574,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 +634,8 @@ public:
virtual MaterialThreadMode_t GetThreadMode() = 0;
virtual void ExecuteQueued() = 0;
virtual void OnDebugEvent( const char *pEvent ) = 0;
//---------------------------------------------------------
// Config management
//---------------------------------------------------------
@ -690,6 +706,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 +731,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;
@ -740,6 +760,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 +970,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 +999,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 +1023,8 @@ public:
virtual bool OwnGPUResources( bool bEnable ) = 0;
#endif
virtual void SpinPresent( unsigned int nFrames ) = 0;
// -----------------------------------------------------------
// Access the render contexts
// -----------------------------------------------------------
@ -1029,13 +1060,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 +1089,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 +1307,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 +1327,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 +1409,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 +1443,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 +1466,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 +1489,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 +1520,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 +1543,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 +1558,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 +1580,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;
};

View File

@ -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

View File

@ -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;
};
@ -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 );
@ -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 );

View File

@ -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 ) {};
};

View File

@ -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;
@ -536,6 +551,10 @@ public:
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;
};

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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