Fix OpenGL render target binding composition

This commit is contained in:
2026-03-26 01:56:10 +08:00
parent 4b7d05d22d
commit 2e17c0019c
8 changed files with 361 additions and 54 deletions

View File

@@ -14,6 +14,7 @@ class OpenGLVertexArray;
class OpenGLShader;
class OpenGLTexture;
class OpenGLPipelineState;
class OpenGLFramebuffer;
enum class PrimitiveType {
Points,
@@ -193,6 +194,7 @@ public:
void DrawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t startIndex, int32_t baseVertex, uint32_t startInstance) override;
private:
void ReleaseComposedFramebuffer();
void EnsureInternalVertexArrayBound();
void DisableConfiguredVertexAttributes();
@@ -203,6 +205,7 @@ private:
OpenGLPipelineState* m_currentPipelineState;
std::vector<unsigned int> m_enabledVertexAttributes;
OpenGLShader* m_currentShader;
OpenGLFramebuffer* m_composedFramebuffer;
};
} // namespace RHI

View File

@@ -18,8 +18,9 @@ enum class FramebufferAttachmentType {
struct FramebufferAttachment {
unsigned int texture = 0;
unsigned int target = 0;
int mipLevel = 0;
int layer = 0;
int layer = -1;
FramebufferAttachmentType type = FramebufferAttachmentType::Color;
uint32_t format = 0;
};
@@ -71,4 +72,4 @@ private:
};
} // namespace RHI
} // namespace XCEngine
} // namespace XCEngine

View File

@@ -1,5 +1,6 @@
#pragma once
#include "XCEngine/RHI/OpenGL/OpenGLFramebuffer.h"
#include "XCEngine/RHI/RHIResourceView.h"
#include "XCEngine/RHI/RHITypes.h"
@@ -63,6 +64,8 @@ public:
uint64_t GetBufferOffset() const { return m_bufferOffset; }
uint32_t GetBufferSize() const { return m_bufferSize; }
uint32_t GetBufferStride() const { return m_bufferStride; }
const FramebufferAttachment& GetFramebufferAttachment() const { return m_framebufferAttachment; }
const OpenGLTexture* GetTextureResource() const { return m_texture; }
private:
ResourceViewType m_viewType;
@@ -76,6 +79,7 @@ private:
OpenGLFramebuffer* m_framebuffer;
OpenGLTextureUnitAllocator* m_textureUnitAllocator;
OpenGLUniformBufferManager* m_uniformBufferManager;
FramebufferAttachment m_framebufferAttachment;
uint64_t m_bufferOffset;
uint32_t m_bufferSize;
uint32_t m_bufferStride;