Commit graph

2196 commits

Author SHA1 Message Date
Ryan Houdek
8bb8446e34 Enables usage of GLSL textureSize on Qualcomm v66.
Qualcomm's v66 drivers have a working textureSize() function now.
Enable usage of it.
2014-05-05 08:50:13 -05:00
magumagu
2e464800bc VideoCommon: correctly compute whether an indirect texture stage is active.
This is consistent with the implementation in PixelShaderGen.
2014-05-04 22:44:10 -07:00
magumagu
52c42a2946 VideoCommon: fix indirect texture coordinate computation in TEV.
Even if an indirect texture stage doesn't actually sample a texture, we
still need to emit the relevant math.

Fixes Issue 7092.
2014-05-04 22:12:57 -07:00
Lioncash
f4d80bd8a5 Move the #pragma once header guard before the includes in Statistics.h in VideoCommon. 2014-05-04 00:24:21 -04:00
Tony Wasserka
557c3db462 Merge pull request #81 from degasus/skip_framelimit_hotkey
Add a hotkey for disabling the framelimit.
2014-05-01 12:40:01 +02:00
Ryan Houdek
2d8cfb89d7 Changes posmtx vertex attribute to integer.
This makes it so we don't need to do some dumb casting from float to integer in our shaders.
Only tested in OpenGL, needs to be tested in D3D.
2014-04-30 19:11:06 -05:00
degasus
30586f4d29 Add set/get functions for IsFramelimiterTempDisabled 2014-04-30 12:51:13 +02:00
degasus
8483811b39 Add a hotkey for disabling the framelimit.
Atm this is hardcoded to '\t'.
2014-04-30 12:50:53 +02:00
Pierre Bourdon
25f5598e31 Merge pull request #306 from neobrain/pixel_center_correction
VertexShaderGen: Correct vertex shader output to consider shifted pixel centers.
2014-04-25 09:32:36 +02:00
Tony Wasserka
ca2a79d0bd Workaround dumb custom texture loading logic so that D3D11, GL core (used on OS X) and GLES code paths have less broken custom textures. 2014-04-24 00:33:48 +02:00
Tony Wasserka
c47c32d4a8 VertexShaderGen: Correct vertex shader output to consider shifted pixel centers.
Fixes issue 267.
2014-04-24 00:21:17 +02:00
Ryan Houdek
fd37a768a6 Fix texture conversion shaders for GLSL ES.
Noticed this while messing with EFB to RAM.
We were having an implicit conversion from integer to float, GLSL ES doesn't allow implicit conversion.
Changes it to a explicit conversion to float.
2014-04-22 15:48:26 -05:00
Tony Wasserka
762572a08c BPMemory: Fix GenMode using an incorrect number of bits for the number of color chans. 2014-04-21 22:47:08 +02:00
Tony Wasserka
16d3dbc5ea BPMemory: Use BitField for the GenMode fields. 2014-04-21 22:34:23 +02:00
Ryan Houdek
92ec49ac9f Change to ARM's naming convention in DriverDetails.
This matches how ARM handles their naming in their drivers for different models.
Really it's that way because both Mali-T6xx and Mali-T7xx fall under Midgard.
While everything else (except Mali-55) fall under Utgard.
2014-04-18 21:06:32 -05:00
magumagu
b3a67821e4 VideoCommon: fix rounding in TEV.
The hardware backends pass the TEV tests in gxtest with this change.
2014-04-15 16:47:01 -07:00
Tony Wasserka
068f26d2aa PixelShaderGen: Fix an issue with color combiner compare mode and simplify the affected line a bit.
This was a mistake of mine when translating floating point values to integer values.
Also, the max() part of that line was just completely redundant because the sign of an absolute value is always greater than or equal to zero.

Fixes issue 7178.
2014-04-15 23:41:07 +02:00
Tony Wasserka
4f3227b4a9 Merge pull request #261 from magumagu/pixelshadergen-extra-paren
PixelShaderGen: delete extra parenthesis
2014-04-14 09:48:02 +02:00
magumagu
a2150ef1f8 PixelShaderGen: delete extra parenthesis.
Without this patch, we can generate a pixel shader which doesn't compile
in some cases.
2014-04-14 00:41:27 -07:00
Ryan Houdek
a9fa49f34d Support checking for the Mali-T7xx line of GPUs.
They are similar enough that they will share bugs with their drivers, so make them fall under the same Mali-Txxx umbrella of bug issues.
If there is ever a need in the future for having separate bugs depending on family, we can support that then.
2014-04-11 23:46:44 -05:00
magumagu
fd9c1fa746 VideoBackend: remove unused config vars.
No point to keeping around variables which are always "true".
2014-04-11 14:53:12 -07:00
Tony Wasserka
306b9afd1e Merge pull request #224 from magumagu/swrender-deletepixelfork
Software backend: Delete forked PixelEngine.
2014-04-11 20:01:23 +02:00
Tony Wasserka
cdf6172348 Merge pull request #213 from Jezze/vertexloader-cleanups
Vertexloader cleanups
2014-04-10 08:52:36 +02:00
Ryan Houdek
87d106d65c Remove dumb CodeBlock duplication in the emitters.
Fixes issue 6990.
This uses a bit of templating to remove the duplicate code that is the CodeBlocks in each emitter headers.
No actual functionality change in this.
2014-04-09 13:53:43 -05:00
Ryan Houdek
3251d78f89 Add initial support for GLSL ES 3.10.
GLSL ES 3.10 adds implicit support for the binding layout qualifier that we use.
Changes our GLSL version enums to bit values so we can check for both ES versions easily.
2014-04-03 00:46:09 -05:00
Pierre Bourdon
9b03178673 Merge pull request #222 from comex/more-clang-fixes
More clang fixes
2014-03-30 13:24:08 +02:00
comex
b5654a2464 Don't cast -1 to enum to represent a missing value.
This is undefined behavior in C++, and a clang warning suggests it is
actually producing bad code as a result:

../Source/Core/VideoCommon/BPFunctions.cpp:164:45: warning: comparison of constant 4294967295 with expression of type 'PEControl::PixelFormat' is always false [-Wtautological-constant-out-of-range-compare]
        if (new_format == old_format || old_format == (unsigned int)-1)
