made rendering work

This commit is contained in:
2026-02-05 11:10:40 +02:00
parent faae0bdcc7
commit 4bfbcaa4a6
22 changed files with 737 additions and 483 deletions

View File

@@ -1,5 +1,5 @@
#include "tier0/lib.h"
#include "tier1/commandline.h"
#include "tier0/commandline.h"
#include "tier1/appinit.h"
#include "tier1/utlstring.h"
#include "tier2/ifilesystem.h"
@@ -8,6 +8,7 @@
static IShaderCompiler *s_pVulkanSpirvCompiler;
static const char *s_szGameRoot;
ICompiledShaderManager *g_pShaderManager;
void CompileShader( const char *szShader )
{
@@ -18,17 +19,16 @@ void CompileShader( const char *szShader )
s_pVulkanSpirvCompiler->CompileShader(szShader, &shader);
Plat_MakeDir("build/funnygame/assets", 0755);
Plat_MakeDir("build/funnygame/assets/shaders", 0755);
Plat_MakeDir("../build/funnygame/assets", 0755);
Plat_MakeDir("../build/funnygame/assets/shaders", 0755);
CUtlString szOutputDirectory = szShader;
szOutputDirectory.RemoveHead(strlen(s_szGameRoot)+1);
szOutputDirectory.AppendHead("build/funnygame/assets/");
szOutputDirectory.AppendHead("../build/funnygame/assets/");
szOutputDirectory.AppendTail("_c");
printf("%s\n",szOutputDirectory.GetString());
CompiledShaderManager()->WriteToFile(&shader, szOutputDirectory);
g_pShaderManager->WriteToFile(&shader, szOutputDirectory);
};
void PrintHelp()
@@ -40,11 +40,21 @@ void PrintHelp()
int main( int c, char **v )
{
CUtlString szExePath = Plat_GetExecutablePath();
CUtlString szOriginalPath = Plat_GetWorkingDir();
CommandLine()->CreateCommandLine(c, v);
Plat_SetWorkingDir(szExePath.GetDirectory());
CreateInterfaceFn g_pCompilerFactory = Sys_GetFactory("ShaderCompiler");
Plat_SetWorkingDir(szOriginalPath);
g_pShaderManager = (ICompiledShaderManager*)g_pCompilerFactory(COMPILED_SHADER_MANAGER_INTERFACE_VERSION, NULL);
CreateInterfaceFn pFilesystemFactory = Sys_GetFactory("filesystem_std");
filesystem = (IFileSystem*)pFilesystemFactory(FILESYSTEM_INTERFACE_VERSION, NULL);
filesystem->Init();
s_pVulkanSpirvCompiler = (IShaderCompiler*)CreateInterface(SLANG_SHADER_COMPILER_SPIRV_VULKAN, NULL);
s_pVulkanSpirvCompiler = (IShaderCompiler*)g_pCompilerFactory(SLANG_SHADER_COMPILER_SPIRV_VULKAN, NULL);
s_pVulkanSpirvCompiler->Init();
const char *szInputDirectory = CommandLine()->ParamValue("-i");