Project

General

Profile

Actions

Emulator Issues #4234

closed

BPS: The Strike - DX11 PSTextureEncoder Error

Added by kickstand2003 almost 14 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

What's the problem?
While loading "BPS: The Strike" using DX11 the following errors occur:

DX11::PSTextureEncoder::EncodeFailed in Src
PSTextureEncoder.cpp at line 1058: cache lines per row sanity check

DX11::PSTextureEncoder::EncodeFailed in Src\PSTextureEncoder.cpp at line 1061: total encode size sanity check

Dolphin version with the problem (as it appears in the title bar, Ex.: "R 4779" or "R 6403M"):
r7253 and above

(optional) Dolphin version that does not have the problem:
r7252 and below

Operating system and version:
32-bit or 64-bit:
win7 64bit

Game ID (as it appears in game properties, Ex.: "GZ2P01" or "RSBE01"):
RY8EFS

Build command-line (not on Windows):

Was the ISO a plain dump from disc, compressed and/or scrubbed?
plain dump

Please provide any additional information below.
These are the two problem lines of code:

CHECK(cacheLinesPerRow*32 <= MAX_BYTES_PER_BLOCK_ROW, "cache lines per row sanity check");

and CHECK(totalCacheLines*32 <= MAX_BYTES_PER_ENCODE, "total encode size sanity check");

The value of cacheLinesPerRow32 at the time of the error is 12800 which is somehow larger than MAX_BYTES_PER_BLOCK_ROW (10240). The value of totalCacheLines32 at the time of the error is 1920000 which is somehow larger than MAX_BYTES_PER_ENCODE (1351680).

This is probably going to be an issue for Nolan.Check and may need to be forwarded to him since it has to do with his newer DX11 work.

Actions #1

Updated by kickstand2003 almost 14 years ago

BTW these errors didn't start happening until PSTextureEncoder.cpp was added in r7253

Actions #2

Updated by Nolan.Check almost 14 years ago

  • Status changed from New to Work started

It looks like the game is trying to do an EFB copy that's bigger than the EFB. I don't have this game, so I can't easily test any fixes.

Thank you for providing numbers. I'm assuming you have the ability to build and debug dolphin-emu. Can you please tell me what arguments were passed to PSTextureEncoder::Encode? I need the values of dstFormat, srcFormat, srcRect, isIntensity, and scaleByHalf. Let me know if you need any help getting these.

Actions #3

Updated by kickstand2003 almost 14 years ago

dstFormat is 6
srcFormat is 0
isIntensity is false
scaleByHalf is false

I'm not sure how to get the srcRect value sice they are in a struct. Since a few revisions ago I cannot get dolphin to run in the vs10 IDE to follow values and i'm ignorant on the built in dolphin debugger. I'm using panicalerts to report these values right now..

Actions #4

Updated by Nolan.Check almost 14 years ago

So it's trying to export a texture of width 800 pixels, but the EFB is only 640 pixels wide. That's really weird. I'm not sure how the real hardware behaves in this situation. Does the game work if you use EFB-to-texture instead of EFB-to-RAM?

Actions #5

Updated by kickstand2003 almost 14 years ago

I just now tried it and yes it runs great with EFB-to-texture.

Actions #6

Updated by Nolan.Check almost 14 years ago

Please paste the following code at line 1039 in PSTextureEncoder.cpp:

NOTICE_LOG(VIDEO,
"Encoding EFB: dstFormat 0x%X, srcFormat %d, "
"srcRect (%d,%d),(%d,%d), isIntensity %d, scaleByHalf %d, "
"copyMipMapStrideChannels %d",
dstFormat, srcFormat, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom,
isIntensity ? 1 : 0, scaleByHalf ? 1 : 0,
bpmem.copyMipMapStrideChannels);

Then, turn on Video Backend Notices in the log configuration, and report what it says.

Actions #7

Updated by kickstand2003 almost 14 years ago

08:28:681 Src\PSTextureEncoder.cpp:1039 N[Video]:Encoding EFB: dstFormat 0x6, srcFormat 0, srcRect <0,0>,<800,600>, isIntensity 0, scaleByHalf 0, copyMipMapStrideChannels 400

Actions #8

Updated by Nolan.Check almost 14 years ago

I can't imagine why a game would try to export an 800x600 texture. The GameCube and Wii don't have that much resolution. I'm guessing it's a bug in the game that just happens to work fine on real hardware. Either that, or dolphin-emu is getting srcRect from the wrong place.

Does srcRect change if you play at different resolutions? It should stay the same.

Actions #9

Updated by kickstand2003 almost 14 years ago

Yeah srcRect stays at (0,0),(800,600) no matter which resolution the game is played at. After looking at copyMipMapStrideChannels in the code isn't 400 way beyond the expected value?

Actions #10

Updated by Nolan.Check almost 14 years ago

400 is exactly the value we'd expect for an 800-pixel wide RGBA format texture:

RGBA format has 4x4-pixel blocks. If texture is 800 pixels wide, there are 200 blocks in a block-row. Each block takes 2 cache lines. Thus, 400 cache lines per block row.

copyMipMapStrideChannels tells the number of cache lines between one block row and the next during export. It's being deliberately set by the game for an 800-pixel wide texture.

Maybe we should just clamp the export size to the maximum possible. I'll make a patch soon and we'll see what happens.

Actions #11

Updated by Nolan.Check almost 14 years ago

Please test r7337.

Actions #12

Updated by kickstand2003 almost 14 years ago

r7337 did fix the issue. The game runs now but only around 6-7fps and 20% speed. I do not know if the speed problem is due to the fix because the game wouldn't run before. Thanks for taking the time to make a fix, maybe it will benefit other games besides this one.

Actions #13

Updated by Nolan.Check almost 14 years ago

  • Status changed from Work started to Fixed

Good. Does the speed improve much if you set "Enable Cache" along with EFB-to-RAM? And how is the speed if you use EFB-to-texture?

Actions

Also available in: Atom PDF