2014-03-30 01:40:06 -04:00
magumagu
0661efea84 Software backend: Delete forked PixelEngine.
Mostly just zapping a bunch of duplicated code; the only interesting thing
going on here is the changes to the performance counter implementation.
2014-03-29 12:07:20 -07:00
Pierre Bourdon
664c8d30a0 Remove all trailing whitespaces from our codebase. 2014-03-29 11:05:44 +01:00
Jens Nyberg
73176d0333 VideoCommon/VertexLoader: Add more use of std::min and std::max 2014-03-27 00:33:41 +01:00
Jens Nyberg
478a27e052 VideoCommon/VertexLoader: Remove duplicate point min and max calculation 2014-03-27 00:24:48 +01:00
Jens Nyberg
0c62ae9c1a VideoCommon/VertexLoader: Remove NRM enum 2014-03-26 23:56:57 +01:00
Pierre Bourdon
ea6b37cb75 Merge pull request #193 from neobrain/tev_combiner_fixes
PixelShaderGen: Cleanups and fixes for tev combiners.
2014-03-26 10:05:46 +01:00
Tony Wasserka
c6070b94ce BPMemory: Fix an enum to use u32 as its underlying type. 2014-03-26 10:02:57 +01:00
Tony Wasserka
eb0f547a17 PixelShaderGen: Cleanups. 2014-03-26 00:23:36 +01:00
Tony Wasserka
4f82d6f7af PixelShaderGen: Implement tev combiner lerping in a faster way which also reproduces hardware behavior perfectly.
The new behavior has been verified to be correct by hardware tests. This is an improvement over the old code, which was just a guess.
2014-03-26 00:17:04 +01:00
Tony Wasserka
fdad95c055 PixelShaderGen: Cleanups and fixes for tev combiners.
Fixes issue 4674.
2014-03-26 00:17:03 +01:00
Tony Wasserka
16105db709 BPMemory: Make use of BitField in a number of structures. 2014-03-25 23:57:58 +01:00
Tony Wasserka
8941f19cdb BPMemory: Expose the pixel_format and zformat fields in PE_CONTROL as enumerations. 2014-03-25 23:57:58 +01:00
Tony Wasserka
77a7bab5ae BPMemory: Use the new BitField class in two selected structures. 2014-03-25 23:57:57 +01:00
Jens Nyberg
4a68550d01 Remove superfluous bit shift 2014-03-18 04:07:45 +01:00
Ryan Houdek
484fb46390 Clang 3.4 exposes some warnings on Android.
Fixes all warnings on Android build except for what is in externals.
Removes a function from TextureDecoder_Generic since it is unused and generates a warning.
2014-03-17 18:17:12 -05:00
Matthew Parlane
6445e02d53 Merge pull request #159 from Tilka/misc
Cleanup stuff
2014-03-17 17:43:20 +13:00
Tillmann Karras
2fcaca0603 More range-based loops and overrides 2014-03-17 02:55:55 +01:00
Lioncash
a9adaa5601 Prevent VideoConfig inheritance. 2014-03-16 17:00:29 -04:00
Linktothepast
82f772fdcc Remove the extra parameters field from the PH.
Metroid: Other M was the only game which required this field, but the
issue in that game can be fixed properly by enabling format change
emulation. Hence, there's no point in having this around anymore.
Fixes issue 6644.
2014-03-15 15:04:39 +02:00
Pierre Bourdon
8d679e76d2 Merge pull request #164 from lioncash/cstr-cull
Kill off some usages of c_str.
2014-03-15 00:57:56 +01:00
Tony Wasserka
0f81cbd6be PixelShaderGen: More code alignment fixes. 2014-03-14 22:33:26 +01:00
Tony Wasserka
c1016205d3 Pixel/LightingShaderGen: Fix code alignment issues.
Most of these weren't even introduced by me, but hey - I'm nice and love wasting my time :p
2014-03-14 22:33:26 +01:00
Tony Wasserka
2067f88e0f PixelShaderGen: Don't make local lookup tables "static". 2014-03-14 22:33:26 +01:00
Tony Wasserka
0ce92e0162 PixelShaderGen: Remove the "i" prefix for integer variables.
The prefix was just required in the development stage to reduce the risk of regressions.
2014-03-14 22:33:26 +01:00
Tony Wasserka
bdd629c598 PixelShaderGen: Use spaces for alignment where appropriate. 2014-03-14 22:33:26 +01:00
Tony Wasserka
6e65e02c9e ConstantManager: Do not use single-element arrays. 2014-03-14 22:33:25 +01:00
Tony Wasserka
6c2971eaf6 PixelShaderGen: Write 16777215 in hex (0xFFFFFF) so that it's easier to understand. 2014-03-14 22:33:25 +01:00
Tony Wasserka
8ebb65ebf2 PixelShaderGen: Prettify generated shader source. 2014-03-14 22:33:24 +01:00
Tony Wasserka
e2e1c5c905 PixelShaderGen: Add a note about a random idea which should be checked with hardware tests. 2014-03-14 22:33:12 +01:00
Tony Wasserka
6fcbda6752 PixelShaderGen: Cleanup and clarify bump alpha combiner inputs. 2014-03-14 22:33:12 +01:00
Tony Wasserka
9a96a1d525 PixelShaderGen: Remove old, mostly useless comments.
A few vague lines of comments cannot replace an afternoon reading of how TEV works.
2014-03-14 22:33:12 +01:00
Tony Wasserka
8b8bb04fd3 PixelShaderGen: Use bit shifts instead of multiplications as a small optimization. 2014-03-14 22:33:12 +01:00
Tony Wasserka
036a8c6951 PixelShaderGen: Clean up tev compare functionality. 2014-03-14 22:33:10 +01:00
Tony Wasserka
fa7173d099 PixelShaderGen: Store tex scale as an integer. 2014-03-14 22:32:30 +01:00
Tony Wasserka
16109fb453 PixelShaderGen: Treat UV coordinates as actual integers. 2014-03-14 22:32:29 +01:00
Tony Wasserka
50526ae50a PixelShaderGen: Remove some dead code. 2014-03-14 22:32:18 +01:00
Tony Wasserka
065919f599 PixelShaderGen: Perform some of the fog calculations with integers. 2014-03-14 22:31:32 +01:00
Tony Wasserka
605b687af8 PixelShaderGen: Use integer math for z textures. 2014-03-14 22:31:31 +01:00
Tony Wasserka
3a6389992e PixelShaderGen: Treat UV coordinates like S17.7 integers (they're still stored as float, though). 2014-03-14 22:31:30 +01:00
Tony Wasserka
3e6efdb53e LightingShaderGen: Perform more lighting calculations with integers. 2014-03-14 22:31:19 +01:00
Tony Wasserka
387b9bf3c2 LightingShaderGen: Perform some lighting calculations with integers. 2014-03-14 22:31:19 +01:00
Tony Wasserka
78623871f9 ShaderGen: Store material uniforms as integers. 2014-03-14 22:31:19 +01:00
Tony Wasserka
4bf57565e8 ShaderGen: Store light color uniforms as integers. 2014-03-14 22:31:18 +01:00
Tony Wasserka
68e91f0d55 PixelShader: Store fog color as an integer. 2014-03-14 22:31:18 +01:00
Tony Wasserka
0238a56816 PixelShaderGen: Change indirect texture matrix uniforms to use integers. 2014-03-14 22:31:18 +01:00
Tony Wasserka
c13a5c38e9 PixelShaderGen: Change the "alpha" uniform to use integers. 2014-03-14 22:31:18 +01:00
Tony Wasserka
ec60acac3a PixelShaderGen: Change the "colors" and "kcolors" uniforms to be integers. 2014-03-14 22:31:18 +01:00
Tony Wasserka
df94e62350 PixelShaderGen: Process fog calculations with integer math. 2014-03-14 22:31:18 +01:00
Tony Wasserka
21eb482a6e PixelShaderGen: Write constants in decimal instead of hexadecimal where appropriate. 2014-03-14 22:31:11 +01:00
Tony Wasserka
cff952c397 PixelShaderGen: Use integer math for indirect tev stage texcoord calculation. 2014-03-14 22:30:27 +01:00
Tony Wasserka
e7a42d884f PixelShaderGen: prev should be initialized to the proper value; tev output needs to be clamped between -1024 and 1023. 2014-03-14 22:30:16 +01:00
Tony Wasserka
cb1514e082 PixelShaderGen: Remove superfluous registerstate stuff. Also, made alphabump an integer. 2014-03-14 22:30:15 +01:00
Tony Wasserka
a11ae69cb0 PixelShaderGen: Use integer math for TEV combiners. 2014-03-14 22:28:32 +01:00
Tony Wasserka
aaa8e74a68 PixelShaderGen: Use integer math for tev outputs. 2014-03-14 22:28:14 +01:00
Tony Wasserka
654442feb7 PixelShaderGen: Use integer math for tev konst value. 2014-03-14 22:28:12 +01:00
Tony Wasserka
e69ee6ae0a PixelShaderGen: Remove remaining floating point bits for texture color. 2014-03-14 22:26:50 +01:00
Tony Wasserka
ac1c77c392 PixelShaderGen: Use integer math for rasterizer color. 2014-03-14 22:26:50 +01:00
Tony Wasserka
3ea97f7730 PixelShaderGen: Use integer math for indirect texture coords. 2014-03-14 22:26:50 +01:00
Tony Wasserka
0e711bf520 PixelShaderGen: Use integer math for sampling textures. 2014-03-14 22:26:50 +01:00
Tony Wasserka
1b3b12caa0 PixelShaderGen: Fix an issue where small negative z coordinates would underflow when they shouldn't. 2014-03-14 22:26:50 +01:00
Tony Wasserka
fa77e1d2b6 PixelShaderGen: Use integer math for alpha testing. 2014-03-14 22:26:48 +01:00
Ryan Houdek
22c989de9a Provide our own dot functions in GLSL since GLSL doesn't provide integer versions of this function, even though AMD and Nvidia provide their own. 2014-03-14 22:26:27 +01:00
Tony Wasserka
bed442198f PixelShaderGen: Make SampleTexture static inline. 2014-03-14 22:26:26 +01:00
Lioncash
a82675b7d5 Kill off some usages of c_str.
Also changes some function params, but this is ok.
Some simplifications were also able to be made (ie. killing off strcmps with ==, etc).
2014-03-14 13:51:23 -04:00
Matthew Parlane
31cfc73a09 Fixes spacing for "for", "while", "switch" and "if"
Also moved && and || to ends of lines instead of start.
Fixed misc vertical alignments and some { needed newlining.
2014-03-11 00:35:07 +13:00
Tillmann Karras
d802d39281 clang-modernize -use-nullptr
and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine
2014-03-09 21:14:26 +01:00
Tillmann Karras
f28116b7da clang-modernize -add-override 2014-03-09 21:12:01 +01:00
Tillmann Karras
c89f04a7c5 clang-modernize -loop-convert
and some manual adjustments
2014-03-09 21:11:59 +01:00
Matthew Parlane
25341f88ef Fixes include order of TextureConversionShader.cpp 2014-03-09 12:38:29 +13:00
Ryan Houdek
4f02132f93 Make our architecture defines less stupid.
Our defines were never clear between what meant 64bit or x86_64
This makes a clear cut between bitness and architecture.
This commit also has the side effect of bringing up aarch64 compiling support.
2014-03-04 09:36:59 -06:00
Tillmann Karras
315a8ba1c0 Various changes suggested by cppcheck
- remove unused variables
- reduce the scope where it makes sense
- correct limits (did you know that strcat()'s last parameter does not
  include the \0 that is always added?)
- set some free()'d pointers to NULL
2014-02-28 12:43:20 +01:00
Tillmann Karras
6914eca167 Fix various warnings reported by clang
- mostly remove unused variables
- rename some generic JIT identifiers
2014-02-28 12:28:19 +01:00
degasus
f628695d31 comment fixes 2014-02-26 12:48:52 +01:00
degasus
aaaa5af0b2 remove (ATTR|VARY)(IN|OUT) macros 2014-02-26 11:37:29 +01:00
degasus
1d0b6a1156 Merge duplicate parts of sampler into header 2014-02-26 11:37:29 +01:00
degasus
11efa88157 calculate constant values on shader compilation 2014-02-26 11:37:29 +01:00
degasus
8a4aa8c1f5 Rewrite texture tiling implementation
inline halfxb

So we know which is the first pixel by masking.

inline xl

inline xb a bit

inline yl

inline uv1.x shift

remove likely wrong guessed ternary operator

add pixel layout comment

inline xel

optimize the shifts a bit

inline xb

optimize shifts in a second step

extract xb

rename all variables

calculate cache line by position.x

Revert 5115b459f40d53044cd7a858f52e6e876e1211b4 "optimize the shifts a bit"

It seems I was wrong, the other way is the more natural.

use x_virtual_position instead of uv1.x for x_offset_in_block

This looks more natural and the offset should be masked anyway.

substitude factor with cache_lines

move 32bit logic in a conditional block
2014-02-26 11:37:29 +01:00
degasus
bd3beeb184 TextureConverter: Use Log2() and shifts instead of multiplications/divisions 2014-02-26 11:37:29 +01:00
degasus
f99c8a0b70 merge common parts of encoding shaders 2014-02-26 11:37:28 +01:00
Pierre Bourdon
4ba9cb217f Fix a compilation error introduced in PR #91.
For some reason it passed builbot-try but didn't build after being merged to
msater. Did not expect that, sorry :(
2014-02-23 03:45:46 +01:00
Pierre Bourdon
83b7bb64aa Make Common/ mostly IWYU clean (and fix errors in rest of the project detected by this change). 2014-02-22 23:37:29 +01:00
Pierre Bourdon
ffe588cc24 Fix more header sorting issues in VideoCommon/ (now check-includes clean). 2014-02-20 01:01:10 +01:00
Pierre Bourdon
362dec9c7c Dolphin now builds on Linux with only Source/Core as include dir 2014-02-18 12:18:47 +01:00
Lioncash
2afe215271 Convert all includes to relative paths. 2014-02-18 02:19:10 -05:00
Lioncash
3fd87a7636 Second and final pass of clearing out tabs. 2014-02-17 02:19:41 -05:00
Ryan Houdek
6b5f6ddaa1 Merge pull request #82 from lioncash/vertical-alignment
Fix some vertical alignments
2014-02-16 19:12:42 -06:00
Lioncash
6c4ee1753a Fix some vertical alignments
ie. uses spaces for alignment.
2014-02-16 20:12:05 -05:00
Tony Wasserka
de5bfd0bce Merge pull request #37 from degasus/VideoCommonApiFixes
VideoCommon API cleanups
2014-02-16 22:08:28 +01:00
Pierre Bourdon
92f8d93e96 Remove the old MMIO access "interface". 2014-02-16 19:22:40 +01:00
Pierre Bourdon
5b5dfb384e MMIO: Port the VideoCommon PE MMIOs to the new interface. 2014-02-16 19:22:40 +01:00
Pierre Bourdon
4129b30494 MMIO: Port the VideoCommon CP MMIOs to the new interface (and provide framework for other video related mappings). 2014-02-16 19:22:40 +01:00
degasus
647aad0a19 inline SetViewport into VertexShaderManager 2014-02-15 21:09:42 +01:00
degasus
d5f1f0d4a9 merge some common parts of Swap() into VideoCommon 2014-02-15 11:33:43 +01:00
degasus
3551259c7a use EFBRectangle for scissor rect
This one is backend independed. The backend should recalc such things on their own.
2014-02-15 11:33:43 +01:00
degasus
1f4219b5b4 move perfquery enable checks into videocommon (caller side) 2014-02-15 11:33:43 +01:00
degasus
5a660c27bc rename UpdateViewport to SetViewport like all others setters in RenderBase.h 2014-02-15 11:33:43 +01:00
degasus
e5318d2624 move shared parts from VertexManager::vFlush into VideoCommon 2014-02-15 11:33:43 +01:00
Tillmann Karras
404624bf0b Turn loops into range-based form
and some things suggested by cppcheck and compiler warnings.
2014-02-13 09:05:50 +01:00
lioncash
d2038049f5 Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Matthew Parlane
32bfcc034f Some tidy up of sprintf to StringFromFormat
Includes a small fix to SetupWiiMemory
2014-02-10 17:25:18 +13:00
Lioncash
ebb48d019e Clean up some struct indentations
Also cleaned up the indentations of some variable declarations.
2014-02-09 19:40:11 -05:00
Lioncash
40182a48a5 Cleanup enum indentations. 2014-02-09 16:16:10 -05:00
Pierre Bourdon
e59f770ccb Revert "Merge pull request #49 from Parlane/sprintf_tidy"
Change broke the build on Debian stable.

This reverts commit 28755439b3, reversing
changes made to 64e01ec763.
2014-02-09 16:14:13 +01:00
Matthew Parlane
ebff7974c3 Some tidy up of sprintf to StringFromFormat 2014-02-08 14:32:48 +13:00
Pierre Bourdon
59e2179172 Merge pull request #35 from lioncash/videocommons-kill-xchg-in-statistics
[VideoCommon] Eliminate the function Xchg in Statistics.cpp. std::swap does the same thing.
2014-02-04 16:40:25 -08:00
Lioncash
6d9cd07bb9 [VideoCommon] Eliminate the function Xchg in Statistics.cpp. std::swap does the same thing. 2014-02-04 19:35:27 -05:00
Tony Wasserka
af24ed782d Merge pull request #14 from degasus/uboWorkaroundRemove
OGL: Remove non-UBO code path.
2014-02-04 14:05:55 -08:00
Tillmann Karras
8ef57064b2 Silence warning 2014-02-04 01:30:39 +01:00
Lioncash
e96f464eb5 [VideoCommon] Remove references to now non-existant files OpenCL.h and OpenCL/OCLTextureDecoder.h in the Visual Studio vcxproj file. 2014-02-01 21:52:06 -05:00
degasus
6089e4470a OGL: remove ubo workaround
This was only keeped for some broken mesa versions. Meanwhile most used versions should be fixed for almost a year.
2014-02-01 22:33:45 +01:00
degasus
31c3bee5bc VertexShaderGen: fix D3D posmtx attribute regression by VertexLoaderCleanup branch
Sorry, I'm too dumb too test my code. I hope this will work fine now.
2014-02-01 11:35:46 +01:00
Tony Wasserka
3dd31fe22b Merge pull request #11 from degasus/VertexLoaderCleanup
Vertex loader cleanup.
2014-01-31 06:13:26 -08:00
degasus
3437c7f060 VideoCommon: small VertexLoader(Manager)? refactoring 2014-01-31 07:31:03 +01:00
degasus
010a0d481a VideoCommon: remove Cache Displaylist
This option was known to break every second game and only boost a bit.
It also seems to be broken because of streaming into pinned memory and buffer storage buffers.

v2: also remove dlc_desc
2014-01-31 07:30:55 +01:00
degasus
a65162f1cd PortableVertexFormat: use AttributeFormat for posmtx attribute format 2014-01-31 07:19:34 +01:00
degasus
6c59b691b0 PortableVertexFormat: use AttributeFormat for texcoord attribute format 2014-01-31 07:19:34 +01:00
degasus
ef2d6e7d53 PortableVertexFormat: use AttributeFormat for color attribute format 2014-01-31 07:19:34 +01:00
degasus
b38ef39ab7 PortableVertexFormat: use AttributeFormat for normal attribute format 2014-01-31 07:19:34 +01:00
degasus
210f4f3e55 PortableVertexFormat: add a struct which hold all needed information for every vertex and use this for position
atm, position attribute is hardcoded both in VertexLoader and in backends.

v2: fix coding style + cleanup lookup table
2014-01-31 07:19:25 +01:00
degasus
02d1d8e6a0 NativeVertexFormat: swap unsigned / signed formats to match GX order 2014-01-30 11:12:10 +01:00
Ryan Houdek
99b6c82ac3 [Android] Fix Adreno v53 development drivers rotating framebuffer
Older Qualcomm drivers rotated the framebuffer 90 degrees and this fix didn't work.
Now for some obscene reason it rotates a full 180 degrees.
This can at least be worked around by flipping around the image on our end.
2014-01-29 16:39:45 -06:00
Lioncash
0f555d3a47 Remove two references to DX9 in VideoCommon.
DX9 isn't a backend anymore, so may as well get rid of them
2014-01-29 14:39:13 -05:00
degasus
b1290a8630 OGL: remove version check for buffer_storage on windows
On Windows, nvidia don't give us their driver version, so we can't workaround any issues.
As buffer_storage is broken on some drivers, we wanted to disble it for them.
So we can't.

Luckyly only "some" released driver versions are affected as this extension is only available since some months. Let's hope that nobody have to use one of this driver version, else they will get a black screen ...
2014-01-28 15:15:26 +01:00
crudelios
9b6c6fa9e4 BBox: Changed the rounding again, the old one fixed Paper Mario but had bugs in Mickey's Magical Mirror. This change fixes the glitches in both games.
Also fixed some compiler warnings.
2014-01-26 13:21:22 +00:00
degasus
d3fd0eddbb OSX: don't avoid unsync mapping on nvida gpus just because the windows driver doesn't like it
OSX has their own driver, so performance issues aren't shared with the nvidia driver (unlike the closed source linux and windows nvidia driver). So now they'll also use the MapAndSync backend like all other osx drivers.

fixes issue 6596

I've also cleaned up the if/else block selecting the best backend a bit.
2014-01-26 11:00:29 +01:00
crudelios
23b8465621 BBox: fix for a small rounding issue.
The new chapter title in Paper Mario TTYD had a small graphical bug due to the new code because it read one extra pixel, this fixes it.

I hope this gets everything, I though I had checked most bugs and yet here I am, commit-spamming...
2014-01-25 19:13:32 +00:00
crudelios
5f14f0e3ce BBox: read from the proper world matrix index when transforming vertexes to screen coordinates.
Fixes some remaining bbox related bugs in Mickey's Magical Mirror and a slight graphical glitch in Paper Mario: TTYD when flipping and Vivian as your companion (I've been scratching my head for days to find this one).
2014-01-25 18:04:15 +00:00
crudelios
cdfe58f7ed Rewrote bounding box algotithm. Fixes issues 5967, 6154, 6196, 6211.
Instead of being vertex-based, it is now primitive (point, line or dissected triangle) based, with proper clipping.
Also, screen position is now calculated based on viewport values, instead of "guesstimating".

This fixes many graphical glitches in Paper Mario: TTYD and Super Paper Mario.

Also, the new code allows Mickey's Magical Mirror and Disney's Hide & Sneak to work (mostly) bug-free. I changed their inis to use bbox.

These changes have a slight cost in performance when bbox is being used (rare), mostly due to the new clipping algorithm.

Please check for any regressions or crashes.
2014-01-25 15:36:23 +00:00
degasus
1898524c96 VideoCommon: fix "Buffer not large enough for all vertices!" 2014-01-24 00:10:21 +01:00
degasus
1ff681a412 D3D: move streaming buffer fallback into D3D backend
Neith OGL nor VideoCommon doen't use it, so there is no need to have it in VideoCommon.
2014-01-23 15:27:18 +01:00
degasus
62f1905978 VideoCommon: don't save streaming fifos into savestate 2014-01-23 15:12:31 +01:00
degasus
52feed04db VideoCommon: allow backends to set the buffer pointer as they want to 2014-01-23 15:12:31 +01:00
degasus
3cb5bb3b30 VertexLoader: temp class for reader/writer 2014-01-21 23:44:51 +01:00
degasus
0b97b33ceb VertexLoader: inline destionation buffer 2014-01-21 19:23:07 +01:00
degasus
c613868f57 VertexLoader: load scale factor as const, this will save some assembler instructions 2014-01-21 18:54:16 +01:00
degasus
f90fe90320 fix windows debug comile
This is broken because of revision ebbf1d392b
2014-01-21 14:23:50 +01:00
degasus
ebbf1d392b VideoCommon: merge trivial parts of VertexManager::Flush 2014-01-21 10:47:00 +01:00
Ryan Houdek
839df31347 Merge of GL-AutoChoose.
This branch is the final step of fully supporting both OpenGL and OpenGL ES in the same binary.
This of course only applies to EGL and won't work for GLX/AGL/WGL since they don't really support GL ES.
The changes here actually aren't too terrible, basically change every #ifdef USE_GLES to a runtime check.

This adds a DetectMode() function to the EGL context backend.
EGL will iterate through each of the configs and check for GL, GLES3_KHR, and GLES2 bits
After that it'll change the mode from _DETECT to whichever one is the best supported.
After that point we'll just create a context with the mode that was detected
2014-01-18 04:11:59 +00:00
degasus
304adc6e0d IndexGenerator: inline all variables
As we do lots of writes to *Iptr, the compiler isn't allowed to cache any shared variable (neither index nor Iptr itself).
This commit inlines Iptr + index into the index generator functions, so the compiler know that they are const.
2014-01-17 16:34:53 +01:00
degasus
1d6425bd5e IndexGenerator: drop unused variable 2014-01-17 16:34:53 +01:00
degasus
6b01839525 VideoCommon: merge triangle+list+point index buffers
We are used to render them out of order as long as everything else matches, but rendering order does matter, so we have to flush on primitive switch. This commit implements this flush.
Also as we flush on primitive switch, we don't have to create three different index buffers. All indices are now stored in one buffer.

This will slow down games which switch often primitive types (eg ztp), but it should be more accurate.
2014-01-17 16:34:53 +01:00
degasus
770485ad04 VertexLoader: don't check for possible range
I(index) < std::numeric_limits<I>::max() is always true, so we don't have to check it
2014-01-16 22:07:48 +01:00
degasus
5eae39766b enable buffer_storage on nvidia 331.38 on linux
it works fine here, and as the VSH is removed, this is the newest driver.
2014-01-16 17:51:38 +01:00
degasus
331af32038 fixup "Remove the ZTP speedup hack"
This fixes revision b49c09c36b
2014-01-16 00:26:49 +01:00
Tony Wasserka
f1adc56a56 Remove vertex streaming hack.
NV has buffer_storage, AMD has pinned memory.
Both are better than that hack which shouldn't ever have been introduced in the first place.
2014-01-16 00:11:12 +01:00
Tony Wasserka
b49c09c36b Remove the ZTP speedup hack. Also remove useless debugging code, and a presumably outdated workaround (which was commented out).
Fixes issue 6875.
2014-01-16 00:11:12 +01:00
degasus
5e5db9fbc6 VideoCommon: cleanup of "components" usage
This "u32 components" is a list of flags which attributes of the vertex loader are present.
We are used to append this variable to lots of vertex generation functions, but some of them don't need it at all.
2014-01-15 16:58:36 +01:00
Pierre Bourdon
a561c436fc Change the default GFX backend from D3D11 to OGL.
Rationale and discussion:
    https://ml.dolphin-emu.org/archives/dolphin-dev/2014-January/000003.html
2014-01-14 21:57:32 +01:00
degasus
e00c3ce363 TextureConverter: remove implicit int->float convertion
They was used to check if we're writing to the first or second part of one pixel.
So this is now done with a boolean and a ternary operator.
2014-01-13 12:10:17 +01:00
Scott Mansell
9aff16e7c1 Fix stupid bug in Z16L depth texture efb2ram encoding shader. 2014-01-12 13:32:06 +13:00
Ryan Houdek
e3d103f60c Update some of the comments in DriverDetails.h for drivers that have fixed their bugs. 2014-01-11 07:31:47 -06:00
Ryan Houdek
67f099af33 Enable buffer_storage for Nvidia drivers 332.21 and above. 2014-01-09 12:06:12 -06:00
degasus
eb310cbd1d VideoCommon: disable efb access + perf querys on cph thread
The usual way to handle this kind of request is to rise a flag which the gpu thread polls.
The gpu thread itself either generates the result or just write zeros if disabled.
After this, it rise another flag which says that this work is done.

So if disabled, we still have the cpu-gpu round trip time. This commit just returns 0 on the cpu thread
instead of playing ping pong...
2014-01-09 18:37:59 +01:00
Ryan Houdek
b55a4bb087 Slight optimization in the pixel shader. We are using pow(2.0, X) in place of exp2(X). This can be faster in places that don't optimize a pow to a exp2 in this case.
Notice this from here: http://cgit.freedesktop.org/mesa/mesa/commit/?id=847bc36a38d42967ad6bf0492fe90a4892d9d799
Intel Haswell GPU is 24 cycles for POW and 14 cycles for EXP2.
Maybe other GPUs don't optimize this either. Just be safe.
2014-01-08 16:40:31 -06:00
Ryan Houdek
7acc64eb0a [Android] Reenable the bug for dynamic UBO array member accesses.
Some information on this bug since this isn't quite true.
Seemingly with the v53 driver, Qualcomm has actually fixed this bug. So we can dynamically access UBO array members.
The issue that is cropping up is actually converting our attribute 'fposmtx' to an integer.
int posmtx = int(fpostmtx);
This line causes some seemingly garbage values to enter in to the posmtx variable.
Not sure exactly why it is failing, probably them just not actually converting the float to an integer and just handling the float directly as a integer.
So the bug is going to stay active with Qualcomm devices until we convert this vertex attribute from a float to a integer.
2014-01-07 07:56:30 -06:00
degasus
e6676b4565 OpenGL: fix scaled efb2ram copys
This fix a regression in revision 687097d4bc because of the wrong order of moving the sampled rect and scaling.
2014-01-05 18:19:17 +01:00
Pierre Bourdon
ed67d1ae2f Fix the Zelda: The Wind Waker heat effect glitch.
Let's talk a bit about this bug. 12nd oldest bug not fixed in Dolphin, it was a
lot of fun to debug and it kept me busy for a while :)

Shoutout to Nintendo for framework.map, without which this could have taken a
lot longer.

Basic debugging using apitrace shows that the heat effect is rendered in an
interesting way:
* An EFB copy texture is created, using the hardware scaler to divide the
  texture resolution by two and that way create the blur effect.
* This texture is then warped using indirect texturing: a deformation map is
  used to "move" the texture coordinates used to sample the framebuffer copy.

Pixel shader: http://pastie.org/private/25oe1pqn6s0h5yieks1jfw

Interestingly, when looking at apitrace, the deformation texture was only 4x4
pixels... weird. It also does not have any feature that you would expect from a
deformation map. Seeing how the heat effect glitches, this deformation texture
being wrong looks like a good candidate for the problem. Let's see how it's
loaded!

By NOPing random calls to GXSetTevIndirect, we find a call that when removed
breaks the effect completely. The parameters used for this call come from the
results of methods of JPAExTexShapeArc objects. 3 different objects go through
this code path, by breaking each one we can notice that the one "controlling"
the heat effect is the one at 0x81575b98.

Following the path of this object a bit more, we can see that it has a method
called "getIndTexId". When this is called, the returned texture ID is used to
index a map and get a JPATextureArc object stored at 0x81577bec.

Nice feature of JPATextureArc: they have a getName method. For this object, it
returns "AK_kagerouInd01". We can probably use that to see how this texture
should look like, by loading it "manually" from the Wind Waker DVD.
Unfortunately I don't know how to do that. Fortunately @Abahbob got me the
texture I wanted in less than 10min after I asked him on Twitter.
AK_kagerouInd01 is a 32x32 texture that really looks like a deformation map:
http://i.imgur.com/0TfZEVj.png . Fun fact: "kagerou" means "heat haze" in JP.

So apparently we're not using the right texture object when rendering! The
GXTexObj that maps to the JPATextureArc is at offset 0x81577bf0 and points to
data at 0x80ed0460, but we're loading texture data from 0x0039d860 instead.

I started to suspect the BP write that loads the texture parameters "did not
work" somehow. Logged that and yes: nothing gets loaded to texture stage 1! ...
but it turns out this is normal, the deformation map is loaded to texture stage
5 (hardcoded in the DOL). Wait, why is the TextureCache trying to load from
texture stage 1 then?!

Because someone sucked at hex.

Fixes issue 2338.
2014-01-05 11:33:15 +01:00
degasus
c42f274e22 OpenGL: use shader 420pack if available to staticly bind ubo location
Bindung locations after compiling a shader stalls the driver. So if we manage not to bind anything after compilation, the lag would be reduced much.
2014-01-05 10:38:45 +01:00
degasus
4fff5ac90d OpenGL: drop UBO-workaround usage for efb2ram shaders
It's just brainfuck to use this workaroung there. Just fetch the uniform location like all other util shaders.
2014-01-05 09:52:26 +01:00
degasus
01351795f0 TextureCache: Warn for invalid custom textures
At the moment, custom textures with:
- invalid mipmap size
- invalid aspect ratio
- non-fractional scaling factors
are allowed. But they can't be loaded fine by the backend, so generate a warning if someone trys to load them.
2014-01-03 14:30:12 +01:00
degasus
0f0a3cc509 ogl: clamp to edge for out of bound efb access
fixes issue 6898

OpenGL defaults are GL_REPEAT, which is even more unlikely than GL_CLAMP_TO_EDGE.
As I can't test the behavoir of the real hardware, I changed it to how it works before,
but I guess just clip the texture makes more sense.
2014-01-03 08:15:19 +01:00
Ryan Houdek
1118226f27 Merge branch 'master' into buffer_storage 2013-12-31 19:18:30 -06:00
Ryan Houdek
8d8b0fc884 Merge branch 'master' into buffer_storage
Conflicts:
	Source/Core/VideoBackends/OGL/Src/Render.cpp
	Source/Core/VideoCommon/Src/DriverDetails.cpp
	Source/Core/VideoCommon/Src/DriverDetails.h
2013-12-31 15:41:50 -06:00
Jasper St. Pierre
34692ab826 Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
Jasper St. Pierre
43e618682e Convert all vcxproj files to UNIX line endings 2013-12-31 14:03:18 -05:00
Ryan Houdek
6d63db96e9 Disable primitive restart on buggy OS X Intel HD 3000 drivers. 2013-12-30 18:26:55 -06:00
Tony Wasserka
3aa0a63fe6 VertexShaderGen: Remove Sonic Unleashed hack. Doesn't seem to be required anymore.
Either way, even if it's still needed for anything, this is not the correct way to fix the issue.
2013-12-30 20:28:07 +01:00
NeoBrainX
3cfa04b5cf VertexShaderManager: Remove a hardcoded projection hack. 2013-12-30 19:26:10 +00:00
Ryan Houdek
ce99921c20 [buffer_storage] Implement ARB_buffer_storage. Disable it for GL_ARRAY_BUFFER due to a bug in Nvidia's drivers that causes black screen with it. 2013-12-27 10:56:03 -06:00
Ryan Houdek
e697d7a2dd [Android] Work around Qualcomm's broken garbage in their v53 drivers. This doesn't fix the issue, just a work around. This is the stupidest issue coming from Qualcomm. Now Dolphin Mobile won't crash immediately, but there are new SPS issues. 2013-12-19 17:30:39 -06:00
Ryan Houdek
945b903499 Work around AMD's broken Linux drivers when it comes to pinned memory and base_vertex usage. It seems that using pinned memory with base_vertex disabled is quicker than the other way around. 2013-12-19 09:40:13 -06:00
Ryan Houdek
a35b62358a [Android] Things fixed in Qualcomm driver v53. GLSL Centroid usage. SHADER_INFO_LOG reporting 0 at all times. Some crazy nonsense that broke the FPS counter. Those are all fixed. glBufferSubData still makes the device do a OOM error, and is still stupidly slow to use. Many more bugs remain in this latest Qualcomm driver. 2013-12-18 22:23:26 -06:00
Ryan Houdek
eb3b933dd0 Remove all instances of OpenCL in the Dolphin Project. A brief history of OpenCL in Dolphin. OpenCL was originally added to the Dolphin codebase 1 month after it was released with OS X Snow Leopard in 2009. OpenCL was one of the largest group projects that Dolphin ever has had. The OpenCL texture decoder was originally aded with version 1.0 of the OpenCL spec; This version didn't have the capability of a OpenCL-OpenGL interop which would allow for uploading textures once and have it decoded directly to a OpenGL texure. This was to be worked out when the OpenCL 1.1 spec was released and allowed the interop. This work has never been done, and no one in the team is willing to work on it for various reasons. OpenCL has had the unreasonable expectation that it increases the performance of video games that require a large amount of EFB copies like NSMBW. In reality, enabling OpenCL just put the graphics card in a higher power mode which increased the game speed. This is due to the unfortunate effect of Dolphin tending to not push GPUs out of their lower frequency power savings modes. Thanks to everyone that had contributed to the OpenCL texture decoder. 2013-12-11 15:15:55 -06:00
Tony Wasserka
c9d9081bf9 Use less brain damaged names for DLCache and TextureDecoder. 2013-12-11 20:35:12 +01:00
degasus
2d8515c0cf VideoCommon: remove outdated copy of OGL::VertexManager::vFlush 2013-12-09 23:49:09 +01:00
degasus
42619c1d2d Merge branch 'ogl-tex2d'
Conflicts:
	Source/Core/VideoBackends/OGL/Src/TextureConverter.cpp
2013-12-09 13:04:14 +01:00
degasus
687097d4bc OGL: use integer uniforms for efb2ram texture converter 2013-12-09 12:33:50 +01:00
Ryan Houdek
14d9802ea4 Oops. Fix a typo in the DriverDetails change. 2013-12-06 12:18:20 -06:00
Ryan Houdek
faf8792351 Support OS specific bugs in our DriverDetails. 2013-12-05 09:32:27 -06:00
degasus
2cbefa2905 PixelShaderManager: clear s_bViewPortChanged flag
This flag wasn't cleared at all, so we set our constants dirty every time...

This could fix some performance regressions because of revision 6798a4763e
2013-12-03 09:37:45 +01:00
degasus
69137cff4c Merge X11+D3D FreeLook feature into DolphinWX
This removes the redundant code and also implements this feature for OSX and Wayland.
But so it's dropped for non-wx builds...

imo DolphinWX still isn't the best place for this, but now it's in the same file as all other hotkeys. Maybe they'll be moved to InputCommon sometimes at once ...
2013-11-29 06:09:54 +01:00
degasus
11973d31c1 TextureConverter: remove WriteIncrementSampleX 2013-11-25 17:11:41 +01:00
Ryan Houdek
421fd0e16e Fix OpenGL ES 3. 2013-11-25 15:36:24 +00:00
degasus
64a1969e36 TextureConverter: fix scoping 2013-11-25 16:34:08 +01:00
degasus
2a2f2fd4eb TextureConvertion: merge Write*Swizzler 2013-11-25 16:19:08 +01:00
degasus
6750a81972 TextureConverter: Use integer math for swizzling
also move int(efb_coord) -> float(ogl_fb_coord) into WriteSampleColor
2013-11-25 15:49:13 +01:00
degasus
bcb31b09d3 TextureConverter: Use gl_FragCoord instead of uv0 2013-11-25 15:01:18 +01:00
degasus
a289e0604f TextureConverter: remove D3D9 foo
This file is in VideoCommon, but as D3D11 doesn't use it and D3D9 is dropped, it's time to clean up.
2013-11-25 14:53:44 +01:00
degasus
146e435009 OpenGL: fix efb2ram for texture2D
This was hacky as hell. Our efb2ram shader generator is just freaked out.
2013-11-25 08:56:01 +01:00
Ryan Houdek
da3eef1019 Fix the issue with COLOROUT not being defined anymore. Fix a issue where Mali shader compiler is idiotic in finding an overload for the mix function. 2013-11-25 00:06:29 +00:00
Ryan Houdek
f292819ff5 [Android] Due to recent changes in code breaking Tegra 4 support, and also the upcoming code which will be breaking GLES2 support entirely. Taking the initiative to drop the remaining support code from the codebase in preparation for the upcoming changes. For a look at how Dolphin on Tegra 4 looked like prior and would not have been able to be fixed at all due to Tegra 4 not supporting the precision we need in our shaders; Look at this Youtube video http://youtu.be/Ga7Jc_Ote7U 2013-11-24 15:49:23 -06:00
degasus
09f4439d0c VideoCommon: reorder cbufid in orderer. We've used once two times 2013-11-24 04:43:54 +01:00
degasus
7d58278b67 Merge branch 'efb2tex_alpha' 2013-11-24 04:02:38 +01:00
Matthew Parlane
0a31255943 Unused arguments removed from XFBSource::Draw
Thanks neo.
2013-11-24 11:33:43 +13:00
Tony Wasserka
672fa65ee7 OpenGL: Enable pinned memory even for index buffers (works for me). Big-ish speedup on AMD GPUs for streaming intensive games. 2013-11-22 18:09:52 +01:00
degasus
b0a83c9aaa VideoCommon: don't read alpha from efb which don't have alpha
This fixes issue 6788
2013-11-22 04:50:33 +01:00
Tony Wasserka
286b6110f1 Revert "Handle BP mask register better to avoid useless BP writes (causing flushes)"
This reverts commit 954be9e2d9.

Fixes issue 6826.
2013-11-20 22:53:10 +01:00
Matthew Parlane
b372f97675 Imagewrite.cpp had same problem.
I hate windows :(
2013-11-17 11:30:05 +13:00
Matthew Parlane
33d8166620 Use IOFile for TextureToPng to support non-ascii
Changed save texture/screenshot uses to std::string
Removed unneeded new/delete calls when dealing with temp data.
2013-11-17 11:14:38 +13:00
Matthew Parlane
71d70d896f Api was too confusing for people. 2013-11-17 10:34:34 +13:00
Matthew Parlane
3a13dfdd9b [OGL] Textures now save to PNG not TGA 2013-11-16 15:59:59 +13:00
Ryan Houdek
b9d7bb9012 [Android] Broken UBOs has been fixed in Adreno driver v53, so update the comment in DriverDetails.h. Also enable dynamic UBO array member access with that version since there is a high chance of it being fixed. Dynamic UBO member access is commonly noticed with character models being terrible looking. 2013-11-15 16:51:07 -06:00
Matthew Parlane
c712fb7356 Fix introduced ImageWrite warning. 2013-11-15 17:58:57 +13:00
Ryan Houdek
117bf435b0 Fix GUI-less build. Also potentially OS X. We now require libpng due to our screenshot code relying on it now. WXWidgets links in libpng by itself so it isn't noticed in a wxwidgets build. OS X seems to not have libpng linked in from wxWidgets so just link in libpng at all times. 2013-11-15 01:09:38 +00:00
Matthew Parlane
ba71cdcc51 Goto crosses initialization error.
Sorry.
2013-11-15 13:05:03 +13:00
Matthew Parlane
033ed9477e Reworked Screenshot saving.
Now OGL doesn't rely on WX for PNG saving.
FlipImageData supports (pixel data len > 3) now.
TextureToPng is now in ImageWrite.cpp/h
Video Common depends on zlib and png.
D3D no longer depends on zlib and png.
2013-11-15 13:00:38 +13:00
Jordan Cristiano
39a4d4329d more warning fixes 2013-11-14 02:19:15 -05:00
Jordan Cristiano
f96e9e1ae4 warnings and code formatting 2013-11-13 04:03:46 -05:00
Tony Wasserka
0b02880b76 Revert "Be less dumb."
Revert "Actually, filename really does need to be a parameter because of some random debug thing."
Revert "fix non-HAVE_WX case"
Revert "Handle screenshot saving in RenderBase.  Removes dependency on D3DX11 for screenshots (texture dumping is still broken)."

This reverts commits 00fe5057f1, 74b5fb3ab4, cd46138d29 and 5f72542e06 because taking screenshots in D3D still crashed for me so there was no point in the code changes (which I found ugly anyway).
2013-11-10 00:22:33 +01:00
degasus
8923968b47 Revert "VideoCommon: create native texture pool"
This reverts commit 6cece6b486.

In fact, there was a _huge_ speedup on lots of games (mostly on nvidia+ogl), but there are some crashes on D3D.
I have to fix this crash and then I'll commit something like this again :-)

Conflicts:
	Source/Core/VideoCommon/Src/TextureCacheBase.cpp
2013-11-07 21:16:36 +01:00
degasus
ea2d8bf328 VideoCommon: fix custom textures
This fix a regression by revision 6cece6b486

delete pointer must not do anything if pointer==NULL.
2013-11-07 15:55:34 +01:00
Pierre Bourdon
954be9e2d9 Handle BP mask register better to avoid useless BP writes (causing flushes)
Patch from konpie: http://forums.dolphin-emulator.com/showthread.php?tid=24658
2013-11-07 03:06:53 +01:00
degasus
6cece6b486 VideoCommon: create native texture pool
We often need the same native texture objects for new textures. This commit
try to avoid destroying and creation of this textures by pooling them.

This should be a big performance gain for some efb2ram games as they may
overwrites partially a cached texture (which would be deleted) and afterwards
try to read it.

Creating/destroying sounds like an easy task, but it isn't. eg the nvidia ogl
driver synchonize their threads do avoid use-after-free issues.
2013-11-05 12:21:22 +01:00
degasus
045efdfc3e ogl: drop all %f from TextureConversionShader 2013-11-04 12:38:55 +01:00
Matthew Parlane
e15f628935 Fix {Read,Write}FileToString.
We should be using binary always.
2013-11-05 00:33:41 +13:00
comex
c579637eaf Run code through the advanced tool 'sed' to remove trailing whitespace. 2013-11-03 20:54:05 -05:00
comex
965b32be9c Run code through clang-modernize -loop-convert to create range-based for loops, and manually fix some stuff up. 2013-11-03 20:54:01 -05:00
comex
74b5fb3ab4 Actually, filename really does need to be a parameter because of some random debug thing. 2013-11-02 22:44:27 -04:00
comex
cd46138d29 fix non-HAVE_WX case 2013-11-02 22:23:29 -04:00
comex
5f72542e06 Handle screenshot saving in RenderBase. Removes dependency on D3DX11 for screenshots (texture dumping is still broken). 2013-11-02 22:19:21 -04:00
comex
82729fcc8f Merge remote-tracking branch 'shuffle2/vc12'
Conflicts:
	Source/Core/Common/Common.vcxproj
	Source/Core/Common/Common.vcxproj.filters
2013-10-31 16:51:56 -04:00
degasus
92fdac412b VideoCommon: drop UpdateViewportWithCorrection
It's only used once in BPFunction which itself is also only used once.
So the setter is moved to BPStructs like all other ones.
2013-10-29 18:55:50 +01:00
degasus
2118c1d3c3 VideoCommon: remove constants.depthparams[2+3] as they aren't used in the shader at all 2013-10-29 18:55:50 +01:00
degasus
f4a9deefa8 ogl: remove some unneeded includes 2013-10-29 18:55:50 +01:00
degasus
3151d8709c VideoCommon: move ViewportCorrection into VideoCommon
D3D doesn't allow bigger viewports than rendertargets. But flipper does, so the viewport will be clipped and the transformation matrix will be changed.
This was done in the D3D backend itself. This is now moved into VideoCommon. This don't reduce code, but in this way, VideoCommon doesn't depend on the backends.
2013-10-29 18:55:50 +01:00
degasus
b253d60f04 VideoCommon: Drop D3D9 SSAA implementation
This isn't needed for both OGL+D3D11 as they support sample shading directly. So we
could use the common MSAA util shaders instead of writing custom ones.
2013-10-29 18:20:07 +01:00
Shawn Hoffman
ccd30024b3 Update to VS2013 and a slew of build-related updates. Notes:
* Currently there is no DEBUGFAST configuration. Defining DEBUGFAST as a preprocessor definition in Base.props (or a global header) enables it for now, pending a better method. This was done to make managing the build harder to screw up. However it may not even be an issue anymore with the new .props usage.
* D3DX11SaveTextureToFile usage is dropped and not replaced.
* If you have $(DXSDK_DIR) in your global property sheets (Microsoft.Cpp.$(PlatformName).user), you need to remove it. The build will error out with a message if it's configured incorrectly.
* If you are on Windows 8 or above, you no longer need the June 2010 DirectX SDK installed to build dolphin. If you are in this situation, it is still required if you want your built binaries to be able to use XAudio2 and XInput on previous Windows versions.
* GLew updated to 1.10.0
* compiler switches added: /volatile:iso, /d2Zi+
* LTCG available via msbuild property: DolphinRelease
* SDL updated to 2.0.0
* All Externals (excl. OpenAL and SDL) are built from source.
* Now uses STL version of std::{mutex,condition_variable,thread}
* Now uses Build as root directory for *all* intermediate files
* Binary directory is populated as post-build msbuild action
* .gitignore is simplified
* UnitTests project is no longer compiled
2013-10-26 17:55:38 -07:00
Lioncash
97cd42f5c3 Remove some unnecessary includes as well as simplifying exisiting ones if possible. 2013-10-19 19:58:56 -04:00
comex
de1773affb Basic precompiled header support for Linux/OS X. Shaves 20-30% off full rebuild time on my system. 2013-10-17 00:07:35 -04:00
Ryan Houdek
f0bf5aa113 Fix rendering on Adreno and Mali. This adds a new DriverDetails bug to know if the bufferstreaming is broken. Thanks degasus for fixing this. 2013-10-16 11:27:58 +00:00
degasus
b1afb32188 ShaderGen: fix for commit bd80de14f4 2013-10-15 14:48:40 +02:00
degasus
bd80de14f4 ShaderGen: drop PerPixelLighting + 8Texcoord hack
D3D9 only supports 8 texcoords. But we need a new one for ppl, so we just store it in the first 4 texcoords in the free 4th component.

This isn't needed for both d3d11 and ogl3, so just remove it.
2013-10-15 14:38:26 +02:00
degasus
f62579761c ShaderGen: remove nonsense for() if() {} 2013-10-15 14:31:02 +02:00
comex
390760bd75 Perf: Use unordered_map instead of map in very slightly hot function.
Incrementing an unordered_map's iterator is a bit faster.
2013-10-13 15:31:42 -04:00
comex
1570558789 Remove unused variable waitingForPEInterruptDisable. 2013-10-13 14:00:38 -04:00
NeoBrainX
59ae93d04e PixelShaderGen: Refine the comment from revision 3fbe1b1ccd. 2013-10-13 14:59:59 +00:00
degasus
3fbe1b1ccd VideoCommon: Update FastDepth's comment 2013-10-13 16:14:30 +02:00
degasus
6798a4763e VideoCommon: revert the ViewPort changes
xfregs isn't written when calling this function, so we have to use such an invalid flag :-(
2013-10-13 15:41:11 +02:00
degasus
2754c1132e VideoCommon: reimplement Dirty() in PixelShaderManager
This isn't needed in VertexShaderManager as it's still in the old dirty flag way.

But it's very importend for PixelShaderManager as some float4s aren't initialized as 0.0f
2013-10-12 20:31:59 +02:00
degasus
50c404ce4a VideoCommon: fix dstAlpha 2013-10-12 20:31:59 +02:00
degasus
0b2fb548c3 VideoCommon: remove SetVSConstant4f 2013-10-12 20:31:59 +02:00
degasus
5de7ac4791 OGL: update ubo workaround 2013-10-12 20:31:59 +02:00
degasus
cc6c454898 VideoCommon: refactor PixelShaderManager setters
The old way was to use a dirty flag per setter. Now we just update the const buffer per setter directly.
The old optimization isn't needed any more as the setters don't call the backend any more.

The follow parts are rewritten:

Alpha

ZTextureType

zbias

FogParam

FogColor

Color

TexDim

IndMatrix

MaterialColor

FogRangeAdjust

Lights
2013-10-12 20:31:25 +02:00
degasus
15ed0ea9cf videoCommon: remove not supported constant types
I'm pretty sure GPUs can read u8 values, but this isn't exported by the API.

But hey, see unpackSnorm4x8 :-)
2013-10-12 20:29:56 +02:00
degasus
6e2fe72b8f D3D: also uses VideoCommon constant buffer handling
As now both backends uses the VideoCommon one, the old setting API was removed.
2013-10-12 20:29:56 +02:00
degasus
7c14463d11 ogl: implement useful constant buffer upload
this will remove the additional memcpy introduced in my last commit
2013-10-12 20:29:56 +02:00
degasus
4377618438 VideoCommon: keep a copy of the const buffer in VideoCommon
The upload in the backend isn't done, it's just pushed by the mostly removed SetMulti*SConstant4fv.
Also no optimizations was done on VideoCommon side, but I can start now :-)

Sorry for the hacky way, but I think this is a nice (working) snapshot for a much bigger change.
2013-10-12 20:29:56 +02:00
Jasper St. Pierre
a7c7208103 Put Plugins/ in Core/, rename to VideoBackends 2013-10-07 10:37:01 -04:00
Ryan Houdek
c054049712 Fix PixelShaderGen from the previous commit. 2013-10-06 21:54:09 -05:00
Ryan Houdek
26c38648ec [Android] Missed a few things for PowerVR544MP3 'support.' It doesn't actually get any video output on it just like Tegra 4. 2013-10-06 21:51:41 -05:00
Ryan Houdek
d4bd5fde71 Only emit the texgens if they are used, not every single time do all of them. 2013-10-06 21:32:05 -05:00
Tony Wasserka
ed88cf6cad Removing more references to D3D9. 2013-10-06 13:37:10 +02:00
Tony Wasserka
5de6726658 Remove another D3D9 reference. 2013-10-06 13:30:59 +02:00
Tony Wasserka
d198fee21b Remove more references to D3D9... 2013-10-06 13:30:59 +02:00
Tony Wasserka
61ed40749f Shader generators: Remove any references to D3D9 and cleanup the affected code. 2013-10-06 13:30:56 +02:00
Tony Wasserka
0e2e71e483 Remove some now unused VideoConfig settings. 2013-10-06 13:28:46 +02:00
Lioncash
0d4df39e1f Remove D3D9 related files.
Cf. issue 6167 for a list of shortcomings that made us decide on removing the backend.
2013-10-06 13:28:41 +02:00
Ryan Houdek
6bdcde9dd6 [Android] Tegra 4 'support.' This brings up the OpenGL backend to support Tegra 4 to the point where it will run games but it doesn't have any video output for some reason. This is a large change that doesn't actually change much functionally. Walking through the changes.
It changes the string in the Android backend select to just OpenGL ES.
Adds a check in the Android code to check for Tegra 4 and to enable the option to select the OpenGL ES backend.
Adds a DriverDetails bug under BUG_ISTEGRA as a blanket case of Tegra 4 support.
The changes that effects most lines in this change. Removing all float suffixes in the pixel/vertex/util shaders since OpenGL ES 2 doesn't support float suffixes.
Disables the shaders for reinterpreting the EFB format since Tegra 4 doesn't support integers.
Changes GLFunctions.cpp to grab the correct Tegra extension functions.
Readds the GLSL 1.2 'hacks' as GLSLES2 'hacks' since they are required for GLSL ES 2
Adds a GLSLES2 to the GLSL_VERSION enum.
Disable the SamplerCache on Tegra since Tegra doesn't support samplers...
Enable glBufferSubData on Tegra since it is the only mobile GPU to correctly work with it.
Disable glDrawRangeElements on Tegra since it doesn't support it, This uses glDrawElements instead.
2013-10-06 03:12:29 -05:00
comex
f57ff0a569 Support a gcm revision-specific game ini for cheats + partially fix gecko codes in default ini.
The local ini is not revision-specific because it would require renaming
everything.  Meh.
2013-09-28 23:38:25 -04:00
Ryan Houdek
4efc3e6c8f Quick build fix. 2013-09-26 07:50:24 +00:00
Ryan Houdek
feaf65f2ae [Android] The dynamic UBO access isn't actually fixed, contrary to what rev cd646d8e236 said. I presumed it fixed with v4x drivers, but I didn't have the LG G2 with me to test 100% at the time. This won't afflict any Adreno device with v4x drivers since UBOs are disabled for them since they are _broken_. 2013-09-26 07:46:56 +00:00
Ryan Houdek
cd646d89e2 [Android] The issue with the dynamic UBO access on Adreno platforms was fixed with v41 of the video drivers. v41 and above of the video drivers fix the spiky polygon problems that are noticed ingames. 2013-09-25 01:50:02 +00:00
Scott Mansell
0696fc93b2 Merge branch 'fix-field-ordering'
Fixes 6387
Closes 6635
2013-09-24 13:47:20 +12:00
Ryan Houdek
96a77f9feb [Android] Fix the ability to stop the game and start another. 2013-09-23 01:43:18 -05:00
Scott Mansell
440353a3a1 Remove all refrences of field ordering from video backends.
They were unused.
2013-09-23 18:29:31 +12:00
degasus
573dbfd494 ogl: drop glsl120 support 2013-09-22 23:45:14 +02:00
comex
6209067daa Fix stack misalignment fix. 2013-09-22 15:48:27 -04:00
Rachel Bryk
9a6f28fce4 Revert "Fix stack misalignment issues."
This reverts commit d334a9bc23.

