Skip to content

Commit 77f19ba

Browse files
RicardoLuis0dpjudas
authored andcommitted
initial work for ubershaders
1 parent 81062ec commit 77f19ba

22 files changed

+678
-385
lines changed

src/common/rendering/vulkan/shaders/vk_shader.cpp

+201-72
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ VkShaderProgram* VkShaderManager::Get(const VkShaderKey& key)
112112
{ "dithertrans", "shaders/scene/frag_main.glsl", "shaders/scene/material_default.glsl", "shaders/scene/mateffect_default.glsl", "shaders/scene/lightmodel_shared.glsl", "shaders/scene/lightmodel_normal.glsl", "#define NO_ALPHATEST\n#define DITHERTRANS\n" },
113113
};
114114

115+
VkShaderKey customKey = key;
116+
customKey.AlphaTest = false;
117+
115118
const auto& desc = effectshaders[key.SpecialEffect];
116119
program.vert = LoadVertShader(desc.ShaderName, mainvp, nullptr, desc.defines, key, nullptr);
117120
if (!key.NoFragmentShader)
@@ -274,7 +277,7 @@ static void AddBuiltinFields(FString &layoutBlock, int &index, bool is_in, const
274277
}
275278
}
276279

277-
void VkShaderManager::BuildLayoutBlock(FString &layoutBlock, bool isFrag, const VkShaderKey& key, const UserShaderDesc *shader)
280+
void VkShaderManager::BuildLayoutBlock(FString &layoutBlock, bool isFrag, const VkShaderKey& key, const UserShaderDesc *shader, bool isUberShader)
278281
{
279282
bool hasClipDistance = fb->GetDevice()->EnabledFeatures.Features.shaderClipDistance;
280283

@@ -293,6 +296,17 @@ void VkShaderManager::BuildLayoutBlock(FString &layoutBlock, bool isFrag, const
293296
}
294297
layoutBlock << " int uBoneIndexBase; // bone animation\n";
295298
layoutBlock << " int uFogballIndex; // fog balls\n";
299+
300+
if(isUberShader)
301+
{
302+
layoutBlock << " int uShaderKey1;\n";
303+
layoutBlock << " int uShaderKey2;\n";
304+
}
305+
else
306+
{
307+
layoutBlock << " int unused2;\n";
308+
layoutBlock << " int unused3;\n";
309+
}
296310

297311
if(shader && shader->Uniforms.UniformStructSize)
298312
{
@@ -326,7 +340,7 @@ void VkShaderManager::BuildLayoutBlock(FString &layoutBlock, bool isFrag, const
326340
}
327341
}
328342

329-
void VkShaderManager::BuildDefinesBlock(FString &definesBlock, const char *defines, bool isFrag, const VkShaderKey& key, const UserShaderDesc *shader)
343+
void VkShaderManager::BuildDefinesBlock(FString &definesBlock, const char *defines, bool isFrag, const VkShaderKey& key, const UserShaderDesc *shader, bool isUberShader)
330344
{
331345
if (fb->IsRayQueryEnabled())
332346
{
@@ -352,86 +366,173 @@ void VkShaderManager::BuildDefinesBlock(FString &definesBlock, const char *defin
352366
definesBlock << "#define NO_CLIPDISTANCE_SUPPORT\n";
353367
}
354368

355-
if (!key.AlphaTest) definesBlock << "#define NO_ALPHATEST\n";
356-
if (key.GBufferPass) definesBlock << "#define GBUFFER_PASS\n";
357-
if (key.AlphaTestOnly) definesBlock << "#define ALPHATEST_ONLY\n";
358-
if (key.Simple) definesBlock << "#define SIMPLE\n";
359-
if (key.Simple3D) definesBlock << "#define SIMPLE3D\n";
360-
361-
switch(key.LightBlendMode)
369+
if(isUberShader)
362370
{
363-
case 0:
364-
definesBlock << "#define LIGHT_BLEND_CLAMPED\n";
365-
break;
366-
case 1:
367-
definesBlock << "#define LIGHT_BLEND_COLORED_CLAMP\n";
368-
break;
369-
case 2:
370-
definesBlock << "#define LIGHT_BLEND_UNCLAMPED\n";
371-
break;
372-
}
371+
//ugh EffectState also controls layout, because specular/pbr/etc defines switch texture indices around for normal/specular/etc
373372

374-
switch(key.LightAttenuationMode)
375-
{
376-
case 0:
377-
definesBlock << "#define LIGHT_ATTENUATION_LINEAR\n";
378-
break;
379-
case 1:
380-
definesBlock << "#define LIGHT_ATTENUATION_INVERSE_SQUARE\n";
381-
break;
382-
}
373+
definesBlock << LoadPrivateShaderLump("shaders/shaderkey.glsl").GetChars() << "\n";
383374

384-
if (key.DepthFadeThreshold) definesBlock << "#define USE_DEPTHFADETHRESHOLD\n";
375+
definesBlock << "#define UBERSHADERS\n";
385376

386-
if (key.Simple2D) definesBlock << "#define SIMPLE2D\n";
387-
if (key.ClampY) definesBlock << "#define TEXF_ClampY\n";
388-
if (key.Brightmap) definesBlock << "#define TEXF_Brightmap\n";
389-
if (key.Detailmap) definesBlock << "#define TEXF_Detailmap\n";
390-
if (key.Glowmap) definesBlock << "#define TEXF_Glowmap\n";
377+
definesBlock << "#define DO_ALPHATEST ((uShaderKey1 & SK1_ALPHATEST) != 0)\n";
378+
379+
//definesBlock << "#define SIMPLE ((uShaderKey1 & SK1_SIMPLE) != 0)\n";
380+
//definesBlock << "#define SIMPLE3D ((uShaderKey1 & SK1_SIMPLE3D) != 0)\n";
381+
// controls layout
382+
if (key.Simple) definesBlock << "#define SIMPLE\n";
383+
if (key.Simple3D) definesBlock << "#define SIMPLE3D\n";
391384

392-
if (key.UseRaytrace) definesBlock << "#define USE_RAYTRACE\n";
393-
if (key.UseRaytracePrecise) definesBlock << "#define USE_RAYTRACE_PRECISE\n";
394-
if (key.PreciseMidtextureTrace) definesBlock << "#define PRECISE_MIDTEXTURES\n";
385+
definesBlock << "#define SIMPLE2D ((uShaderKey1 & SK1_SIMPLE2D) != 0)\n";
395386

396-
definesBlock << "#define SHADOWMAP_FILTER ";
397-
definesBlock << std::to_string(key.ShadowmapFilter).c_str();
398-
definesBlock << "\n";
387+
definesBlock << "#define TM_STENCIL (SK_GET_TEXTUREMODE() == SK1_TM_STENCIL)\n";
388+
definesBlock << "#define TM_OPAQUE (SK_GET_TEXTUREMODE() == SK1_TM_OPAQUE)\n";
389+
definesBlock << "#define TM_INVERSE (SK_GET_TEXTUREMODE() == SK1_TM_INVERSE)\n";
390+
definesBlock << "#define TM_ALPHATEXTURE (SK_GET_TEXTUREMODE() == SK1_TM_ALPHATEXTURE)\n";
391+
definesBlock << "#define TM_CLAMPY (SK_GET_TEXTUREMODE() == SK1_TM_CLAMPY)\n";
392+
definesBlock << "#define TM_INVERTOPAQUE (SK_GET_TEXTUREMODE() == SK1_TM_INVERTOPAQUE)\n";
393+
definesBlock << "#define TM_FOGLAYER (SK_GET_TEXTUREMODE() == SK1_TM_FOGLAYER)\n";
399394

400-
if (key.UseShadowmap) definesBlock << "#define USE_SHADOWMAP\n";
401-
if (key.UseLevelMesh) definesBlock << "#define USE_LEVELMESH\n";
395+
definesBlock << "#define TEXF_ClampY ((uShaderKey1 & SK1_TEXF_CLAMPY) != 0)\n";
396+
definesBlock << "#define TEXF_Brightmap ((uShaderKey1 & SK1_TEXF_BRIGHTMAP) != 0)\n";
397+
definesBlock << "#define TEXF_Detailmap ((uShaderKey1 & SK1_TEXF_DETAILMAP) != 0)\n";
398+
definesBlock << "#define TEXF_Glowmap ((uShaderKey1 & SK1_TEXF_GLOWMAP) != 0)\n";
402399

403-
switch (key.TextureMode)
404-
{
405-
case TM_STENCIL: definesBlock << "#define TM_STENCIL\n"; break;
406-
case TM_OPAQUE: definesBlock << "#define TM_OPAQUE\n"; break;
407-
case TM_INVERSE: definesBlock << "#define TM_INVERSE\n"; break;
408-
case TM_ALPHATEXTURE: definesBlock << "#define TM_ALPHATEXTURE\n"; break;
409-
case TM_CLAMPY: definesBlock << "#define TM_CLAMPY\n"; break;
410-
case TM_INVERTOPAQUE: definesBlock << "#define TM_INVERTOPAQUE\n"; break;
411-
case TM_FOGLAYER: definesBlock << "#define TM_FOGLAYER\n"; break;
412-
}
400+
definesBlock << "#define GBUFFER_PASS ((uShaderKey1 & SK1_GBUFFER_PASS) != 0)\n";
413401

414-
switch (key.LightMode)
415-
{
416-
case 0: definesBlock << "#define LIGHTMODE_DEFAULT\n"; break;
417-
case 1: definesBlock << "#define LIGHTMODE_SOFTWARE\n"; break;
418-
case 2: definesBlock << "#define LIGHTMODE_VANILLA\n"; break;
419-
case 3: definesBlock << "#define LIGHTMODE_BUILD\n"; break;
402+
definesBlock << "#define USE_SHADOWMAP ((uShaderKey1 & SK1_USE_SHADOWMAP) != 0)\n";
403+
404+
definesBlock << "#define USE_RAYTRACE ((uShaderKey1 & SK1_USE_RAYTRACE) != 0)\n";
405+
definesBlock << "#define USE_RAYTRACE_PRECISE ((uShaderKey1 & SK1_USE_RAYTRACE_PRECISE) != 0)\n";
406+
definesBlock << "#define PRECISE_MIDTEXTURES ((uShaderKey1 & SK1_PRECISE_MIDTEXTURES) != 0)\n";
407+
408+
definesBlock << "#define SHADOWMAP_FILTER (SK_GET_SHADOWMAP_FILTER())\n";
409+
410+
definesBlock << "#define FOG_BEFORE_LIGHTS ((uShaderKey1 & SK1_FOG_BEFORE_LIGHTS) != 0)\n";
411+
definesBlock << "#define FOG_AFTER_LIGHTS ((uShaderKey1 & SK1_FOG_AFTER_LIGHTS) != 0)\n";
412+
definesBlock << "#define FOG_RADIAL ((uShaderKey1 & SK1_FOG_RADIAL) != 0)\n";
413+
414+
definesBlock << "#define SWLIGHT_RADIAL ((uShaderKey1 & SK1_SWLIGHT_RADIAL) != 0)\n";
415+
definesBlock << "#define SWLIGHT_BANDED ((uShaderKey1 & SK1_SWLIGHT_BANDED) != 0)\n";
416+
417+
definesBlock << "#define LIGHTMODE_DEFAULT (SK_GET_LIGHTMODE() == SK1_LIGHTMODE_DEFAULT)\n";
418+
definesBlock << "#define LIGHTMODE_SOFTWARE (SK_GET_LIGHTMODE() == SK1_LIGHTMODE_SOFTWARE)\n";
419+
definesBlock << "#define LIGHTMODE_VANILLA (SK_GET_LIGHTMODE() == SK1_LIGHTMODE_VANILLA)\n";
420+
definesBlock << "#define LIGHTMODE_BUILD (SK_GET_LIGHTMODE() == SK1_LIGHTMODE_BUILD)\n";
421+
422+
definesBlock << "#define LIGHT_BLEND_CLAMPED (SK_GET_LIGHTBLENDMODE() == SK1_LIGHT_BLEND_CLAMPED)\n";
423+
definesBlock << "#define LIGHT_BLEND_COLORED_CLAMP (SK_GET_LIGHTBLENDMODE() == SK1_LIGHT_LIGHT_BLEND_COLORED_CLAMP)\n";
424+
definesBlock << "#define LIGHT_BLEND_UNCLAMPED (SK_GET_LIGHTBLENDMODE() == SK1_LIGHT_BLEND_UNCLAMPED)\n";
425+
426+
definesBlock << "#define LIGHT_ATTENUATION_LINEAR ((uShaderKey1 & SK1_TEXTUREMODE) == 0)\n";
427+
definesBlock << "#define LIGHT_ATTENUATION_INVERSE_SQUARE ((uShaderKey1 & SK1_TEXTUREMODE) != 0)\n";
428+
429+
//definesBlock << "#define USE_LEVELMESH (!!(uShaderKey1 & SK1_USE_LEVELMESH))\n";
430+
// controls layout
431+
if (key.UseLevelMesh) definesBlock << "#define USE_LEVELMESH\n";
432+
433+
definesBlock << "#define FOGBALLS ((uShaderKey1 & SK1_FOGBALLS) != 0)\n";
434+
435+
//key.NoFragmentShader not used in defines
436+
437+
definesBlock << "#define USE_DEPTHFADETHRESHOLD ((uShaderKey2 & SK2_USE_DEPTHFADETHRESHOLD) != 0)\n";
438+
definesBlock << "#define NOT_ALPHATEST_ONLY ((uShaderKey2 & SK2_ALPHATEST_ONLY) == 0)\n";
439+
440+
//definesBlock << "#define SHADE_VERTEX ((uShaderKey2 & SK2_SHADE_VERTEX) != 0)\n";
441+
// controls layout
442+
if (key.ShadeVertex) definesBlock << "#define SHADE_VERTEX\n";
443+
444+
definesBlock << "#define LIGHT_NONORMALS ((uShaderKey2 & SK2_LIGHT_NONORMALS) != 0)\n";
445+
definesBlock << "#define USE_SPRITE_CENTER ((uShaderKey2 & SK2_USE_SPRITECENTER) != 0)\n";
446+
447+
definesBlock << "#define uFogEnabled ((uShaderKey1 & SK1_SIMPLE2D) ? -3 : 0)\n";
420448
}
449+
else
450+
{
451+
if (key.AlphaTest) definesBlock << "#define DO_ALPHATEST\n";
452+
if (key.Simple) definesBlock << "#define SIMPLE\n";
453+
if (key.Simple2D) definesBlock << "#define SIMPLE2D\n";
454+
if (key.Simple3D) definesBlock << "#define SIMPLE3D\n";
455+
456+
switch (key.TextureMode)
457+
{
458+
case TM_STENCIL: definesBlock << "#define TM_STENCIL\n"; break;
459+
case TM_OPAQUE: definesBlock << "#define TM_OPAQUE\n"; break;
460+
case TM_INVERSE: definesBlock << "#define TM_INVERSE\n"; break;
461+
case TM_ALPHATEXTURE: definesBlock << "#define TM_ALPHATEXTURE\n"; break;
462+
case TM_CLAMPY: definesBlock << "#define TM_CLAMPY\n"; break;
463+
case TM_INVERTOPAQUE: definesBlock << "#define TM_INVERTOPAQUE\n"; break;
464+
case TM_FOGLAYER: definesBlock << "#define TM_FOGLAYER\n"; break;
465+
}
466+
467+
if (key.ClampY) definesBlock << "#define TEXF_ClampY\n";
468+
if (key.Brightmap) definesBlock << "#define TEXF_Brightmap\n";
469+
if (key.Detailmap) definesBlock << "#define TEXF_Detailmap\n";
470+
if (key.Glowmap) definesBlock << "#define TEXF_Glowmap\n";
421471

422-
if (key.FogBeforeLights) definesBlock << "#define FOG_BEFORE_LIGHTS\n";
423-
if (key.FogAfterLights) definesBlock << "#define FOG_AFTER_LIGHTS\n";
424-
if (key.FogRadial) definesBlock << "#define FOG_RADIAL\n";
425-
if (key.SWLightRadial) definesBlock << "#define SWLIGHT_RADIAL\n";
426-
if (key.SWLightBanded) definesBlock << "#define SWLIGHT_BANDED\n";
427-
if (key.FogBalls) definesBlock << "#define FOGBALLS\n";
472+
if (key.GBufferPass) definesBlock << "#define GBUFFER_PASS\n";
428473

474+
if (key.UseShadowmap) definesBlock << "#define USE_SHADOWMAP\n";
429475

430-
if (key.ShadeVertex) definesBlock << "#define SHADE_VERTEX\n";
431-
if (key.LightNoNormals) definesBlock << "#define LIGHT_NONORMALS\n";
432-
if (key.UseSpriteCenter) definesBlock << "#define USE_SPRITE_CENTER\n";
433476

434-
definesBlock << ((key.Simple2D) ? "#define uFogEnabled -3\n" : "#define uFogEnabled 0\n");
477+
if (key.UseRaytrace) definesBlock << "#define USE_RAYTRACE\n";
478+
if (key.UseRaytracePrecise) definesBlock << "#define USE_RAYTRACE_PRECISE\n";
479+
if (key.PreciseMidtextureTrace) definesBlock << "#define PRECISE_MIDTEXTURES\n";
480+
481+
definesBlock << "#define SHADOWMAP_FILTER " << std::to_string(key.ShadowmapFilter).c_str() << "\n";
482+
483+
if (key.FogBeforeLights) definesBlock << "#define FOG_BEFORE_LIGHTS\n";
484+
if (key.FogAfterLights) definesBlock << "#define FOG_AFTER_LIGHTS\n";
485+
if (key.FogRadial) definesBlock << "#define FOG_RADIAL\n";
486+
487+
if (key.SWLightRadial) definesBlock << "#define SWLIGHT_RADIAL\n";
488+
if (key.SWLightBanded) definesBlock << "#define SWLIGHT_BANDED\n";
489+
490+
switch (key.LightMode)
491+
{
492+
case 0: definesBlock << "#define LIGHTMODE_DEFAULT\n"; break;
493+
case 1: definesBlock << "#define LIGHTMODE_SOFTWARE\n"; break;
494+
case 2: definesBlock << "#define LIGHTMODE_VANILLA\n"; break;
495+
case 3: definesBlock << "#define LIGHTMODE_BUILD\n"; break;
496+
}
497+
498+
switch(key.LightBlendMode)
499+
{
500+
case 0:
501+
definesBlock << "#define LIGHT_BLEND_CLAMPED\n";
502+
break;
503+
case 1:
504+
definesBlock << "#define LIGHT_BLEND_COLORED_CLAMP\n";
505+
break;
506+
case 2:
507+
definesBlock << "#define LIGHT_BLEND_UNCLAMPED\n";
508+
break;
509+
}
510+
511+
switch(key.LightAttenuationMode)
512+
{
513+
case 0:
514+
definesBlock << "#define LIGHT_ATTENUATION_LINEAR\n";
515+
break;
516+
case 1:
517+
definesBlock << "#define LIGHT_ATTENUATION_INVERSE_SQUARE\n";
518+
break;
519+
}
520+
521+
if (key.UseLevelMesh) definesBlock << "#define USE_LEVELMESH\n";
522+
if (key.FogBalls) definesBlock << "#define FOGBALLS\n";
523+
524+
//key.NoFragmentShader not used in defines
525+
526+
if (key.DepthFadeThreshold) definesBlock << "#define USE_DEPTHFADETHRESHOLD\n";
527+
528+
if (!key.AlphaTestOnly) definesBlock << "#define NOT_ALPHATEST_ONLY\n";
529+
530+
if (key.ShadeVertex) definesBlock << "#define SHADE_VERTEX\n";
531+
if (key.LightNoNormals) definesBlock << "#define LIGHT_NONORMALS\n";
532+
if (key.UseSpriteCenter) definesBlock << "#define USE_SPRITE_CENTER\n";
533+
534+
definesBlock << ((key.Simple2D) ? "#define uFogEnabled -3\n" : "#define uFogEnabled 0\n");
535+
}
435536

436537
// Setup fake variables for the 'in' attributes that aren't actually available because the garbage shader code thinks they exist
437538
// God I hate this engine... :(
@@ -631,19 +732,47 @@ ShaderIncludeResult VkShaderManager::OnInclude(FString headerName, FString inclu
631732
return ShaderIncludeResult(headerName.GetChars(), code.GetChars());
632733
}
633734

634-
FString VkShaderManager::LoadPublicShaderLump(const char *lumpname)
735+
FString VkShaderManager::LoadPublicShaderLump(const char *lumpname, bool isUberShader)
635736
{
636737
int lump = fileSystem.CheckNumForFullName(lumpname, 0);
637738
if (lump == -1) lump = fileSystem.CheckNumForFullName(lumpname);
638739
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
639-
return GetStringFromLump(lump);
740+
741+
return LoadShaderLump(lump, isUberShader);
640742
}
641743

642-
FString VkShaderManager::LoadPrivateShaderLump(const char *lumpname)
744+
FString VkShaderManager::LoadPrivateShaderLump(const char *lumpname, bool isUberShader)
643745
{
644746
int lump = fileSystem.CheckNumForFullName(lumpname, 0);
645747
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
646-
return GetStringFromLump(lump);
748+
749+
return LoadShaderLump(lump, isUberShader);
750+
}
751+
752+
FString VkShaderManager::LoadShaderLump(int lumpnum, bool isUberShader)
753+
{
754+
FString str = GetStringFromLump(lumpnum);
755+
756+
if(isUberShader)
757+
{
758+
str.Substitute("#uifdef", "if");
759+
str.Substitute("#uelifdef", "else if");
760+
str.Substitute("#uif", "if");
761+
str.Substitute("#uelif", "else if");
762+
str.Substitute("#uelse", "else");
763+
str.Substitute("#uendif", "");
764+
}
765+
else
766+
{
767+
str.Substitute("#uifdef", "#if defined");
768+
str.Substitute("#uelifdef", "#elif defined");
769+
str.Substitute("#uif", "#if");
770+
str.Substitute("#uelif", "#elif");
771+
str.Substitute("#uelse", "#else");
772+
str.Substitute("#uendif", "#endif");
773+
}
774+
775+
return str;
647776
}
648777

649778
VkPPShader* VkShaderManager::GetVkShader(PPShader* shader)

src/common/rendering/vulkan/shaders/vk_shader.h

+12-9
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ struct PushConstants
5555
int uLightIndex; // dynamic lights
5656
int uBoneIndexBase; // bone animation
5757
int uFogballIndex; // fog balls
58+
uint64_t shaderKey;
5859
};
5960

6061
struct ZMinMaxPushConstants
@@ -93,25 +94,25 @@ class VkShaderKey
9394
uint64_t GBufferPass : 1; // GBUFFER_PASS
9495
uint64_t UseShadowmap : 1; // USE_SHADOWMAP
9596
uint64_t UseRaytrace : 1; // USE_RAYTRACE
97+
uint64_t UseRaytracePrecise : 1; // USE_RAYTRACE_PRECISE
98+
uint64_t PreciseMidtextureTrace : 1; // PRECISE_MIDTEXTURES
99+
uint64_t ShadowmapFilter : 4; // SHADOWMAP_FILTER
96100
uint64_t FogBeforeLights : 1; // FOG_BEFORE_LIGHTS
97101
uint64_t FogAfterLights : 1; // FOG_AFTER_LIGHTS
98102
uint64_t FogRadial : 1; // FOG_RADIAL
99103
uint64_t SWLightRadial : 1; // SWLIGHT_RADIAL
100104
uint64_t SWLightBanded : 1; // SWLIGHT_BANDED
101105
uint64_t LightMode : 2; // LIGHTMODE_DEFAULT, LIGHTMODE_SOFTWARE, LIGHTMODE_VANILLA, LIGHTMODE_BUILD
106+
uint64_t LightBlendMode : 2; // LIGHT_BLEND_CLAMPED , LIGHT_BLEND_COLORED_CLAMP , LIGHT_BLEND_UNCLAMPED
107+
uint64_t LightAttenuationMode : 1; // LIGHT_ATTENUATION_LINEAR , LIGHT_ATTENUATION_INVERSE_SQUARE
102108
uint64_t UseLevelMesh : 1; // USE_LEVELMESH
103109
uint64_t FogBalls : 1; // FOGBALLS
104110
uint64_t NoFragmentShader : 1;
105111
uint64_t DepthFadeThreshold : 1;
106112
uint64_t AlphaTestOnly : 1; // ALPHATEST_ONLY
107-
uint64_t LightBlendMode : 2; // LIGHT_BLEND_CLAMPED , LIGHT_BLEND_COLORED_CLAMP , LIGHT_BLEND_UNCLAMPED
108-
uint64_t LightAttenuationMode : 1; // LIGHT_ATTENUATION_LINEAR , LIGHT_ATTENUATION_INVERSE_SQUARE
109-
uint64_t UseRaytracePrecise : 1; // USE_RAYTRACE_PRECISE
110-
uint64_t ShadowmapFilter : 4; // SHADOWMAP_FILTER
111113
uint64_t ShadeVertex : 1; // SHADE_VERTEX
112114
uint64_t LightNoNormals : 1; // LIGHT_NONORMALS
113115
uint64_t UseSpriteCenter : 1; // USE_SPRITE_CENTER
114-
uint64_t PreciseMidtextureTrace : 1; // PRECISE_MIDTEXTURES
115116
uint64_t Unused : 26;
116117
};
117118
uint64_t AsQWORD = 0;
@@ -166,11 +167,13 @@ class VkShaderManager
166167
ShaderIncludeResult OnInclude(FString headerName, FString includerName, size_t depth, bool system);
167168

168169
FString GetVersionBlock();
169-
FString LoadPublicShaderLump(const char *lumpname);
170-
FString LoadPrivateShaderLump(const char *lumpname);
170+
FString LoadPublicShaderLump(const char *lumpname, bool isUberShader = false);
171+
FString LoadPrivateShaderLump(const char *lumpname, bool isUberShader = false);
172+
173+
FString LoadShaderLump(int lumpnum, bool isUberShader);
171174

172-
void BuildLayoutBlock(FString &definesBlock, bool isFrag, const VkShaderKey& key, const UserShaderDesc *shader);
173-
void BuildDefinesBlock(FString &definesBlock, const char *defines, bool isFrag, const VkShaderKey& key, const UserShaderDesc *shader);
175+
void BuildLayoutBlock(FString &definesBlock, bool isFrag, const VkShaderKey& key, const UserShaderDesc *shader, bool isUberShader = false);
176+
void BuildDefinesBlock(FString &definesBlock, const char *defines, bool isFrag, const VkShaderKey& key, const UserShaderDesc *shader, bool isUberShader = false);
174177

175178
VulkanRenderDevice* fb = nullptr;
176179

0 commit comments

Comments
 (0)