Commit Graph

197 Commits

Author SHA1 Message Date
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
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
Ryan Houdek fd8757a64b Fix OpenGL 2.1 devices that support everything we need.
The only two devices that do this are Mesa software rasterizer and Intel Ironlake(With a few hacks).
Basically since it doesn't support OpenGL 3.0, it can't grab the version the new way.
So failing that, it sets to GL 2.1, and continues.

Further along, on Ironlake at least, it tries grabbing the extensions the new GL 3.0 way and fails.
So have a fallback that grabs the extensions string the old way, in probably the most elegant way possible.
2014-01-23 16:02:53 -06:00
degasus 65121cf9a9 OpenGL: remove unused OpenGL headers 2014-01-23 18:52:57 +01:00
degasus ff002320a5 OpenGL: Stream vertices + indices 2014-01-23 15:12:31 +01:00
degasus 128fcdac26 OpenGL: refactor all of our StreamBuffers
The old way was to use big switch/case statements based on a type of buffer.
The new one is to use inheritance.

This change prohibits us to change the buffer type while running, but I doubt we'll ever do so.
Performance should also be a bit better. Also a nice cleanup.

Added some comments about this different kind of buffers.
2014-01-23 15:12:31 +01:00
degasus be1fee6d74 OpenGL: change StreamBuffer in a streaming way
This is a bit slower on map_and_* because of flushing and _very_ much slower on buffer(sub)?data because of a new memcpy.
But this design allow us to decode directly into a gpu buffer, eg vertexloader will profit :)
2014-01-23 15:12:31 +01:00
Ryan Houdek 07db7520bf [GLExt-Cleanup] This cleans up some extra bits unneeded in the extension headers
gl.h and glext.h provide most of the function pointer typedefs and defines for extensions and core features.
The only one it doesn't provide is GL 1.1 function typedefs, but this is to be expected.
If anything needs defines or typedefs in their header in the future, that's as easy as before.
2014-01-23 07:11:13 -06:00
degasus ebbf1d392b VideoCommon: merge trivial parts of VertexManager::Flush 2014-01-21 10:47:00 +01:00
degasus 60632fda6f OpenGL: remove small optimization
This one was introduced to reduce the glBindTexture and glActiveTexture calls. But it was quite a bit of logic and only an improvment on uploading/creating a texture, which is done rarely.
2014-01-21 10:34:48 +01:00
degasus fe02833f13 OpenGL: fix our ubo workaround when blend_func_extended is missing 2014-01-21 10:03:05 +01:00
Scott Moreau 2c8340e1dc Move GLInterface.h into GLInterface directory 2014-01-20 00:46:21 -07:00
Ryan Houdek 683dbc09ac Stop building GLExtensions.cpp twice(One in GL, one in software). We don't need to build it twice, this'll save a bit of time in the build process.
Also a bit of spacing cleanup.
2014-01-19 11:37:37 -06:00
Ryan Houdek 5d26bf6d9d Rename our GLInterface class function 'GetProcAddress' in order to not have clashing function names due to Windows. 2014-01-18 14:18:32 +00:00
Ryan Houdek bea484e12f Move Win32 specific function grabbing fallback to WGL.cpp. Fixes issue 6964. 2014-01-18 14:10:24 +00: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 5a599d472e Merge branch 'GLExtensions' 2014-01-17 16:49:51 +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 e932a349e8 [GLExtensions] fixup for missing changes on rebase 2014-01-17 16:10:10 +01:00
Ryan Houdek 29e0a90b88 [GLExtensions] Rename internal GetProcAddress function since it clashes with the global Windows function. Fix Windows function pointer grabbing. 2014-01-17 16:06:46 +01:00
Ryan Houdek 6cdb05b633 [GLExtensions] OpenGL 3.0 also added GL_ARB_map_buffer_range to core. 2014-01-17 16:06:23 +01:00
Ryan Houdek a5ffe9932a [GLExtensions] Future proof ourself by putting the default: instance on the top, so we'll grab extensions if they support something newer. Handle older GLVersions in the case they get that far. 2014-01-17 16:06:18 +01:00
Ryan Houdek 2a11fead5c [GLExtensions] Populate the extension list for OpenGL implementations that don't show core extensions. 2014-01-17 16:06:13 +01:00
Ryan Houdek 0ea6718d99 [GLExtensions] Fix OS X build. 2014-01-17 16:06:08 +01:00
Ryan Houdek 34c9a33807 [GLExtensions] Remove AGL GetProcAddress. Change dlsym to using RTLD_NEXT. Enable dlsym fallback for OS X 2014-01-17 16:06:03 +01:00
Ryan Houdek ca96274936 [GLExtensions] Make sure to link against libdl since we use it to grab GL function pointers in Linux/Android in the case the GLInterface->GetProcAddress fails. 2014-01-17 16:05:57 +01:00
Ryan Houdek 45dfa3a481 [GLExtensions] Missed a couple USE_GLES3 compile time differences. 2014-01-17 16:05:52 +01:00
Ryan Houdek 97dc20d1be [GLExtensions] Pull in all the function pointers for OpenGL 1.1, This removes the need for a couple compile time differences between GL and GLES3 mode. 2014-01-17 16:05:40 +01:00
Ryan Houdek f308b878b2 [GLExtensions] Oops. Don't just outright disable these helper functions. 2014-01-17 16:05:34 +01:00
Ryan Houdek cfb8b43b4a [GLExtensions] Don't fail out loading funciton pointers in both ES2 and ES3 modes. 2014-01-17 16:05:25 +01:00
Jack Frost f4bd7bdef0 fix windows build
add the GL include (back) to Base.props
use a similar technique to GLX.cpp (by Sonic) in WGL.cpp to get
wglSwapIntervalEXT without the WGLEW check

Conflicts:
	Source/Core/VideoBackends/OGL/OGL.vcxproj
	Source/Core/VideoBackends/OGL/OGL.vcxproj.filters
	Source/VSProps/Base.props
2014-01-17 16:01:17 +01:00
Ryan Houdek 10bd61a9d2 [GLExtensions] Dynamically pull in the GL 1.3 and 1.4 functions as well. 2014-01-17 15:56:54 +01:00
Ryan Houdek d5a7ea2041 [GLExtensions] KHR_debug on OpenGL ES 3 has a KHR suffix on their function pointers. In Desktop OpenGL there is no suffix. So handle this correctly. Make the GrabFunction macro slightly less evil, so update the init_* to reflect it. Thanks Bh44L for the suggestion. 2014-01-17 15:56:28 +01:00
Ryan Houdek d093276e93 [GLExtensions] Fix a typo in KHR_debug 2014-01-17 15:56:20 +01:00
Ryan Houdek cf8865a6e5 [GLExtensions] Add ARB_buffer_storage to negate at least one null pointer instance. 2014-01-17 15:52:34 +01:00
Ryan Houdek 71681de81a [GLExtensions] Initial code drop for GLExtensions. This drops GLEW entirely from the codebase. This has been tested on Android and Linux+ATI. Of course untested on Windows and Apple. Also untested with Linux + EGL but should be fine there. There are most likely a couple of extensions I'm missing which would result in null pointer runs but not bad for the initial commit.
Conflicts:
	CMakeLists.txt
	Externals/GLew/glew.vcxproj
	Externals/GLew/glew.vcxproj.filters
	Source/Core/VideoBackends/OGL/CMakeLists.txt
	Source/Core/VideoBackends/OGL/GLFunctions.cpp
	Source/Core/VideoBackends/OGL/GLFunctions.h
	Source/Core/VideoBackends/OGL/GLUtil.h
	Source/Core/VideoBackends/OGL/Render.cpp
	Source/VSProps/Base.props
2014-01-17 15:50:51 +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
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
degasus 95aa977d81 OGL: remove masking from streambuffer
We used this to disable pinned memory for index buffer, but as the detection
was reworked completely, it's just unused code.
2014-01-09 18:52:05 +01: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 cdf69adcb0 Fix for previous commit. I was supposed to use GL_VERSION, not GL_RENDERER. 2014-01-07 19:35:06 -06:00
Ryan Houdek d2e62796fc Probe the GL_RENDERER string on Nvidia to grab the driver version. 2014-01-07 18:29:04 -06: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 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 0faf696be7 Merge Fail. We don't disable BaseVertex on broken pinned memory. 2014-01-01 17:20:09 -06: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 de16b7207c D3D/OGL: Add a TODO noting that we don't support GX_CULL_ALL, most notably required for accurate zfreeze emulation. 2013-12-30 20:37:59 +01:00
Ryan Houdek a5bfdbf6cd Free performance for AMD+Linux. Instead of disabling BaseVertex due to pinned_memory. Just disable pinned_memory for the ELEMENT_ARRAY_BUFFER type which has issues with baseVertex(ELEMENT_ARRAY_BUFFER)+pinned_memory. In my two tests with this, I went from 5FPS to 11FPS in one test, and 2FPS to 6FPS in another. 2013-12-28 08:00:44 -06:00
Ryan Houdek 0b31fc8f52 [buffer_storage] Temporary fix for Android/GLES3 just like how everything else is. Cleanup for this will be in a new branch. 2013-12-28 05:16:39 -06:00
Ryan Houdek 8fdcba0c06 [buffer_storage] Code formatting changes suggested by Bh44L 2013-12-28 05:15:43 -06:00
Ryan Houdek 935e1fdf99 [Android] Enable shader cache. 2013-12-28 04:55:39 -06:00
Ryan Houdek d8b7f4d73f [Android] Support grabbing OpenGL extensions and a function for checking for support. 2013-12-28 01:08:52 -06:00
Ryan Houdek 77ba051361 [buffer_storage] Add the CLIENT_STORAGE_BIT since we access the buffer more frequently on the client side than the server side. That is exactly what the hint is for. 2013-12-27 22:58:36 -06:00
Ryan Houdek d8ceb97a60 [buffer_storage] Require GLEW 1.10 which has the new OpenGL 4.4 methods. Fixes linux build. 2013-12-27 15:37:31 -06: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 a87e0e7489 Remove our GLU dependency. Fix static zlib 2013-12-23 16:01:34 -07: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 8c264a3964 In the shader log message, say if the error came from a PS or VS. 2013-12-18 22:21:14 -06:00
Ryan Houdek f9ff0bc55d Have our OpenGL/ES context creation be less stupid. 2013-12-12 12:43:49 -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
degasus 134c89ef98 OpenGL: disable shader cache when ShaderDebugging is enabled
fixes 6859
2013-12-09 16:45:20 +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
degasus edc879ce48 OpenGL: fix crash in revision 95aeedec19
Real xfb didn't provide any read_stride, so there is a division by zero.

This commit calculates the correct read_stride for real_xfb, so there is also no hack for texture vs xfb needed.
2013-12-03 00:09:37 +01:00
degasus 95aeedec19 OpenGL: readback efb2ram with different strides at once
This is done with a pixel buffer object. We still have to stall the GPU, but
we only do it once per efb2ram call.
As the cpu can't access the vram, it has to queue a memcpy for the gpu and
wait for the gpu to finish this copy. We did this for every cache line which
is just stupid. Now we copy the complete texture into a pbo and readback this
at once. So we don't have to wait for lots of round-trip-times.
2013-11-26 20:05:49 +01:00
degasus 1138c2e155 OpenGL: reset EFB after efb2ram FB initialization 2013-11-26 04:07:59 +01:00
degasus 0b4cb2e15f OpenGL: split real xfb + efb2ram framebuffers 2013-11-25 22:27:11 +01:00
Ryan Houdek 9dbb262aab Fix for OpenGL ES 3. 2013-11-25 15:11:06 +00: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 454e1dd9a2 OpenGL: attributeless rendering for efb2ram
This wasn't as easy as we now have to cache also the uniform locations.
2013-11-25 13:03:35 +01:00
degasus 6ed3f82aff OpenGL: attributeless rendering for postprocessing 2013-11-25 12:36:17 +01:00
degasus 38fe05b1df OpenGL: attributeless rendering in emulate format changes
only cleanup
2013-11-25 12:27:54 +01:00
degasus dd0b74ac15 OpenGL: cleanup efb2tex
Also use attributeless rendering. But we need the src rect, so set it by uniform.
If there is a slowdown here (I doubt as the driver likely has a fast path to update uniforms)
then we should check if this rect changes and only then update the uniform.
2013-11-25 12:19:34 +01:00
degasus b93756df87 OpenGL: drop texture_rect hack
Everything is moved to texture2d (but often in a hacky way), so we don't need this global hack any more.
2013-11-25 09:05:50 +01:00
degasus afcf0e65d1 OpenGL: fix emulate format changes for texture2d 2013-11-25 08:59:04 +01:00
degasus b904d56036 OpenGL: fix efb2tex for texture2d 2013-11-25 08:43:55 +01:00
degasus 1a3e790d9e OpenGL: fix xfb for texture2d 2013-11-25 08:38:00 +01:00
degasus e8f23af10b OpenGL: always use texture2d as efb 2013-11-25 08:32:41 +01:00
degasus 230e12ae8c OpenGL: also remove VAO from xfb convertion
We use attributeless rendering, so officially we have to bind _any_ VAO.
As the state of this VAO doesn't matter, we don't have to switch it.

Also fix an AMD issue as they don't like to render from an empty VAO.
2013-11-25 07:38:20 +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 d410fe7c96 OpenGL: cleanup yuv2rgb (real xfb) workflow
We neither scale nor render from subimages, so we by using gl_Position, we don't have to generate _any_ vertices for this converting.

Also remove the glTexSubImage optimization as every driver does it when needed. But there are some workflows (eg on APU) where it's better to realloc this texture instead of a second memcpy or stall.
2013-11-24 15:56:50 +01:00
Scott Mansell 12741f6406 Add comments for anybody attempting accuracy improvements in the future. 2013-11-25 01:30:53 +13:00
Scott Mansell b5bd2ba847 OpenGL: Enable filtering for EFB to Real XFB copies.
This fixes Real XFB Jaggies in OpenGL on games which use yscaling, such
as most PAL games.

This fixes the last of the "Real XFB Macroblocking" issues for opengl,
see issue #6503
2013-11-25 01:11:42 +13:00
Scott Mansell e6b35642df Fix Desktop GLSL versions in the recent changes.
Seems OpenGL ES 3 Requires you must have an lod argument, while Desktop
versions require you must not have a lod argument if you are using a
Sampler2DRect (which doesn't do Mipmapping).
2013-11-24 22:48:10 +13:00
Ryan Houdek 531f840720 Fix OpenGL ES 3 in the recent changes. texelFetch doesn't require the lod argument in desktop GLSL versions, but in GLSL ES 3 it is a required argument. 2013-11-24 07:45:42 +00:00
degasus 994426b3dc Opengl: fix real XFB sample positions
(0,0) and (1,0) aren't accurate xfb sample positions. This fixes the image shift to the left and some blocking on higher IR.
2013-11-24 05:39:40 +01:00
Scott Mansell eef2cddfd7 Opengl: Fix opengl realxfb "macroblocking"/bluring issue.
YUYV textures should NEVER be interpolated/filtered in RGB colour space.
Use TexelFetch to always fetch an actual texture sample.

issue 6503
2013-11-24 17:15:11 +13:00