Hash :
b4d84458
Author :
Date :
2025-05-23T18:08:19
Move Buffer from VertexBinding to VertexArray In later CL we will not taking shared context lock for certain VertexArray API calls. VertexArray itself is per context, so this sounds reasonable to do. The main challenge here is a lot of VertexArray function end up accessing gl::Buffer object, which could be modified by other shared contexts. In order to safely not taking the shared context lock, we need to separate out Buffer object out of VertexArray itself so that these lockless APIs will take VertexArray that does not have access to buffer. In this CL, VertexArray is split into two classes: VertexArrayPrivate is everything in VertexArray except buffers. VertexArray is a subclass of VertexArrayPrivate and owns all the buffers. Buffer is removed from gl::VertexBinding class. In order to let back end access to buffers, VertexArrayImpl holds a weak reference to VertexArray::mVertexArrayBuffers (which is a vector of buffers). Further, VertexArrayBufferBindingMask mBufferBindingMask is moved from VertexArrayState into VertexArray class well, since it tracks which index has a non-null buffer. The bulk of change are due to the VertexARrayImpl constructor change, since it now takes vertexArrayBuffers argument. Other bulk of changes are due to VertexBinding no long has the buffer, but you need to get it directly from VertexArray or VertexArrayImpl. This CL also reverts some of the change in crrev.com/c/6758215 that mVertexBindings no longer contains kElementArrayBufferIndex. BYPASS_LARGE_CHANGE_WARNING Bug: b/433331119 Change-Id: I15f4576f7c5c8d8f4d9c9c07d38a60ce539bfeea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6774702 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
//
// Copyright 2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// GLImplFactory.h:
// Factory interface for OpenGL ES Impl objects.
//
#ifndef LIBANGLE_RENDERER_GLIMPLFACTORY_H_
#define LIBANGLE_RENDERER_GLIMPLFACTORY_H_
#include <vector>
#include "angle_gl.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/Overlay.h"
#include "libANGLE/Program.h"
#include "libANGLE/ProgramExecutable.h"
#include "libANGLE/ProgramPipeline.h"
#include "libANGLE/Renderbuffer.h"
#include "libANGLE/Shader.h"
#include "libANGLE/Texture.h"
#include "libANGLE/TransformFeedback.h"
#include "libANGLE/VertexArray.h"
#include "libANGLE/renderer/serial_utils.h"
namespace gl
{
class State;
} // namespace gl
namespace rx
{
class BufferImpl;
class CompilerImpl;
class ContextImpl;
class FenceNVImpl;
class SyncImpl;
class FramebufferImpl;
class MemoryObjectImpl;
class OverlayImpl;
class PathImpl;
class ProgramExecutableImpl;
class ProgramImpl;
class ProgramPipelineImpl;
class QueryImpl;
class RenderbufferImpl;
class SamplerImpl;
class SemaphoreImpl;
class ShaderImpl;
class TextureImpl;
class TransformFeedbackImpl;
class VertexArrayImpl;
class GLImplFactory : angle::NonCopyable
{
public:
GLImplFactory();
virtual ~GLImplFactory();
// Shader creation
virtual CompilerImpl *createCompiler() = 0;
virtual ShaderImpl *createShader(const gl::ShaderState &data) = 0;
virtual ProgramImpl *createProgram(const gl::ProgramState &data) = 0;
virtual ProgramExecutableImpl *createProgramExecutable(
const gl::ProgramExecutable *executable) = 0;
// Framebuffer creation
virtual FramebufferImpl *createFramebuffer(const gl::FramebufferState &data) = 0;
// Texture creation
virtual TextureImpl *createTexture(const gl::TextureState &state) = 0;
// Renderbuffer creation
virtual RenderbufferImpl *createRenderbuffer(const gl::RenderbufferState &state) = 0;
// Buffer creation
virtual BufferImpl *createBuffer(const gl::BufferState &state) = 0;
// Vertex Array creation
virtual VertexArrayImpl *createVertexArray(
const gl::VertexArrayState &data,
const gl::VertexArrayBuffers &vertexArrayBuffers) = 0;
// Query and Fence creation
virtual QueryImpl *createQuery(gl::QueryType type) = 0;
virtual FenceNVImpl *createFenceNV() = 0;
virtual SyncImpl *createSync() = 0;
// Transform Feedback creation
virtual TransformFeedbackImpl *createTransformFeedback(
const gl::TransformFeedbackState &state) = 0;
// Sampler object creation
virtual SamplerImpl *createSampler(const gl::SamplerState &state) = 0;
// Program Pipeline object creation
virtual ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) = 0;
// Memory object creation
virtual MemoryObjectImpl *createMemoryObject() = 0;
// Semaphore creation
virtual SemaphoreImpl *createSemaphore() = 0;
// Overlay creation
virtual OverlayImpl *createOverlay(const gl::OverlayState &state) = 0;
rx::UniqueSerial generateSerial() { return mSerialFactory.generate(); }
private:
rx::UniqueSerialFactory mSerialFactory;
};
inline GLImplFactory::GLImplFactory() = default;
inline GLImplFactory::~GLImplFactory() = default;
} // namespace rx
#endif // LIBANGLE_RENDERER_GLIMPLFACTORY_H_