Finally fix the shaders issue on Windows, as well as a crash that only occurred in Release builds
This commit is contained in:
@@ -27,7 +27,7 @@ xcopy %ResourceDir%\fonts %TargetDir%\data\fonts /s /y /i /d
|
|||||||
xcopy %ResourceDir%\strings %TargetDir%\data\strings /s /y /i /d
|
xcopy %ResourceDir%\strings %TargetDir%\data\strings /s /y /i /d
|
||||||
|
|
||||||
@echo Copying shaders...
|
@echo Copying shaders...
|
||||||
xcopy %1\..\..\tools\mask.* %TargetDir%\data\shaders /s /y /i /d
|
xcopy %ResourceDir%\..\src\tools\mask.* %TargetDir%\data\shaders /s /y /i /d
|
||||||
|
|
||||||
@echo Copying base scenarios...
|
@echo Copying base scenarios...
|
||||||
xcopy %ResourceDir%\"Blades of Exile Bases" %ScenEdDir%\"Blades of Exile Base" /s /y /i /d
|
xcopy %ResourceDir%\"Blades of Exile Bases" %ScenEdDir%\"Blades of Exile Base" /s /y /i /d
|
||||||
|
@@ -50,30 +50,45 @@ void init_graph_tool(){
|
|||||||
fs::path fragPath = shaderPath/"mask.frag", vertPath = shaderPath/"mask.vert";
|
fs::path fragPath = shaderPath/"mask.frag", vertPath = shaderPath/"mask.vert";
|
||||||
std::ifstream fin;
|
std::ifstream fin;
|
||||||
|
|
||||||
fin.open(fragPath.c_str());
|
do {
|
||||||
if(!fin.good()) std::cerr << std_fmterr << ": Error loading fragment shader" << std::endl;
|
|
||||||
|
std::cerr << "Loading fragment shader from " << fragPath.string() << std::endl;
|
||||||
|
fin.open(fragPath.string().c_str());
|
||||||
|
if(!fin.good()) {
|
||||||
|
std::cerr << std_fmterr << ": Error loading fragment shader" << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
fin.seekg(0, std::ios::end);
|
fin.seekg(0, std::ios::end);
|
||||||
int size = fin.tellg();
|
int size = fin.tellg();
|
||||||
fin.seekg(0);
|
fin.seekg(0);
|
||||||
char* fbuf = new char[size + 1];
|
char* fbuf = new char[size + 1];
|
||||||
fbuf[size] = 0;
|
fbuf[size] = 0;
|
||||||
fin.read(fbuf, size);
|
fin.read(fbuf, size);
|
||||||
|
fbuf[fin.gcount()] = 0;
|
||||||
fin.close();
|
fin.close();
|
||||||
|
|
||||||
fin.open(vertPath.c_str());
|
std::cerr << "Loading vertex shader from " << vertPath.string() << std::endl;
|
||||||
if(!fin.good()) std::cerr << std_fmterr << ": Error loading vertex shader" << std::endl;
|
fin.open(vertPath.string().c_str());
|
||||||
|
if(!fin.good()) {
|
||||||
|
std::cerr << std_fmterr << ": Error loading vertex shader" << std::endl;
|
||||||
|
delete[] fbuf;
|
||||||
|
break;
|
||||||
|
}
|
||||||
fin.seekg(0, std::ios::end);
|
fin.seekg(0, std::ios::end);
|
||||||
size = fin.tellg();
|
size = fin.tellg();
|
||||||
fin.seekg(0);
|
fin.seekg(0);
|
||||||
char* vbuf = new char[size + 1];
|
char* vbuf = new char[size + 1];
|
||||||
vbuf[size] = 0;
|
vbuf[size] = 0;
|
||||||
fin.read(vbuf, size);
|
fin.read(vbuf, size);
|
||||||
|
vbuf[fin.gcount()] = 0;
|
||||||
|
|
||||||
if(!maskShader.loadFromMemory(vbuf, fbuf)) {
|
if(!maskShader.loadFromMemory(vbuf, fbuf)) {
|
||||||
std::cerr << "Error: Failed to load shaders from " << shaderPath << "\nVertex:\n" << vbuf << "\nFragment:\n" << fbuf << std::endl;
|
std::cerr << "Error: Failed to load shaders from " << shaderPath << "\nVertex:\n" << vbuf << "\nFragment:\n" << fbuf << std::endl;
|
||||||
}
|
}
|
||||||
delete[] fbuf;
|
delete[] fbuf;
|
||||||
delete[] vbuf;
|
delete[] vbuf;
|
||||||
|
|
||||||
|
} while(false);
|
||||||
int i;
|
int i;
|
||||||
// TODO: The duplication of location here shouldn't be necessary
|
// TODO: The duplication of location here shouldn't be necessary
|
||||||
static const location pat_offs[17] = {
|
static const location pat_offs[17] = {
|
||||||
|
Reference in New Issue
Block a user