Commit Graph

134 Commits

Author SHA1 Message Date
Gregory Hainaut 85fb55a0e1 gsdx ogl: memory management take 3
Add a factor 2 on the VRAM to get the quantity of available memory for the textures.
The driver is allowed to put some textures in RAM. Of course it is bad for performance
but it won't crash.

Due to the 4GB by process limit, I keep a (reasonable) maximum of 3.8GB.

In order to avoid a crash when memory is too low an exception will be risen
with no guarantee on rendering and big performance impact. In this situation
you ought to reduce upscaling/disable large framebuffer.
2016-07-10 10:23:23 +02:00
Gregory Hainaut a37cd40ce3 gsdx ogl: only print an error when VRAM is low
Until a better solution is found or people buy better GPU :)
2016-07-09 11:43:28 +02:00
Gregory Hainaut 7e2b3da928 gsdx ogl: monitor global GPU memory texture usage
So far there is a hardcoded limit at ~3.7GB

In the future, the limit will be reduced for low-end GPU.
2016-07-07 22:05:15 +02:00
Gregory Hainaut 79587215bb gsdx ogl: add the option force_texture_clear for test purpose
Might be completely useless.

1 => always clear framebuffers and textures to black (aka 0)
2 => always clear framebuffers and textures to red
2016-06-24 18:41:55 +02:00
Gregory Hainaut 113c78b67e gsdx ogl: replace eight 8MB PBO with a single fat 64MB PBO
It ought to be the same in performance but code will be easier this way

v2: print the sync status
v3: use a performance print so it doesn't spam the console
2016-06-18 14:59:19 +02:00
Gregory Hainaut fca2661e05 gsdx ogl: add a pretty name to various opengl opengl 2016-06-09 18:27:58 +02:00
Gregory Hainaut a9c18c57e4 gsdx option: use the new GetConfig* function
v2:
add PSX stuff
ssakash review
2016-05-28 10:07:27 +02:00
Gregory Hainaut f5b174f985 gsdx ogl: pitch is always the width of the transfer not the size of the texture 2016-05-16 19:20:01 +02:00
Gregory Hainaut fa921215d9 gsdx ogl: add GL_ARB_get_texture_sub_image extension support
could help to read back a portion of a texture
2016-05-16 18:58:33 +02:00
Gregory Hainaut 37e4d2bd48 gsdx ogl: update old comment 2016-05-16 18:58:33 +02:00
Gregory Hainaut 5b061e062c gsdx ogl: replace ClearRenderTarget_i by glClearTexSubImage
Avoid state change, avoid potential texture buffer reallocation

Note: require GL_ARB_clear_texture
2016-05-15 15:55:31 +02:00
Gregory Hainaut caacb1dc9f gsdx-ogl: add texure clear function (GL4.4) 2016-05-15 14:57:11 +02:00
Gregory Hainaut d58b71688b gsdx debug: auto GL_POP
Nicer and exception safe

V2: miss definition of vs/ps
2016-05-05 18:53:32 +02:00
Gregory Hainaut 87867beb0e gsdx-ogl: remove the invalidation of texture
It doesn't help the perf and only create overhead (test done on snow engine game)
2016-04-21 21:07:17 +02:00
Gregory Hainaut 2e567d6d55 gsdx ogl: update comment
something to test in the future
2016-04-14 10:19:18 +02:00
Gregory Hainaut 22a40b65ae gsdx-ogl: always use 1 for GL_UNPACK_ALIGNMENT
Avoid a gl function call for each texture uploads
2016-04-11 12:45:11 +02:00
Gregory Hainaut a62019a3fd gsdx-ogl: found_GL_ARB_buffer_storage is now mandatory 2016-04-07 22:17:22 +02:00
Gregory Hainaut 8dee7daeb9 gsdx-ogl: init textures for all formats
CID 150171
2016-03-30 19:56:19 +02:00
Gregory Hainaut 205b496d5c gsdx: fix gl recording regression 2016-03-21 18:52:26 +01:00
Gregory Hainaut 7eb242d3ad gsdx-ogl: remove the ogl_texture_storage option
The previous commits make PBO faster for all drivers.
2016-03-19 01:00:52 +01:00
Gregory Hainaut 68aa182b16 gsdx-ogl: sort the texture upload code
I wanted to do a separate path for palette texture. So far, it isn't very
conclusive.
2016-03-19 00:58:58 +01:00
Gregory Hainaut eb69522641 gsdx-ogl: optimize texture memory upload
Previous code was
1/ unpack texture into local buffer
2/ copy local buffer into gl buffer
3/ copy gl buffer to texture

New code is
1/ unpact texture directly into gl buffer
2/ copy gl buffer to texture

Perf increase (done in native)
DQ8:   255 -> 270 (+5%)
Colin: 126 -> 135 (+8%)
ZoE:   50  -> 54  (+8%)
2016-03-18 20:24:42 +01:00
Gregory Hainaut da741e294e gsdx-ogl: optimize GPU->CPU memory transfer size
Might help for snow engine game (a little)

Previous code use to read the full texture whereas now it will be limited
to the size of the useful data.
2016-03-18 20:24:42 +01:00
Jonathan Li 6b950d0408 gsdx: Allow dump and capture PNG compression to be changed
Valid values for png_compression_level are from 0 (no compression) to 9
(max compression). The default is 1.

