Pcsx2: Add GL_ARB_shader_stencil_export support to handle accurate DATE

Created on 17 Jan 2017  路  14Comments  路  Source: PCSX2/pcsx2

Extension description: https://www.opengl.org/registry/specs/ARB/shader_stencil_export.txt

  • Allow to write the stencil reference value from the shader.
  • So we can directly write the alpha value in the stencil. It can be done with a single draw call for complex case (+ likely an extra draw call for the init)

Supported GPU:

  • Recent Intel (gen9+), I think it mean skylake or newer
  • Recent AMD
  • Good news, Mesa supports it on the software renderer (so it can be implemented/tested on my Nvidia GPU)

Limitation:

  • Another code path for DATE
  • Will be deprecated by GL_ARB_fragment_shader_interlock (but I don't have the HW to implement it)
Hardware OpenGL

Most helpful comment

Does this actually work on AMD cards? :P

All 14 comments

Does this actually work on AMD cards? :P

:rofl: Don't be jealous ;)

I'm not jealous, I don't own an AMD card, it was more of a mocking :P

I know. But you ought to be jealous. I'm pretty sure it can provide a massive speed boost on scene that used complex DATE rendering. Anyway it isn't my priority but it could be a nice addition. (and maybe future Nvidia hardware will support it one day).

Supported GPU: Recent

Don't you just need OGL 4.1 hardware?

Will be deprecated by GL_ARB_fragment_shader_interlock

Nvidia and intel have it, but amd and mesa are a big mystery 馃構

I'm not jealous, I don't own an AMD card, it was more of a mocking :P

Seriously, that was my first question too.

Seriously, that was my first question too.

We won't have an accurate answer until it's been applied.

Nvidia only support it for Maxwell GPU and later. I will upgrade my GPU to a XX50 card when we have GDDR5X (or similar) and an available firmware for the free driver. Until then, don't hold you breath. It isn't implemented in Mesa currently. Maybe they will implement it in their software renderer.

I don't know which AMD card support it. I think all DX12 class GPU are fine. Maybe all DX11 class GPU. @FlatOutPS2 do you have it in your driver ? Anyway, extension will remain optional. It is only a way to accelerate the shadow rendering of some games. Code is already optimized to use various fast path.

GL_ARB_shader_stencil_export is supported by my driver, GL_ARB_fragment_shader_interlock is not. :P

Yes interlock is a long term future.

Question , how to check if it's supported or not ?

edit: For intel we'll probably have to wait for cannonlake to support the needed extensions to run opengl at all :D

As I linked, it's already supported. And if it's just an extension to 4.5 I'd expect everything from Haswell above to support it at least on linux one day.

You can check with gpu caps viewer or gl caps viewer

No you don't understand the meaning of extensions. All gl features are extensions of a spec. From time to time, some of them are grouped together below a marketing number (therefore it is mandatory to implement them if you want to put the sticker on the box). To avoid marketing issue, some ARB extensions aren't linked to any marketing number. This way there are really optional.

Intel Linux implementation requires gen9. So I don't think haswell will get it. Anyway, so far it is only something that worth an investigation. It might not work as expected, or it could be slower.

Unfortunately I was confused with the other extension AMD_shader_stencil_value_export.txt

And even with the latter I'm not sure it is doable. We need something to change the value of the next stencil test not the current one (my main misunderstanding) which is useless.

Sorry for the hope.

Intel Linux implementation requires gen9. So I don't think haswell will get it.

Well surprise surprise https://github.com/mesa3d/mesa/commit/939312702e35928770e5f90f7b053ece3d10e7ae#diff-d59cd5f9d5db0eb2f923d478a2cf1e17R224
馃檭

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RinMaru picture RinMaru  路  5Comments

jobs-git picture jobs-git  路  3Comments

mcabel picture mcabel  路  4Comments

Clarke2131 picture Clarke2131  路  3Comments

Nezarn picture Nezarn  路  6Comments