Skip to content

Commit 66158e0

Browse files
committed
fix decals ssbo update (gpu-particles)
1 parent 119ad1f commit 66158e0

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

game/graphics/pfx/pfxbucket.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ float PfxBucket::ParState::lifeTime() const {
3030
std::mt19937 PfxBucket::rndEngine;
3131

3232
PfxBucket::PfxBucket(const ParticleFx &decl, PfxObjects& parent, VisualObjects& visual)
33-
:decl(decl), parent(parent), visual(visual), vertexCount(decl.visTexIsQuadPoly ? 6 : 3) {
33+
:decl(decl), parent(parent), visual(visual) {
3434
item = visual.get(decl.visMaterial);
3535

3636
if(!item.isEmpty())
@@ -65,6 +65,9 @@ bool PfxBucket::isEmpty() const {
6565
}
6666

6767
size_t PfxBucket::allocBlock() {
68+
for(size_t i=0; i<Resources::MaxFramesInFlight; ++i)
69+
forceUpdate[i] = true;
70+
6871
for(size_t i=0;i<block.size();++i) {
6972
if(!block[i].allocated) {
7073
block[i].allocated = true;
@@ -125,6 +128,8 @@ size_t PfxBucket::allocEmitter() {
125128
auto& e = impl.back();
126129
e.block = size_t(-1); // no backup memory
127130
e.st = S_Inactive;
131+
for(size_t i=0; i<Resources::MaxFramesInFlight; ++i)
132+
forceUpdate[i] = true;
128133

129134
return impl.size()-1;
130135
}
@@ -139,6 +144,8 @@ void PfxBucket::freeEmitter(size_t& id) {
139144
} else {
140145
v.st = S_Free;
141146
}
147+
for(size_t i=0; i<Resources::MaxFramesInFlight; ++i)
148+
forceUpdate[i] = true;
142149
v.next.reset();
143150
id = size_t(-1);
144151
shrink();
@@ -514,8 +521,10 @@ void PfxBucket::preFrameUpdate(uint8_t fId) {
514521
ssbo = device.ssbo(heap,pfxCpu);
515522
item.setPfxData(&ssbo,fId);
516523
} else {
517-
if(!decl.isDecal())
524+
if(!decl.isDecal() || forceUpdate[fId]) {
518525
ssbo.update(pfxCpu);
526+
forceUpdate[fId] = false;
527+
}
519528
}
520529
}
521530

game/graphics/pfx/pfxbucket.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class PfxBucket {
130130
std::vector<ParState> particles;
131131
std::vector<ImplEmitter> impl;
132132
std::vector<Block> block;
133-
const size_t vertexCount;
133+
bool forceUpdate[Resources::MaxFramesInFlight] = {};
134134

135135
static std::mt19937 rndEngine;
136136

game/world/objects/vobbundle.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "vobbundle.h"
22

33
#include "world/world.h"
4-
#include "utils/versioninfo.h"
54
#include "resources.h"
65

76
VobBundle::VobBundle(World& owner, std::string_view filename, Vob::Flags flags) {

0 commit comments

Comments
 (0)