Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
90abae3
Test for env bug.
rvkennedy Aug 7, 2024
f23f106
Fix VULKAN_SDK_DIR path that breaks this path.
rvkennedy Aug 7, 2024
bf69994
.
rvkennedy Aug 7, 2024
b7f51d8
Path logic for compilerPaths.
rvkennedy Aug 8, 2024
37924f7
Force creation of output directory.
rvkennedy Aug 8, 2024
5fd6043
Adjusted error output.
rvkennedy Aug 8, 2024
aadbf6e
Better comment for Sfx build in project.
rvkennedy Aug 8, 2024
871efeb
sfx_INCLUDES should not include spurious semicolons via CMake.
rvkennedy Aug 8, 2024
7d0fd98
No semicolons in Sfx parameters.
rvkennedy Aug 8, 2024
817c3d0
Attempt to work around CMake bug for sfx.exe
rvkennedy Aug 9, 2024
1981619
Maybe fix Sfx issues.
rvkennedy Aug 9, 2024
faa9f13
Again Cmake issues.
rvkennedy Aug 9, 2024
aeca4c0
Shader.cmake
rvkennedy Aug 9, 2024
0c06020
Improve Sfx Cmake functionality.
rvkennedy Aug 9, 2024
d138bb4
.
rvkennedy Aug 10, 2024
9455b7d
D3d12 depends on Crossplatform.
rvkennedy Aug 26, 2024
cf0fe2b
Merge branch 'teleport' of github.com:simul/Platform into teleport
rvkennedy Aug 26, 2024
2d0819e
Vulkan texture uppload fixes.
rvkennedy Sep 9, 2024
e904d0d
Fix Vulkan texture upload bug.
simul-test Sep 20, 2024
288d496
BC6H texture upload in Vulkan.
rvkennedy Sep 23, 2024
14f8f20
Merge branch 'teleport' of github.com:simul/Platform into teleport
rvkennedy Sep 23, 2024
caa6ae5
Fix imgui rendering problems which occur with more than one command l…
simul-test Oct 22, 2024
7f6129e
Merge remote-tracking branch 'remotes/origin/main' into teleport
rvkennedy Oct 25, 2024
5127faa
Merge branch 'main' of github.com:simul/Platform into teleport
simul-test Nov 11, 2024
9bacb89
Merge branch 'teleport' of github.com:simul/Platform into teleport
rvkennedy Nov 13, 2024
15276a3
Sfx compiler checks individual shaders for changes before calling com…
rvkennedy Nov 18, 2024
d4f9b90
Only check compiler path once per run per platform/API.
simul-test Nov 19, 2024
f5684db
C++ 20 compatibility.
rvkennedy Jan 19, 2025
837528e
Merge branch 'teleport' of github.com:simul/Platform into teleport
simul-test Jan 19, 2025
9654b8e
Re-enable DEBUG in linker settings.
rvkennedy Jan 24, 2025
2c52dad
Merge branch 'main' of github.com:simul/Platform into teleport
rvkennedy Jan 25, 2025
91c16d3
Shader fixes.
rvkennedy Jan 27, 2025
a46b529
Speed up Sfx by moving regex replacement earlier in shader build proc…
rvkennedy Apr 13, 2025
d8ed2f4
Safety checks.
rvkennedy Apr 19, 2025
738a893
Merge branch 'teleport' of github.com:simul/Platform into teleport
simul-test May 9, 2025
e1c9b27
Merge branch 'teleport' of github.com:simul/Platform into teleport
simul-test May 9, 2025
8dd76f5
Remove freetype submodule. Should use FetchContent instead.
rvkennedy May 12, 2025
e3c621e
Multiple possible axes standard for cubemap matrices.
rvkennedy Jul 1, 2025
5b12441
Merge from main.
Jan 3, 2026
99dc312
Merge fixes
Jan 3, 2026
140b722
Linux build fixes.
Jan 3, 2026
6de5a5c
Sfx parameter fix.
Jan 3, 2026
0345ab1
Linux fixes.
Jan 3, 2026
a3d476a
Linux support fixes.
Jan 4, 2026
9d63263
Move pvector definitions and allow easier translation to tvector.
Jan 4, 2026
31f88b1
Remove cache option from Vulkan SDK installation
rvkennedy Feb 7, 2026
ba5aebf
Update GitHub Actions workflow for Build
rvkennedy Feb 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:

