Skip to content

Commit 38ff901

Browse files
committed
remove expandincludes, existing code already did that better
1 parent 8930aa4 commit 38ff901

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

code/graphics/opengl/gropenglshader.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,6 @@ static SCP_string opengl_shader_get_header(shader_type type_id, int flags, bool
346346
return sflags.str();
347347
}
348348

349-
#ifdef USE_OPENGL_ES
350-
SCP_string glsl_es_expand_includes(const SCP_string&);
351-
#endif
352-
353349
/**
354350
* Load a shader file from disc or from the builtin defaults in def_files.cpp if none can be found.
355351
* This function will also create a list of preprocessor defines for the GLSL compiler based on the shader flags
@@ -371,9 +367,6 @@ static SCP_string opengl_load_shader(const char* filename) {
371367

372368
cfread(&content[0], len + 1, 1, cf_shader);
373369
cfclose(cf_shader);
374-
#ifdef USE_OPENGL_ES
375-
content = glsl_es_expand_includes(content);
376-
#endif
377370

378371
return content;
379372
}
@@ -383,41 +376,10 @@ static SCP_string opengl_load_shader(const char* filename) {
383376
nprintf(("shaders"," Loading built-in default shader for: %s\n", filename));
384377
auto def_shader = defaults_get_file(filename);
385378
content.assign(reinterpret_cast<const char*>(def_shader.data), def_shader.size);
386-
#ifdef USE_OPENGL_ES
387-
content = glsl_es_expand_includes(content);
388-
#endif
389379

390380
return content;
391381
}
392382

393-
#ifdef USE_OPENGL_ES
394-
/*
395-
* This function will expand any includes a shader may have with GLSL ES
396-
* Since shaders #includes are not supported.
397-
*/
398-
SCP_string glsl_es_expand_includes(const SCP_string& src)
399-
{
400-
SCP_stringstream input(src);
401-
SCP_stringstream output;
402-
SCP_string line;
403-
404-
while (std::getline(input, line)) {
405-
if (line.find("#include") != std::string::npos) {
406-
auto start = line.find('"');
407-
auto end = line.find('"', start + 1);
408-
if (start != std::string::npos && end != std::string::npos) {
409-
std::string filename = line.substr(start + 1, end - start - 1);
410-
SCP_string included = opengl_load_shader(filename.c_str());
411-
output << included << "\n";
412-
continue;
413-
}
414-
}
415-
output << line << "\n";
416-
}
417-
return output.str();
418-
}
419-
#endif
420-
421383
static void handle_includes_impl(SCP_vector<SCP_string>& include_stack,
422384
SCP_stringstream& output,
423385
int& include_counter,

0 commit comments

Comments
 (0)