This commit is contained in:
Nicholas Hastings 2012-08-25 11:13:43 -04:00
commit 12273f0314
23 changed files with 3733 additions and 75 deletions

Binary file not shown.

BIN
lib/mac/libtier0.dylib Executable file

Binary file not shown.

BIN
lib/mac/libvstdlib.dylib Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="shaderapiempty.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>shaderapiempty</ProjectName>
<ProjectGuid>{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}</ProjectGuid>
<RootNamespace>tier1</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</GenerateManifest>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..;..\..;..\..\public;..\..\public\tier0;..\..\public\tier1;..\..\public\interfaces;..\..\public\shaderapi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<PrecompiledHeader>
</PrecompiledHeader>
<AssemblerOutput>
</AssemblerOutput>
<BrowseInformation>
</BrowseInformation>
<WarningLevel>Level3</WarningLevel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<ExceptionHandling>false</ExceptionHandling>
<FloatingPointModel>Fast</FloatingPointModel>
</ClCompile>
<PreLinkEvent>
<Command>
</Command>
</PreLinkEvent>
<Lib>
<AdditionalDependencies>
</AdditionalDependencies>
</Lib>
<Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake>
<Bscmake />
<Link>
<AdditionalDependencies>..\..\lib\public\interfaces.lib;..\..\lib\public\tier0.lib;..\..\lib\public\tier1.lib;..\..\lib\public\vstdlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>libc;libcd;libcmt</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>..;..\..;..\..\public;..\..\public\tier0;..\..\public\tier1;..\..\public\interfaces;..\..\public\shaderapi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<AssemblerOutput>
</AssemblerOutput>
<BrowseInformation>
</BrowseInformation>
<WarningLevel>Level3</WarningLevel>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<ExceptionHandling>false</ExceptionHandling>
<FloatingPointModel>Fast</FloatingPointModel>
</ClCompile>
<PreLinkEvent>
<Command>
</Command>
</PreLinkEvent>
<Lib>
<AdditionalDependencies>
</AdditionalDependencies>
</Lib>
<Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake>
<Bscmake />
<Link>
<AdditionalDependencies>..\..\lib\public\interfaces.lib;..\..\lib\public\tier0.lib;..\..\lib\public\tier1.lib;..\..\lib\public\vstdlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>libc;libcd;libcmtd</IgnoreSpecificDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{f1ed3caa-29ea-4ac3-b9cd-4b1e2ecd2269}</UniqueIdentifier>
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="shaderapiempty.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

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

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

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

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