fixed windows builds

This commit is contained in:
2025-07-20 00:45:31 +03:00
parent 070c3ff309
commit fb4c201921
26 changed files with 519 additions and 338 deletions

View File

@@ -452,13 +452,13 @@ IGraphicsPipeline *IRenderer::CreateGraphicsPipeline(
for ( auto &shader: shaders )
{
MLShader_t mlshader = {};
FileHandle_t f = IFileSystem::Open(shader.szPath, IFILE_READ);
FileHandle_t f = FileSystem()->Open(shader.szPath, IFILE_READ);
if (!f)
Plat_FatalErrorFunc("Failed to open shader %s\n", shader.szPath.GetString());
CUtlBuffer<uint8_t> buffer(IFileSystem::Size(f)+1);
IFileSystem::Read(f, buffer.GetMemory(), buffer.GetSize());
buffer[IFileSystem::Size(f)] = 0;
IFileSystem::Close(f);
CUtlBuffer<uint8_t> buffer(FileSystem()->Size(f)+1);
FileSystem()->Read(f, buffer.GetMemory(), buffer.GetSize());
buffer[FileSystem()->Size(f)] = 0;
FileSystem()->Close(f);
NS::String *szSourceCode = NS::String::string((const char*)buffer.GetMemory(), NS::StringEncoding::UTF8StringEncoding);
MTL::CompileOptions *options = NULL;
mlshader.library = g_mlDevice->newLibrary(szSourceCode, options, &error);
@@ -539,12 +539,12 @@ ITexture *ITextureManager::LoadTexture( const char *szName )
if (!V_strcmp(texture->szName, szName))
return texture;
};
FileHandle_t file = IFileSystem::Open(szName, IFILE_READ);
FileHandle_t file = FileSystem()->Open(szName, IFILE_READ);
if (!file)
Plat_FatalErrorFunc("Failed to load %s\n", szName);
CUtlBuffer<stbi_uc> buffer(IFileSystem::Size(file));
IFileSystem::Read(file, buffer.GetMemory(), buffer.GetSize());
CUtlBuffer<stbi_uc> buffer(FileSystem()->Size(file));
FileSystem()->Read(file, buffer.GetMemory(), buffer.GetSize());
int nImageX;
int nImageY;
int nImageChannels;
@@ -579,23 +579,23 @@ void IMetal::Init()
static MTL::RenderPipelineState* s_fullScreenDraw;
void IMetal::CreatePipelines()
{
for (auto &step: g_StepPrepass)
for (auto &step: Renderer()->m_StepPrepass)
step.pPipeline->Init();
for (auto &step: g_StepMeshRendering)
for (auto &step: Renderer()->m_StepMeshRendering)
step.pPipeline->Init();
for (auto &step: g_StepShading)
for (auto &step: Renderer()->m_StepShading)
step.pPipeline->Init();
for (auto &step: g_StepPostProcessing)
for (auto &step: Renderer()->m_StepPostProcessing)
step.pPipeline->Init();
for (auto &step: g_StepUI)
for (auto &step: Renderer()->m_StepUI)
step.pPipeline->Init();
NS::Error *error = 0;
FileHandle_t f = IFileSystem::Open("gfx/ml_quad.metal", IFILE_READ);
CUtlBuffer<uint8_t> buffer(IFileSystem::Size(f)+1);
IFileSystem::Read(f, buffer.GetMemory(), buffer.GetSize());
buffer[IFileSystem::Size(f)] = 0;
IFileSystem::Close(f);
FileHandle_t f = FileSystem()->Open("gfx/ml_quad.metal", IFILE_READ);
CUtlBuffer<uint8_t> buffer(FileSystem()->Size(f)+1);
FileSystem()->Read(f, buffer.GetMemory(), buffer.GetSize());
buffer[FileSystem()->Size(f)] = 0;
FileSystem()->Close(f);
NS::String *szSourceCode = NS::String::string((const char*)buffer.GetMemory(), NS::StringEncoding::UTF8StringEncoding);
MTL::CompileOptions *options = NULL;
MTL::Library *library = g_mlDevice->newLibrary(szSourceCode, options, &error);