Commit Graph

2030 Commits

Author SHA1 Message Date
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
Gregory Hainaut edef3ad8c3 Merge pull request #1170 from PCSX2-Alpha/TC_Scaling
GSDX: Detect RT size based on display and frame registers.
2016-03-02 13:51:28 +01:00
Akash b07b06a9fb GSDX-Texture Cache: Rework scaling function
The following patch uses the height value of the display rectangle rather than make an estimation of the Frame buffer height when the game uses a non-referenceable height (or) width.
2016-02-24 09:14:01 +05:30
Gregory Hainaut cb776d2f50 gsdx:atomic: better match the old if(!_interlockedbittestandset(&m_mapped, 0)) behavior
Thanks @turtleli
2016-02-23 18:43:44 +01:00
Gregory Hainaut f9b4ff17a5 gsdx: drop interlocked* function on linux 2016-02-22 19:12:50 +01:00
Gregory Hainaut a601991f91 gsdx: add atomic for transaction scope object 2016-02-22 19:12:50 +01:00
Gregory Hainaut f904cd6c4a gsdx: add atomic for SW Renderer
V2: fix assertion
2016-02-22 19:12:37 +01:00
Gregory Hainaut 9bbb0fe1f6 gsdx: add atomic for texture upload
V2: fix init of atomic flag object
2016-02-21 18:17:53 +01:00
Gregory Hainaut a66c911fed cmake: factorize debug/dev define 2016-02-21 16:17:10 +01:00
Gregory Hainaut 9ba470fc63 gsdx-ogl: properly handle t_float in GS
f8c442cf76 misses the swap of t_float in GS

Fix regression in Okami

Bonus: factorize VS_WILDHACK in the VS
2016-02-21 11:48:30 +01:00
Gregory Hainaut bef8447447 Merge pull request #1186 from PCSX2/gsdx-unoptimize-vs
gsdx-ogl: make VS more generic
2016-02-20 10:39:19 +01:00
Gregory Hainaut 6002719c8c Merge pull request #1185 from PCSX2/tekken5-fast-depth
gsdx: no depth lookup optimization
2016-02-20 10:24:21 +01:00
Gregory Hainaut 1853d0d16d gsdx: no depth lookup optimization
Don't lookup a depth buffer if depth test is always pass without write

Boost performance on Tekken5 when depth emulation is enabled in openGL
(Tekken5 sets same address for both the RT and the depth but depth is disabled)

v2:
Keep ds if DATE is enabled (some implementation uses a stencil buffer)
Be more aggressive to avoid an useless depth lookup
2016-02-18 20:35:50 +01:00
Gregory Hainaut f8c442cf76 gsdx-ogl: make VS more generic
Texture coordinate could be dummy/float/int integral/int normalized.

Old behavior:
* VS was in charge to select the texture coordinate
* int integral format wasn't supported

New behavior:
* Always compute all formats
* FS will be in charge to select the good format

Impact:
* VS will be slightly slower but it reduces shaders permutation from
   little to 0 (won't be bad for CPU)
* FS speed isn't impacted as 2 separate code paths were already required
  to support both format
* Rasterizer will be 33% slower but unlikely to be the limited factor of
  the GPU
* In future we could directly use the integral format in the FS.

V2: remove useless PSin_t
2016-02-18 19:02:05 +01:00
Gregory Hainaut 0dadc124d3 gsdx-ogl: invert behavior of unsafe user hack
It would be on by default. Unsafe & fast path.

The hack is a security if someone encounters any issue

v2: update Windows gui file
v3: fix typo in tooltip and linux gui
2016-02-18 18:48:13 +01:00
netoale b910e20413 Update GSCrc.cpp
added french version of Simpsons The Game 0x5C1EBF61
2016-02-15 21:56:53 +01:00
refractionpcsx2 909584d473 GSDX: Disable Nvidia hack when in native res 2016-02-15 20:27:51 +00:00
Gregory Hainaut 8ae7f60b04 Merge pull request #1175 from PCSX2-Alpha/GSDX_stuffs
GSDX: Vertical frequency corrections and extra stuffs
2016-02-13 18:15:49 +01:00
Gregory Hainaut 77f9113301 gsdx-gl: use CONTEXT_FLAG_NO_ERROR_BIT_KHR to reduce driver overheard
Didn't test it yet as my driver is too old.

Note: might break the open source drivers.
2016-02-13 15:28:11 +01:00
Akash e810428c86 GSDX: Remove some old comments
Disgaea 2 intro FMV now works fine with/without upscaling. (confirmed
with rama)
2016-02-12 12:05:42 +05:30
Akash 465cfb4fad PCSX2-GSFrame: Make upscaling impact resolution values 2016-02-12 11:57:41 +05:30
Akash 67a7a63a36 GSDX: Add vertical frequency for all video modes 2016-02-12 05:28:30 +05:30
Akash 1445bf7fb1 GSDX: Extend macros for all video modes.
The following patch detects the other video modes based on Phased lock loop divider (LC)
2016-02-12 04:43:57 +05:30
Gregory Hainaut 253e801f51 linux: enable float operation on SSE unit
Potentially faster and requires to flush denormal float to 0
2016-02-09 18:24:12 +01:00
Gareth Poole 0b362fd866 GSdx: Fix spelling issues in GSdx Linux configuration window 2016-02-08 19:14:56 +01:00
Gregory Hainaut 51b40c6b18 gsdx: move black CRC hack from openGL to DX level
Rendering is much nicer this way
2016-02-06 17:32:12 +01:00
Jonathan Li 93dc772565 GSdx: Missed a _WINDOWS usage...
Visual Studio Find and Replace can only be trusted if all the files are
included in the project. I suppose it's time to add any missing files
to the relevant projects...
2016-02-04 19:12:46 +00:00
Gregory Hainaut 85f64b8c08 Merge pull request #1137 from PCSX2-Alpha/CRTC_Scaling
PCRTC: Proper handling for 720P/1080P video modes.
2016-02-01 10:11:58 +01:00
Akash c889659ad7 GSDX: Prevent a bad division
GetDeviceSize() already does a half division based on the INT and FFMD
registers.
2016-01-30 05:20:06 +05:30
Akash 7407162dfe GSDX: Add some nice macros 2016-01-30 05:19:53 +05:30
Gregory Hainaut 841df74010 gsdx: add info to get a working driver 2016-01-28 21:18:24 +01: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 2ff611137e pcsx2|lilypad|gsdx: use portable printf format
(portable: let's see VS compilation...)
2016-01-22 19:46:03 +01:00
Gregory Hainaut da4d3562f5 gsdx-ogl: update status of the SSO extension
AMD (proprietary) is working on it
Free driver will be fixed on Mesa 11.2 (and I hope mesa 11.1.2)
2016-01-22 09:28:59 +01:00
Gregory Hainaut 3f3141c186 GSdx-ogl: limit accurate sprite blending to smaller draw call
Completely restore speed in Zone of Ender

Fix #1093
2016-01-22 09:07:35 +01:00
Gregory Hainaut 69d585e867 Merge pull request #1114 from remeh/clang-unused-param
gsdx: cmake: don't display "unused parameters" warnings on release bu…
2016-01-22 08:07:07 +01:00
Akash 22fccd5143 GSDX: Add a nice debug message 2016-01-20 04:29:23 +05:30
Akash ebb6e34196 PCRTC: Fix video modes higher than 480P 2016-01-20 04:23:45 +05:30
willkuer fd412c2938 gsdx: Generic GSSetting
The old implementation saved the current value of a GSSetting as uint in
a field called 'id'. The  implementation of GSSettings suggests that
GSSettings  could be saved in a database with id as primary key. This
would require a translation look up from id to value but  could have all
advantages of a database. However the interface to GSSetting was never
implemented like that.

In the new implementation GSSetting has a 'value' field that stores an
int representative value of the desired state. Additionally the
constructor is 'overloaded' as template to reduce casting in the
consumer code. However all consumer values need to be castable to int.

Accordingly combobox initialization was adjusted.
2016-01-18 23:59:27 +01:00
Gregory Hainaut 5bf12519da Merge pull request #1105 from ssakash/CRTC_-NTSC-height-saturation
PCRTC: Better handling of CRTC height saturation
2016-01-17 16:38:59 +01:00
Gregory Hainaut 254081e3ad Merge pull request #1115 from turtleli/gsdx-ogl-blend
gsdx-ogl: Improve accurate blend sprite draw speed
2016-01-17 15:42:07 +01:00
Jonathan Li 37deeb0d52 gsdx-ogl: Optimise overlap detection algorithm
Vectorise coordinate min/max sorting, and use the ordered runion
instead.
2016-01-16 19:21:56 +00:00
Jonathan Li 14dffa762b gsdx: Add runion_ordered to GSVector
Allows to save a few instructions cycles when xy and zw are already
sorted (min and max rectangle coords).
2016-01-16 19:21:55 +00:00
Jonathan Li 2fc3ef8124 gsdx-ogl: Add sprite overlap statistics to debug messages 2016-01-16 19:21:54 +00:00
Gregory Hainaut 35568f6425 gsdx: disable simd in 64 bits
Let's concentrate first on SSE2

This commit fuses a couple of ifdef
2016-01-16 14:34:00 +01:00
Gregory Hainaut 022cd9cd64 gsdx: s/u32 pointer/uptr/ 2016-01-16 14:34:00 +01:00
Jonathan Li 74ace74d50 gsdx-ogl: Group non-overlapped accurate blend sprite draws
Reduces the number of draw calls and barriers when drawing sprites.
2016-01-13 08:07:53 +00:00
Jonathan Li f3b6829c74 gsdx-ogl: Restart collision detection algorithm for remaining sprites
It's useless on its own, but it prepares for the next commit.
2016-01-13 08:02:42 +00:00
remeh 28cfd50f08 gsdx: cmake: don't display "unused parameters" warnings on release build with clang. 2016-01-12 13:42:47 +01:00
Akash aade5278d8 PCRTC: Better handling of CRTC height saturation 2016-01-10 21:47:59 +05:30
Gregory Hainaut 7c7de87fcf Merge pull request #1078 from PCSX2/gsdx-unsafe-fbmask
Gsdx unsafe fbmask
2016-01-08 19:26:14 +01:00
Gregory Hainaut 3451f7e760 gsdx-ogl: handle invalid gl_lengh in debug message
Mesa intel sets it to -1.

Close #1089
2016-01-07 21:49:17 +01:00
Akash 8c5c73ea4b GSDX: Fast blending option for windows 2016-01-03 15:40:04 +01:00
Gregory Hainaut 24be4b4969 gsdx-ogl: remove unsafe fbmask of the free SW blending
Initially it was free to do the SW blending because safe fbmask
will already do a sw blending.

Unsafe version uses a fast path with a limited blending. Therefore
SW blending isn't free anymore.

Improve the speed of the previous speed hack (xenosaga 1)
2016-01-03 15:39:45 +01:00
Gregory Hainaut bb15e54438 gsdx-linux: add a new gui entry for the previous hack 2016-01-03 15:39:45 +01:00
Gregory Hainaut 0d25a0592a gsdx-ogl: fast blending accurate hack
The hack relies on the undefined behavior of the hardware so it can
potentially generate rendering corruption.

This new hack drops the cache flusing when only the alpha channel is masked.
Alpha is a direct copy of the fragment. Normally masked bits will be constant
everywhere (RT, FS output, texture cache) so it would likely work.

Just in case, code is only enabled with the new shiny hack
2016-01-03 15:39:45 +01:00
Jonathan Li bb37d1c339 gsdx:windows: Don't change renderer when changing adapter
The previous behaviour loaded the saved renderer config whenever the
adapter combobox was changed. The renderer will now only change if the
new adapter doesn't support the currently selected renderer (i.e
Direct3D11 might not be supported, so it'll revert to Direct3D 9).

Fixes #1080.
2016-01-02 22:20:30 +00:00
Jonathan Li 12e80c271b gsdx:windows: Widen Hacks dialog slightly
The Wild Arms Offset text was slightly cut off due to the label being
too small. Make the dialog slightly wider so the full text will fit.

Someone should probably make the dialog look nicer at some point.
2016-01-02 22:17:30 +00:00
Gregory Hainaut fc98fc9781 gsdx: only enable "please fix me" message on debug build 2016-01-02 18:53:15 +01:00
Gregory Hainaut 7aae0ce394 gsdx ogl: minor string update 2016-01-01 14:43:47 +01:00
Gregory Hainaut 902e295089 gsdx: fix onimusha crash in custom resolution
I don't understand why but it seems it needs more than 8MB
2015-12-30 19:14:52 +01:00
Gregory Hainaut bfa53af50f gsdx linux: fix ShadeBoost option case 2015-12-30 19:14:52 +01:00
ramapcsx2 d84d765aeb whops 2015-12-30 18:53:38 +01:00
ramapcsx2 8e3aec8aaf gsdx dialog: renderer order and naming changed. due to many factors, we can't yet remove any of the software options. naming / order changes are possible though, if a majority votes for it. 2015-12-30 18:06:54 +01:00
Kingcom 191453d89a gsdx: fix windows compilation 2015-12-28 22:05:01 +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 c36fccdd8e gsdx: fix crash when preload data frame is enabled
Height of the dirty rectangle must be the GS size of the RT. Of course
RT doesn't have any height so we compute the max safest value.

Fix issue #987

Candidate for 1.4 release
2015-12-28 18:00:14 +01:00
ramapcsx2 ef62d753d1 Merge pull request #1056 from ssakash/gsdx_swthreads
GSDX: Some change to software rendering threads
2015-12-28 17:23:32 +01:00
willkuer 0c4b25bcec gsdx: defaulting extra rendering threads to 2 2015-12-28 01:05:25 +05:30
Gregory Hainaut ac0d7f74cf gsdx: reorder renderer config code & fix linux gui
Group all DX option into a unique section (avoid tons of ifdef)

Rename Null renderer as "None (Core Benchmark)"
2015-12-27 11:24:05 +01:00
Akash 21c6fa5f1b gsdx-gui: Label and Tooltip changes to RT option 2015-12-23 19:51:13 +05:30
Akash acb82389c8 GSDX: disable SW mode options on hardware renderer 2015-12-23 12:30:22 +05:30
Akash 5e67276b6c GSDX-OCL: remove OCL device combobox from GUI
The following patch hides the combobox from the GUI when ENABLE_OPENCL macro is not defined.
2015-12-22 04:15:56 +05:30
ramapcsx2 3fd0b10762 small fix for WinXP / GSdx renderer cleanup 2015-12-21 19:53:36 +01:00
ramapcsx2 3210740872 Patch by r5 that reorders renderers in GSdx' config dialog. Also removes some redundant options. 2015-12-21 19:30:03 +01:00
Gregory Hainaut 077f06562f gsdx-linux: use standard code for the renderer box
Fix the openCL issue and code is cleaner
2015-12-20 19:33:39 +01:00
ramapcsx2 9092be3a52 GSdx: better default renderer selection. Thanks, Gregory :) 2015-12-20 16:03:58 +01:00
ramapcsx2 16231f599b Merge branch 'master' of https://github.com/PCSX2/pcsx2 2015-12-20 14:47:27 +01:00
ramapcsx2 43b9caf735 GSdx: default renderer to DX11 hw. SPU2-X: default output module to xaudio2 (portaudio has issues selecting the proper hardware device) 2015-12-20 14:46:59 +01:00
Gregory Hainaut cae0ac2d3f gsdx: change gl reporting color message 2015-12-20 14:15:46 +01:00
Gregory Hainaut b1d7f0e3fd gsdx: remove openCL from the ini if it isn't enabled 2015-12-14 10:00:28 +01:00
Jonathan Li 2e1ea22532 gsdx: Make TV Shader F7 toggle temporary
Both the Linux and Windows config dialogs now have a TV Shaders combobox,
so the F7 toggle can be made temporary. This makes the hotkey behaviour
consistent with all the other hotkeys.
2015-12-02 19:45:24 +00:00
Jonathan Li 6e5b8c25dd gsdx:windows: Adjust dialog margin values 2015-12-02 19:07:36 +00:00
Jonathan Li 0f2cb4e2f5 Merge pull request #993 from ssakash/GSDX_dlgchanges
gsdx:windows: Add TV shaders and change GUI design
2015-12-02 18:58:09 +00:00
ramapcsx2 4c765a04f7 Change an outdated GSdx comment. It may confuse people nowadays. 2015-12-01 21:36:23 +01:00
Akash 1c6a717e93 GSDX: New shader dialog 2015-12-01 15:01:12 +05:30
Gregory Hainaut a026a1979f gsdx linux: align checkbox text vertically
like Windows :p
2015-11-28 13:24:12 +01:00
Akash 8b6ad4ff85 GSDX-TC: check userhacks for preload data frame 2015-11-22 10:49:46 +05:30
Gregory Hainaut df87b64ca5 gsdx-linux: left align label 2015-11-20 17:36:03 +01:00
Gregory Hainaut a41308e8c3 gsdx-linux: add a gui option for the tv shaders 2015-11-20 17:36:03 +01:00
Gregory Hainaut 19c9a0b441 gsdx: remove aggressive threading
http://wiki.pcsx2.net/index.php/PCSX2_Documentation/Threading_Basics
2015-11-20 17:36:03 +01:00
Gregory Hainaut 7a69812b17 Merge pull request #927 from PCSX2/preload-rt
gsdx-tc: extend preload frame hack to load target too
2015-11-16 09:36:31 +01:00
Jonathan Li 96c921c776 gsdx: Update DirectX end user runtimes URL
The old one isn't working. I don't think there's a URL that redirects to
whatever language the user is using (unless my browser settings are
wrong), so I've just used the English US URL.
2015-11-15 22:10:00 +00:00
Gregory Hainaut 67551f31fd gsdx: use constant expression in offsetof
Well previous expression was a constant already but
compiler failed miserably.
2015-11-13 18:38:48 +01:00
Gregory Hainaut 7eb0f3564b gsdx: AVX is M_SSE == 0x500
0x501 is for AVX2
2015-11-13 18:29:34 +01:00
Gregory Hainaut 967cc0b37b gsdx: align variable 'offsetof' of x64.avx with x86 2015-11-13 18:25:23 +01:00
Gregory Hainaut 3fea5779df gsdx: align sprite test of x64.avx with x86.avx 2015-11-13 18:25:23 +01:00
Gregory Hainaut 736656f7d6 gsdx: properly defined type for xbyak
Compatible 64 bits and avoid local modification
2015-11-13 09:30:48 +01:00
Johannes Obermayr f4a76c48c2 Use GLsizeiptr on Mesa >= 20150122.
Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
2015-11-12 21:21:13 +01:00
Gregory Hainaut 9b2b024721 gsdx-linux: add the preload gs hack option 2015-11-12 21:00:10 +01:00
Gregory Hainaut ef3aa17025 gsdx-ogl: disable useless Nvidia driver message 2015-11-12 17:04:54 +01:00
Gregory Hainaut d67ba015c5 Merge pull request #962 from ssakash/GSDX_sizechecks
GSDX: Improve FB size handling
2015-11-12 12:17:31 +01:00
Gregory Hainaut c12958bf10 gsdx: sign-compare
Need review
2015-11-12 12:11:44 +01:00
Gregory Hainaut abb4cb4810 plugin API: use const char* insead of char*
I hope it doesn't change the ABI

v2: fix GSnull/zzogl/zerogs
v3: duplicated code on windows...
2015-11-12 12:11:42 +01:00
Jonathan Li 4eb57cde0e gsdx: Adjust current renderer message
The leading space was really annoying me. Also make the variable local
instead of static.

And fix a bad indentation.
2015-11-11 18:52:52 +00:00
refractionpcsx2 52802371e4 GSdx D3D11: Workaround for Gust games, must enable sprite hack (which these games need anyway) and it will fix the squares caused by the Nvidia fix. Not a perfect solution but we can't have it both ways :( 2015-11-10 22:58:53 +00:00
willkuer 9245d3ed7e gsdx: RendererEnum
1. Add GS_Renderer Enum

Replace all instances of int/uint32 renderer identifier by a strongly
typed enum and appropriate casts.

Only instances in GS[*].cpp/h classes were touched. GPU[*].cpp/h classes
do not to follow the same convention.

2. Add default renderer according to OS

The default renderer is OS dependent (Win -> Dx9HW, others -> OGLHW).
Consequently one should always check againt the appropriate default
value on config load.

The old behaviour was only - if a at all - problematic if the respective
element in the gsdx.ini was missing and probably even then didn't create
issues. The current implementation is still more stable and does not
depend on the implementation of GS.cpp -> GetConfig()
2015-11-10 00:26:39 +01:00
Jonathan Li 44d89308c9 Revert "Revert "gsdx|spu2-x: Use atlcomcli.h for CComPtr definition""
This reverts commit 9bb990e9ed.

Fight! Ahem...
2015-11-09 20:55:07 +00:00
Akash d5ba546d2e GSDX: Improve CRTC output size handling 2015-11-09 05:52:42 +05:30
Jonathan Li 9bb990e9ed Revert "gsdx|spu2-x: Use atlcomcli.h for CComPtr definition"
This reverts commit 0eb771c2a6.

The buildbot apparently cannot find atlcomcli.h. Oh joy.
2015-11-08 20:46:41 +00:00
Jonathan Li 49ff324882 Merge pull request #955 from turtleli/replace-comptr-h
gsdx|spu2-x: Use atlcomcli.h for CComPtr definition
2015-11-08 13:27:28 +00:00
Gregory Hainaut 4ef0572ceb gsdx-ogl: disable copy constructor
'class GSVertexBufferStateOGL' does not have a copy constructor which is recommended since the class contains a pointer to allocated memory.
2015-11-06 23:01:59 +01:00
Gregory Hainaut 3e4c3353ce gsdx-ogl: missing break 2015-11-06 23:01:58 +01:00
Gregory Hainaut 9f1649ae57 gsdx: use a type in sizeof
(warning) Suspicious usage of 'sizeof' with a numeric constant as parameter.
2015-11-06 23:01:58 +01:00
Gregory Hainaut 7c6d2361af gsdx: use scalar delete
(error) Mismatching allocation and deallocation: data
2015-11-06 23:01:58 +01:00
Gregory Hainaut f3394b16b8 gsdx: use standard quote character
Nicer with tool that support ANSII text (cppcheck)
2015-11-06 23:01:58 +01:00
Jonathan Li 0eb771c2a6 gsdx|spu2-x: Use atlcomcli.h for CComPtr definition
VS2013/VS2015 community includes it, so everything will still compile
for everyone.

Also delete common/include/comptr.h.
2015-11-06 18:52:33 +00:00
Jonathan Li 4ab092d011 Merge pull request #911 from ssakash/gsdx_debug
Gsdx: Add Mipmap (Software mode) and preload data frame to GUI.
2015-11-06 13:01:49 +00:00
Akash 754a7eb7de GSDX: Update toggle key messages 2015-11-06 01:47:53 +05:30
Akash d866b5592e GSDX: Add two new options to GUI.
The following patch adds Mipmap option (software mode exclusive) and Preload Data Frame (Hardware mode exclusive) to the GSDX plugin settings for debug purposes.
2015-11-06 01:47:44 +05:30
Gregory Hainaut 5ba41306ea gsdx-tc: HasSharedBits uses PSM not address
Nice heap overflow. I'm surprised that it kinda worked.
2015-11-02 07:36:37 +01:00
Gregory Hainaut 59be6c8710 gsdx: protect some options to avoid buffer overflow
Keep TVShader/interlace/aspectratio in the legal range.

Avoid a crash if the user (aka me) edit the ini file with bad value.
2015-10-25 21:44:20 +01:00
Gregory Hainaut b87cda94c5 Merge branch 'glsl-fix-tv-shaders' of git://github.com/turtleli/pcsx2 into turtleli-glsl-fix-tv-shaders 2015-10-25 21:23:39 +01:00
Gregory Hainaut bba67fbd83 Merge pull request #912 from PCSX2/accurate-blending-issue-762
gsdx-ogl: PrimitiveOverlap requires real rectangle
2015-10-25 20:55:41 +01:00
Jonathan Li 1659d5974e gsdx-ogl: Fix scanline, diagonal, triangular TV shaders
PSin.p is normalised, so integer conversions won't work. Use
gl_FragCoord instead.
2015-10-25 19:20:22 +00:00
Gregory Hainaut 50e6306331 Merge pull request #919 from ssakash/coverity_init
Coverity: Initialize class members
2015-10-25 20:08:46 +01:00
Gregory Hainaut 03bf1ec7b3 gsdx-tc: extend preload frame hack to load target too
The goal is to check the impact on game that have wrong RT content.

It helps a bit Smash Court Tennis Pro Tournament 2 but the game suffers
another texture cache bug. (RT BW is 10 whereas texture BW is 8)

Note: Armored Core: Last Raven must be tested (only game so far
that rely on the option and I didn't want to add a new one).
2015-10-25 15:26:38 +01:00
Gregory Hainaut 295f867118 gsdx: invalid alpha after an EE write
Typical wrong draw:
1/ draw in 32 bits
2/ draw in 24 bits
3/ Use alpha as a texure. (Must reuse the GPU data)
4/ Write alpha from EE
5/ Use alpha as a texure. (Must upload new data)

This commit fixes the step 5.

Fix #917 (Conflict - Desert Storm)
2015-10-24 16:23:50 +02:00
Gregory Hainaut 5cbd0cf42a gsdx-debug: add more push/pop debug group on the init 2015-10-24 14:14:37 +02:00
Gregory Hainaut 9ba949c2d9 gsdx-debug: support correct logging on mesa
By default low severity message were disabled. (thanks to be open source)
2015-10-24 14:14:37 +02:00
Akash c1f1646dab GSDX: Initialize class members
CID 146973 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)2. uninit_member: Non-static class member overflow is not initialized in this constructor nor in any functions that it calls.
2999}
2015-10-23 01:35:15 +05:30
Gregory Hainaut 87001326f6 gsdx: remove 4Y-old unused code
It was never used.
2015-10-22 19:51:03 +02:00
Gregory Hainaut a8968257db glsl: keep fract in [0;1] range
Shin Megami Tensei Lucifers seems to generate infinites values.
I suspect that DX always clamp fract output.