steps:
- name: Clone Platform
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Update Submodules
run: git submodule update --init --force

- name: Install Vulkan SDK
uses: humbletim/install-vulkan-sdk@v1.1.1
uses: humbletim/install-vulkan-sdk@v1.2
with:
version: 1.3.296.0
cache: true
Expand Down
3 changes: 0 additions & 3 deletions Applications/Sfx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,4 @@ if(PLATFORM_WINDOWS OR PLATFORM_LINUX)
VS_DEBUGGER_COMMAND_ARGUMENTS "${SFX_TEST_FILE} -I\"${CMAKE_SOURCE_DIR}/..\" -I\"${SIMUL_PLATFORM_DIR}/CrossPlatform/Shaders\" -o\"${CMAKE_BINARY_DIR}/Platform/shaderbin/$PLATFORM_NAME\" ${TEST_CONFIGS} -l -v ${SFX_TEST_DEFINES}"
)
endif()
if(PLATFORM_LINUX)
target_link_libraries(Sfx c++)
endif()
endif()
91 changes: 46 additions & 45 deletions Applications/Sfx/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,8 @@ void ReplaceRegexes(string &src, const std::map<string,string> &replace)
}
static std::map<std::string,std::string> useCompilerPath;

static bool checkedCompilerPath=false;

