Rpcs3: DX12: Saint Seiya Brave Soldiers - fragment program compile failure

Created on 9 Aug 2016  路  65Comments  路  Source: RPCS3/rpcs3

DX12 (Stuck at "Now Loading" scene)

E {rsx::thread} RSX: FS build failed:D:\EMU\PS3\RPCS3.V2\FragmentProgram.hlsl(197,12-55): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
D:\EMU\PS3\RPCS3.V2\FragmentProgram.hlsl(188,3-36): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (248 iterations) or unrolled loop is too large, use the [unroll(n)] attribute to force an exact higher number

F {rsx::thread} class std::runtime_error thrown: fragment program compilation failure
(in file c:\rpcs3\rpcs3\emu\rsx\d3d12\D3D12PipelineState.h:162)

untitled

Direct3D 12 Shaders

All 65 comments

@raven02 OpenGL and Vulkan goes further now (tested with fcb85379)
https://ci.appveyor.com/api/buildjobs/bvjdcpmxcq0nb0j2/artifacts/rpcs3-ReleaseLLVM-fcb85379.zip

ssbs2
ssbs3

-The black shadow at the side of the clothes appears to be an attempt to render the model without the clothes...
-DX12 still stucks at the loading screen

It麓s affects (Saint Seiya - Soldier麓s Soul [BLES02181]) the same way.

_off-topic_ - the game (Saint Seiya: Sanctuary Battle [BLES-01421]) is running in the last builds (i don麓t know since when it start running), and the characters clothes are all kind of white (in OpenGL). Maybe its also related to the issue #2178.
Vulkan and DX12 is a totally mess on the screen.

@raven02 @kd-11

@ikki84 , just wonder which LLEs are required to in-game .

I will list here all that are selected:

-libdmux , libdmuxpamf
-libfiber
-libfont , libfontFT
-libfreetype , libfreetypeTT
-libresc
-libspurs_jq
-libsre

*Also fonts files are in "/dev_flash/data/font"

Thanks @ikki84

@raven02 Thank you and all the developers of rpcs3.
The emulator is making progress :)

I was testing this game again, the last build it was working is:

RPCS3 v0.0.1-3-8454949 Pre-Alpha:
https://ci.appveyor.com/api/buildjobs/hb0slyqiyw809da8/artifacts/rpcs3-ReleaseLLVM-8454949e.zip

Since then all the master builds stopped working, using the lle modules that I listed above.

In a build that is not merged yet it became to work again with some regressions:

RPCS3 v0.0.1-3-123f51d Pre-Alpha
https://ci.appveyor.com/api/buildjobs/7qol4mha9p7iur94/artifacts/rpcs3-ReleaseLLVM-123f51d5.zip

*The title screen miss the background (looks like the front part its hidding it) and the saint麓s clothes are flickering and changing position all the time.

RPCS3 v0.0.1-3-8454949 Pre-Alpha:

title screen rpcs3 v0 0 1-3-8454949 pre-alpha
character select rpcs3 v0 0 1-3-8454949 pre-alpha

RPCS3 v0.0.1-3-123f51d Pre-Alpha:

title screen - rpcs3 v0 0 1-3-123f51d pre-alpha
character select - 1 rpcs3 v0 0 1-3-123f51d pre-alpha
character select -2 rpcs3 v0 0 1-3-123f51d pre-alpha

Logs:
log RPCS3 v0.0.1-3-8454949 Pre-Alpha.txt
log RPCS3 v0.0.1-3-123f51d Pre-Alpha.txt

@raven02 @kd-11

Some bugs here may be fixed now since https://github.com/RPCS3/rpcs3/pull/2237
Missing geometry may be due to previously broken handling of parallel branch instructions. These can be spotted by searching for "jump_position" in the vertex shaders or the log. This is one such case.

@kd-11
much better :)
Fotoszok.pl
E {rsx::thread} RSX: Unimplemented sca_opcode BRB
[E {rsx::thread} RSX: Unknown/illegal instruction: 0x3d (forced unit 2)]

*Video: https://m.youtube.com/watch?v=Q4sh0-CM-k8

@kd-11
[9e84804e]
Saint Seiya Brave Soldiers:

Log:
shaderLog:
OpenGL-RenderDoc-Menu:
OpenGL-RenderDoc-In game:

Wait; so the armor was rendered correcly before (i.e not flashing and misplaced)?
If so, I might just have to reorganize the code generation and this might be fixed.

Anyway, the generated shader now has alot of dead code; Not sure if its supposed to be like this.

EDIT: After reading https://github.com/RPCS3/rpcs3/issues/2050#issuecomment-255616460 it seems that the flicker already existed before, so not a regression.

I suspect the unimplemented branch instruction is what keeps some code from being executed at all, causing the flicker.

https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.378
Post the emulator log with this build; It should log the call to the undefined op and give some more information.
A renderdoc trace with OGL would be nice too if it runs.

@kd-11 Yes, the armor was rendered correcly before.

@kd-11
[6f6d0dca]

Log:
shaderLog:
OpenGL-RenderDoc-Menu:
OpenGL-RenderDoc-character select screen:
OpenGL-RenderDoc-In game:

E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C088, d3=0x20401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C088, d3=0x1401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C089, d3=0x61401FFC
E {rsx::thread} RSX: Unknown/illegal instruction: 0x3d (forced unit 2)
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C082, d3=0xA0401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C092, d3=0x40401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x9C6C, d1=0x8840000D, d2=0x8086C093, d3=0xA141FFFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C084, d3=0x20401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C085, d3=0x81401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C084, d3=0x20401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C085, d3=0x81401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C084, d3=0x20401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C085, d3=0x81401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C084, d3=0x20401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C085, d3=0x81401FFC

E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C082, d3=0x401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C082, d3=0x401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unknown/illegal instruction: 0x3d (forced unit 2)
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Unimplemented sca_opcode BRB, d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C086, d3=0xE1401FFC

Surely the problem is after pull request #2153 and before #2237.

@SakataGintokiYT @kd-11 @raven02 Could you test it?
https://ci.appveyor.com/api/buildjobs/f6pe0p1t4wejeo8c/artifacts/rpcs3-ReleaseLLVM-025e3f04.zip

Merry Christmas.

@ikki84
same

As far as I know, BRB is not properly implemented yet. I'll get back to rpcs3 after the holidays. Cheers.

@SakataGintokiYT Strange, I am sure it fix the armor and the characters.
Could try it again?
Just try it using OpenGL. / Vulkan and DX12 will not work.

https://ci.appveyor.com/api/buildjobs/f6pe0p1t4wejeo8c/artifacts/rpcs3-ReleaseLLVM-025e3f04.zip

@ikki84
Still the same issue maybe it's drivers question ? or gpu model...

Radeon R7 200.

@SakataGintokiYT Retry with this build: https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.379
Attempts to actually implement the opcodes BRB and CLB

@kd-11
GL:

路F {rsx::thread} class gl::glsl::link_exception thrown: linkage failed: 'Vertex info
-----------
0(115) : error C0000: syntax error, unexpected $undefined at token "<undefined>"
0(283) : error C1118: "break" not in loop
0(286) : error C0000: syntax error, unexpected '}' at token "}"
0(301) : error C0000: syntax error, unexpected '(', expecting "::" at token "("

Vulkan:

路E {rsx::thread} RSX: Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
ERROR: 0:116: '$' : unexpected token 
ERROR: 1 compilation errors.  No code generated.


路E {rsx::thread} RSX: 
路F {rsx::thread} class std::runtime_error thrown: Failed to compile vertex shader
(in file C:\rpcs3\rpcs3\Emu\RSX\VK\VKVertexProgram.cpp:391)

Shaderlog Vulkan
Shaderlog GL

https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.381
I dont expect much progress, just the GL shaderlog will do. This is mainly for experimenting with the code generator and figuring out how jump addresses are supposed to be determined.

F {PPU[0x70000000] Thread (main_thread) [0x0102c0a4]} struct vm::access_violation thrown: Access violation reading address 0x0