Finally fix #782 !
2015-10-22 18:36:45 +02:00
Gregory Hainaut c0d0e2e89d gsdx-ogl: PrimitiveOverlap requires real rectangle
runion/rempty/rinter requires x < z and y < w

Help issue #762 (accurate blending issue)

If you want to shine, please put better GSVector code (AVX512 is 2 instruction :p)
2015-10-22 12:34:50 +02:00
Gregory Hainaut 92553add8e gsdx-ogl: accurate date regression. Bad interaction between depth & DATE
In the DATE42 algo, first pass must find the primitive that write the
bad alpha value. If depth test is fail, alpha value won't be written therefore
you mustn't keep the primitive id.

In theory to ensure 100% correctness, depth would need to be fully executed
(currently depth write is disabled). However it requires to copy the depth buffer.
It is likely bad for the perf.

Issue reported on DBZInfWorld
2015-10-22 12:31:51 +02:00
Gregory Hainaut 6561fbc831 gsdx-ogl: only enable aniso when sampling from the HW texture unit
Potentially help issue #884
2015-10-22 12:21:43 +02:00
Gregory Hainaut 826319ce34 gsdx-ogl: check null pointer
CID 151735 (#1 of 1): Dereference after null check (FORWARD_NULL)
61. var_deref_model: Passing null pointer rt to CopyRectConv, which dereferences it
2015-10-21 20:10:16 +02:00
Gregory Hainaut 395b4c25f3 Merge pull request #899 from ssakash/gsdx_nullcheck
gsdx: use old size of target if ds and rt is null
2015-10-18 19:25:39 +02:00
Gregory Hainaut d5e0899955 oups collision with ref commit 2015-10-18 11:19:39 +02:00
Gregory Hainaut f99882c61c gsdx-ogl: keep gl_ActiveTexture & gl_BlendColor (fix MS compilation)
It seems openGL ABI isn't exactly the same between Windows and my PC.
2015-10-18 11:18:19 +02:00
refractionpcsx2 179a4cead5 GSdx: Fix compilation 2015-10-18 02:01:56 +01:00
Akash 294b8d3c6e gsdx: use old size of target if ds and rt is null
CID 146843 (#1 of 1): Dereference after null check (FORWARD_NULL)6. var_deref_model: Passing null pointer ds to GetSize, which dereferences it.
2015-10-17 22:47:44 +05:30
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 1c8f8a00b8 Merge pull request #894 from ssakash/coverity_fix
Coverity: Prevent NULL dereferences and other stuffs.
2015-10-17 16:00:28 +02:00
Akash fedd07e4a8 gsdx: prevent a potential division by zero
CID 146834 (#2-1 of 2): Division or modulo by zero (DIVIDE_BY_ZERO)9. divide_by_zero: In expression tpf * 10000ULL / ttpf, division by expression ttpf which may be zero has undefined behavior.
2015-10-17 11:26:11 +05:30
Akash 04b765a674 gsdx: check for null deference.
CID 146839 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)11. var_deref_model: Passing null pointer fb_pages to UsePages, which dereferences it.

CID 146840 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)11. var_deref_model: Passing null pointer zb_pages to UsePages, which dereferences it.

* Prevent a potential null pointer deference in ```void GSRendererSW::UsePages()```
2015-10-17 09:14:07 +05:30
Gregory Hainaut 03bc304ecf gsdx-ogl: fix colclip regression when accurate blending is enabled
Fix #865
2015-10-16 22:07:50 +02:00
Jonathan Li 39dc23e83b gsdx:windows: Widen and rearrange GUI
All combobox text can now be seen in full without having to click on the
combobox.

The internal and custom resolution stuff has been moved into the Hardware
Mode Settings groupbox since it doesn't affect software mode.

The dialog has also been rearranged a bit.
2015-10-03 22:33:55 +01:00
Jonathan Li 64cccda076 gsdx:windows: Add external shader selection to GUI
This lets Windows users select the external shader and config file via the
GUI.

Also, comment out an unused variable in the Hacks dialog code.
2015-10-03 22:33:15 +01:00
Jonathan Li a57b2a059a gsdx:windows: Add file selection support
The file open dialog will be usable for all GSdx dialogs if required.
2015-09-28 12:45:14 +01:00
Jonathan Li c0137227e6 gsdx:dx: Allow selection of external shader/shader config
shaders/GSdx.fx is now the default location and is no longer hardcoded.
The external shader and external shader config can now be selected. (The
OpenGL renderer already has this feature.)

Note: It is still possible to not use a config file, just use an invalid
value for shaderfx_conf.
2015-09-28 12:45:13 +01:00
Jonathan Li df98c766e5 gsdx:dx9: Refactor shader compilation code
Don't use D3DX compile from file and compile from resource functions -
use the compile from memory function instead. It does the same thing,
except you have to set things up yourself.

Benefits:
Allows external shaders to be split into a config file and a shader file
without hardcoding the config file name.
Less code.

Yes, I more or less used the same message as the dx11 one.
2015-09-28 12:45:13 +01:00
Jonathan Li fabd6075ef gsdx:dx11: Refactor shader compilation code
Don't use D3DX compile from file and compile from resource functions -
use the compile from memory function instead. It does the same thing,
except you have to set things up yourself.

Benefits:
Easier move to D3DCompile when it becomes necessary.
Allows external shaders to be split into a config file and a shader
file without hardcoding the config file name.
Less code.
2015-09-28 12:45:12 +01:00
Gregory Hainaut c7000355fe gsdx-ogl: flush debug file before exiting the application 2015-09-28 09:41:30 +02:00
Jonathan Li cbd2417833 gsdx:ogl:windows: Fix calling convention mismatch
OpenGL does not use the cdecl calling convention (which is the default
calling convention for GSdx on Windows). Since DebugOutputToFile is used
by OpenGL, it needs to use the same calling convention that OpenGL uses.

This fixes a debug build crash when the OpenGL renderers are used and
debug_opengl is nonzero in the ini.
2015-09-26 22:38:05 +01:00
Gregory Hainaut 00e37224ed gsdx: check the return value of mkdir function
Reported by coverity
2015-09-26 13:51:23 +02:00
Gregory Hainaut 78b73ba585 gsdx: avoid null pointer deferencement 2015-09-25 20:59:36 +02:00
Gregory Hainaut 5fb8c7e65c gsdx: initialize members in constructor of objects
A couple of useless members were removed too.

Also fix wnd initialization

Coverity:
CID 146955 (#1 of 1): Uninitialized pointer read (UNINIT)
18. uninit_use: Using uninitialized value wnd[i].
2015-09-23 09:46:53 +02:00
Gregory Hainaut c4a3d57499 gsdx: protect fscanf string read
Coverity:
CID 146816 (#1 of 1): Calling risky function (DC.STREAM_BUFFER)
dont_call: fscanf(FILE *, char const *, ...) assumes an arbitrarily large string, so callers must use correct precision specifiers or never use fscanf(FILE *, char const *, ...)
2015-09-23 09:39:09 +02:00
Gregory Hainaut 7bec15b99f gsdx: remove useless condition check
Base pointer and format are always positive (unsigned int BTW) so drop
>= 0 comparison
2015-09-23 09:39:08 +02:00
Avi Halachmi (:avih) cee0b795ee Recording: handle cancel (at the GS[dx] dialog) gracefully
Without this patch, if a user initiates a recording and then cancels at the GSdx
dialog, the audio was recording anyway, which is probably highly unexpected.

However, while probably highly unexpected, it could still be useful to record
only audio, but with this patch it's now impossible.

We can reconsider if it turns out that people are actually using this "feature",
though one might as well set the video setting to be very unobtrusive (very low
resolution/bitrate) such that it uses very little CPU.
2015-09-22 01:11:25 +03:00
Avi Halachmi (:avih) 4474d4391b GSdx: capture - print recomended resolution and DAR to the console
This is the internal resolution which GSdx uses and recording at this resolution
is optimal, i.e. without any dumb scaling, with all relevant pixels and without
redundant pixels.

The resulting clip still doesn't have the correct aspect ratio set, but that's
just a property which can be set to the clip afterwards, which is where the DAR
becomes useful. Since it's usually anamorphic, when muxing later with the audio
use the DAR to set the playback aspect ratio.
2015-09-22 01:11:13 +03:00
Avi Halachmi (:avih) 3f81fc98dd gsdx: custom resolution - use 0 instead of 9 2015-09-22 01:00:53 +03:00
Jonathan Li 4208267966 gsdx|spu2-x:windows: Scale GUI logo with DPI
The SS_REALSIZECONTROL style resizes image to fit the control window, so
let's use that.
2015-09-21 20:45:50 +01:00
Jonathan Li c088039394 gsdx:linux: Fix clang compile
Everything seems to compile and run with clang 3.7.0 now. I don't know
if clang 3.6.x works or not. 3.5.x doesn't.
2015-09-21 20:45:50 +01:00
Jonathan Li 69d27dfb4b Merge pull request #829 from ssakash/rework_internalres
gsdx changes:
Remove native resolution checkbox from GUI and rework associated code
Small changes to Windows and Linux GUI
Support 8x native resolution
Fix custom resolution width less than native width use case
2015-09-21 20:12:47 +01:00
Gregory Hainaut d42cef891c gsdx: remove ALIGN_STACK feature on GCC
Stack is already aligned correctly. Besides GCC optimizes the variable so it doesn't
have any effect except that it generates useless warnings.
2015-09-20 22:19:45 +02:00
Gregory Hainaut 9b69afe541 gsdx-ogl: typo that broke TC offset hack 2015-09-20 22:19:45 +02:00
Gregory Hainaut b60dd9d1fe Merge pull request #814 from PCSX2/coverity-qa-high
Fix a bunches of coverity warning/errors.
2015-09-20 22:18:03 +02:00
Avi Halachmi (:avih) 94c5eab776 GSdx: capture dialog - actually remember the last used codec
Previously it was saving the display name to the config but trying to restore
according to the friendly name.

Now store and restore according to the "displayName" which is more unique than
"friendlyName" since it includes GUID[s], and handle it consistently as _bstr_t.
2015-09-20 20:04:36 +03:00
Jonathan Li d4f6894e1b gsdx: Fix custom resolution and minor cleanup
This fixes the following issues when custom resolution is selected.
 - When the width is smaller than the native resolution width, the
   texture cache targets are removed on every Vsync signal, causing a
   black screen issue.
 - The texture cache code needs a 1 returned for the custom resolution
   upscale multiplier or there'll be some really funny graphical issues.

It also removes unnecessary GetConfig (which I think unconditionally
does a a file read on Windows) calls if the width was increased - the
upscale multiplier is already stored, and the custom resolution width
and height calls are now unnecessary.

Also fix some whitespace issues.
2015-09-20 07:49:46 +05:30
Gregory Hainaut 28191baa80 gsdx-linux: merge native/upscaling/custom into a single box 2015-09-20 07:49:44 +05:30
Akash a9b0cfc519 GSDX: Add 8X native to Internal resolution. 2015-09-20 07:49:32 +05:30
Avi Halachmi (:avih) 54afd377ee GSdx: recording: Progressive: make the recorded clip play at full speed
Before this patch, when recording Progressive (frame) mode, it recorded all
the frames correctly but set the clip's fps property to 25/29.97, so when
played back it played at half the speed (but was fine when played at double speed).

This patch does not affect the number of frames recorded per second, but rather
only sets the resulting clip fps property to the correct one (double than before).

Also fixes a bug that in a non-managed window in progressive mode, the title
displayed "200%" speed when it should have displayed 100% speed.

Fixes #832
2015-09-19 14:44:48 +03:00
Akash b97018932d GSDX: Rework Internal Resolution function
upscale_multiplier function values have been changed to allocate native resolution and also move custom resolution to 9.
Remove the old native checkbox value and include Native in the combo box.
Internal GSDX functions have also been updated with this new update to the upscale_multiplier variable.
2015-09-14 10:26:27 +05:30
Miguel A. Colón Vélez 4760d71a86 Remove the remaining postbuild stuff.
The bot should work now.
2015-09-13 04:33:17 -04:00
Jonathan Li 239306e9a2 pcsx2|gsdx:linux: Fix posix_memalign
The AddressSanitizer can be used on Linux again. Well, PCSX2 doesn't get
very far when it's used though.
2015-09-12 09:58:00 +01:00
Gregory Hainaut cee0fde940 gsdx-tc: improve support of TEXA register
* Greatly reduce the number of clut read (factor 10x)
* Avoid to get wrong TEXA texture in the cache.
* Fix "jump depends on uninitialized variable" Valgrind warning.

Fix #748

I try my best to avoid any breakage of DX but please test it too.
2015-09-11 14:16:11 +02:00
Gregory Hainaut 78569ee833 gsdx-ogl: redo properly the setup of texture format
* add lengthly comment to explain the format
* Likely reduce the number of shader permutation
* Avoid slow AEM (on GPU)

Expect regressions because TC needs some fixes

v2: fix palette mode
2015-09-11 14:14:22 +02:00
Gregory Hainaut 2430abed33 gsdx: potential division by zero
CID 146833 (#2-1 of 2): Division or modulo by zero (DIVIDE_BY_ZERO)
divide_by_zero: In expression this->m_width / this->m_upscale_multiplier, division by expression this->m_upscale_multiplier which may be zero has undefined behavior.
2015-09-11 08:54:29 +02:00
Gregory Hainaut e6d1a4cccf gsdx: avoid a potential division by zero
CID 146835 (#1 of 1): Division or modulo by float zero (DIVIDE_BY_ZERO)
50. divide_by_zero: In expression (float)(end - start) / (float)frame_number, division by expression frame_number which may be zero has undefined behavior
2015-09-11 08:54:29 +02:00
Gregory Hainaut 2934a15902 gsdx: remove a duplicated check 2015-09-11 08:54:29 +02:00
Gregory Hainaut ac8f4e69d6 pcsx2|gsdx: avoid potential null deferencement 2015-09-11 08:54:29 +02:00
Miguel A. Colón Vélez 26e2b4a5be Rename Release/Debug SSE2 to Release/Debug. 2015-09-08 23:17:07 -04:00
Gregory Hainaut ddc03cbccf gsdx: add a nice enum to replace the hardcoded convert shader 2015-09-08 16:51:24 +02:00
Gregory Hainaut 1ae0fed83b gsdx: fix a regression due to the shader renaming 2015-09-08 16:06:15 +02:00
Gregory Hainaut 81e056e79a gsdx: always enable the boost queue
ifdef was for VS2010

GSThread.h is useless. I keep it for the transactional queue implementation
2015-09-08 14:43:09 +02:00
Gregory Hainaut 3706cfe908 gsdx: always enable CXX11 mutex feature.
ifdef was only useful for VS2010
2015-09-08 14:34:17 +02:00
Gregory Hainaut ca9b5ce11d gsdx-ogl: move depth conversion shader
Add 2 new shaders:
* ps_main12: cast a 16 bit depth to a RGB5A1 color
* ps_main16: cast a a RGB5A1 color to a 16 bit depth

Shader might be used in future commit as it seems Silent Hill uses this
kind of format.

Fix tab/indentation too
2015-09-08 12:41:05 +02:00
Gregory Hainaut 4eed4ca3a1 gsdx-debug: restore 16 bit dump format in the SW renderer
Actually dump both 32/16 bits (former for texture shuffle and later
for real 16 bits RT)
2015-09-08 12:41:05 +02:00
Jonathan Li 9052930ebc Merge pull request #791 from turtleli/gsdx-gui-changes
Add tooltips to Windows GUI. Fixes #578.
Rearrange Window GSdx GUI a bit.
Reformat tooltip descriptions to be both Linux and Windows (un)friendly.
Add new tooltip descriptions.
2015-09-03 22:49:41 +01:00
Jonathan Li e5f045c375 gsdx: Add new tooltips and descriptions.
For Linux and Windows, add tooltip descriptions for AF, AA1, extra
rendering threads, Enable Shade Boost, FX Shader/External Shader, FXAA.

For Windows, also add Alpha Correction and Logarithmic Z tooltips.

For Linux, add software mipmap tooltip.

Thanks to tsunami2311, ssakash, gregory38 and whoever did the wiki for
helping with descriptions.
2015-09-01 19:25:28 +01:00
Jonathan Li 55adc7e728 gsdx: tooltip description formatting and minor fixes
The hack description box messages were replaced by tooltips on Windows,
so there is no need for the first line in the description to refer to
the hack anymore.

3-state checkboxes were also converted to comboboxes, so remove any
references to checkbox states.

Reformat the descriptions so it looks okay on both Windows and Linux.
Could be better, but I'm out of ideas.

Also fix a few typos and missing punctuation.
2015-09-01 19:25:27 +01:00
Jonathan Li b687b106f1 gsdx: Removed unnecessary defines and functions
The changes to the Hacks dialog removes the need for these defines.

Also remove the swap_state function since it's now unused.
2015-09-01 19:25:26 +01:00
Jonathan Li c72b4d6e8a gsdx:windows: Rework hacks dialog to use tooltips
Changes the three-state checkboxes to comboboxes.
Removes the hack description box.
Hides Alpha and Alpha Stencil when OpenGL is selected.
Rearranges the hacks dialog.
2015-09-01 19:25:26 +01:00
Jonathan Li fcc8a941b0 gsdx:windows: Redo main dialog
This moves the hardware, non-renderer dependent options to the top and
makes the renderer options visible only when it affects the current
renderer.

The texture filtering checkbox has been changed to a combobox and now
uses the same description as Linux does.

Also changes the Title to GSdx Settings.
2015-09-01 19:25:25 +01:00
Jonathan Li e6b9805167 gsdx:windows: Show tooltips on main dialog 2015-09-01 19:25:25 +01:00
Jonathan Li 48bba4d581 gsdx:windows: Add tooltip support
Tooltips will be usable for all Gsdx dialogs if required.
2015-09-01 19:25:24 +01:00
Gregory Hainaut bdc8038e7e glsl: set a size to gl_ClipDistance array
The purpose is to avoid issue on MS-Intel driver without
a dedicated hack in the compilation.

Code doesn't use it so I suspect others implement to discard the
statement.
2015-08-25 18:58:39 +02:00
Gregory Hainaut a1957a685d glsl: drop an useless min in FS
GPU will clamp color anyway. It reduces the number of instruction of 25% (4->3)
2015-08-25 18:58:39 +02:00