Add RHI texture upload and descriptor set fixes

This commit is contained in:
2026-03-26 00:04:51 +08:00
parent 605ef56e16
commit 76c4c2ace2
15 changed files with 468 additions and 46 deletions

View File

@@ -82,6 +82,7 @@ bool OpenGLResourceView::IsValid() const {
case ResourceViewType::DepthStencil:
return m_framebufferID != 0;
case ResourceViewType::ShaderResource:
return m_texture != nullptr && m_texture->GetID() != 0;
case ResourceViewType::UnorderedAccess:
return m_texture != nullptr && m_textureUnit >= 0;
case ResourceViewType::ConstantBuffer:
@@ -129,12 +130,7 @@ bool OpenGLResourceView::InitializeAsShaderResource(
OpenGLTexture* texture,
const ResourceViewDesc& desc,
OpenGLTextureUnitAllocator* allocator) {
if (!texture || !allocator) {
return false;
}
int32_t unit = allocator->Allocate();
if (unit < 0) {
if (!texture) {
return false;
}
@@ -142,9 +138,8 @@ bool OpenGLResourceView::InitializeAsShaderResource(
m_format = static_cast<Format>(desc.format);
m_dimension = desc.dimension;
m_texture = texture;
m_textureUnit = unit;
m_textureUnit = -1;
m_textureUnitAllocator = allocator;
allocator->BindTexture(unit, texture);
return true;
}