General improvements
This commit is contained in:
5
fpc/.fpccfg
Normal file
5
fpc/.fpccfg
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[MSVC_C_COMPILER_INTERFACE_NAME]
|
||||||
|
exe = /opt/msvc/bin/x64/cl
|
||||||
|
|
||||||
|
[MSVC_LINKER_INTERFACE_NAME]
|
||||||
|
exe = /opt/msvc/bin/x64/link
|
||||||
@@ -31,5 +31,6 @@ install_fpc:
|
|||||||
cp -r public ../build/tools
|
cp -r public ../build/tools
|
||||||
cp -r ../public/tier0 ../build/tools/public
|
cp -r ../public/tier0 ../build/tools/public
|
||||||
cp -r ../public/tier1 ../build/tools/public
|
cp -r ../public/tier1 ../build/tools/public
|
||||||
|
cp -r ../public/tier2 ../build/tools/public
|
||||||
|
|
||||||
auto: install install_fpc
|
auto: install install_fpc
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ CUtlVector<CUtlString> g_CompiledFiles = {
|
|||||||
"../tier1/utlvector.cpp",
|
"../tier1/utlvector.cpp",
|
||||||
"../tier1/utlmap.cpp",
|
"../tier1/utlmap.cpp",
|
||||||
"../tier1/commandline.cpp",
|
"../tier1/commandline.cpp",
|
||||||
|
"../tier2/filesystem.cpp",
|
||||||
|
"../tier2/filesystem_libc.cpp",
|
||||||
|
"../tier2/fileformats/ini.cpp",
|
||||||
|
|
||||||
"main.cpp",
|
"main.cpp",
|
||||||
"library/runner.cpp",
|
"library/runner.cpp",
|
||||||
|
|||||||
BIN
fpc/fpc_temp
BIN
fpc/fpc_temp
Binary file not shown.
@@ -119,3 +119,5 @@ CUtlVector<CBuildStage*>& BuildStages()
|
|||||||
{
|
{
|
||||||
return g_buildStages;
|
return g_buildStages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IINIFile *g_pConfig;
|
||||||
|
|||||||
@@ -20,8 +20,10 @@ CUtlString Target_t::GetTriplet()
|
|||||||
triplet.AppendTail("unknown-unknown");
|
triplet.AppendTail("unknown-unknown");
|
||||||
if ( kernel == TARGET_KERNEL_LINUX )
|
if ( kernel == TARGET_KERNEL_LINUX )
|
||||||
triplet.AppendTail("unknown-linux-gnu");
|
triplet.AppendTail("unknown-linux-gnu");
|
||||||
if ( kernel == TARGET_KERNEL_WINDOWS )
|
if ( kernel == TARGET_KERNEL_WINDOWS_GNU )
|
||||||
triplet.AppendTail("pc-windows-gnu");
|
triplet.AppendTail("pc-windows-gnu");
|
||||||
|
if ( kernel == TARGET_KERNEL_WINDOWS_MSVC )
|
||||||
|
triplet.AppendTail("pc-windows-msvc");
|
||||||
if ( kernel == TARGET_KERNEL_DARWIN )
|
if ( kernel == TARGET_KERNEL_DARWIN )
|
||||||
triplet.AppendTail("apple-darwin");
|
triplet.AppendTail("apple-darwin");
|
||||||
if ( kernel == TARGET_KERNEL_IOS )
|
if ( kernel == TARGET_KERNEL_IOS )
|
||||||
@@ -80,6 +82,8 @@ Target_t Target_t::DefaultTarget()
|
|||||||
kernel = TARGET_KERNEL_UNKNOWN;
|
kernel = TARGET_KERNEL_UNKNOWN;
|
||||||
else if ( szOS == "windows" )
|
else if ( szOS == "windows" )
|
||||||
kernel = TARGET_KERNEL_WINDOWS;
|
kernel = TARGET_KERNEL_WINDOWS;
|
||||||
|
else if ( szOS == "windows-msvc" )
|
||||||
|
kernel = TARGET_KERNEL_WINDOWS_MSVC;
|
||||||
else if ( szOS == "linux" )
|
else if ( szOS == "linux" )
|
||||||
kernel = TARGET_KERNEL_LINUX;
|
kernel = TARGET_KERNEL_LINUX;
|
||||||
else if ( szOS == "macos" )
|
else if ( szOS == "macos" )
|
||||||
|
|||||||
0
fpc/library/windows/c.cpp
Normal file
0
fpc/library/windows/c.cpp
Normal file
141
fpc/library/windows/ld.cpp
Normal file
141
fpc/library/windows/ld.cpp
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
#include "ld.h"
|
||||||
|
#include "helper.h"
|
||||||
|
#include "libgen.h"
|
||||||
|
#include "target.h"
|
||||||
|
#include "tier0/platform.h"
|
||||||
|
#include "tier1/interface.h"
|
||||||
|
#include "tier1/utlstring.h"
|
||||||
|
#include "tier2/fileformats/ini.h"
|
||||||
|
|
||||||
|
class CMSVCLinker : public ILinker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual CUtlString Link( LinkProject_t *pProject ) override;
|
||||||
|
virtual bool IsLibraryExists( CUtlString szName ) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPOSE_INTERFACE(CMSVCLinker, ILinker, MSVC_LINKER_INTERFACE_NAME);
|
||||||
|
|
||||||
|
CUtlString CMSVCLinker::Link( LinkProject_t *pProject )
|
||||||
|
{
|
||||||
|
if (pProject->m_szName == 0)
|
||||||
|
{
|
||||||
|
Plat_FatalErrorFunc("m_szName must be present\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pProject->m_target.kernel != TARGET_KERNEL_WINDOWS_MSVC)
|
||||||
|
{
|
||||||
|
Plat_FatalErrorFunc("target must be TARGET_KERNEL_WINDOWS_MSVC\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find a name for the file
|
||||||
|
CUtlString szFileName;
|
||||||
|
unsigned int hash = pProject->GenerateProjectHash();
|
||||||
|
switch(pProject->linkType)
|
||||||
|
{
|
||||||
|
case ELINK_EXECUTABLE:
|
||||||
|
szFileName = CUtlString("%s.exe", pProject->m_szName.GetString());
|
||||||
|
case ELINK_STATIC_LIBRARY:
|
||||||
|
szFileName = CUtlString("lib%s.a", pProject->m_szName.GetString());
|
||||||
|
break;
|
||||||
|
case ELINK_DYNAMIC_LIBRARY:
|
||||||
|
szFileName = CUtlString("%s.dll", pProject->m_szName.GetString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
CUtlString szTarget = pProject->m_target.GetTriplet();
|
||||||
|
CUtlString szOutputFile = CUtlString("%s/%s/ld/%u_%s/%s",FPC_TEMPORAL_DIRNAME, szTarget.GetString(), hash, pProject->m_szName.GetString(), szFileName.GetString());
|
||||||
|
CUtlString szOutputDir = szOutputFile;
|
||||||
|
szOutputDir = dirname(szOutputDir);
|
||||||
|
filesystem2->MakeDirectory(szOutputDir);
|
||||||
|
|
||||||
|
IINISection *pSection = g_pConfig->GetSection("MSVC_LINKER_INTERFACE_NAME");
|
||||||
|
CUtlString szExePath = pSection->GetStringValue("exe");
|
||||||
|
|
||||||
|
if (pProject->linkType == ELINK_STATIC_LIBRARY)
|
||||||
|
{
|
||||||
|
V_printf(" AR %s\n", pProject->m_szName.GetString());
|
||||||
|
bool shouldRecompile = false;
|
||||||
|
CUtlVector<CUtlString> args;
|
||||||
|
for (auto object: pProject->objects)
|
||||||
|
{
|
||||||
|
if (filesystem2->ShouldRecompile(object.m_szObjectFile,szOutputFile))
|
||||||
|
{
|
||||||
|
shouldRecompile = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!shouldRecompile)
|
||||||
|
goto compiled;
|
||||||
|
args = {
|
||||||
|
"rcs",
|
||||||
|
szOutputFile
|
||||||
|
};
|
||||||
|
for (auto object: pProject->objects)
|
||||||
|
args.AppendTail(object.m_szObjectFile);
|
||||||
|
runner->Run("ar", args);
|
||||||
|
runner->Wait();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
V_printf(" LINK %s\n", pProject->m_szName.GetString());
|
||||||
|
bool shouldRecompile = false;
|
||||||
|
CUtlVector<CUtlString> args;
|
||||||
|
|
||||||
|
// Check if any of the files have changed
|
||||||
|
for (auto object: pProject->objects)
|
||||||
|
{
|
||||||
|
if (filesystem2->ShouldRecompile(object.m_szObjectFile,szOutputFile))
|
||||||
|
{
|
||||||
|
shouldRecompile = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!shouldRecompile)
|
||||||
|
goto compiled;
|
||||||
|
|
||||||
|
|
||||||
|
CUtlString szTarget = pProject->m_target.GetTriplet();
|
||||||
|
CUtlString szCompiledTarget = szTarget;
|
||||||
|
if (pProject->m_target.kernel == TARGET_KERNEL_ANDROID)
|
||||||
|
{
|
||||||
|
szCompiledTarget = CUtlString("%s%u", szTarget.GetString(), pProject->m_androidmanifest.m_nTargetVersion);
|
||||||
|
}
|
||||||
|
args = {
|
||||||
|
"-o",
|
||||||
|
szOutputFile,
|
||||||
|
"-target",
|
||||||
|
szCompiledTarget,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Disable stdlib
|
||||||
|
if (pProject->bNoStdLib)
|
||||||
|
{
|
||||||
|
args.AppendTail("-nostdlib");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto object: pProject->objects)
|
||||||
|
args.AppendTail(object.m_szObjectFile);
|
||||||
|
|
||||||
|
for (auto lib: pProject->libraries)
|
||||||
|
{
|
||||||
|
args.AppendTail("-l");
|
||||||
|
args.AppendTail(lib);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apple frameworks
|
||||||
|
for (auto &directory: pProject->frameworkDirectories)
|
||||||
|
{
|
||||||
|
args.AppendTail("-F");
|
||||||
|
args.AppendTail(directory);
|
||||||
|
}
|
||||||
|
for (auto &framework: pProject->frameworks)
|
||||||
|
{
|
||||||
|
args.AppendTail("-framework");
|
||||||
|
args.AppendTail(framework);
|
||||||
|
}
|
||||||
|
runner->Run(szExePath, args);
|
||||||
|
runner->Wait();
|
||||||
|
}
|
||||||
|
compiled:
|
||||||
|
return szOutputFile;
|
||||||
|
};
|
||||||
27
fpc/main.cpp
27
fpc/main.cpp
@@ -1,16 +1,17 @@
|
|||||||
|
#include "tier0/platform.h"
|
||||||
|
#include "tier1/commandline.h"
|
||||||
|
#include "tier1/interface.h"
|
||||||
|
#include "tier1/utlvector.h"
|
||||||
|
#include "tier2/ifilesystem.h"
|
||||||
|
#include "tier2/fileformats/ini.h"
|
||||||
#include "public/c.h"
|
#include "public/c.h"
|
||||||
#include "public/helper.h"
|
#include "public/helper.h"
|
||||||
#include "public/ld.h"
|
#include "public/ld.h"
|
||||||
#include "public/target.h"
|
#include "public/target.h"
|
||||||
#include "runner.h"
|
#include "runner.h"
|
||||||
#include "tier0/platform.h"
|
|
||||||
#include "tier1/commandline.h"
|
|
||||||
#include "c.h"
|
#include "c.h"
|
||||||
#include "tier1/interface.h"
|
|
||||||
#include "tier1/utlvector.h"
|
|
||||||
#include "signal.h"
|
#include "signal.h"
|
||||||
#include "libgen.h"
|
#include "libgen.h"
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
CUtlString owndir;
|
CUtlString owndir;
|
||||||
extern char *g_szBuildDir;
|
extern char *g_szBuildDir;
|
||||||
@@ -18,10 +19,6 @@ int build()
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
runner = (IRunner*)CreateInterface(RUNNER_INTERFACE_NAME, NULL);
|
|
||||||
filesystem2 = (IFileSystem2*)CreateInterface(FILE_SYSTEM_2_INTERFACE_NAME, NULL);
|
|
||||||
ccompiler = (ICCompiler*)CreateInterface(CLANG_C_COMPILER_INTERFACE_NAME, NULL);
|
|
||||||
linker = (ILinker*)CreateInterface(CLANG_LINKER_INTERFACE_NAME, NULL);
|
|
||||||
|
|
||||||
CProject_t compileScriptProject = {};
|
CProject_t compileScriptProject = {};
|
||||||
compileScriptProject.m_szName = "build";
|
compileScriptProject.m_szName = "build";
|
||||||
@@ -36,6 +33,7 @@ int build()
|
|||||||
|
|
||||||
CUtlString script = linker->Link(&linkScriptProject);
|
CUtlString script = linker->Link(&linkScriptProject);
|
||||||
|
|
||||||
|
|
||||||
void *scriptDLL = Plat_LoadLibrary(script);
|
void *scriptDLL = Plat_LoadLibrary(script);
|
||||||
|
|
||||||
auto PreinitFn = (void(*)())Plat_GetProc(scriptDLL, "Preinit");
|
auto PreinitFn = (void(*)())Plat_GetProc(scriptDLL, "Preinit");
|
||||||
@@ -52,6 +50,8 @@ int build()
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void IEngine_Signal(int sig)
|
void IEngine_Signal(int sig)
|
||||||
{
|
{
|
||||||
switch (sig)
|
switch (sig)
|
||||||
@@ -104,6 +104,15 @@ findbuild:
|
|||||||
signal(SIGSEGV, IEngine_Signal);
|
signal(SIGSEGV, IEngine_Signal);
|
||||||
signal(SIGTERM, IEngine_Signal);
|
signal(SIGTERM, IEngine_Signal);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
runner = (IRunner*)CreateInterface(RUNNER_INTERFACE_NAME, NULL);
|
||||||
|
filesystem2 = (IFileSystem2*)CreateInterface(FILE_SYSTEM_2_INTERFACE_NAME, NULL);
|
||||||
|
ccompiler = (ICCompiler*)CreateInterface(CLANG_C_COMPILER_INTERFACE_NAME, NULL);
|
||||||
|
linker = (ILinker*)CreateInterface(CLANG_LINKER_INTERFACE_NAME, NULL);
|
||||||
|
filesystem->Init();
|
||||||
|
|
||||||
|
g_pConfig = INIManager()->ReadFile(".fpccfg");
|
||||||
|
|
||||||
CommandLine()->CreateCommandLine(c, v);
|
CommandLine()->CreateCommandLine(c, v);
|
||||||
if (CommandLine()->CheckParam("build"))
|
if (CommandLine()->CheckParam("build"))
|
||||||
return build();
|
return build();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "apktool.h"
|
#include "apktool.h"
|
||||||
#include "tier1/utlstring.h"
|
#include "tier1/utlstring.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
#include "tier2/fileformats/ini.h"
|
||||||
|
|
||||||
#define FPC_TEMPORAL_DIRNAME ".fpc"
|
#define FPC_TEMPORAL_DIRNAME ".fpc"
|
||||||
|
|
||||||
@@ -99,4 +100,6 @@ int __build_stage_##sz()
|
|||||||
// Used internally
|
// Used internally
|
||||||
CUtlVector<CBuildStage*>& BuildStages();
|
CUtlVector<CBuildStage*>& BuildStages();
|
||||||
|
|
||||||
|
extern IINIFile *g_pConfig;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ public:
|
|||||||
// Basic interface name
|
// Basic interface name
|
||||||
#define LINKER_INTERFACE_NAME "Linker001"
|
#define LINKER_INTERFACE_NAME "Linker001"
|
||||||
#define CLANG_LINKER_INTERFACE_NAME "Clang" LINKER_INTERFACE_NAME
|
#define CLANG_LINKER_INTERFACE_NAME "Clang" LINKER_INTERFACE_NAME
|
||||||
|
#define MSVC_LINKER_INTERFACE_NAME "MSVC" LINKER_INTERFACE_NAME
|
||||||
|
|
||||||
abstract_class ILinker
|
abstract_class ILinker
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,9 +10,11 @@
|
|||||||
|
|
||||||
enum ETargetKernel
|
enum ETargetKernel
|
||||||
{
|
{
|
||||||
TARGET_KERNEL_UNKNOWN,
|
TARGET_KERNEL_UNKNOWN = 0,
|
||||||
TARGET_KERNEL_LINUX,
|
TARGET_KERNEL_LINUX,
|
||||||
TARGET_KERNEL_WINDOWS,
|
TARGET_KERNEL_WINDOWS_MSVC,
|
||||||
|
TARGET_KERNEL_WINDOWS_GNU,
|
||||||
|
TARGET_KERNEL_WINDOWS = TARGET_KERNEL_WINDOWS_GNU,
|
||||||
TARGET_KERNEL_DARWIN,
|
TARGET_KERNEL_DARWIN,
|
||||||
TARGET_KERNEL_IOS,
|
TARGET_KERNEL_IOS,
|
||||||
TARGET_KERNEL_ANDROID,
|
TARGET_KERNEL_ANDROID,
|
||||||
|
|||||||
18
materialsystem/stdshaders/flat.ini
Normal file
18
materialsystem/stdshaders/flat.ini
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
[Shaders]
|
||||||
|
|
||||||
|
|
||||||
|
[Raster.Input.Triangle]
|
||||||
|
VertexSize = 20
|
||||||
|
Index = RGB32_UINT
|
||||||
|
Position = RGB32_SFLOAT
|
||||||
|
UV = RG32_SFLOAT
|
||||||
|
|
||||||
|
[Raster.Parameters]
|
||||||
|
TextureAtlas = true
|
||||||
|
|
||||||
|
[Raster.Outputs]
|
||||||
|
Color0 = RGBA16_SRGB
|
||||||
|
Depth = D32_SFLOAT
|
||||||
|
|
||||||
|
[Shading.Parameters]
|
||||||
|
TextureAtlas = true
|
||||||
@@ -253,15 +253,26 @@ public:
|
|||||||
|
|
||||||
virtual IVertexBuffer *CreateVertexBuffer( uint32_t nSize ) override;
|
virtual IVertexBuffer *CreateVertexBuffer( uint32_t nSize ) override;
|
||||||
virtual IIndexBuffer *CreateIndexBuffer( uint32_t nSize ) override;
|
virtual IIndexBuffer *CreateIndexBuffer( uint32_t nSize ) override;
|
||||||
|
virtual void DestroyBuffer( IBuffer *pBuffer ) override;
|
||||||
|
|
||||||
virtual IImage *CreateRenderTarget( uint32_t x, uint32_t y, EImageFormat eFormat, EMultisampleType eMultisampleType ) override;
|
virtual IImage *CreateRenderTarget( uint32_t x, uint32_t y, EImageFormat eFormat, EMultisampleType eMultisampleType ) override;
|
||||||
virtual IImage *CreateStorageImage( uint32_t x, uint32_t y, EImageFormat eFormat, EMultisampleType eMultisampleType ) override;
|
virtual IImage *CreateStorageImage( uint32_t x, uint32_t y, EImageFormat eFormat, EMultisampleType eMultisampleType ) override;
|
||||||
|
|
||||||
virtual void DestroyBuffer( IBuffer *pBuffer ) override;
|
|
||||||
virtual void DestroyImage( IImage *pImage ) override;
|
virtual void DestroyImage( IImage *pImage ) override;
|
||||||
|
|
||||||
IBuffer *CreateBuffer( uint32_t nSize, VkBufferUsageFlags2 eUsage );
|
IBuffer *CreateBuffer( uint32_t nSize, VkBufferUsageFlags2 eUsage );
|
||||||
IBuffer *CreateBufferAligned( uint32_t nSize, uint32_t nAlignment, VkBufferUsageFlags2 eUsage );
|
IBuffer *CreateBufferAligned( uint32_t nSize, uint32_t nAlignment, VkBufferUsageFlags2 eUsage );
|
||||||
|
|
||||||
|
virtual IShader *CreateShader( const char *szName ) override;
|
||||||
|
virtual void DestroyShader( IShader *pMaterial ) override;
|
||||||
|
|
||||||
|
virtual IMaterial *CreateMaterial( IShader *pShader ) override;
|
||||||
|
virtual void DestroyMaterial( IMaterial *pMaterial ) override;
|
||||||
|
|
||||||
|
virtual void SetMaterial( IMaterial *pMaterial ) override;
|
||||||
|
virtual void SetVertexBuffer( IVertexBuffer *pBuffer ) override;
|
||||||
|
virtual void SetIndexBuffer( IVertexBuffer *pBuffer ) override;
|
||||||
|
virtual void DrawPrimitives( uint32_t nVertexCount, uint32_t nFirstVertex, uint32_t nInstanceCount, uint32_t nFirstInstance ) override;
|
||||||
|
virtual void DrawPrimitivesIndexed( uint32_t nIndexCount, uint32_t nFirstIndex, uint32_t nVertexOffset, uint32_t nInstanceCount, uint32_t nFirstInstance ) override;
|
||||||
private:
|
private:
|
||||||
VkPhysicalDevice SelectPhysicalDevice( CUtlVector<VkPhysicalDevice> physicalDevices );
|
VkPhysicalDevice SelectPhysicalDevice( CUtlVector<VkPhysicalDevice> physicalDevices );
|
||||||
CUtlVector<const char *> GetDeviceExtensions();
|
CUtlVector<const char *> GetDeviceExtensions();
|
||||||
|
|||||||
@@ -72,13 +72,21 @@ abstract_class IShader
|
|||||||
public:
|
public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define BEGIN_SHADER(name) \
|
||||||
|
class CShader_##name \
|
||||||
|
{
|
||||||
|
|
||||||
|
#define END_SHADER() \
|
||||||
|
}
|
||||||
|
|
||||||
abstract_class IMaterial
|
abstract_class IMaterial
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void SetConstants( void *pData ) = 0;
|
virtual void SetConstants( void *pData ) = 0;
|
||||||
|
|
||||||
virtual void SetTexture( const char *szName, IImage *pImage ) = 0;
|
virtual void SetTexture( const char *szName, IImage *pImage ) = 0;
|
||||||
virtual void SetBuffer( const char *szName, IImage *pImage ) = 0;
|
virtual void SetBuffer( const char *szName, IBuffer *pImage ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
abstract_class IRenderContext: public IAppSystem
|
abstract_class IRenderContext: public IAppSystem
|
||||||
@@ -94,7 +102,7 @@ public:
|
|||||||
virtual void DestroyBuffer( IBuffer *pBuffer ) = 0;
|
virtual void DestroyBuffer( IBuffer *pBuffer ) = 0;
|
||||||
virtual void DestroyImage( IImage *pImage ) = 0;
|
virtual void DestroyImage( IImage *pImage ) = 0;
|
||||||
|
|
||||||
virtual IShader *CreateShader( const char *szName );
|
virtual IShader *CreateShader( const char *szName ) = 0;
|
||||||
virtual void DestroyShader( IShader *pMaterial ) = 0;
|
virtual void DestroyShader( IShader *pMaterial ) = 0;
|
||||||
|
|
||||||
virtual IMaterial *CreateMaterial( IShader *pShader ) = 0;
|
virtual IMaterial *CreateMaterial( IShader *pShader ) = 0;
|
||||||
@@ -103,8 +111,8 @@ public:
|
|||||||
virtual void SetMaterial( IMaterial *pMaterial ) = 0;
|
virtual void SetMaterial( IMaterial *pMaterial ) = 0;
|
||||||
virtual void SetVertexBuffer( IVertexBuffer *pBuffer ) = 0;
|
virtual void SetVertexBuffer( IVertexBuffer *pBuffer ) = 0;
|
||||||
virtual void SetIndexBuffer( IVertexBuffer *pBuffer ) = 0;
|
virtual void SetIndexBuffer( IVertexBuffer *pBuffer ) = 0;
|
||||||
virtual void DrawPrimitives( ) = 0;
|
virtual void DrawPrimitives( uint32_t nVertexCount, uint32_t nFirstVertex, uint32_t nInstanceCount, uint32_t nFirstInstance ) = 0;
|
||||||
virtual void DrawPrimitivesIndexed( ) = 0;
|
virtual void DrawPrimitivesIndexed( uint32_t nIndexCount, uint32_t nFirstIndex, uint32_t nVertexOffset, uint32_t nInstanceCount, uint32_t nFirstInstance ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public:
|
|||||||
abstract_class IINIManager
|
abstract_class IINIManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual IINIFile *ReadFile( const char *psz ) = 0;
|
||||||
virtual IINIFile *ReadString( const char *psz ) = 0;
|
virtual IINIFile *ReadString( const char *psz ) = 0;
|
||||||
virtual void ReleaseFile( IINIFile *pFile ) = 0;
|
virtual void ReleaseFile( IINIFile *pFile ) = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "tier1/utlstring.h"
|
#include "tier1/utlstring.h"
|
||||||
#include "tier1/utlvector.h"
|
#include "tier1/utlvector.h"
|
||||||
#include "tier0/lib.h"
|
#include "tier0/lib.h"
|
||||||
|
#include "tier2/ifilesystem.h"
|
||||||
|
|
||||||
enum ESectionType
|
enum ESectionType
|
||||||
{
|
{
|
||||||
@@ -82,11 +83,24 @@ IINISection *CINIFile::GetSection( const char *szSectionName )
|
|||||||
class CINIManager: public IINIManager
|
class CINIManager: public IINIManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual IINIFile *ReadFile( const char *psz ) override;
|
||||||
virtual IINIFile *ReadString( const char *psz ) override;
|
virtual IINIFile *ReadString( const char *psz ) override;
|
||||||
virtual void ReleaseFile( IINIFile *pFile ) override;
|
virtual void ReleaseFile( IINIFile *pFile ) override;
|
||||||
bool IsWordSymbol( char c );
|
bool IsWordSymbol( char c );
|
||||||
CUtlVector<CUtlString> TokenizeString();
|
CUtlVector<CUtlString> TokenizeString();
|
||||||
};
|
};
|
||||||
|
IINIFile *CINIManager::ReadFile( const char *psz )
|
||||||
|
{
|
||||||
|
IFileHandle *pFile;
|
||||||
|
CUtlBuffer<char> data;
|
||||||
|
|
||||||
|
pFile = filesystem->Open(psz, FILEMODE_READ);
|
||||||
|
data = CUtlBuffer<char>(pFile->Size()+1);
|
||||||
|
pFile->Read(data.GetMemory(), pFile->Size());
|
||||||
|
pFile->Close();
|
||||||
|
|
||||||
|
ReadString(data.GetMemory());
|
||||||
|
}
|
||||||
|
|
||||||
IINIFile *CINIManager::ReadString( const char *psz )
|
IINIFile *CINIManager::ReadString( const char *psz )
|
||||||
{
|
{
|
||||||
@@ -276,7 +290,7 @@ IINIFile *CINIManager::ReadString( const char *psz )
|
|||||||
|
|
||||||
void CINIManager::ReleaseFile( IINIFile *pFile )
|
void CINIManager::ReleaseFile( IINIFile *pFile )
|
||||||
{
|
{
|
||||||
|
delete (CINIFile*)pFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CINIManager::IsWordSymbol( char c )
|
bool CINIManager::IsWordSymbol( char c )
|
||||||
|
|||||||
Reference in New Issue
Block a user