mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Fix] (MG_State/BufferState, VertexArrayState): Correct IBO binding slot.
This commit is contained in:
@@ -5,8 +5,8 @@ namespace MobileGL {
|
||||
namespace GLState {
|
||||
BufferState::BufferState()
|
||||
: m_indexGenerator(1024, 1) {
|
||||
for (SizeT i = 0; i < (SizeT)BufferTarget::BufferTargetCount; ++i) {
|
||||
m_bindingSlots[i] = BindingSlot<BufferObject>((BufferTarget)i);
|
||||
for (SizeT i = 0; i < m_bindingSlots.size(); ++i) {
|
||||
m_bindingSlots[i] = BindingSlot<BufferObject>(GlobalBufferTargets[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,14 +31,18 @@ namespace MobileGL {
|
||||
}
|
||||
|
||||
BindingSlot<BufferObject>& BufferState::GetBindingSlot(BufferTarget target) {
|
||||
return m_bindingSlots[(SizeT)target];
|
||||
for (SizeT i = 0; i < m_bindingSlots.size(); ++i) {
|
||||
if (m_bindingSlots[i].GetTarget() == target) {
|
||||
return m_bindingSlots[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BufferState::MarkBufferObjectForDeletion(Uint index) {
|
||||
if (m_indexGenerator.IsValid(index)) {
|
||||
auto it = m_bufferObjects.find(index);
|
||||
if (it != m_bufferObjects.end()) {
|
||||
for (SizeT i = 0; i < (SizeT)BufferTarget::BufferTargetCount; ++i) {
|
||||
for (SizeT i = 0; i < m_bindingSlots.size(); ++i) {
|
||||
if (m_bindingSlots[i].GetBoundObject() == it->second) {
|
||||
m_bindingSlots[i].Bind(nullptr);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,21 @@
|
||||
namespace MobileGL {
|
||||
namespace MG_State {
|
||||
namespace GLState {
|
||||
constexpr const auto GlobalBufferTargets = ToArray(
|
||||
BufferTarget::Vertex,
|
||||
BufferTarget::Uniform,
|
||||
BufferTarget::CopyRead,
|
||||
BufferTarget::CopyWrite,
|
||||
BufferTarget::PixelPack,
|
||||
BufferTarget::PixelUnpack,
|
||||
BufferTarget::Query,
|
||||
BufferTarget::Texture,
|
||||
BufferTarget::TransformFeedback,
|
||||
BufferTarget::AtomicCounter,
|
||||
BufferTarget::DispatchIndirect,
|
||||
BufferTarget::DrawIndirect,
|
||||
BufferTarget::ShaderStorage);
|
||||
|
||||
class BufferState {
|
||||
public:
|
||||
BufferState();
|
||||
@@ -18,7 +33,7 @@ namespace MobileGL {
|
||||
private:
|
||||
UnorderedMap<Uint, SharedPtr<BufferObject>> m_bufferObjects;
|
||||
IndexGenerator<Uint> m_indexGenerator;
|
||||
Array<BindingSlot<BufferObject>, (SizeT)BufferTarget::BufferTargetCount> m_bindingSlots;
|
||||
Array<BindingSlot<BufferObject>, GlobalBufferTargets.size()> m_bindingSlots;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user