Commit Graph

74 Commits

Author SHA1 Message Date
Gregory Hainaut 4e2e9aa56c gsdx-ogl: always read the first attachment of the fbo 2015-05-11 16:28:34 +02:00
Gregory Hainaut 5565544ba6 gsdx-ogl: DATE with texture barrier
Much faster for small batch that write the alpha value. Code can
be enabled with accurate_date option.

Here a summary of all DATE possibilities:
1/ no overlap of primitive
    => texture barrier (pro no setup of stencil and single draw)

2/ alpha written
    => small batch => texture barrier (primitive by primitive). Done in N-primitive draw calls.
    (based on GL_ARB_texture_barrier)

    => bigger batch => compute the first good primitive, slow but only 2 draw calls.
    (based on GL_ARB_shader_image_load_store)

    => Otherwise there is the UserHacks_AlphaStencil but it is a hack!

3/ alpha written
    => full setup of stencil ( 2 draw calls)
2015-05-09 19:54:01 +02:00
Gregory Hainaut 3c7a3a3d83 gsdx-ogl: disable accurate option if driver doesn't support it 2015-05-09 18:41:17 +02:00
Gregory Hainaut b490085214 gsdx-ogl: add 2 options in the GUI to ease testing
accurate_date => use an emulated stencil to compute destination alpha
    test (could be slow)

accurate_blend => do nothing (future)
2015-05-08 19:28:16 +02:00
Gregory Hainaut d6448183d7 gsdx-ogl-debug: insert error message in GL stream
This way, you can see your message in the GL debugger
2015-05-08 00:16:31 +02:00
Gregory Hainaut cc4713d379 gsdx-debug: extend ogl debug capabilities
Group opengl calls into a nice name.

Apitrace shows them in a tree format that support folding. Previously it
was a long flat list (10K-40K of lines by frame)

I align the call number with the internal s_n variable. This way it is
easy to map GSdx dump output with the GL debugger :)
2015-05-06 19:09:13 +02:00
Gregory Hainaut b1ec8a5a42 gsdx-ogl: detect support of GL_EXT_texture_filter_anisotropic 2015-05-02 10:53:19 +02:00
Gregory Hainaut 335695bd0e purge GLES from GSdx !
mobile will use vulkan (or any new API) anyway
2015-05-01 20:02:17 +02:00
Gregory Hainaut 2ff3d17f67 gsdx-ogl: don't create override option for mandatory extension
Ini is alredy big enough
2015-05-01 14:18:05 +02:00
Gregory Hainaut 757726bb91 gsdx-ogl: allow to invalidate the texture
It just a hint to the driver to avoid any useless transfer

I don't expect any change but it is free so why not ;)
2015-04-25 12:50:12 +02:00
Gregory Hainaut 75817bb27b gsdx-ogl: add a quick and dirty DSA layer emulation
The global idea is to use
1/ bind in tight loop
2/ DSA otherwise (to avoid any binding in tight loop)
2015-04-25 12:50:11 +02:00
Gregory Hainaut eb257d9295 gsdx-ogl: add dsa function place holder 2015-04-25 12:50:11 +02:00
Gregory Hainaut baf84b98c4 gsdx-ogl: add override_GL_ARB_texture_barrier option
To ease regression test.
2015-04-25 09:59:25 +02:00
Gregory Hainaut b12eb45bb7 gsdx-ogl: try to avoid crash on fglrx windows 2015-04-25 09:50:19 +02:00
Gregory Hainaut f0182f9a66 windows requires APIENTRY (=> stdcall) 2015-04-25 01:32:09 +02:00
Gregory Hainaut 6d31d1e0d0 gsdx-ogl: add a layer to emulate DSA for texture
Framebuffer function will be nice too
2015-04-24 19:32:00 +02:00
Gregory Hainaut f71eb171cf gsdx-ogl: add glTextureBarrier function pointer
Could be useful
2015-04-24 18:35:01 +02:00
Gregory Hainaut 03e72781aa gsdx-ogl: drop support of GL_ARB_clear_texture extension
Extension is a bit slower.

