- let FileData.GetString only return a const char pointer.
Not exposing the implementation will allow a lot more optimization in the backend and we also want to get rid of FString here.
This commit is contained in:
parent
5398045f7d
commit
eccbafc1bc
8 changed files with 31 additions and 31 deletions
|
|
@ -423,27 +423,27 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
int pp_lump = fileSystem.CheckNumForFullName(proc_prog_lump, 0); // if it's a core shader, ignore overrides by user mods.
|
||||
if (pp_lump == -1) pp_lump = fileSystem.CheckNumForFullName(proc_prog_lump);
|
||||
if (pp_lump == -1) I_Error("Unable to load '%s'", proc_prog_lump);
|
||||
FileData pp_data = fileSystem.ReadFile(pp_lump);
|
||||
FString pp_data = fileSystem.ReadFile(pp_lump).GetString();
|
||||
|
||||
if (pp_data.GetString().IndexOf("ProcessMaterial") < 0 && pp_data.GetString().IndexOf("SetupMaterial") < 0)
|
||||
if (pp_data.IndexOf("ProcessMaterial") < 0 && pp_data.IndexOf("SetupMaterial") < 0)
|
||||
{
|
||||
// this looks like an old custom hardware shader.
|
||||
|
||||
if (pp_data.GetString().IndexOf("GetTexCoord") >= 0)
|
||||
if (pp_data.IndexOf("GetTexCoord") >= 0)
|
||||
{
|
||||
int pl_lump = fileSystem.CheckNumForFullName("shaders/glsl/func_defaultmat2.fp", 0);
|
||||
if (pl_lump == -1) I_Error("Unable to load '%s'", "shaders/glsl/func_defaultmat2.fp");
|
||||
FileData pl_data = fileSystem.ReadFile(pl_lump);
|
||||
fp_comb << "\n" << pl_data.GetString().GetChars();
|
||||
fp_comb << "\n" << pl_data.GetString();
|
||||
}
|
||||
else
|
||||
{
|
||||
int pl_lump = fileSystem.CheckNumForFullName("shaders/glsl/func_defaultmat.fp", 0);
|
||||
if (pl_lump == -1) I_Error("Unable to load '%s'", "shaders/glsl/func_defaultmat.fp");
|
||||
FileData pl_data = fileSystem.ReadFile(pl_lump);
|
||||
fp_comb << "\n" << pl_data.GetString().GetChars();
|
||||
fp_comb << "\n" << pl_data.GetString();
|
||||
|
||||
if (pp_data.GetString().IndexOf("ProcessTexel") < 0)
|
||||
if (pp_data.IndexOf("ProcessTexel") < 0)
|
||||
{
|
||||
// this looks like an even older custom hardware shader.
|
||||
// We need to replace the ProcessTexel call to make it work.
|
||||
|
|
@ -452,7 +452,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
}
|
||||
}
|
||||
|
||||
if (pp_data.GetString().IndexOf("ProcessLight") >= 0)
|
||||
if (pp_data.IndexOf("ProcessLight") >= 0)
|
||||
{
|
||||
// The ProcessLight signatured changed. Forward to the old one.
|
||||
fp_comb << "\nvec4 ProcessLight(vec4 color);\n";
|
||||
|
|
@ -460,19 +460,19 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
}
|
||||
}
|
||||
|
||||
fp_comb << RemoveLegacyUserUniforms(pp_data.GetString()).GetChars();
|
||||
fp_comb << RemoveLegacyUserUniforms(pp_data).GetChars();
|
||||
fp_comb.Substitute("gl_TexCoord[0]", "vTexCoord"); // fix old custom shaders.
|
||||
|
||||
if (pp_data.GetString().IndexOf("ProcessLight") < 0)
|
||||
if (pp_data.IndexOf("ProcessLight") < 0)
|
||||
{
|
||||
int pl_lump = fileSystem.CheckNumForFullName("shaders/glsl/func_defaultlight.fp", 0);
|
||||
if (pl_lump == -1) I_Error("Unable to load '%s'", "shaders/glsl/func_defaultlight.fp");
|
||||
FileData pl_data = fileSystem.ReadFile(pl_lump);
|
||||
fp_comb << "\n" << pl_data.GetString().GetChars();
|
||||
fp_comb << "\n" << pl_data.GetString();
|
||||
}
|
||||
|
||||
// ProcessMaterial must be considered broken because it requires the user to fill in data they possibly cannot know all about.
|
||||
if (pp_data.GetString().IndexOf("ProcessMaterial") >= 0 && pp_data.GetString().IndexOf("SetupMaterial") < 0)
|
||||
if (pp_data.IndexOf("ProcessMaterial") >= 0 && pp_data.IndexOf("SetupMaterial") < 0)
|
||||
{
|
||||
// This reactivates the old logic and disables all features that cannot be supported with that method.
|
||||
placeholder << "#define LEGACY_USER_SHADER\n";
|
||||
|
|
@ -491,7 +491,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
int pp_lump = fileSystem.CheckNumForFullName(light_fragprog, 0);
|
||||
if (pp_lump == -1) I_Error("Unable to load '%s'", light_fragprog);
|
||||
FileData pp_data = fileSystem.ReadFile(pp_lump);
|
||||
fp_comb << pp_data.GetString().GetChars() << "\n";
|
||||
fp_comb << pp_data.GetString() << "\n";
|
||||
}
|
||||
|
||||
if (gl.flags & RFL_NO_CLIP_PLANES)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue