Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly fetch correct pitch and depth for textures from RSX #1496

Merged
merged 1 commit into from
Feb 15, 2016

Conversation

kd-11
Copy link
Contributor

@kd-11 kd-11 commented Feb 11, 2016

Texture pitch and depth are fetched from the registers without indexing, causing all texture layers to contain info for texture layer 0. Thanks to @jarveson for pointing out the problem.

Should fix issue #1495

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @DHrpcs3, @vlj and @Nekotekina to be potential reviewers

@kd-11
Copy link
Contributor Author

kd-11 commented Feb 11, 2016

I'm not sure how the pitch per index should be fetched. The other values are set in the init() function but not for depth and pitch. Someone more familiar with the core RSX should confirm.

@kd-11
Copy link
Contributor Author

kd-11 commented Feb 11, 2016

Updated to also affect vertex textures.
Fixes alot of texture alignment issues on openGL backend.

@vlj
Copy link
Contributor

vlj commented Feb 11, 2016

Nice catch.

I think gcm.cpp code correctly parses control 2 and 3, I had an issue where some texture related opcode had a stride of 8 and some other a stride of 1.

Dx12 doesn't use texture pitch from the register and computes it from texture width. It'd likely not accurate but I didn't know how to interpret the pitch value from the register when I wrote the code: sometimes it's 0 and sometimes the pitch value is wrong.
Actually the pitch value is ignored if texture is swizzled. Textures and their mipmaps level are tightly packed. If texture is linear stored then pitch is used for textures and mipmap levels. Since mipmap width is halved at every level it takes more storage space with unused memory gap (which is sometimes used to store other texture like in after burner climax)
Depth is almost always 1. As far as I know rsx doesn't support texture array so depth is needed only in 3d texture case which are rare. The only game that uses a 3d texture so far is Resogun in the first level.
That's likely why it wasn't spotted before.

@kd-11
Copy link
Contributor Author

kd-11 commented Feb 11, 2016

@jarveson Indeed; there is a rather large gap between 583-640 (base 10) so I agree with your analysis about the indexing having a stride of 8. Will update accordingly.

@kd-11
Copy link
Contributor Author

kd-11 commented Feb 11, 2016

Updated vertex texture pitch and depth index stride.

@vlj
Copy link
Contributor

vlj commented Feb 11, 2016

Is travis-ci stuck ?

@tambry tambry closed this Feb 12, 2016
@tambry tambry reopened this Feb 12, 2016
@tambry
Copy link
Contributor

tambry commented Feb 12, 2016

Travis seems to be triggered now. Sadly there's no way to redeliver Travis payloads.

@kd-11 kd-11 force-pushed the rsx_textureinfo_fix branch 2 times, most recently from 7a64d03 to 0cac71b Compare February 12, 2016 08:25
@kd-11
Copy link
Contributor Author

kd-11 commented Feb 12, 2016

Sorry. Bad push. @vlj Requires approval again.

@danilaml
Copy link
Contributor

@tambry where should be rebuild/cancel build option for those in the team (same as appveyor).

@tambry
Copy link
Contributor

tambry commented Feb 12, 2016

@danilaml There is, but I can't do that, when Travis didn't receive the build request. Ie. Github was waiting for Travis build to start for hours.

@kd-11 kd-11 force-pushed the rsx_textureinfo_fix branch 2 times, most recently from c14a260 to cd64875 Compare February 13, 2016 16:45
Include vertex textures too

Set correct stride for vertex texture params

Change references to gl_Position in D3D12FragmentProgramDecompiler

Revert bad commit
tambry added a commit that referenced this pull request Feb 15, 2016
Correctly fetch correct pitch and depth for textures from RSX
@tambry tambry merged commit 787619c into RPCS3:master Feb 15, 2016
@kd-11 kd-11 deleted the rsx_textureinfo_fix branch February 21, 2016 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants