fix(RHI): 修复 OpenGL/D3D12 后端编译问题

- 修复 OpenGLCommandList 方法签名匹配 RHI 抽象接口
- 修复 OpenGLSwapChain Present/Resize 方法签名
- 添加 OpenGL 特有方法重载支持后端测试(底层逃逸)
- 暂时禁用不兼容的 Resources 模块
- 更新 OpenGL 测试 CMakeLists
This commit is contained in:
2026-03-17 19:35:51 +08:00
parent a257ff2d8b
commit e138fb2075
15 changed files with 188 additions and 308 deletions

View File

@@ -60,9 +60,6 @@ void OpenGLCommandList::ClearDepthStencil(float depth, int stencil) {
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
void OpenGLCommandList::SetPipelineState(void* pipelineState) {
}
void OpenGLCommandList::SetVertexBuffer(unsigned int buffer, size_t offset, size_t stride) {
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glVertexAttribPointer(0, stride / sizeof(float), GL_FLOAT, GL_FALSE, stride, (void*)offset);
@@ -490,12 +487,27 @@ void OpenGLCommandList::SetPipelineState(void* pipelineState) {
}
void OpenGLCommandList::SetVertexBuffer(uint32_t slot, void* buffer, uint64_t offset, uint32_t stride) {
GLuint glBuffer = static_cast<GLuint>(reinterpret_cast<uintptr_t>(buffer));
glBindBuffer(GL_ARRAY_BUFFER, glBuffer);
glVertexAttribPointer(slot, stride / sizeof(float), GL_FLOAT, GL_FALSE, stride, reinterpret_cast<void*>(static_cast<uintptr_t>(offset)));
glEnableVertexAttribArray(slot);
}
void OpenGLCommandList::SetVertexBuffers(uint32_t startSlot, uint32_t count, const uint64_t* buffers, const uint64_t* offsets, const uint32_t* strides) {
for (uint32_t i = 0; i < count; i++) {
GLuint glBuffer = static_cast<GLuint>(buffers[i]);
glBindBuffer(GL_ARRAY_BUFFER, glBuffer);
glEnableVertexAttribArray(startSlot + i);
glVertexAttribPointer(startSlot + i, strides[i] / sizeof(float), GL_FLOAT, GL_FALSE, strides[i], reinterpret_cast<void*>(static_cast<uintptr_t>(offsets[i])));
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
void OpenGLCommandList::SetIndexBuffer(void* buffer, uint64_t offset, Format format) {
GLuint glBuffer = static_cast<GLuint>(reinterpret_cast<uintptr_t>(buffer));
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glBuffer);
(void)offset;
(void)format;
}
void OpenGLCommandList::CopyResource(void* dst, void* src) {