Shaderlog GL
Log GL

https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.383
Should dump the last raw compiled vertex program as vertexprogram.raw (opengl only) so that I can work on the shader code without having the game. Just attach the opengl shaderlog for this one.

[17ce61d5]

@kd-11

OpenGL

E {rsx::thread} RSX: Unimplemented sca_opcode BRB d0=0x1F9C6C, d1=0x8800000D, d2=0x8106C081, d3=0x41401FFC
E {rsx::thread} RSX: Failed to compile vertex shader: 0(94) : error C0000: syntax error, unexpected $undefined at token "<undefined>"
0(138) : error C1118: "break" not in loop
0(141) : error C0000: syntax error, unexpected '}' at token "}"
0(156) : error C0000: syntax error, unexpected '(', expecting "::" at token "("

F {rsx::thread} class gl::glsl::link_exception thrown: linkage failed: 'Vertex info
-----------
0(94) : error C0000: syntax error, unexpected $undefined at token "<undefined>"
0(138) : error C1118: "break" not in loop
0(141) : error C0000: syntax error, unexpected '}' at token "}"
0(156) : error C0000: syntax error, unexpected '(', expecting "::" at token "("
(0) : error C2003: incompatible options for link
'

GL-ShaderLog / VertexProgram.raw:

I know about the typo, its fixed here: https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.384

https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.385 generates better code, although I've yet to see a case where the encapsulated code should be taken.

[21e3f316]
@kd-11

Shaderlog:
Console dump:

I now understand how the BRB instruction is supposed to affect shaders, but the shaderlog is too large for me to find the broken case specifically.
@SakataGintokiYT If the game still runs, could you attach the renderdoc trace for the menu? I already located the missing branch op, but I need to know what is generated in its place with my commits.:

image

[21e3f31]
@kd-11
Shaderlog:
RenderDoc-Menu:

Nice. The test is now in the right place, just has the wrong condition.
Use https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.386 and attach the trace. It should write more info into the shader itself.

[236d51ed]

@kd-11
Shaderlog:
RenderDoc:

I think https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.387 should fix this one. From analyzing different instances where the instruction appears, and taking into account known and used bits, it seems bit 25 switches on/off whether the branch will be taken. The shaders given by this game have more than one way to compute position and the branch should determine which path to take.
I have considered the possibility that it may be a multi-bit index into a constants register array, but looking at vertex constants, it seems unlikely as they are used for other computations and contain float data.

Another alternative would be that we should decode input as a component of vertex input.
EDIT: Nope, wouldn't work. If anything I'm even more convinced of the bit flag after going through some of the more complex shaders used.

[4a855794]
@kd-11

[Saint Seiya Brave Soldiers]
Video:
Shaderlog:
RenderDoc-In game:
RenderDoc-Menu:


[Saint Seiya: Soldiers' Soul]
Video:
Shaderlog:
RenderDoc-Menu:
RenderDoc-In game:

@kd-11 If you revert this pull https://github.com/RPCS3/rpcs3/pull/2206 , and keep the posts pull requests after #2206 The game will render properly.
I don麓t know exactly which part of the pull make the things flicker and render wrong but my hint is that its related to Persistent mapped buffers.

Same without this commit #2206 / I have Nvidia GPU

@SakataGintokiYT I understand it, but I think if @kd-11 examine that pull, he could attempt to fix it for Nvidia users too.

saintseiya1

In that case, please test with legacy opengl buffers. If that fixes the flicker, I know why persistent buffers are not operating in an optimal manner. My assumption was that the buffers would be large enough that waits would happen only once every few seconds (there's a flush command in there for god's sake which harms performance). Looking at the renderdoc traces, its obvious that there are very many draw calls per frame and obviously trampling would take place. I shall fix the persistent buffers bug ASAP.

Okay, after looking at the renderdoc trace, it seems I messed up the commit. This issue ought to have been fixed; sorry for the confusion.

https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.389 should fix the opcode issue. As for the buffer RAW hazard, I expect some corruption but only when persistent mapped buffers are enabled and the issue would not be easy to capture using a trace, manifesting as an unstable render.

Fixed in https://github.com/kd-11/rpcs3/commit/7a758f4a98328e5daefb18e071086bb0ca56aec9!


In Vulkan too.

Also, there's a color error in Vulkan

Seems to be another channel remap issue for the colors. I'll clean up the decompiler code and submit for merge into master. The vulkan colors thing should be easy to fix.
Can someone please attach the D3D12 shader log? I'll try and fix that compilation error if the broken shader is captured in the logs.

[7a758f4a]

@kd-11

E {rsx::thread} RSX: FS build failed:0000000007192fc0
F {rsx::thread} class std::runtime_error thrown: fragment program compilation failure
(in file c:\rpcs3\rpcs3\emu\rsx\d3d12\D3D12PipelineState.h:162)

D3D12-Shaderlog

Check if https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.390 introduces any regressions to vulkan or opengl. I've changed the BRB implementation a bit.

@kd-11 , Sorry to bother you. After working in https://github.com/RPCS3/rpcs3/pull/2391, is possible to review this case again?

@ikki84 That's the plan. I temporarily abandoned this one since it breaks some games, but I'll focus on it once the current stuff is merged.

@kd-11 i have retested with you last commit, and have a see problem for Sanctuary battle, same splatterhouse, game very pixelisize, but only in render 3d, no for HUD
just see.
capture d ecran 2017-02-17 15 59 42
capture d ecran 2017-02-17 16 01 28
capture d ecran 2017-02-17 16 06 15

But not for Brave soldier
capture d ecran 2017-02-17 16 19 22

Current software upscaling is very rough. I'm avoiding using bilinear filtering due to performance concerns, but will polish up before merging. The image would still not be as sharp as a native image though. Does the log show an "unsupported RTT scaling" warning?

No, i don't see this
SSSB Log

@kd-11 Ico HD show this in Loop

E {rsx::thread} RSX: Unsupported RTT scaling factor: dst_pitch=5120 src_pitch=4864

With latest commit, that error is just a warning and the image is copied without scaling. I'd expect maybe extra padding on the right. Does it output correct images?

Ico show nothing with OGL and cheked color buffer, black screen

Please retest BRB issue with https://github.com/RPCS3/rpcs3/pull/2426

SSBS: Fixed in OpenGL (rendering both character and armor) also rendering in Vulkan.
Crashing in DX12.

@kd-11

**DX12**
Unhandled Win32 exception 0xC0000005.
Segfault reading location ffffffffffffffff at 00000000003bd400.
Instruction address: 00000000003bd400.
Module name: 'rpcs3.exe'.
Module base: 0000000000010000.
RPCS3 image base: 0000000000010000.

Log:
Shaderlog:


VK/OpenGL
Fotoszok.pl

Tested with https://github.com/RPCS3/rpcs3/pull/2426

In summary,

GL : works perfectly fine
DX12: crashes at start up
Vulkan : Blurred character and wrong logo color (YEBIS2)

I've fixed some DX12 crashes, so you can retest with newer commit

@kd-11

E {rsx::thread} RSX: FS build failed:D:\EMU\PS3\RPCS3.V2\FragmentProgram.hlsl(197,12-55): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
D:\EMU\PS3\RPCS3.V2\FragmentProgram.hlsl(188,3-36): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (248 iterations) or unrolled loop is too large, use the [unroll(n)] attribute to force an exact higher number

F {rsx::thread} class std::runtime_error thrown: fragment program compilation failure
(in file c:\rpcs3\rpcs3\emu\rsx\d3d12\D3D12PipelineState.h:162)

That's not related to BRB which is a vertex shader instruction. I think that wraps it up for BRB then.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xiangzhai picture xiangzhai  路  3Comments

JohnGodgames picture JohnGodgames  路  3Comments

Birch-san picture Birch-san  路  3Comments

kurosh10000 picture kurosh10000  路  3Comments

XeClutch picture XeClutch  路  3Comments