mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- fixed shader building.
We really need a version directive for user shaders, this is getting too messy. :(
This commit is contained in:
parent
667b2d6bf4
commit
3e8f53e98c
2 changed files with 9 additions and 4 deletions
|
@ -379,14 +379,16 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
vp_comb << "#define SUPPORTS_SHADOWMAPS\n";
|
||||
}
|
||||
|
||||
vp_comb << defines << i_data.GetChars();
|
||||
FString fp_comb = vp_comb;
|
||||
vp_comb << defines << i_data.GetChars();
|
||||
fp_comb << "$placeholder$\n" << defines << i_data.GetChars();
|
||||
|
||||
vp_comb << "#line 1\n";
|
||||
fp_comb << "#line 1\n";
|
||||
|
||||
vp_comb << RemoveLayoutLocationDecl(vp_data.GetString(), "out").GetChars() << "\n";
|
||||
fp_comb << RemoveLayoutLocationDecl(fp_data.GetString(), "in").GetChars() << "\n";
|
||||
FString placeholder = "\n";
|
||||
|
||||
if (proc_prog_lump != NULL)
|
||||
{
|
||||
|
@ -448,9 +450,8 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
if (pp_data.GetString().IndexOf("ProcessMaterial") >= 0 && pp_data.GetString().IndexOf("SetupMaterial") < 0)
|
||||
{
|
||||
// This reactivates the old logic and disables all features that cannot be supported with that method.
|
||||
fp_comb.Insert(0, "#define LEGACY_USER_SHADER\n");
|
||||
placeholder << "#define LEGACY_USER_SHADER\n";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -458,6 +459,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
fp_comb << proc_prog_lump + 1;
|
||||
}
|
||||
}
|
||||
fp_comb.Substitute("$placeholder$", placeholder);
|
||||
|
||||
if (light_fragprog)
|
||||
{
|
||||
|
|
|
@ -284,8 +284,10 @@ std::unique_ptr<VulkanShader> VkShaderManager::LoadFragShader(FString shadername
|
|||
{
|
||||
FString code = GetTargetGlslVersion();
|
||||
code << defines;
|
||||
code << "\n$placeholder$"; // here the code can later add more needed #defines.
|
||||
code << "\n#define MAX_STREAM_DATA " << std::to_string(MAX_STREAM_DATA).c_str() << "\n";
|
||||
code << shaderBindings;
|
||||
FString placeholder = "\n";
|
||||
|
||||
if (!device->UsedDeviceFeatures.shaderClipDistance) code << "#define NO_CLIPDISTANCE_SUPPORT\n";
|
||||
if (!alphatest) code << "#define NO_ALPHATEST\n";
|
||||
|
@ -342,7 +344,7 @@ std::unique_ptr<VulkanShader> VkShaderManager::LoadFragShader(FString shadername
|
|||
if (pp_code.IndexOf("ProcessMaterial") >= 0 && pp_code.IndexOf("SetupMaterial") < 0)
|
||||
{
|
||||
// This reactivates the old logic and disables all features that cannot be supported with that method.
|
||||
code.Insert(0, "#define LEGACY_USER_SHADER\n");
|
||||
placeholder << "#define LEGACY_USER_SHADER\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -351,6 +353,7 @@ std::unique_ptr<VulkanShader> VkShaderManager::LoadFragShader(FString shadername
|
|||
code << (material_lump + 1) << "\n";
|
||||
}
|
||||
}
|
||||
code.Substitute("$placeholder$", placeholder);
|
||||
|
||||
if (light_lump)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue