Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c431d59

Browse files
null77Commit Bot
authored andcommitted
Add Serial to all GL resources.
The Serial will help track active resources for filtering out inactive setup calls in capture/replay. Bug: angleproject:4223 Change-Id: I64ba50f27d656c12d45155dc735e9b6f9c04528f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1969062 Commit-Queue: Jamie Madill <[email protected]> Reviewed-by: Cody Northrop <[email protected]> Reviewed-by: Geoff Lang <[email protected]>
1 parent 99c274b commit c431d59

16 files changed

+44
-16
lines changed

src/libANGLE/Buffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ BufferState::BufferState()
3939
BufferState::~BufferState() {}
4040

4141
Buffer::Buffer(rx::GLImplFactory *factory, BufferID id)
42-
: RefCountObject(id),
42+
: RefCountObject(factory->generateSerial(), id),
4343
mImpl(factory->createBuffer(mState)),
4444
mImplObserver(this, kImplementationSubjectIndex)
4545
{

src/libANGLE/Fence.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ angle::Result FenceNV::finish(const Context *context)
5959
}
6060

6161
Sync::Sync(rx::GLImplFactory *factory, GLuint id)
62-
: RefCountObject(id),
62+
: RefCountObject(factory->generateSerial(), id),
6363
mFence(factory->createSync()),
6464
mLabel(),
6565
mCondition(GL_SYNC_GPU_COMMANDS_COMPLETE),

src/libANGLE/Framebuffer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,8 @@ bool FramebufferState::isDefault() const
674674
const FramebufferID Framebuffer::kDefaultDrawFramebufferHandle = {0};
675675

676676
Framebuffer::Framebuffer(const Caps &caps, rx::GLImplFactory *factory, FramebufferID id)
677-
: mState(caps, id),
677+
: mSerial(factory->generateSerial()),
678+
mState(caps, id),
678679
mImpl(factory->createFramebuffer(mState)),
679680
mCachedStatus(),
680681
mDirtyDepthAttachmentBinding(this, DIRTY_BIT_DEPTH_ATTACHMENT),
@@ -692,7 +693,8 @@ Framebuffer::Framebuffer(const Caps &caps, rx::GLImplFactory *factory, Framebuff
692693
}
693694

694695
Framebuffer::Framebuffer(const Context *context, egl::Surface *surface, egl::Surface *readSurface)
695-
: mState(),
696+
: mSerial(context->getImplementation()->generateSerial()),
697+
mState(),
696698
mImpl(surface->getImplementation()->createDefaultFramebuffer(context, mState)),
697699
mCachedStatus(GL_FRAMEBUFFER_COMPLETE),
698700
mDirtyDepthAttachmentBinding(this, DIRTY_BIT_DEPTH_ATTACHMENT),

src/libANGLE/Framebuffer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,8 @@ class Framebuffer final : public angle::ObserverInterface,
392392

393393
static const FramebufferID kDefaultDrawFramebufferHandle;
394394

395+
rx::Serial serial() const { return mSerial; }
396+
395397
private:
396398
bool detachResourceById(const Context *context, GLenum resourceType, GLuint resourceId);
397399
bool detachMatchingAttachment(const Context *context,
@@ -457,6 +459,7 @@ class Framebuffer final : public angle::ObserverInterface,
457459
mFloat32ColorAttachmentBits.set(index, format->type == GL_FLOAT);
458460
}
459461

462+
rx::Serial mSerial;
460463
FramebufferState mState;
461464
rx::FramebufferImpl *mImpl;
462465

src/libANGLE/MemoryObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace gl
1515
{
1616

1717
MemoryObject::MemoryObject(rx::GLImplFactory *factory, MemoryObjectID id)
18-
: RefCountObject(id), mImplementation(factory->createMemoryObject())
18+
: RefCountObject(factory->generateSerial(), id), mImplementation(factory->createMemoryObject())
1919
{}
2020

2121
MemoryObject::~MemoryObject() {}

src/libANGLE/Program.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,8 @@ ShaderType ProgramState::getLastAttachedShaderStageType() const
12321232
}
12331233

12341234
Program::Program(rx::GLImplFactory *factory, ShaderProgramManager *manager, ShaderProgramID handle)
1235-
: mProgram(factory->createProgram(mState)),
1235+
: mSerial(factory->generateSerial()),
1236+
mProgram(factory->createProgram(mState)),
12361237
mValidated(false),
12371238
mLinked(false),
12381239
mLinkResolved(true),

src/libANGLE/Program.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,8 @@ class Program final : angle::NonCopyable, public LabeledObject
971971
// Writes a program's binary to the output memory buffer.
972972
void serialize(const Context *context, angle::MemoryBuffer *binaryOut) const;
973973

974+
rx::Serial serial() const { return mSerial; }
975+
974976
private:
975977
struct LinkingState;
976978

@@ -1078,6 +1080,7 @@ class Program final : angle::NonCopyable, public LabeledObject
10781080

10791081
void postResolveLink(const gl::Context *context);
10801082

1083+
rx::Serial mSerial;
10811084
ProgramState mState;
10821085
rx::ProgramImpl *mProgram;
10831086

src/libANGLE/ProgramPipeline.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const std::string &ProgramPipelineState::getLabel() const
2727
}
2828

2929
ProgramPipeline::ProgramPipeline(rx::GLImplFactory *factory, ProgramPipelineID handle)
30-
: RefCountObject(handle), mProgramPipeline(factory->createProgramPipeline(mState))
30+
: RefCountObject(factory->generateSerial(), handle),
31+
mProgramPipeline(factory->createProgramPipeline(mState))
3132
{
3233
ASSERT(mProgramPipeline);
3334
}

src/libANGLE/Query.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace gl
1515
{
1616
Query::Query(rx::GLImplFactory *factory, QueryType type, QueryID id)
17-
: RefCountObject(id), mQuery(factory->createQuery(type)), mLabel()
17+
: RefCountObject(factory->generateSerial(), id), mQuery(factory->createQuery(type)), mLabel()
1818
{}
1919

2020
Query::~Query()

src/libANGLE/RefCountObject.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "common/debug.h"
1818
#include "libANGLE/Error.h"
1919
#include "libANGLE/Observer.h"
20+
#include "libANGLE/renderer/serial_utils.h"
2021

2122
#include <cstddef>
2223

@@ -140,14 +141,17 @@ template <typename IDType>
140141
class RefCountObject : public gl::RefCountObjectNoID
141142
{
142143
public:
143-
explicit RefCountObject(IDType id) : mId(id) {}
144+
explicit RefCountObject(rx::Serial serial, IDType id) : mSerial(serial), mId(id) {}
144145

146+
rx::Serial serial() const { return mSerial; }
145147
IDType id() const { return mId; }
146148

147149
protected:
148150
~RefCountObject() override {}
149151

150152
private:
153+
// Unique serials are used to identify resources for frame capture.
154+
rx::Serial mSerial;
151155
IDType mId;
152156
};
153157

0 commit comments

Comments
 (0)