Page 1 of 1

AGCRenderContext - GPU encountered illegal instruction

Posted: 06 Jul 2022, 20:08
by extsmichalak
Hey!
We're hitting an exception on PlayStation in AGCRenderContext, line #518:
mCurrentIndex = (mCurrentIndex + 1) % NumBuffers;
(mCurrentIndex = 0, NumBuffers = 2)
000000.026| INFO| Renderer: PlayStation 5, display size: 3840x2160
# GPU Bad packet error:Privilege reg. vmid: game process, opcode:0xc0053c00 0 0 0x1a400
GPU encountered illegal instruction.
For context, we're trying to create a blur effect on a Rectangle with VisualBrush , which has Visual prop set to the background element (a ControlTemplate). It works just fine on PC, Xbox, Switch. As those rectangles are enlarged on focus, it needs to recalculate the ViewBox, and we have a converter for this (we mentioned it before, current implementation is more or less the same as mentioned in the last post: viewtopic.php?t=2406).

It stops crashing on Playstation when I remove those lines responsible for recalculating ViewBox value, e.g.:
<b:ChangePropertyAction PropertyName="Viewbox" TargetName="leftRectBrush" Value="{Binding Tag, ElementName=leftGridSmall, Converter={StaticResource TheConverterMentioned}, ConverterParameter=TheUserControlName}" />
but obviously the blur stops working.

I know it's a lot to ask, as it seems to be a very specific bug, but maybe anything rings a bell? Thank you in advance!

Re: AGCRenderContext - GPU encountered illegal instruction

Posted: 07 Jul 2022, 16:25
by jsantos
Do you know if by any chance that converter is giving an empty or malformed ViewBox ?

Re: AGCRenderContext - GPU encountered illegal instruction

Posted: 07 Jul 2022, 20:51
by extsmichalak
Hey again,
Thanks for the hint! Was checking the values the converter returns before I wrote this question, but it seems this line causes a crash:
result.Reset(Noesis::Boxing::Box(Noesis::Rect(Noesis::Point(0, 0), Noesis::Size(1, 1))));
It's called whenever the converter is not able to cast the BaseComponent value to Rectangle. Does converter always have to reset the result? After removing this line (and not modifying the result) at all, it seems it works fine, without printing any warnings/errors (converter returns true, even if it cannot cast).

Thanks!

EDIT:
Actually I get a warning on Xbox without that:
000002.469|  ERROR| [Noesis] Value cannot be assigned to the property 'VisualBrush.Viewbox' (property has type 'Rect', value has type 'null')Value cannot be assigned to the property 'VisualBrush.Viewbox' (property has type 'Rect', value has type 'null')
 
It seems like the default value is missing. The VisualBrush's ViewBox value is bound to the helper Tag prop of the grid that's a parent of that Rectangle.
<Grid x:Name="rightGridSmall">
            <b:Interaction.Triggers>
              <b:EventTrigger EventName="Loaded">
                <b:ChangePropertyAction PropertyName="Tag" Value="{Binding ElementName=rightRectangleSmall}" />
              </b:EventTrigger>
            </b:Interaction.Triggers>
            <Rectangle
              x:Name="rightRectangleSmall"
              RadiusX="16"
              RadiusY="16">
              <Rectangle.Effect>
                <BlurEffect Radius="12" />
              </Rectangle.Effect>
              <Rectangle.Fill>
                <VisualBrush
                  x:Name="rightRectBrush"
                  d:Viewbox="1212,465,432,400"
                  AlignmentX="Right"
                  AlignmentY="Top"
                  Viewbox="{Binding Tag, ElementName=rightGridSmall, Converter={StaticResource TheConverter}, ConverterParameter=TheScreen}"
                  ViewboxUnits="Absolute"
                  Visual="{Binding ElementName=TheBackground}" />
              </Rectangle.Fill>
            </Rectangle>
            ...

Re: AGCRenderContext - GPU encountered illegal instruction

Posted: 11 Jul 2022, 18:39
by sfernandez
Does converter always have to reset the result?
If you don't set a value in the result and the target property does not accept null values, then the FallbackValue will be used, and if that is not set either, then the default value of the property is used.
After removing this line (and not modifying the result) at all, it seems it works fine, without printing any warnings/errors (converter returns true, even if it cannot cast).
That is the expected behavior.
Actually I get a warning on Xbox without that:
Could you please paste the callstack when that error message is shown? I wasn't expecting a null value could be set on the property when using a binding and a converter.

Re: AGCRenderContext - GPU encountered illegal instruction

Posted: 12 Jul 2022, 19:09
by extsmichalak
Hey again :)
Looks like the default value was not set properly - most probably wasn't set soon enough and converter failed to process the value.

Thank you for all of the hints and help here!

Re: AGCRenderContext - GPU encountered illegal instruction

Posted: 13 Jul 2022, 18:28
by jsantos
Thanks for the feedback! Marking this as solved