This breaks single core.
2013-09-22 14:29:35 -04:00
comex
d334a9bc23 Fix stack misalignment issues.
- Call ABI_AlignStack even on x86-64.

- Have ABI_AlignStack respect the difference in current alignment
  between the root JIT function, which has a prolog, and
  ProtectFunction thunks, which do not.  This was causing many games
  to crash on start on OS X.  Since this might otherwise mean changing
  the stack pointer before every call...

- Have one prolog/epilog function rather than two (one of which
  definitely did not do what it was thought to do), and make it
  actually work like a normal one, so that the stack frame shows up
  properly in the debugger.  There should be no performance impact.
2013-09-20 16:46:48 -04:00
Pierre Bourdon
86f6e8cc1e Better fix for issue 6614: ISOProperties should store integer settings for PHack booleans. INIFile is stupid, please kill it with fire. 2013-09-18 12:33:57 +02:00
Pierre Bourdon
7aa98a3830 Fix loading of the 'projection hack enabled' gameini setting
Fixes issue 6614.
2013-09-18 12:23:46 +02:00
Ryan Houdek
24a44ecfb8 [ANDROID] Add two new DriverDetails bugs for Adreno. V45 of the driver has broken shader compilation with UBOs in the shaders, this is most likely fixed with V53 found in the Nexus 5. Add a bug for issue surrounding on screentext and doing a glClear after swap causes screen swizzling and zero frames rendered respectively. On the Java side, pass in the dimensions of the screen swapped since there is an issue with Adreno where it rotates the output 90 degrees for some reason. Disable the GLSL shader cache on Android for now due to the inability to cleanly exit the emulator, this tends to cause the cache to get corrupted. All this together fixes rendering with Adreno 3xx GPUs with driver version v14 and above. In particular my Galaxy S4 still resets with this without the root commands, but my HTC Droid DNA and LG G2 is fine. This must be due to particular 'enhancements' that the Samsung kernel has over the other ones. The speed on Adreno has yet to be optimized, so it will most likely be slow still. Faster than the software rasterizer in any case. The ARMJIT is still broken in at this point, so not much fun can be had. 2013-09-18 02:37:10 -05:00
degasus
75f2738f5c VideoCommon: fix ogl lighting bug which happens because of NaN emulation
attn is sometimes very big (eg 1e27), so attn*attn doesn't fit into a float.
So the funny part here is: 0.0 * (1e27*1e27) = 0.0 * Inf = NaN

As the shader compiler is allowed to change the order of multiplications,
this issue isn't fixed completely.
2013-09-16 17:10:19 +02:00
Pierre Bourdon
501eafb407 Overlay local gameinis over global gameinis instead of copying.
Huge megacommit because a lot of things needed to be modified to make this
possible.
2013-09-14 17:46:41 +02:00
NeoBrainX
d1e96c7282 Display warning OSD messages when a game ini is overriding any settings. 2013-09-14 06:08:31 +02:00
Pierre Bourdon
91a758b342 Move TextureDecoder.cl from User to Sys 2013-09-14 06:08:30 +02:00
degasus
3fcdf5e25b VideoCommon: use memcmp to compare shader uid 2013-09-11 17:34:23 +02:00
degasus
3ec9f9b64a videoCommon: also reset logicOp on mode switch 2013-09-09 02:30:44 +02:00
Pierre Bourdon
7acee71c0c Move swapModeTable to a local variable, avoids shader uid generation writing to it 2013-09-04 23:23:29 +02:00
Pierre Bourdon
175707739e Move LightingUidData to the LightingShaderGen header 2013-09-04 23:23:29 +02:00
Ryan Houdek
2897619ddb Removal of my terrible idea. 2013-09-02 05:31:48 -05:00
Ryan Houdek
831963616f [Android] Make texture loading/deleting/drawing backend non-specific by making them happen in the backend instead of somewhere else. Just a clean up commit really. 2013-09-02 01:40:05 -05:00
comex
35b8dfbe0c A few more warnings. 2013-09-01 23:33:35 -04:00
degasus
15df7b3445 ogl driverdetails: add flag to disable hacked and pinned memory
pinned memory is broken for index buffers
hacked buffer crashes the amd driver
2013-08-26 19:45:19 +02:00
degasus
1cbc8f8182 sync gpu: check disable flag before volatile
This could be an optimizing as this condition could be moved out of the loop.
So we save an atomic load.
But I don't know if it matters at all
2013-08-24 18:43:07 +02:00
Rodolfo Bogado
dbcc677922 Merge remote-tracking branch 'remotes/origin/dx9-ssaa-fix' 2013-08-23 22:43:03 -03:00
Rodolfo Bogado
40243a4fe7 Indentation Fix 2013-08-23 22:28:17 -03:00
Pierre Bourdon
9303b57db1 Refactor VideoCommon/OnScreenDisplay.
Use strings internally, use a multimap and std::function for callbacks (instead
of a flat vector + loop over the vector to find the right callback type), fix
coding style issues. Simplify MainAndroid code a bit.
2013-08-24 02:13:54 +02:00
Pierre Bourdon
367d6dfd65 Add an OSD message when taking screenshots in D3D9/D3D11
Fixes issue 6486.
2013-08-24 01:41:17 +02:00
degasus
7a5374258e ogl: rework DriverDetails framework + detect UBO mesa bug 2013-08-23 10:52:29 +02:00
Ryan Houdek
1eb1ba8c3d Typo + Add Lima to the driverdetails. 2013-08-21 05:41:32 -05:00
Ryan Houdek
1910f5851f Make us capable of supporting driver specific issues(OSS versus official) 2013-08-21 05:34:52 -05:00
Pierre Bourdon
a3a4f21284 Remove some spurious endlines at the end of log messages 2013-08-21 00:19:50 +02:00
degasus
814c1c9572 pixelShaderGen: also execute alpha test for always fail with late z test
This should fix issue 6493, but maybe no real issue as this rendering just do nothing
2013-08-19 21:27:54 +02:00
Pierre Bourdon
d6fe9c639b Add an OSD message to remind the user if Shader Debugging is enabled
Fixes issue 6497.
2013-08-17 23:48:06 +02:00
Ryan Houdek
7934df3879 Remove a redundant check in the fifo. 2013-08-17 01:27:08 +00:00
Rodolfo Bogado
979718484f Merge branch 'master' of https://code.google.com/p/dolphin-emu into dx9-ssaa-fix 2013-08-15 00:21:28 -03:00
Pierre Bourdon
7622d5b354 Only call SetGenerationMode from BPWritten if the cull mode changed.
Should decrease CPU usage on the GPU thread by a bit in the OGL backend.
2013-08-15 00:26:03 +02:00
Pierre Bourdon
26f58e1ba5 Add an option to enable performance queries in gameini files, disable it by default 2013-08-14 23:16:46 +02:00
Pierre Bourdon
ffdd79df36 Move VideoBackendBase from Common to VideoCommon 2013-08-14 23:16:46 +02:00
NeoBrainX
0cd94b5bc7 VertexShaderGen: Cleanup. 2013-08-14 11:47:23 +00:00
Rodolfo Bogado
9e0fc8b42d Merge branch 'master' of https://code.google.com/p/dolphin-emu into dx9-ssaa-fix 2013-08-12 21:32:25 -03:00
NeoBrainX
c05aa0141d ShaderGen: Optimize out most function calls for uid generation. 2013-08-12 18:30:42 +02:00
NeoBrainX
fe2ca814c5 LightingShaderGen: Use macro magic instead of snprintf. Should fix performance problems. 2013-08-12 18:30:42 +02:00
NeoBrainX
22d9736787 ShaderGen: Static inline everything. 2013-08-12 18:30:42 +02:00
NeoBrainX
69a5a79c03 PixelShaderGen: Optimize shader uid data order. 2013-08-12 18:30:42 +02:00
NeoBrainX
7a1940020d VertexShaderGen: Optimize shader uid data order. 2013-08-12 18:30:41 +02:00
Rodolfo Bogado
5948665cd6 Merge branch 'master' of https://code.google.com/p/dolphin-emu into dx9-ssaa-fix 2013-08-12 10:30:19 -03:00
NeoBrainX
4c22e1264e PixelShaderGen: Do not write depth in pixel shader if depth testing (and thus writing) is not enabled. Should improve performance quite a bit in some cases.
Fixes issue 6474.
2013-08-12 09:33:36 +00:00
Rodolfo Bogado
f4000b6b42 Add the ability to force Dual Source Blending in the configuration file.
this way everyone can check if their hardware support this feature in dx9
2013-08-11 18:48:31 -03:00
NeoBrainX
eed36cbf78 D3D11: Implement zcomploc for hardware supporting D3D 11.0. 2013-08-09 22:20:35 +02:00
degasus
a6fd2c8227 fix lightning for inconsitent config
It's possible to configure to use the vertex color as lightning source without enabling the vertex color at all.
The old implementation will use zero, but it seems to be wrong (prooven by THPS3), more likely is to disable
the lightning and just return the global color.
This fixes THPS3 on OpenGL, but it isn't verifed on hardware
2013-08-07 14:22:15 +02:00
Rachel Bryk
a33b1fcdc6 Make hotkeys for togglign IR, AR, efb copies and fog settings configurable. 2013-07-30 05:49:02 -04:00
degasus
4987f89ecc simplify my last commit 2013-07-29 23:26:18 +02:00
degasus
d029fc2f9f remove printf in shader uid generation 2013-07-29 20:52:24 +02:00
Ryan Houdek
4aba0135e1 [Android] Qualcomm Swap hack isn't needed anymore due to the new StreamBuffer type. 2013-07-26 21:49:48 -05:00
Ryan Houdek
b6e9a75bdf Good Job Windows. Fixes compiling... 2013-07-27 00:53:53 +00:00
Ryan Houdek
f786f0f0c6 Remove the broken buffers bug on Mali hardware since it isn't needed anymore using the glBufferData route in the StreamBuffer class. 2013-07-27 00:41:38 +00:00
Ryan Houdek
e0a5f7842e Fix Mali-T604 shader compilation 2013-07-25 16:13:33 +00:00
Ryan Houdek
672871b3be Add in the Mali driver bug so we can call glFlush every flush. It seemingly is quicker calling flush every time instead of every n times. 2013-07-25 05:44:20 +00:00
degasus
0ba6d12e9d fix a small uid awsome bug 2013-07-23 02:13:40 +02:00
degasus
15b8ac64ef Implement zcomploc on OpenGL4.2+ 2013-07-22 12:02:16 +02:00
Jasper St. Pierre
3c7f223aa1 Add "Q" / "E" as freelook keybindings
To move the view up and down.
2013-07-22 00:14:42 -04:00