Fix RHI constant binding and add sphere test
This commit is contained in:
@@ -140,10 +140,22 @@ void OpenGLDescriptorSet::Bind() {
|
||||
}
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, m_constantBuffer);
|
||||
glBufferData(GL_UNIFORM_BUFFER, m_constantBufferData.size(), m_constantBufferData.data(), GL_DYNAMIC_DRAW);
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, 0, m_constantBuffer);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
m_constantBufferDirty = false;
|
||||
}
|
||||
|
||||
if (m_constantBuffer != 0) {
|
||||
for (const auto& binding : m_bindings) {
|
||||
if (binding.type != DescriptorType::CBV) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < binding.count; ++i) {
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, binding.binding + i, m_constantBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_bindings.size(); ++i) {
|
||||
const auto& binding = m_bindings[i];
|
||||
|
||||
@@ -170,6 +182,12 @@ void OpenGLDescriptorSet::Unbind() {
|
||||
for (size_t i = 0; i < m_bindings.size(); ++i) {
|
||||
const auto& binding = m_bindings[i];
|
||||
|
||||
if (binding.type == DescriptorType::CBV) {
|
||||
for (uint32_t j = 0; j < binding.count; ++j) {
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, binding.binding + j, 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t j = 0; j < binding.textureUnits.size(); ++j) {
|
||||
uint32_t unit = binding.textureUnits[j];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user