mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 12:31:10 +00:00
[vulkan] Prevent particle update buffers escaping the staging buffer
The escape was actually harmless as the buffers would not be read due to the particle count being 0 (thus why the buffers were at the end of the staging buffer: no space was allocated for them, only for the system buffer, but their offsets were just past the system buffer). However, the validation layers quite rightly did not like that. Thus, the two buffers are pointed to the system buffer so all three descriptors are always valid.
This commit is contained in:
parent
b35854c706
commit
9b609469ed
1 changed files with 11 additions and 2 deletions
|
@ -406,8 +406,17 @@ particles_update (qfv_renderframe_t *rFrame)
|
|||
qfv_parameters_t *params = (qfv_parameters_t *)((byte *)system + paramoffs);
|
||||
memcpy (params, pctx->psystem->partparams, paramsize);
|
||||
|
||||
partsize = max (1, partsize);
|
||||
paramsize = max (1, paramsize);
|
||||
if (!numParticles) {
|
||||
// if there are no particles, then no space for the particle states or
|
||||
// parameters has been allocated in the staging buffer, so map the
|
||||
// two buffers over the system buffer. This avoids either buffer being
|
||||
// just past the end of the staging buffer (which the validation layers
|
||||
// (correctly) do not like).
|
||||
// This is fine because the two buffers are only read by the the
|
||||
// compute shader.
|
||||
partsize = paramsize = syssize;
|
||||
partoffs = paramoffs = 0;
|
||||
}
|
||||
|
||||
size_t sysoffs = packet->offset;
|
||||
VkDescriptorBufferInfo bufferInfo[] = {
|
||||
|
|
Loading…
Reference in a new issue