Skip to content

Commit

Permalink
Fix OpenGL ES 2.0 descriptor set crash (#8176)
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado authored and poweifeng committed Oct 4, 2024
1 parent e9e7911 commit c3c9fe1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion filament/backend/src/opengl/GLDescriptorSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ GLDescriptorSet::GLDescriptorSet(OpenGLContext& gl, DescriptorSetLayoutHandle ds
bool const dynamicOffset = any(entry.flags & DescriptorFlags::DYNAMIC_OFFSET);
dynamicBuffers.set(index, dynamicOffset);
if (UTILS_UNLIKELY(gl.isES2())) {
dynamicBufferCount++;
if (dynamicOffset) {
dynamicBufferCount++;
}
desc.emplace<BufferGLES2>(dynamicOffset);
} else {
auto const type = GLUtils::getBufferBindingType(BufferObjectBinding::UNIFORM);
Expand Down
1 change: 1 addition & 0 deletions filament/backend/src/opengl/OpenGLDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3892,6 +3892,7 @@ void OpenGLDriver::bindDescriptorSet(
// `offsets` data's lifetime will end when this function returns. We have to make a copy.
// (the data is allocated inside the CommandStream)
mBoundDescriptorSets[set].dsh = dsh;
assert_invariant(offsets.data() != nullptr || ds->getDynamicBufferCount() == 0);
std::copy_n(offsets.data(), ds->getDynamicBufferCount(),
mBoundDescriptorSets[set].offsets.data());
}
Expand Down

0 comments on commit c3c9fe1

Please sign in to comment.