We use it to clear the RT but we generally use it right away so
we don't avoid the FB attachment.
2015-04-24 18:15:58 +02:00
Gregory Hainaut f6652e9a50 gsdx-ogl: disable slow and buggy code until I found a better solution
ogl_texture_storage 1 creates texture corruption.

Advance date is too slow, code need to be updated (properly) to uses 2 passes only not 3
Maybe one could be enough (sometimes)
2015-04-22 09:33:41 +02:00
Gregory Hainaut cebccea81c gsdx: disable some gl extensions when VMware driver is detected
It is likely the Mesa driver, code seems to have the same issue (separate shader)
2014-12-12 20:44:58 +01:00
Gregory Hainaut 3311336d0e gsdx-ogl: disable ARB_bindless_texture
I have a crash when I try to delete some texture (for example when the simulator is paused)
2014-11-11 23:45:41 +01:00
Gregory Hainaut 47f40ed79a gsdx-ogl: reduce pbo complexity
Copy the full line into the pbo. Dma will only take GL_UNPACK_ROW_LENGTH
- increase memcpy size by 2 in the pbo
+ single memcpy will be faster and can use sse

Enable buffer_storage extension:
* GL_CLIENT_STORAGE_BIT was required (it is the duty of TexSubImage to copy data into the GPU mem)
* Enable the extension by default
2014-11-08 21:30:14 +01:00
Gregory Hainaut a573ce185c gsdx-ogl: mark GL_EXT_shader_io_blocks as mandatory for GLES 2014-10-02 20:44:22 +02:00
Gregory Hainaut d37cc8e1e7 gsdx-ogl: GL_ARB_shading_language_420pack is now mandatory
All API/drivers support it so time to remove the fallback.
2014-10-02 20:44:22 +02:00
Gregory Hainaut f46e8cc6ac gsdx-ogl: bump base requirement to 3.3
A couple of fallbacks were introduced for the Mesa driver that only support 3.0
DSA will require a recent Mesa which already support GL3.3

Require at least SandyBridge for Intel GPU
2014-09-30 22:18:20 +02:00
Gregory Hainaut 594f6c33a2 gsdx-ogl-ES: require GL_EXT_shader_io_blocks + GLES3.1
Allow to use same shader interface for all API

Note: on the GL API it will require GL3.3 (see next commit)
2014-09-30 22:18:01 +02:00
Gregory Hainaut 8833afc2fa gsdx-ogl: drop GL_ARB_multi_bind
It will be replaced by DSA so let's reduce the complexity of opengl
2014-09-28 12:23:44 +02:00
Gregory Hainaut fa43018d10 gsdx-ogl: no DSA isn't mandatory yet... 2014-09-28 12:11:22 +02:00
Gregory Hainaut 1e86e3cb08 gsdx-ogl: rework callback debug
* use DebugOutputToFile as a callback of gl error. Add a breakpoint to
  find the culprit GL call
* use string instead of char[n]

Note: CheckDebugLog is potentially useless now
2014-09-28 12:00:34 +02:00
Gregory Hainaut b7601a9add gsdx-ogl: Enable various GL4+ extensions
* GL_ARB_clip_control: reduce z fighting
* GL_ARB_clear_texture: no real speed gain (but improve code quality)
* GL_ARB_bindless_texture: +1fps (if you're CPU limited)
2014-09-28 12:00:34 +02:00
Gregory Hainaut 9d8d702aa6 gsdx-ogl: drop GL_NV_depth_clamp extension
superseeded by GL_ARB_clip_control
2014-09-28 12:00:34 +02:00
Gregory Hainaut d720cc16a6 gsdx-ogl: gl4.5: add plumbering to support direct_state_access and clip_control 2014-09-28 12:00:33 +02:00
Matteo Beniamino 15c487e547 GSdx: fixed use of separate shader objects for Intel driver. 2014-08-23 17:09:38 +02:00
Gregory Hainaut ef0e3fe6c6 gsdx: disable separate shader on radeon driver (linux) 2014-07-19 14:02:37 +02:00
Gregory Hainaut ea25d12405 gsdx-gles: nvidia driver quick trial (only GLES3.0)
* Fix to create a 3.0 GLES context
* set a default precision to fix most of shader compilation issue
* Crash later because of GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
    => need to test opensource driver
2014-04-12 12:40:23 +02:00
Gregory Hainaut 483b5a75e8 gsdx ogl: automatic setup of geometry shader
* disable it for gallium Mesa driver
* Re-enable it for Nvidia driver
2014-03-29 10:47:53 +01:00
Gregory Hainaut bde2e3956d gsdx-ogl: automatic dectection of buffer_storage 2014-03-25 16:36:29 +01:00
gregory.hainaut 3d7b86660a gsdx ogl: Enable by default advance DATE effect on nvidia (GL4 GPU)
Note: DATE is used for shadows (persona 3) and others effect

You can disable it when you disable gl image extension (override_GL_ARB_shader_image_load_store = 0)
You can also enable it on AMD too (set it to 1 this time) but no guarantee.

If you feel the extension is too slow, you can try disable some gl barrier (aka "damn the torpedo full steam ahead!").
It can be done with the option UserHacks_DateGL4 = 1. Otherwise just disable the extension.

Note: don't enable UserHacks_AlphaStencil in the same time. GL_ARB_shader_image_load_store is an alternative implementation.
Enabling both in the same time will lead to undefined (well surely wrong) behavior.




git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5890 96395faa-99c1-11dd-bbfe-3dabce05a288
2014-02-08 11:05:26 +00:00
gregory.hainaut c0558c00e7 gsdx ogl:
* gui refresh
  + Use some tab to reduce heigth for small screen
  + Add logz option
  + remove broken/experimental keyword. GSdx ogl is not too bad ;)
* autodetect GL_NV_depth_buffer_float

Linux tester you are welcome!



git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5862 96395faa-99c1-11dd-bbfe-3dabce05a288
2014-02-01 11:11:14 +00:00
gregory.hainaut 84895eadd9 gsdx ogl: correct most of Z-depth issue
Best setting if you driver support GL_NV_depth_buffer_float => GL_NV_Depth = 1 & logz = 0
Otherwise => GL_NV_Depth = 0 & logz = 1

Explanation of the bug:
Dx z position ranges from 0.0f to 1.0f (FS ranges 0.0f to 1.0f)
GL z Position ranges from -1.0f to 1.0f (FS ranges 0.0f to 1.0f)

Why it sucks:
GS small depth value will be "mapped" to -1.0f. In others all small values will be 1.0f! Terrible lost
of accuraccy.

The GL_NV_depth_buffer_float extension allow to set the near plane as -1.0f.
So
"GL z Position ranges from -1.0f to 1.0f (FS ranges 0.0f to 1.0f)"
will become
"GL z Position ranges from -1.0f to 1.0f (FS ranges -1.0f to 1.0f)"
and therefore
"z posision [0.0f;1.0f] will map to FS [0.0f;1.0f]" as DX

Yes we just get back all precision lost previously :)
However you need hardware (intel?) and driver support (free driver?/gles?) :(





git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5860 96395faa-99c1-11dd-bbfe-3dabce05a288
2014-01-31 21:30:54 +00:00
gregory.hainaut bdea4837c7 ... forget to refresh my patch ...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5784 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-12-30 10:15:01 +00:00
gregory.hainaut 4d3de6e911 gsdx linux:
* allow to control the gl dectection from the gui (+1 for the user-friendliness ;) )
* disable geometry shader by default on Intel driver


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5783 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-12-30 09:30:10 +00:00
gregory.hainaut e80b002929 gsdx ogl: Flush various pending work
* try to use more subroutine on VS&PS, unfortunately hit a driver crash!
* Call Attach/DetachContext through GSDevice so I can unmap currently mapped buffer
* Implement glsl part of GL_ARB_bindless texture, again hit another driver crash!
* various fix of GL_ARB_buffer_storage. Basic benchmark show only improvement on 'cold' case, I guess it will improve smoothness
* try to fix GL_clear_texture, no success so far. It seem the extension is limited to basic texture (aka no depth/stencil)



git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5752 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-10-24 20:54:27 +00:00
gregory.hainaut e01c6cd9ce gsdx ogl: the proof of concept commit
* GL_ARB_shader_subroutine for perf
fix for nvidia => add missing shader declaration. Nvidia got +4fps on colin3 :) 

For the moment only 2 PS parameters are supported. Code need to be extended to support others games that often
switch shader program (like xenosaga).
require GL4 class hardware and the option override_GL_ARB_shader_subroutine = 1
Note: strangely on AMD linux it is slower!

* GL_ARB_shader_image_load_store for accuraccy (Date)
Use a signed integer texture and reenable color buffer writing

Current status: Amagami_transparency.gs & P3_battle_shadows.gs are now working on Nvidia with a small perf impact.
Current implementation detail:
1/ setup the standard stencil as before
2/ on remaining pixel, draw once to compute first primitive that will write a fail alpha value.
3/ final draw based on primitive id of step 2

Note: I think we would get a bad behavior if depth test&mask are enabled on step 2/3
Note2: on my limited testcase the perf impact was on CPU. It would be possible to merge step1&2 to nullifying it (could 
even be faster actually), however it would require more GPU power.

Again require GL4 class hardware. And the option UserHacks_DateGL4 = 1



git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5725 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-08-28 08:44:16 +00:00
gregory.hainaut 452cf72ddf onepad: fix a bug to handle multiple button (fix #1271)
zzogl: fix memory leak (fix #1431, #1432)
GSdx ogl: disable geometry shader on Nvidia/Windows (I will wait a 3rd implementation to find which one is correct)


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5724 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-08-25 12:11:32 +00:00
gregory.hainaut 690432de30 gsdx ogl:
* redo most of the texture upload (PBO): colin3 benchmark: 32 fps now (vs 26 fps 2 weeks ago)
* use the cross vendor vsync extension on linux (previous wasn't supported by nvidia)


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5721 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-08-17 09:05:41 +00:00
gregory.hainaut 07605941ef gsdx ogl:
* some preliminary work to test/benchmark bindless texture in the future (glsl was not yet updated)
Bindless texture allow to get a GPU texture pointer and then set it directly
to the shader as a basic uniform.
=> no more texture unit selection/validation
=> no more texture validation neither texture hash lookup

3rdparty: update gl header to the latest gl4.4


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5720 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-08-17 08:57:52 +00:00
gregory.hainaut b4084047be gsdx ogl: Used a basic flat interpolation for color interpolation (line & tri primitives)
Card that support gs:
remain only a gs to generate sprite from a line. Even dummy gs are costly for the GPU.

Card that don't support gs:
remove useless copy of color for line and triangle primitives

Note for dx: opengl 3.2 (maybe not gles) supports both flat interpolation
convention (GL_FIRST_VERTEX_CONVENTION or GL_LAST_VERTEX_CONVENTION).  It might
be possible to shuffle vertex index to put the last vertex in first position.

- buff[0] = head + 0;
- buff[1] = head + 1;
- buff[2] = head + 2;
+ buff[0] = head + 2;
+ buff[1] = head + 1;
+ buff[2] = head + 0;



git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5718 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-08-14 10:18:38 +00:00
gregory.hainaut 0f603a98d5 gsdx ogl: Test the ARB_shader_subroutine GL4.0 extension
The idea was to replace shader program swith by pointer function calls inside
shaders.  At least parameters that are often changed between draw call. So far
I only ported atst and colclip. Unfortunately code is "slower" (on GSdx standalone).
For the moment keep the code but disabled.

If I understand well the validation of program is done in the "driver thread"
but the additional call are done in the overloaded MTGS thread. Apitrace
profiling shows faster GPU draw calls. Another possibility is that the driver still
need to validate the draw call because of others state change.

Here some stats on colin3 (90 frames):
without subroutine: UseProgram 125246
with subroutine: UseProgram 2906, subroutine 125945 => 3605 extra calls overhead (not
all parameters are ported to subroutine)



git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5715 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-08-10 19:43:59 +00:00
gregory.hainaut a46b489a24 gsdx ogl: various minor optimization.
* move most of gl states into a separate namespace. Extend it to depth/stencil/blend micro state
=> save 10,000 opengl call by frame for colin mcrae 3
* Only setup blend state of first drawbuffer
* Don't request anymore a debug context on dev/release build



git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5713 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-08-05 20:25:25 +00:00