switch from uniform to shader keys
This commit is contained in:
parent
37a7907221
commit
04ee3c335e
9 changed files with 94 additions and 90 deletions
|
|
@ -221,6 +221,29 @@ std::unique_ptr<VulkanShader> VkShaderManager::LoadFragShader(FString shadername
|
|||
if (key.GBufferPass) definesBlock << "#define GBUFFER_PASS\n";
|
||||
if (key.AlphaTestOnly) definesBlock << "#define ALPHATEST_ONLY\n";
|
||||
|
||||
switch(key.LightBlendMode)
|
||||
{
|
||||
case 0:
|
||||
definesBlock << "#define LIGHT_BLEND_CLAMPED\n";
|
||||
break;
|
||||
case 1:
|
||||
definesBlock << "#define LIGHT_BLEND_COLORED_CLAMP\n";
|
||||
break;
|
||||
case 2:
|
||||
definesBlock << "#define LIGHT_BLEND_UNCLAMPED\n";
|
||||
break;
|
||||
}
|
||||
|
||||
switch(key.LightAttenuationMode)
|
||||
{
|
||||
case 0:
|
||||
definesBlock << "#define LIGHT_ATTENUATION_LINEAR\n";
|
||||
break;
|
||||
case 1:
|
||||
definesBlock << "#define LIGHT_ATTENUATION_INVERSE_SQUARE\n";
|
||||
break;
|
||||
}
|
||||
|
||||
if (key.DepthFadeThreshold) definesBlock << "#define USE_DEPTHFADETHRESHOLD\n";
|
||||
|
||||
if (key.Simple2D) definesBlock << "#define SIMPLE2D\n";
|
||||
|
|
|
|||
|
|
@ -98,7 +98,9 @@ public:
|
|||
uint64_t NoFragmentShader : 1;
|
||||
uint64_t DepthFadeThreshold : 1;
|
||||
uint64_t AlphaTestOnly : 1; // ALPHATEST_ONLY
|
||||
uint64_t Unused : 40;
|
||||
uint64_t LightBlendMode : 2; // LIGHT_BLEND_CLAMPED , LIGHT_BLEND_COLORED_CLAMP , LIGHT_BLEND_UNCLAMPED
|
||||
uint64_t LightAttenuationMode : 1; // LIGHT_ATTENUATION_LINEAR , LIGHT_ATTENUATION_INVERSE_SQUARE
|
||||
uint64_t Unused : 37;
|
||||
};
|
||||
uint64_t AsQWORD = 0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@
|
|||
#include "hw_clock.h"
|
||||
#include "flatvertices.h"
|
||||
|
||||
#include "g_levellocals.h"
|
||||
|
||||
CVAR(Int, vk_submit_size, 1000, 0);
|
||||
EXTERN_CVAR(Bool, r_skipmats)
|
||||
|
||||
|
|
@ -305,6 +307,9 @@ void VkRenderState::ApplyRenderPass(int dt)
|
|||
|
||||
pipelineKey.ShaderKey.GBufferPass = mRenderTarget.DrawBuffers > 1;
|
||||
|
||||
pipelineKey.ShaderKey.LightBlendMode = (level.info ? static_cast<int>(level.info->lightblendmode) : 0);
|
||||
pipelineKey.ShaderKey.LightAttenuationMode = (level.info ? static_cast<int>(level.info->lightattenuationmode) : 0);
|
||||
|
||||
// Is this the one we already have?
|
||||
bool inRenderPass = mCommandBuffer;
|
||||
bool changingPipeline = (!inRenderPass) || (pipelineKey != mPipelineKey);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue