Skip to content

Conversation

rafadevai
Copy link
Contributor

@rafadevai rafadevai commented Aug 5, 2025

  • Make sure the defaultRenderTarget is created before calling makeCurrent.
  • Add some missing TextureUsage flags to textures

- Make sure the defaultRenderTarget is created
before calling makeCurrent.
- Add some missing TextureUsage flags to textures
- Add a finish to the RenderFrame destructor, so
it guarantess that the GPU work is completed,
prevents some synchronization issues.
@@ -25,6 +25,7 @@ RenderFrame::RenderFrame(filament::backend::DriverApi& api): mApi(api) {

RenderFrame::~RenderFrame() {
mApi.endFrame(0);
mApi.finish();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on the synchronization issues you were experiencing? Was it only with the Vulkan backend?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can only saw it with the vulkan backend (the only one I tested) and it was just the report of the validation layers, the source of this is coming when doing readPixels which is not synchronized properly with vulkan, cant comment on metal.

So I just made the safe approach to make sure the work is completed before trying to read the data, which in the case of tests should be fine.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't "fix the tests" to workaround bugs in the backends -- that's the whole point of having tests. readPixels should work without having to call finish() and it should work from within a renderpass. If the vk backend needs fixing, I prefer we file a buganizer, prioritize and fix rather an working around in the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the finish calls.

Will create a bug for the readPixels synchronization issue.

@@ -48,7 +48,7 @@ layout(location = 0) out vec4 fragColor;

// Filament's Vulkan backend requires a descriptor set index of 1 for all samplers.
// This parameter is ignored for other backends.
layout(location = 0, set = 0) uniform {samplerType} test_tex;
layout(binding = 0, set = 0) uniform {samplerType} test_tex;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we sure this doesn't break the other backends?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using location here is wrong GLSL code, the correct one is binding

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so there's glsl for opengl and then glsl for spirv conversion. Could this be one of places where they differ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked here https://www.khronos.org/opengl/wiki/Layout_Qualifier_(GLSL)

The only thing extra in vulkan is the "set" parameter, but that one seems to be ignored in GL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants