mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
Automatically size the StreamUBO to 64 KB regardless of what is in it
This commit is contained in:
parent
81ea919d61
commit
1004ac1636
2 changed files with 11 additions and 4 deletions
|
@ -142,7 +142,7 @@ static const char *shaderBindings = R"(
|
||||||
};
|
};
|
||||||
|
|
||||||
layout(set = 0, binding = 3, std140) uniform StreamUBO {
|
layout(set = 0, binding = 3, std140) uniform StreamUBO {
|
||||||
StreamData data[256];
|
StreamData data[MAX_STREAM_DATA];
|
||||||
};
|
};
|
||||||
|
|
||||||
layout(set = 0, binding = 4) uniform sampler2D ShadowMap;
|
layout(set = 0, binding = 4) uniform sampler2D ShadowMap;
|
||||||
|
@ -198,6 +198,9 @@ static const char *shaderBindings = R"(
|
||||||
#define uObjectColor2 data[uDataIndex].uObjectColor2
|
#define uObjectColor2 data[uDataIndex].uObjectColor2
|
||||||
#define uDynLightColor data[uDataIndex].uDynLightColor
|
#define uDynLightColor data[uDataIndex].uDynLightColor
|
||||||
#define uAddColor data[uDataIndex].uAddColor
|
#define uAddColor data[uDataIndex].uAddColor
|
||||||
|
#define uTextureBlendColor data[uDataIndex].uTextureBlendColor
|
||||||
|
#define uTextureModulateColor data[uDataIndex].uTextureModulateColor
|
||||||
|
#define uTextureAddColor data[uDataIndex].uTextureAddColor
|
||||||
#define uFogColor data[uDataIndex].uFogColor
|
#define uFogColor data[uDataIndex].uFogColor
|
||||||
#define uDesaturationFactor data[uDataIndex].uDesaturationFactor
|
#define uDesaturationFactor data[uDataIndex].uDesaturationFactor
|
||||||
#define uInterpolationFactor data[uDataIndex].uInterpolationFactor
|
#define uInterpolationFactor data[uDataIndex].uInterpolationFactor
|
||||||
|
@ -233,7 +236,9 @@ static const char *shaderBindings = R"(
|
||||||
std::unique_ptr<VulkanShader> VkShaderManager::LoadVertShader(FString shadername, const char *vert_lump, const char *defines)
|
std::unique_ptr<VulkanShader> VkShaderManager::LoadVertShader(FString shadername, const char *vert_lump, const char *defines)
|
||||||
{
|
{
|
||||||
FString code = GetTargetGlslVersion();
|
FString code = GetTargetGlslVersion();
|
||||||
code << defines << shaderBindings;
|
code << defines;
|
||||||
|
code << "\n#define MAX_STREAM_DATA " << std::to_string(MAX_STREAM_DATA).c_str() << "\n";
|
||||||
|
code << shaderBindings;
|
||||||
if (!device->UsedDeviceFeatures.shaderClipDistance) code << "#define NO_CLIPDISTANCE_SUPPORT\n";
|
if (!device->UsedDeviceFeatures.shaderClipDistance) code << "#define NO_CLIPDISTANCE_SUPPORT\n";
|
||||||
code << "#line 1\n";
|
code << "#line 1\n";
|
||||||
code << LoadPrivateShaderLump(vert_lump).GetChars() << "\n";
|
code << LoadPrivateShaderLump(vert_lump).GetChars() << "\n";
|
||||||
|
@ -246,7 +251,9 @@ std::unique_ptr<VulkanShader> VkShaderManager::LoadVertShader(FString shadername
|
||||||
std::unique_ptr<VulkanShader> VkShaderManager::LoadFragShader(FString shadername, const char *frag_lump, const char *material_lump, const char *light_lump, const char *defines, bool alphatest, bool gbufferpass)
|
std::unique_ptr<VulkanShader> VkShaderManager::LoadFragShader(FString shadername, const char *frag_lump, const char *material_lump, const char *light_lump, const char *defines, bool alphatest, bool gbufferpass)
|
||||||
{
|
{
|
||||||
FString code = GetTargetGlslVersion();
|
FString code = GetTargetGlslVersion();
|
||||||
code << defines << shaderBindings;
|
code << defines;
|
||||||
|
code << "\n#define MAX_STREAM_DATA " << std::to_string(MAX_STREAM_DATA).c_str() << "\n";
|
||||||
|
code << shaderBindings;
|
||||||
|
|
||||||
if (!device->UsedDeviceFeatures.shaderClipDistance) code << "#define NO_CLIPDISTANCE_SUPPORT\n";
|
if (!device->UsedDeviceFeatures.shaderClipDistance) code << "#define NO_CLIPDISTANCE_SUPPORT\n";
|
||||||
if (!alphatest) code << "#define NO_ALPHATEST\n";
|
if (!alphatest) code << "#define NO_ALPHATEST\n";
|
||||||
|
|
|
@ -18,7 +18,7 @@ struct MatricesUBO
|
||||||
VSMatrix TextureMatrix;
|
VSMatrix TextureMatrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_STREAM_DATA 256
|
#define MAX_STREAM_DATA ((int)(65536 / sizeof(StreamData)))
|
||||||
|
|
||||||
struct StreamUBO
|
struct StreamUBO
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue