Skip to content

Conversation

CedricGuillemet
Copy link
Contributor

@CedricGuillemet CedricGuillemet commented Mar 14, 2025

There is an issue when using multiple dynamic textures (Canvas). Only the 1st one is properly displayed.
GLTF Node NegativeScale (0) validation test looks like this:

image

A Renderdoc capture gives this call trace:

image

Texture copies are all done at the same time in bgfx, at the end of sorted drawcalls of a viewid : https://github.com/bkaradzic/bgfx/blob/4602a01ce51611183d8ae8e320ca0f5305b79cb8/src/renderer_d3d11.cpp#L5739

All blit commands are submitted with the same ViewID. Which is confirmed when looking at this:

GetBoundFrameBuffer(*encoder).Blit(*encoder, textureDestination->Handle(), 0, 0, textureSource->Handle());

Solution is incrementing ViewID in Blit and moving the call into DeviceContext as it doesn't rely on FrameBuffer state.

Result:

image

@CedricGuillemet CedricGuillemet requested a review from bghgary March 14, 2025 15:06
@bghgary bghgary marked this pull request as draft March 17, 2025 17:25
@CedricGuillemet CedricGuillemet marked this pull request as ready for review March 19, 2025 10:52
static bx::AllocatorI& GetDefaultAllocator() { return m_allocator; }

// call following method when a submit call is associated with the current acquired viewId
void SetViewAsUsed();
Copy link
Member

Choose a reason for hiding this comment

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

I guess we have to expose this new function because FrameBuffer has to tell DeviceContext this needs to be done when a Submit happens. Is there any other case (other than Submit) where we would need to do this, or is this really tied to FrameBuffer::Submit?

If we need to expose this as a new function, would InvalidateView be a better name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, Framebuffer tells device context the view contains draw call. I've added a call for Clear . InvalidateView works for me!



// Append a task instead of calling blit immediately or blit happens before drawcalls.
arcana::make_task(m_update.Scheduler(), *m_cancellationSource, [this, textureDestination, textureSource, cancellationSource = m_cancellationSource]() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you try removing this? I think we might need to add this to the command queue for the ordering to be correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I tried and copy doesn't happen in the correct order when removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you try putting it in the command queue?

@CedricGuillemet CedricGuillemet marked this pull request as draft March 27, 2025 15:05
…nto multicanvas

# Conflicts:
#	Plugins/NativeEngine/Source/NativeEngine.cpp
@CedricGuillemet
Copy link
Contributor Author

Closing for now. I will re-open after #1468 is in.

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.

3 participants