mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[vulkan] Make lighting samplers configurable
My VersaPro doesn't support more than 32 per-stage samplers (lavapipe). This is a small part of getting Vulkan to run on lavapipe and even in itself is rather incomplete.
This commit is contained in:
parent
062f616548
commit
a0c935e8bc
3 changed files with 19 additions and 5 deletions
|
@ -1,4 +1,10 @@
|
|||
{
|
||||
limits = {
|
||||
//FIXME this really needs to be an external variable as the C code
|
||||
//needs to agree on the size, so it might as well set maxSamplers
|
||||
//directly (and any other such variable)
|
||||
maxSamplers = "min (256u, $physDevLimits.maxPerStageDescriptorSamplers)";
|
||||
};
|
||||
samplers = {
|
||||
quakepic = {
|
||||
magFilter = nearest;
|
||||
|
@ -120,7 +126,7 @@
|
|||
bindings = (
|
||||
{
|
||||
type = combined_image_sampler;
|
||||
descriptorCount = "$frames.size * 256z";
|
||||
descriptorCount = "$frames.size * size_t($properties.limits.maxSamplers)";
|
||||
},
|
||||
);
|
||||
};
|
||||
|
@ -308,7 +314,7 @@
|
|||
{
|
||||
binding = 0;
|
||||
descriptorType = combined_image_sampler;
|
||||
descriptorCount = 256;
|
||||
descriptorCount = $properties.limits.maxSamplers;
|
||||
stageFlags = fragment;
|
||||
},
|
||||
);
|
||||
|
@ -903,6 +909,12 @@
|
|||
stage = fragment;
|
||||
name = main;
|
||||
module = $builtin/lighting.frag;
|
||||
specializationInfo = {
|
||||
mapEntries = (
|
||||
{ size = 4; offset = 0; constantID = 0; },
|
||||
);
|
||||
data = "array($properties.limits.maxSamplers)";
|
||||
};
|
||||
},
|
||||
);
|
||||
vertexInput = $properties.fsquad.vertexInput;
|
||||
|
|
|
@ -14,8 +14,6 @@ struct LightData {
|
|||
vec3 direction;
|
||||
float cone;
|
||||
};
|
||||
//XXX can't include :( be sure to keep up to date with qf_lighting.h
|
||||
#define MaxLights 256
|
||||
|
||||
#define StyleMask 0x07f
|
||||
#define ModelMask 0x380
|
||||
|
@ -33,6 +31,8 @@ struct LightData {
|
|||
#define ST_CASCADE (2 << 10) // cascaded shadow maps
|
||||
#define ST_CUBE (3 << 10) // cubemap (omni, large spotlight)
|
||||
|
||||
layout (constant_id = 0) const int MaxLights = 256;
|
||||
|
||||
layout (set = 2, binding = 0) uniform sampler2DArrayShadow shadowCascade[MaxLights];
|
||||
layout (set = 2, binding = 0) uniform sampler2DShadow shadowPlane[MaxLights];
|
||||
layout (set = 2, binding = 0) uniform samplerCubeShadow shadowCube[MaxLights];
|
||||
|
|
|
@ -416,7 +416,9 @@ Vulkan_Lighting_Init (vulkan_ctx_t *ctx)
|
|||
lframe->shadowWrite = base_image_write;
|
||||
lframe->shadowWrite.dstSet = shadow_set->a[i];
|
||||
lframe->shadowWrite.dstBinding = 0;
|
||||
lframe->shadowWrite.descriptorCount = MaxLights;
|
||||
lframe->shadowWrite.descriptorCount
|
||||
= min (MaxLights,
|
||||
device->physDev->properties.limits.maxPerStageDescriptorSamplers);
|
||||
lframe->shadowWrite.pImageInfo = lframe->shadowInfo;
|
||||
}
|
||||
free (attach_set);
|
||||
|
|
Loading…
Reference in a new issue