extern void CalcCompilerPathToUse(const SfxConfig &sfxConfig,const SfxOptions &sfxOptions)
{
std::string usePath="";
Expand Down Expand Up @@ -657,7 +659,7 @@ bool RewriteOutput(const SfxConfig &sfxConfig
(*log)<< str.c_str();
return has_errors;
}

#pragma optimize("",off)
bool IsShaderUnchanged(std::string sourceFilename,std::string outputFilename,const std::string &src)
{
if(!std::filesystem::exists(outputFilename))
Expand All @@ -676,7 +678,6 @@ bool IsShaderUnchanged(std::string sourceFilename,std::string outputFilename,con
return true;
}


int Compile(std::shared_ptr<ShaderInstance> shaderInstance
,const string &sourceFile
,string targetFile
Expand Down Expand Up @@ -869,7 +870,7 @@ int Compile(std::shared_ptr<ShaderInstance> shaderInstance
string src = preamble;
src += sharedSource;
src+=shaderInstance->m_augmentedSource;
ReplaceRegexes(src, sfxConfig.replace);

const char *strSrc=src.c_str();

wstring targetDir=StringToWString(GetDirectoryFromFilename(targetFile));
Expand All @@ -893,8 +894,8 @@ int Compile(std::shared_ptr<ShaderInstance> shaderInstance
#else
ofstream ofs(WStringToUtf8(generatedSourceFilename).c_str());
#endif
ofs.write(strSrc, strlen(strSrc));
ofs.close();
ofs.write(strSrc, strlen(strSrc));
ofs.close();
}
#ifdef _MSC_VER
// Now delete the corresponding sdb's
Expand Down Expand Up @@ -933,52 +934,52 @@ int Compile(std::shared_ptr<ShaderInstance> shaderInstance
if(!unchanged)
{
compile_command=BuildCompileCommand
(
shaderInstance,
sfxConfig,
sfxOptions,
targetDir,
outputFile,
(
shaderInstance,
sfxConfig,
sfxOptions,
targetDir,
outputFile,
generatedSourceFilename,
t,
pixelOutputFormat
);
// If no compiler provided, we can return now (perhaps we are only interested in
// the shader source)
if (compile_command.empty())
{
if(sfxOptions.verbose)
t,
pixelOutputFormat
);
// If no compiler provided, we can return now (perhaps we are only interested in
// the shader source)
if (compile_command.empty())
{
if(sfxOptions.verbose)
std::cout<<WStringToUtf8(generatedSourceFilename).c_str()<<"\n";
// But let's in that case, wrap up the GENERATED SOURCE in sfxb:
if (sfxOptions.wrapOutput)
{
//concatenate
#ifdef _MSC_VER
// But let's in that case, wrap up the GENERATED SOURCE in sfxb:
if (sfxOptions.wrapOutput)
{
//concatenate
#ifdef _MSC_VER
std::ifstream if_c(generatedSourceFilename.c_str(), std::ios_base::binary);
#else
#else
std::ifstream if_c(WStringToUtf8(generatedSourceFilename).c_str(), std::ios_base::binary);
#endif
if(!if_c.good())
{
SFX_BREAK("Failed to load generated shader source");
exit(1002);
}
std::streampos startp = combinedBinary.tellp();
combinedBinary << if_c.rdbuf();
std::streampos endp = combinedBinary.tellp();
size_t sz=endp - startp;
if(!sz)
{
SFX_BREAK("Empty output shader ");
#endif
if(!if_c.good())
{
SFX_BREAK("Failed to load generated shader source");
exit(1002);
}
std::streampos startp = combinedBinary.tellp();
combinedBinary << if_c.rdbuf();
std::streampos endp = combinedBinary.tellp();
size_t sz=endp - startp;
if(!sz)
{
SFX_BREAK("Empty output shader ");
std::cerr<<"Empty output shader "<<WStringToUtf8(generatedSourceFilename)<<"\n";
exit(1001);
}
binaryMap[sbf] = std::make_tuple(startp, sz);
exit(1001);
}
return true;
binaryMap[sbf] = std::make_tuple(startp, sz);
}
if(sfxOptions.verbose)
std::cout<<WStringToUtf8(compile_command).c_str()<<std::endl;
return true;
}
if(sfxOptions.verbose)
std::cout<<WStringToUtf8(compile_command).c_str()<<std::endl;
}

// Run the provided .exe!
Expand Down Expand Up @@ -1036,7 +1037,7 @@ int Compile(std::shared_ptr<ShaderInstance> shaderInstance
{
if (terminate_command)
exit(2000);
Sleep(10);
sleep(10);
}
if(!if_c.good())
{
Expand Down
2 changes: 2 additions & 0 deletions Applications/Sfx/Compiler.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#pragma once
#include <string>
#include <map>
#include <memory>
#include "SfxClasses.h"
#include "SfxEffect.h"
#include "ShaderInstance.h"

extern void ReplaceRegexes(std::string &src, const std::map<std::string,std::string> &replace);
extern int Compile(std::shared_ptr<sfx::ShaderInstance> shader, const std::string &sourceFile, std::string targetFile
, sfx::ShaderType t
, sfx::PixelOutputFormat pixelOutputFormat
Expand Down
6 changes: 1 addition & 5 deletions Applications/Sfx/Environ.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ static void SetEnv(const std::string &name_utf8, const std::string &value_utf8)
errno_t err = _wputenv_s(
wname.c_str(),wval.c_str());
#else
char txt[1000];
sprintf(txt,"%s=%s",name_utf8.c_str(),value_utf8.c_str());
putenv(txt);
setenv(name_utf8.c_str(),value_utf8.c_str(),1);
#endif
}

Expand All @@ -53,7 +51,6 @@ static void SetEnv(const std::string &name_utf8, const std::string &value_utf8)
static std::string ProcessEnvironmentVariables(const std::string &str)
{
std::string ret=str;
#if defined(WIN32)|| defined(WIN64)
std::regex re("\\$([A-Z|a-z|0-9|_]+)");
std::sregex_iterator next(str.begin(), str.end(), re);
std::sregex_iterator end;
Expand All @@ -71,6 +68,5 @@ static std::string ProcessEnvironmentVariables(const std::string &str)
// Syntax error in the regular expression
}
}
#endif
return ret;
}
4 changes: 2 additions & 2 deletions Applications/Sfx/FileLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void FileLoader::AcquireFileContents(void*& pointer, unsigned int& bytes, const
fclose(fp);
}

uint64_t FileLoader::GetFileDate(const char *filename_utf8)
uint64_t FileLoader::GetFileDateUnixTimeMs(const char *filename_utf8)
{
std::wstring filenamew=StringToWString(filename_utf8);
#ifdef _MSC_VER
Expand All @@ -208,7 +208,7 @@ uint64_t FileLoader::GetFileDate(const char *filename_utf8)
stat(filename_utf8, &buf);
#endif
buf.st_mtime;
time_t t = buf.st_mtime;
time_t t = buf.st_mtime*1000;
return static_cast<uint64_t>(t);
}

Expand Down
3 changes: 2 additions & 1 deletion Applications/Sfx/FileLoader.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include <vector>
#include <string>
#include <stdint.h>
#ifndef _MAX_PATH
#define _MAX_PATH 260
#endif
Expand All @@ -16,7 +17,7 @@ class FileLoader
bool FileExists(const char *filename_utf8) const;
const char *FindFileInPathStack(const char *filename_utf8,const std::vector<std::string> &path_stack_utf8) const;
void AcquireFileContents(void*& pointer, unsigned int& bytes, const char* filename_utf8,bool open_as_text);
static uint64_t GetFileDate(const char* filename_utf8);
static uint64_t GetFileDateUnixTimeMs(const char* filename_utf8);
void ReleaseFileContents(void* pointer);
void Save(void* pointer, unsigned int bytes, const char* filename_utf8,bool save_as_text);
};
Expand Down
11 changes: 6 additions & 5 deletions Applications/Sfx/Main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@

/* Parts of this program are Copyright (c) 2011, Max Aizenshtein <max.sniffer@gmail.com>
*/

#include <stdio.h>
#include <vector>
#include <iomanip> // for setw
Expand Down Expand Up @@ -50,6 +46,7 @@ const SfxOptions &GetSfxOptions()
return sfxOptions;
}
extern bool terminate_command;
#ifdef _MSC_VER
// A ctrl message handler to detect "close" events.
BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
{
Expand Down Expand Up @@ -86,13 +83,14 @@ BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
return FALSE;
}
}
#endif
std::string templateOutputFile;
int main(int argc, char** argv)
{
#ifdef _MSC_VER
if (SetConsoleCtrlHandler(CtrlHandler, TRUE))
{
}
#ifdef _MSC_VER
SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX | SEM_NOALIGNMENTFAULTEXCEPT);
_set_abort_behavior(0, _WRITE_ABORT_MSG);
#endif
Expand Down Expand Up @@ -127,6 +125,8 @@ int main(int argc, char** argv)
int a=0;
for(int i=1;i<argc;i++)
{
while(argv[i][0]==' ')
argv[i]++;
if(strlen(argv[i])>=2&&(argv[i][0]=='-'))
{
const char *arg=argv[i]+2;
Expand Down Expand Up @@ -241,6 +241,7 @@ int main(int argc, char** argv)
}
std::cout << std::setw(4)<< "info: building "<<sourceName<<" for "<<platformName<<"."<< std::endl;
SetEnv("PLATFORM_DIR",platform_dir.c_str());
std::cout<<"\n"<<GetEnv("BUILD_DIR")<<std::endl;
auto pathStrings=genericPathStrings;
pathStrings.push_back(json_path);
pathStrings.push_back(platform_dir+"/Shaders/SL"s);
Expand Down
1 change: 1 addition & 0 deletions Applications/Sfx/Preprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <vector>
#include <string>
#include <map>
#include <stdint.h>
enum Test
{
IS_DEFINED,NOT_DEFINED,ZERO,NONZERO,EQUALS,NOTEQUAL,GREATER,LESS,GREATER_EQUAL,LESS_EQUAL
Expand Down
19 changes: 12 additions & 7 deletions Applications/Sfx/Sfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ typedef int errno_t;
#include "SfxClasses.h"
#include "Sfx.h"
#include "SfxEffect.h"
#include "Compiler.h"

#ifdef _MSC_VER
#define YY_NO_UNISTD_H
Expand Down Expand Up @@ -106,7 +107,7 @@ FILE* OpenFile(const char *filename_utf8,std::string &fullPathNameUtf8,uint64_t
if(last_slash>0)
path=path.substr(0,last_slash);
shaderPathsUtf8.push_back(path);
datetime=FileLoader::GetFileDate(fullPathNameUtf8.c_str());
datetime=FileLoader::GetFileDateUnixTimeMs(fullPathNameUtf8.c_str());
return f;
}

Expand Down Expand Up @@ -513,6 +514,13 @@ std::string GetExecutableDirectory()
}
else
str=L"";
#else
char pBuf[512];
size_t len = sizeof(pBuf);
int bytes = std::min((int)readlink("/proc/self/exe", pBuf, len), (int)len - 1);
if(bytes >= 0)
pBuf[bytes] = '\0';
return std::string(pBuf);
#endif
return WStringToUtf8(str);
}
Expand Down Expand Up @@ -602,13 +610,13 @@ bool sfxParseEffectFromFile(int effect, const char *file, const std::vector<std:
readlink("/proc/self/exe",exeNameUtf8,_MAX_PATH);
#endif
// start with the date that this exe was made, so new exe's rebuild the shaders.
uint64_t exe_datetime=FileLoader::GetFileDate(exeNameUtf8);
uint64_t platformfile_datetime=FileLoader::GetFileDate(config->platformFilename.c_str());
uint64_t exe_datetime=FileLoader::GetFileDateUnixTimeMs(exeNameUtf8);
uint64_t platformfile_datetime=FileLoader::GetFileDateUnixTimeMs(config->platformFilename.c_str());
latest_datetime= std::max(exe_datetime,platformfile_datetime);
latest_file=file;
if (!preprocess(file, config->define, sfxOptions->disableLineWrites))
return false;
uint64_t output_filedatetime = FileLoader::GetFileDate(sfxoFilename.c_str());
uint64_t output_filedatetime = FileLoader::GetFileDateUnixTimeMs(sfxoFilename.c_str());
bool recompile=false;
if(sfxOptions->force)
{
Expand Down Expand Up @@ -646,9 +654,6 @@ bool sfxParseEffectFromFile(int effect, const char *file, const std::vector<std:
if(sfxOptions->verbose)
{
char buffer[_MAX_PATH];
string wd="";
if(_getcwd(buffer,_MAX_PATH))
wd=string(buffer)+"/";
mkpath(sfxOptions->intermediateDirectory);
ppfile=((string(sfxOptions->intermediateDirectory)+"/")+GetFilenameOnly(file))+"_pp";
ofstream pps(ppfile);
Expand Down
2 changes: 1 addition & 1 deletion Applications/Sfx/Sfx.ypp
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ primary_exp : IDENTIFIER
{
buildFunction.declarations.insert(varName);
buildFunction.declareResource(varName);
if (cb=gEffect->GetNamedConstantBufferForMember(varName))
if (cb=gEffect->GetNamedConstantBufferForMember(varName);cb)
buildFunction.declareConstantBuffer(cb);
}
else if ((cb = gEffect->GetConstantBufferForMember(varName)) != nullptr)
Expand Down
Loading
Loading