MarkSim
Topic Author
Posts: 30
Joined: 20 Apr 2021, 18:59

ClipToBounds not working in Android

06 Jan 2022, 16:33

Hi,
We are building for multiple platforms (Windows, Mac, iOS, Android, etc). In one view we have a collection of PNGs tiles that we pan and zoom around. This is basically a ItemsControl, inside a Canvas, Inside a Grid, with ClipToBounds="True" set on the Grid so that the PNGs do not show up outside of the confines of the Grid.

This works fine except on our Android test device, where the PNGs show up outside the confines of the Grid.

Any idea what this might be or where to start looking on this? We just don't get how it can work everywhere else!

Many thanks.
 
User avatar
jsantos
Site Admin
Posts: 3456
Joined: 20 Jan 2012, 17:18
Contact:

Re: ClipToBounds not working in Android

10 Jan 2022, 18:08

If this using Unity or C++ with a custom renderer?
 
MarkSim
Topic Author
Posts: 30
Joined: 20 Apr 2021, 18:59

Re: ClipToBounds not working in Android

11 Jan 2022, 12:53

It is C++, so from your question it sounds like there must be a custom renderer in that case, so looks like the problem is our side..?
 
User avatar
jsantos
Site Admin
Posts: 3456
Joined: 20 Jan 2012, 17:18
Contact:

Re: ClipToBounds not working in Android

11 Jan 2022, 13:05

Not necessarily, but I was assuming you have implemented your own renderer or are you using our implementation? (GLRenderDevice in this case).

Are you setting up a stencil surface and clearing it in Android?
 
MarkSim
Topic Author
Posts: 30
Joined: 20 Apr 2021, 18:59

Re: ClipToBounds not working in Android

11 Jan 2022, 13:40

I've found GLRenderDevice - it looks like it is your implementation but whether anyone else has modded it I'm not sure. Its around 2734 lines, we are using Noesis version 3.0.11 ...

Sorry if its a bit vague, I didn't have much involvement on that side of things originally.
 
User avatar
jsantos
Site Admin
Posts: 3456
Joined: 20 Jan 2012, 17:18
Contact:

Re: ClipToBounds not working in Android

11 Jan 2022, 16:21

I see, well, as said before I would verify first that you are setting and clearing a stencil buffer.

If that's correct could you capture a frame with Renderdoc?
 
MarkSim
Topic Author
Posts: 30
Joined: 20 Apr 2021, 18:59

Re: ClipToBounds not working in Android

24 Jan 2022, 11:21

I see, well, as said before I would verify first that you are setting and clearing a stencil buffer.

If that's correct could you capture a frame with Renderdoc?
I've been looking through GLRenderDevice.cpp, which if I understand correctly is provided by Noesis? I put the question out as to whether it had been modified and it seems not, or at least not anything significant.

In "GLRenderDevice::CreateRenderTarget", a stencil is created:
surface->stencil = CreateStencil(width, height, samples);

Stencil is cleared in "GLRenderDevice::BeginTile"

Stencil is deleted in "GLRenderDevice::DeleteRenderTarget"

Stencil is cleared in InvalidateStateCache.

I could send you the entire GLRenderDevice.cpp if that helps?

I'm not sure what Renderdoc is, I'll check it out. As I mentioned before, it works fine on all other platforms.
 
User avatar
jsantos
Site Admin
Posts: 3456
Joined: 20 Jan 2012, 17:18
Contact:

Re: ClipToBounds not working in Android

24 Jan 2022, 12:33

https://renderdoc.org/

The problem with the stencil is not about the lines you mention in our code. It is the framebuffer where you are rendering your game (and after your game, the UI). That framebuffer must have stencil bits, and you must clear them before calling Render() in our view.

Hope this helps.

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest