Skip to content

gl/vk: Enable vertex texture fetch - #2127

Merged
dbz400 merged 15 commits into
RPCS3:masterfrom
kd-11:master
Sep 20, 2016
Merged

gl/vk: Enable vertex texture fetch#2127
dbz400 merged 15 commits into
RPCS3:masterfrom
kd-11:master

Conversation

@kd-11

@kd-11 kd-11 commented Sep 5, 2016

Copy link
Copy Markdown
Contributor

Enable vertex textures.
Most of the rsx side was already done, so adding to the renderer should not be a big deal.
However, currently, the decompiler only addresses vertex texture 0.

This PR enables vertex texture fetch in GL backend only (for now)

@mention-bot

Copy link
Copy Markdown

@kd-11, thanks for your PR! By analyzing the annotation information on this pull request, we identified @vlj, @raven02 and @Nekotekina to be potential reviewers

@kd-11

kd-11 commented Sep 5, 2016

Copy link
Copy Markdown
Contributor Author

@raven02 Please check for regressions. The vertex texture sample works, but the texture seems to have repeat set to false (atleast for the W32_Z32_Y32_X32_FLOAT test) which confines the geometry to a small block. Maybe we shouldn't honor clamping modes?
Texture wrap for vertex textures is unimplemented

@kd-11

kd-11 commented Sep 5, 2016

Copy link
Copy Markdown
Contributor Author

image

Sort of working now. Some bugs are visible but they seem unrelated, I think the strange geometry over the "terrain" may be a shader effect for depth fog that isn't working properly. If you can get to the underside of the "terrain" you can see the vertex deformations are correct.

@kd-11

kd-11 commented Sep 5, 2016

Copy link
Copy Markdown
Contributor Author

Spurious build failure with appveyor.

@dbz400

dbz400 commented Sep 5, 2016

Copy link
Copy Markdown

Nice @kd-11 .Will check it for regression once the appveyor build ok

@Nezarn

Nezarn commented Sep 6, 2016

Copy link
Copy Markdown

Hatsune Miku Dreamy Theater, 2nd, and extend can now boot
http://i.imgur.com/LTAHxP1.png

ps: someone should restart appveyor, since it didn't had any build errors (at least i can't see any), and also VS builds fine

@dbz400

dbz400 commented Sep 6, 2016

Copy link
Copy Markdown

I tested a bit as well and looks okay for most games.

Fix #1850

@kd-11

kd-11 commented Sep 6, 2016

Copy link
Copy Markdown
Contributor Author

Thats good news. Will update with vulkan and dx12 support.

@kd-11

kd-11 commented Sep 8, 2016

Copy link
Copy Markdown
Contributor Author

Fixed opengl vertex issue, it seems rsx decode returns 0x7fffffff when restart index is 0xffffffff. For some reason bit 31 is 0 when it shouldn't be.
Added vulkan vertex textures and fix for cases where custom restart indices would be used

D3D12 vertex textures is still WIP. I'm almost certain I messed up the descriptor bindings somehow and I'm short on time to keep digging. @vlj please take a look (I get the invalid parameter error)

@raven02 please test for vulkan and ogl regressions

Some more work needs to go into the decompiler itself to get the vertex index being sampled. The dst opcode structure still contains some unknowns. I'll have to ask from those familiar with rsx internals (@vlj) or refer to nouveau docs for the ISA. If anyone has insight into this feel free to chip in. Should probably be a 2-bit encoding in one of the Dx sections.

Comment thread rpcs3/Emu/RSX/gcm_enums.cpp Outdated
CELL_GCM_TEXTURE_MAX_ANISO_16 = 7,

// Texture Filter
CELL_GCM_TEXTURE_FILTER_NONE = 0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no such filter.

@kd-11 kd-11 Sep 8, 2016

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vertex textures do not specify filtering. In the geforce 7 era, filtering vertex textures was not supported at all. I checked this, and on the vertex_texture sample, texture filter modes are set to 0.

EDIT: I could optionally remove that enum and make calls to vertex_texture::min/mag_filter() always return CELL_GCM_TEXTURE_FILTER_NEAREST.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever they do, CELL_GCM_TEXTURE_FILTER_NONE simply doesn't exist. We didn't invent these constants, it's confusing. And note my recent issue about gcm_enums, this problem seems relevant that the values are checked in the situation they shouldn't.

@dbz400

dbz400 commented Sep 8, 2016

Copy link
Copy Markdown

Tested for some games with both GL and Vulkan backend .It looks good.

@SakataGintokiYT

SakataGintokiYT commented Sep 8, 2016

Copy link
Copy Markdown
Contributor

@kd-11
[3a3c1eb3]
Fotoszok.pl

@kd-11

kd-11 commented Sep 8, 2016

Copy link
Copy Markdown
Contributor Author

I'll have to revert some texture format changes on vulkan/gl.

@kd-11

kd-11 commented Sep 8, 2016

Copy link
Copy Markdown
Contributor Author

@SakataGintokiYT Are the vulkan/gl issues regressions? If so, @raven02 I'll need your help to figure out which texture format I botched here. I only changed swizzles for X32/16 and W32_Z32_Y32_X32 which were wrong based on inspection of shader code using the textures.

@kd-11
kd-11 force-pushed the master branch 2 times, most recently from 4df75d4 to d2da682 Compare September 8, 2016 21:28
@kd-11

kd-11 commented Sep 8, 2016

Copy link
Copy Markdown
Contributor Author

Minor bugfixes and reworked a few areas.
Currently:

OpenGL
image

Vulkan
image

For D3D12, the shaders generated are okay, but the upload/binding code is probably where it breaks.

@dbz400

dbz400 commented Sep 9, 2016

Copy link
Copy Markdown

@SakataGintokiYT , is master also broken the Naruto as well ? as i found some games already broken with master and not related to this vertex texture enhancement.

@SakataGintokiYT

SakataGintokiYT commented Sep 9, 2016

Copy link
Copy Markdown
Contributor

@kd-11
@raven02

The games of naruto are broken in master build , in VK and GL It is not a regression this commit.

@dbz400

dbz400 commented Sep 9, 2016

Copy link
Copy Markdown

Thanks for checking this out .It would be nice if you can cross check which commit start the breaking so we can fix the regression .

@SakataGintokiYT

SakataGintokiYT commented Sep 9, 2016

Copy link
Copy Markdown
Contributor

Naruto games only work in DX12 . Never work correctly on Vulkan and OGL so it's not a regression

@kd-11
kd-11 force-pushed the master branch 2 times, most recently from 9391c8b to d54b802 Compare September 17, 2016 15:55
@kd-11

kd-11 commented Sep 17, 2016

Copy link
Copy Markdown
Contributor Author

I've removed dx12 part for now. The shaders and upload code is fine, but the resource binding/descriptor stuff is causing a mismatch. See https://github.com/kd-11/rpcs3/tree/dx12

Travis-Ci and appveyor are crashing before compilation starts, I'm not sure why. Should be good to go as part 1 for now as it shouldn't cause any regressions.

@kd-11 kd-11 changed the title Enable vertex texture fetch (WIP) gl/vk: Enable vertex texture fetch Sep 17, 2016
@dbz400

dbz400 commented Sep 18, 2016

Copy link
Copy Markdown

Need someone to restart appveyor

@kd-11

kd-11 commented Sep 20, 2016

Copy link
Copy Markdown
Contributor Author

Appveyor failing again during pre-compilation setup

@dbz400

dbz400 commented Sep 20, 2016

Copy link
Copy Markdown

@Nekotekina , please help to restart the appveyor.

@dbz400
dbz400 merged commit 867e921 into RPCS3:master Sep 20, 2016
dbz400 pushed a commit that referenced this pull request Sep 24, 2016
* Porting of DH's user clip implementation in gl

* Tweak clang-format

* rsx: Move inline array to draw_clause structure.

* rsx: Use variant based draw commands.

* rsx: Dump DRAW_ARRAYS and DRAW_INDEX_ARRAYS.

* GL: old recompiler clean up (#2142)

* RSX texture refactor (#2144)

* gl/vk: Enable vertex texture fetch (#2127)

* gl: Enable vertex textures

* rsx: use textureLod instead of generic texture sample

* rsx: handle uploading of W32_X32_Y32_Z32

* gl: Re-enable proper shader logging

remove old logging method that overwrites single file

* gl: Declare texture_coord_scale for vertex samplers

* gl: texture remap fixes; enable remap for vertex textures

* gl: offset texture indices to base layer 16

* rsx: Fix W32_Z32_Y32_X32_FLOAT subresource layout

* vk: Enable vertex textures

* rsx: define special calls for vertex texture fetch

* gl: improved vertex texture fetch setup

* vk: Fix texture formats and component mapping

* vk: Implement vertex texture fetch functions properly

* vk/gl: proper fix for primitive restart index

revert inadvertent decompiler update

* gl: Disable filtering for vertex textures

* Hopefully fix appveyor build (#2148)

* GL/Vulkan: Bug fixes and improvements; alphakill for vulkan (#2146)

* vk: Zero-initialize some more structs

* gl: Clean up fragment program generation code

* vk: Enable alpha kill

* vk: Fix surface clear; redirect output for surface_type:b

* vk: Tie renderpass to program object to avoid incompatible passes

* vk: Properly compute descriptor pool size (#2150)

* rsx: Set default attribute format to float.

* rsx: vertex attribute size is 1 again for CMP, let backend handles this formats properties.

* rsx: Move printing function in a separate header/cpp

* Porting of DH's user clip implementation in gl
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