v2: Use zlib Z_BEST_SPEED (1) and Z_BEST_COMPRESSION (9) defines.
2016-03-02 22:58:45 +00:00
Jonathan Li cf939620ea gsdx-ogl: Save depth image as RGB and alpha images 2016-03-02 22:57:16 +00:00
Jonathan Li ee5861efc8 gsdx: Remove non-PNG code
It's no longer in use.
2016-03-02 22:57:12 +00:00
Jonathan Li 87dcfbc645 gsdx-png: Use libpng directly instead of via png++
v2: Increase compression to maximum
v3: Add zlib to GSdx build dependencies
v4: Reduce memory usage
2016-03-02 22:48:54 +00:00
Jonathan Li 0f11838d93 gsdx: s/_WINDOWS/_WIN32/
It's the proper Windows preprocessor macro.
2016-01-27 22:41:45 +00:00
Gregory Hainaut 022cd9cd64 gsdx: s/u32 pointer/uptr/ 2016-01-16 14:34:00 +01:00
Gregory Hainaut a595a09fbd gsdx: increase buffer to have crash in case of overflow
Avoid a crash on Onimusha3 (PAL 60HZ)

In theory it will be better to find the root cause of overflow. I.e. somewhere in this
code below. Dirty rectangle is too big.

***********************************************************************
if(rowsize > 0 && offset % rowsize == 0)
{
    int y = GSLocalMemory::m_psm[psm].pgs.y * offset / rowsize;

    if(r.bottom > y)
    {
        GL_CACHE("TC: Dirty After Target(%s) %d (0x%x)", to_string(type),
                t->m_texture ? t->m_texture->GetID() : 0,
                t->m_TEX0.TBP0);
        // TODO: do not add this rect above too
        t->m_dirty.push_back(GSDirtyRect(GSVector4i(r.left, r.top - y, r.right, r.bottom - y), psm));
        t->m_TEX0.TBW = bw;
        continue;
    }
}
***********************************************************************

So as a temporary solution (that will likely stay for a couple of
years), buffers were increased.
2015-12-28 21:40:06 +01:00
Gregory Hainaut 3e4c3353ce gsdx-ogl: missing break 2015-11-06 23:01:58 +01:00
Gregory Hainaut 0958b9db8e gsdx-ogl: use the standard openGL name
Function pointer was mangled to avoid any collision. Nowadays all symbols
are hidden so no risk of collision.

Syntax is nicer beside it would allow to put back GLES3.2. I think it
supports most of the used extension.

glActiveTexture & glBlendColor are provided without symbol query.
2015-10-17 17:05:15 +02:00
Gregory Hainaut d822b6bd1a gsdx-ogl: add some comments for the future 2015-08-08 09:17:06 +02:00
Gregory Hainaut b17803bb34 gsdx-ogl: wipeout of GL_ARB_bindless_texture
Code is completely broken. It doesn't help to improve speed.

Remove 200 lines ;)
2015-08-08 09:16:49 +02:00
Gregory Hainaut 46a1525668 gsdx-ogl: support various texture format creation
Such as GL_RGBA32F/GL_RGBA16F/GL_RGBA16UI/GL_RGBA16I/GL_RGBA16

Not yet used
2015-07-30 18:22:59 +02:00
Gregory Hainaut 6f9a89dcf2 gsdx-debug: print memory usage of all textures pools
It is a bit crude but it allow to see the impact of code and options.
2015-07-10 22:35:26 +02:00
Gregory Hainaut 3f6edc39cf gsdx-linux-gui: update option
Add mipmap for SW
Add tc depth for HW

Remove nvidia MT, always on
2015-07-01 09:36:54 +02:00
Gregory Hainaut 8393ba56d6 gsdx-ogl: rework palette texture handling
Redirect the red channel to alpha channel for 8 bits texture.

It avoid special management in the shader
2015-06-24 19:50:09 +02:00
Gregory Hainaut d3d5a436ea gsdx-ogl: add code to read back depth texture 2015-05-20 08:07:40 +02:00
Gregory Hainaut 2783da4a22 gsdx-ogl: use a local buffer to store offscreen texture
It will allow to read texture in // (and potentially could be useful
for recording)
2015-05-18 11:29:04 +02:00
Gregory Hainaut b1ea081fc3 gsdx-debug: improve tracing interface
Basically move the format and c_str() in the macro
2015-05-17 13:05:08 +02:00
Gregory Hainaut 8a73849531 gsdx-ogl: enable multithread driver by default for nvidia
+ add a linux gui option to disable it (for test purpose)
2015-05-16 15:22:20 +02:00
Gregory Hainaut 02b478dfbc gsdx: plug the new PNG wrapper
Drop various duplicated code :)
2015-05-16 12:47:28 +02:00
Gregory Hainaut 8341055f3e gsdx-ogl: don't enable ogl_texture_storage on catalyst 2015-05-16 00:31:25 +02:00
Gregory Hainaut cfddcb7a93 gsdx-ogl: typo 2015-05-16 00:31:25 +02:00
Gregory Hainaut 0f01ba4c46 gsdx-ogl: mega boost
Enable Nvidia multi thread driver optimization
Enable ogl_texture_storage by default (requires for the speed boost
, later the option will be removed)
2015-05-16 00:31:25 +02:00
Gregory Hainaut 6166c95325 gsdx-ogl: protect PBO with fence
Safer and doesn't impact perf too much.
2015-05-15 18:32:47 +02:00
Gregory Hainaut a5e424512c gsdx-ogl: really avoid consecutive clean 2015-05-15 16:00:46 +02:00
Gregory Hainaut 613e215c73 gsdx-ogl: add some note for the persistent buffer + add a flush
Persistent is slower (at least on my gs dump) because data is put
in  host instead of the video memory

I don't understand why upload the data directly to the video memory
is faster
2015-05-15 15:25:45 +02:00
Gregory Hainaut 5628bfb20c gsdx-ogl: drop old code
I have group so it doesn't pollute anymore gl trace
2015-05-15 15:25:45 +02:00