Commit graph

307 commits

Author SHA1 Message Date
Jannik Vogel fc9cc21024 OpenGL: Implement W-Buffers and fix depth-mapping 2016-05-10 08:58:52 +02:00
Jannik Vogel 4c98113b57 Pica: Implement W-Buffer in SW rasterizer 2016-05-10 08:58:52 +02:00
linkmauve 006fe5fc0f Merge pull request #1704 from JayFoxRox/pod-config
Pica: PicaShaderConfig is TC and cleared before use
2016-05-10 01:16:53 +01:00
Alexander Laties 0a31e373f1 fixup simple type conversions where possible 2016-05-07 11:41:55 -04:00
Emmanuel Gil Peyrot aa4d4ff23c Frontends, VideoCore: Move glad initialisation to the frontend
On SDL2 this allows it to use SDL_GL_GetProcAddress() instead of the
default function loader, and fixes a crash when using apitrace with an
EGL context.

On Qt we will need to migrate from QGLWidget to QOpenGLWidget and
QOpenGLContext before we can use gladLoadGLLoader() instead of
gladLoadGL(), since the former doesn’t expose a function loader.
2016-05-06 03:10:14 +01:00
Jannik Vogel f74652d2fe Pica: Use a union for PicaShaderConfig 2016-05-03 15:06:49 +02:00
Jannik Vogel 5fc8eb227a Pica: Add TevStageConfigRaw to PicaShaderConfig (MSVC workaround) 2016-05-03 15:06:46 +02:00
Jannik Vogel f3f7018c9e Pica: Make PicaShaderConfig trivially_copyable and clear it before use 2016-05-03 14:10:11 +02:00
Jannik Vogel 5ec1140f8b OpenGL: Don't copy const_color (Reverts #1745) 2016-05-03 12:34:52 +02:00
bunnei 15d0e98267 Merge pull request #1741 from linkmauve/iwyu-video_core
Fix video_core includes (and dependencies) using include-what-you-use
2016-05-01 17:44:57 -04:00
Jannik Vogel 7e0d6903ff OpenGL: Copy TevStageConfig using a loop. Fixes bug: const_color not copied 2016-05-01 16:35:54 +02:00
Jannik Vogel aab41604f7 OpenGL: border_color was never set. Fixed. (#1740) 2016-04-30 12:20:23 -07:00
Emmanuel Gil Peyrot 691a42fe98 VideoCore: Run include-what-you-use and fix most includes. 2016-04-30 17:02:41 +01:00
Yuri Kunde Schlesner e3a8292495 Common: Remove section measurement from profiler (#1731)
This has been entirely superseded by MicroProfile. The rest of the code
can go when a simpler frametime/FPS meter is added to the GUI.
2016-04-29 00:07:10 -07:00
tfarley 562f36a144 HWRasterizer: reorder declarations to match defs 2016-04-22 10:52:02 -04:00
tfarley 3268cab26b HWRasterizer: sync specular uniform for new shaders 2016-04-22 10:48:00 -04:00
bunnei bab30bcd6e Merge pull request #1436 from tfarley/hw-tex-forwarding
Hardware Renderer Texture Forwarding
2016-04-22 08:15:51 -04:00
tfarley 22f3a7e94c HWRasterizer: Texture forwarding 2016-04-21 17:27:56 -04:00
Jannik Vogel 0ad050f85d OpenGL: Implement color combiner Operation::Dot3_RGB 2016-04-10 15:31:24 +02:00
Jannik Vogel 35a92b4097 OpenGL: Respect buffer-write allow registers 2016-04-08 22:57:11 +02:00
Jannik Vogel c6bbc41984 OpenGL: Split buffer-write mask sync into seperate functions 2016-04-08 22:42:44 +02:00
Jannik Vogel d47605b2ed OpenGL: Keep stencil-test and framebuffer.depth_format in sync 2016-04-08 22:35:17 +02:00
bunnei 6e750ae12d Merge pull request #1639 from linkmauve/fix-double-framebuffer-check
OpenGL: Fix a double framebuffer completeness checks.
2016-04-07 19:52:02 -04:00
Mathew Maidment aa6380e5bc Merge pull request #1643 from MerryMage/make_unique
Common: Remove Common::make_unique, use std::make_unique
2016-04-05 20:10:11 -04:00
MerryMage a06dcfeb61 Common: Remove Common::make_unique, use std::make_unique 2016-04-05 13:31:17 +01:00
Emmanuel Gil Peyrot 3219be8ee0 OpenGL: Fix a double framebuffer completeness checks. 2016-04-03 17:00:44 +01:00
Jannik Vogel 693cbc1f8f OpenGL: Check for framebuffer completeness 2016-04-03 17:06:05 +02:00
Jannik Vogel c26b141407 Avoid warnings by casting to size_t for ARRAY_SIZE() comparisons 2016-04-01 02:14:43 +02:00
Yuri Kunde Schlesner 0c447e0a06 OpenGL: Don't attempt to draw empty triangle batches
Our code did not handle this well, causing random crashes in some
situations.
2016-03-23 20:02:05 -07:00
bunnei 8530a2d7df Merge pull request #1344 from LittleWhite-tb/error-output
Output errors in GUI
2016-03-08 23:12:04 -05:00
LittleWhite 4be68dddfb Improve error report from Init() functions
Add error popup when citra initialization failed
2016-03-08 22:05:25 +01:00
Yuri Kunde Schlesner c58bc25d5b Pica: Write depth value even when depth test is disabled
This has been confirmed on hardware. Fixes Etrian Odyssey IV.
2016-03-05 20:16:20 -08:00
Dwayne Slater 6b775034dd Add immediate mode vertex submission 2016-03-02 22:16:38 -05:00
MerryMage 0801363840 renderer_opengl: Initalise fragment shader LUT textures 2016-02-26 00:12:38 +00:00
bunnei 19557aaab3 pica: Cleanup lighting register definitions and documentation. 2016-02-05 17:20:25 -05:00
bunnei c4d318f691 gl_rasterizer: Use alignas(16) instead of explicit padding. 2016-02-05 17:20:24 -05:00
bunnei aaa7beeda8 renderer_opengl: Use GLvec3/GLvec4 aliases for commonly used types. 2016-02-05 17:20:23 -05:00
bunnei 8e9318f20a gl_rasterizer: Fix issue with interpolation of opposite quaternions. 2016-02-05 17:20:23 -05:00
bunnei a949fd5f25 pica_types: Replace float24/20/16 with a template class. 2016-02-05 17:20:22 -05:00
bunnei 310a1c30ca gl_rasterizer: Remove unnecessary casts. 2016-02-05 17:20:19 -05:00
bunnei c229503f4a gl_rasterizer: Fix PicaShaderConfig on GCC. 2016-02-05 17:20:19 -05:00
bunnei 9dfb223d26 gl_rasterizer: Initial implementation of bump mapping. 2016-02-05 17:20:19 -05:00
bunnei 449902b558 gl_shader_gen: Fix bug in LUT range (should within range [0, 255] not [0, 256]). 2016-02-05 17:20:17 -05:00
bunnei 348c9c9ff3 gl_shader_gen: Implement lighting red, green, and blue reflection. 2016-02-05 17:20:16 -05:00
bunnei 01b407638c gl_shader_gen: View should be normalized. 2016-02-05 17:20:15 -05:00
bunnei c37de30cfc gl_shader_gen: Implement fragment lighting fresnel effect. 2016-02-05 17:20:13 -05:00
bunnei 0e67c21c9e gl_shader_gen: Implement fragment lighting specular 1 component. 2016-02-05 17:19:16 -05:00
bunnei 781b046579 gl_shader_gen: Add support for D0 LUT scaling. 2016-02-05 17:18:36 -05:00
bunnei 3d89dacd56 gl_shader_gen: Refactor lighting config to match Pica register naming.
- Also implement D0 LUT enable.
2016-02-05 17:17:35 -05:00
bunnei 6307999116 pica: Cleanup and add some comments to lighting registers. 2016-02-05 17:17:34 -05:00
bunnei 6878ba7608 gl_rasterizer: Minor naming refactor on Pica register naming. 2016-02-05 17:17:33 -05:00
bunnei 76f303538b gl_shader_gen: Reorganize and cleanup lighting code.
- No functional difference.
2016-02-05 17:17:33 -05:00
bunnei 5f3bad8fb1 gl_shader_gen: Fix directional lights. 2016-02-05 17:17:32 -05:00
bunnei bdc72d0904 gl_shader_gen: Fix bug with lighting where clamp highlights was only applied to last light. 2016-02-05 17:17:32 -05:00
bunnei 603b619cbe gl_shader_gen: View vector needs to be normalized when computing half angle vector. 2016-02-05 17:17:31 -05:00
bunnei 021cb0bced renderer_opengl: Use textures for fragment shader LUTs instead of UBOs.
- Gets us LUT interpolation for free.
- Some older Intel GPU drivers did not support the big UBOs needed to store the LUTs.
2016-02-05 17:17:31 -05:00
bunnei bf89870437 renderer_opengl: Initial implementation of basic specular lighting. 2016-02-05 17:17:30 -05:00
bunnei e34fa6365f renderer_opengl: Implement HW fragment lighting distance attenuation. 2016-02-05 17:17:30 -05:00
bunnei e9af70eaf3 renderer_opengl: Implement HW fragment lighting LUTs within our default UBO. 2016-02-05 17:17:29 -05:00
bunnei afbef52516 renderer_opengl: Implement diffuse component of HW fragment lighting. 2016-02-05 17:17:29 -05:00
tfarley a15f4d1590 hwrasterizer: Use proper cached fb addr/size 2016-02-03 15:52:34 -05:00
Yuri Kunde Schlesner 05356543d9 OpenGL: Downgrade GL_DEBUG_SEVERITY_NOTIFICATION to Debug logging level
The nVidia driver is *extremely* spammy on this category, sending a
message on every buffer or texture upload, slowing down the emulator and
making the log useless.
2016-02-02 22:44:13 -08:00
tfarley f53dbafdae hwrasterizer: Use depth offset 2016-01-20 21:57:59 -05:00
bunnei 6a261e825c Merge pull request #1196 from linkmauve/khr_debug
Add optional GL_KHR_debug support
2016-01-12 22:54:52 -05:00
Yuri Kunde Schlesner 402692c08d Merge pull request #1267 from yuriks/flipped-framebuffer
OpenGL: Flip framebuffers during transfer rather than when rendering
2015-12-09 20:35:15 -08:00
Yuri Kunde Schlesner 195fedccf0 VideoCore: Unify interface to OpenGL and SW rasterizers
This removes explicit checks sprinkled all over the codebase to instead
just have the SW rasterizer expose an implementation with no-ops for
most operations.
2015-12-07 20:20:38 -08:00
Yuri Kunde Schlesner 03835d04f4 VideoCore: Rename HWRasterizer methods to be less confusing 2015-12-06 19:08:37 -08:00
Yuri Kunde Schlesner da80ece8b9 OpenGL: Rename cache functions to better match what they actually do 2015-12-06 17:02:52 -08:00
Yuri Kunde Schlesner cf81e08389 OpenGL: Flip framebuffers during transfer rather than when rendering 2015-12-04 22:23:39 -08:00
Yuri Kunde Schlesner 95dbc6eb0e OpenGL: Add support for glFrontFace in the state tracker 2015-12-04 21:58:26 -08:00
Yuri Kunde Schlesner e9c209ccc8 PICA: Properly emulate 1-stage delay in the combiner buffer
This was discovered and verified by @fincs. The tev combiner buffer
actually lags behind by one stage, meaning stage 1 reads the initial
color, stage 2 reads stage 0's output, and so on.

Fixes character portraits in Fire Emblem: Awakening and world textures
in Zelda: ALBW. Closes #1140.
2015-11-30 22:45:18 -08:00
bunnei f008dfbaca renderer_opengl: Fix uniform issues introduced with kemenaran/avoid-explicit-uniform-location. 2015-11-25 22:33:24 -05:00
Pierre de La Morinerie 0735630744 Use regular uniform location
The support for GL_ARB_explicit_uniform_location is not that good
(53% according to http://feedback.wildfiregames.com/report/opengl/feature/GL_ARB_explicit_uniform_location).

This fix the shader compilation on Intel HD 4000 (#1222).
2015-11-25 11:56:11 +01:00
Subv 823ce62f2f FragShader: Use an UBO instead of several individual uniforms 2015-11-18 21:03:56 -05:00
Emmanuel Gil Peyrot 53df67376d OpenGL: Log GL_KHR_debug messages we receive
This allows the driver to communicate errors, warnings and improvement
suggestions about our usage of the API.
2015-10-24 02:30:51 +01:00
bunnei 74186a5f01 gl_shader_gen: Use explicit locations for vertex shader attributes. 2015-10-21 22:29:56 -04:00
bunnei e663f5c914 gl_shader_gen: Optimize code for AppendAlphaTestCondition.
- Also add a comment to AppendColorCombiner.
2015-10-21 22:29:56 -04:00
bunnei e7b1f2ae0a gl_rasterizer: Define enum types for each vertex texcoord attribute. 2015-10-21 21:59:47 -04:00
bunnei 0ebcff710e gl_shader_gen: Various cleanups to shader generation. 2015-10-21 21:59:44 -04:00
bunnei 240a3b80d9 gl_rasterizer: Use MMH3 hash for shader cache hey.
- Includes a check to confirm no hash collisions.
2015-10-21 21:58:59 -04:00
bunnei 71edb55114 gl_shader_gen: Require explicit uniform locations.
- Fixes uniform issue on AMD.
2015-10-21 21:54:56 -04:00
bunnei 5ef2df056d gl_shader_gen: Rename 'o' to 'attr' in vertex/fragment shaders. 2015-10-21 21:53:19 -04:00
bunnei c2c4faef4c gl_shader_gen: AppendAlphaModifier default should be 0.0, not vec4(0.0). 2015-10-21 21:53:18 -04:00
bunnei bd833b8dd8 gl_shader_gen: Fix bug where TEV stage outputs should be clamped. 2015-10-21 21:53:18 -04:00
bunnei f2e7f7e101 gl_rasterizer: Add documentation to ShaderCacheKey. 2015-10-21 21:53:17 -04:00
bunnei 4b5141954e gl_shader_gen: Add additional function documentation. 2015-10-21 21:53:17 -04:00
bunnei 2a0a86f629 gl_shader_util: Cleanup header file + add docstring. 2015-10-21 21:53:16 -04:00
bunnei a74774257e gl_shader_gen: Various cleanups + moved TEV stage generation to its own function. 2015-10-21 21:53:16 -04:00
bunnei c86b9d4242 renderer_opengl: Refactor shader generation/caching to be more organized + various cleanups. 2015-10-21 21:53:14 -04:00
bunnei 3c057bd3d8 gl_rasterizer: Move logic for creating ShaderCacheKey to a static function. 2015-10-21 21:53:05 -04:00
bunnei b02a533d94 gl_shader_util: Use vec3 constants for AppendColorCombiner. 2015-10-21 21:51:24 -04:00
bunnei 37b0aa5af7 gl_rasterizer: Fix typo in uploading TEV const color uniforms. 2015-10-21 21:51:24 -04:00
bunnei 82f3e6dc69 gl_shader_util: Fix precision bug with alpha testing.
- Alpha testing is not done with float32 precision, this makes the HW renderer match the SW renderer.
2015-10-21 21:51:23 -04:00
Subv e3f4233cef Initial implementation of fragment shader generation with caching. 2015-10-21 21:51:23 -04:00
Rohit Nirmal 32391cffdd Silence -Wsign-compare warnings. 2015-10-06 22:16:15 -05:00
Martin Lindhe bafb7afba2 fix some xcode 7.0 warnings 2015-09-29 23:11:09 +02:00
Lioncash 751fbfdcc3 general: Silence some warnings when using clang 2015-09-16 08:51:53 -04:00
Lioncash aec28ed91e video_core: Reorganize headers 2015-09-11 07:31:15 -04:00
Lioncash 1fa772393b video_core: Remove unnecessary includes from headers 2015-09-11 00:10:03 -04:00
bunnei a008b28659 Merge pull request #1133 from lioncash/emplace-back
gl_rasterizer: Replace push_back calls with emplace_back in AddTriangle
2015-09-10 15:07:06 -04:00
Lioncash 8a3428f16c renderer_opengl: Remove unimplemented function declaration 2015-09-10 10:45:44 -04:00
Lioncash 7b72b71605 gl_rasterizer: Replace push_back calls with emplace_back in AddTriangle 2015-09-10 00:20:30 -04:00
Yuri Kunde Schlesner b044c047c4 OpenGL: Use Sampler Objects to decouple sampler config from textures
Fixes #978
2015-09-03 15:09:51 -03:00
Yuri Kunde Schlesner 466e608c19 OpenGL: Remove ugly and endian-unsafe color pointer casts 2015-09-03 15:09:51 -03:00
Yuri Kunde Schlesner ec28f037e6 OpenGL: Add support for Sampler Objects to state tracker 2015-09-03 15:09:50 -03:00
Yuri Kunde Schlesner a1a5570e97 Replace the previous OpenGL loader with a glad-generated 3.3 one
The main advantage of switching to glad from glLoadGen is that, apart
from being actively maintained, it supports a customizable entrypoint
loader function, which makes it possible to also support OpenGL ES.
2015-08-30 08:45:56 -03:00
bunnei 58e9f78844 Merge pull request #1049 from Subv/stencil
Rasterizer: Corrected the stencil implementation.
2015-08-29 20:06:25 -04:00
bunnei f3cef178e3 gl_rasterizer_cache: Detect and ignore unnecessary texture flushes. 2015-08-27 19:07:53 -04:00
Yuri Kunde Schlesner 0fcabd2b11 Integrate the MicroProfile profiling library
This brings goodies such as a configurable user interface and
multi-threaded timeline view.
2015-08-24 22:16:28 -03:00
Subv 583d777b1a HWRenderer: Added a workaround for the Intel Windows driver bug that causes glTexSubImage2D to not change the stencil buffer.
Reported here https://communities.intel.com/message/324464
2015-08-24 11:28:28 -05:00
Subv 0c7da9b815 HWRasterizer: Implemented stencil ops 6 and 7. 2015-08-21 11:05:56 -05:00
Subv e43eb130d4 HWRasterizer: Implemented stencil op 1 (GL_ZERO) 2015-08-21 10:59:49 -05:00
Subv 46f660a789 GLRasterizer: Implemented stencil testing in the hw renderer. 2015-08-20 10:11:09 -05:00
bunnei 18527b9e21 Shader: Move shader code to its own subdirectory, "shader". 2015-08-15 17:33:42 -04:00
bunnei 642b9b5030 GPU: Refactor "VertexShader" namespace to "Shader".
- Also renames "vertex_shader.*" to "shader_interpreter.*"
2015-08-15 17:33:41 -04:00
Yuri Kunde Schlesner 254582aa35 OpenGL: Fix state tracking in situations with reused object handles
If an OpenGL object is created, bound to a binding using the state
tracker, and then destroyed, a newly created object can be assigned the
same numeric handle by OpenGL. However, even though it is a new object,
and thus needs to be bound to the binding again, the state tracker
compared the current and previous handles and concluded that no change
needed to be made, leading to failure to bind objects in certain cases.

This manifested as broken text in VVVVVV, which this commit fixes along
with similar texturing problems in other games.
2015-08-06 00:59:37 -03:00
Yuri Kunde Schlesner ff68db61bc OpenGL: Remove redundant texture.enable_2d field from OpenGLState
All uses of this field where it's false can just set the texture id to 0
instead.
2015-08-05 22:55:22 -03:00
Yuri Kunde Schlesner 428154da45 OpenGL: Add a profiler category measuring framebuffer readback 2015-07-28 17:37:46 -03:00
Yuri Kunde Schlesner 1762267de4 OpenGL: Make OpenGL object resource wrappers fully inline
The functions are so simple that having them separate only bloats the
code and hinders optimization.
2015-07-26 10:58:58 -03:00
bunnei cea45af64d Merge pull request #977 from yuriks/glenable-tex2d
GL Renderer: Remove erroneous glEnable(GL_TEXTURE_2D) calls
2015-07-23 10:07:35 -04:00
Subv 7b4961e968 Rasterizer/GL: Set the border color when binding a texture. 2015-07-22 18:41:37 -05:00
Yuri Kunde Schlesner e5c4fe0098 GL Renderer: Remove erroneous glEnable(GL_TEXTURE_2D) calls
In OpenGL 3, texturing is always enabled, and this call is invalid.
While it produced no effect in the rest of the execution, it wouldn't
have the intended effect of disabling texturing for that unit. Instead
bind a null texture to the unit.
2015-07-22 01:22:09 -03:00
Subv 009e34f08a GPU: Added registers for min and mag texture filters and implemented them in the hw renderer. 2015-07-21 16:26:09 -05:00
Subv a694caeee0 GLRasterizer: Don't try to get a pointer to the depth buffer if it doesn't exist. 2015-07-19 14:09:23 -05:00
Tony Wasserka 902fa4da52 Add CiTrace recording support.
This is exposed in the GUI as a new "CiTrace Recording" widget.

Playback is implemented by a standalone 3DS homebrew application (which only runs reliably within Citra currently; on an actual 3DS it will often crash still).
2015-07-13 22:27:20 +02:00
Tony Wasserka ae7120f5d9 Merge pull request #907 from Lectem/clamp_to_border
Add GL_CLAMP_TO_BORDER support.
2015-07-12 03:19:46 +02:00
Lectem 58d1c6398e Added GL_CLAMP_TO_BORDER support 2015-07-09 22:23:26 +02:00
Emmanuel Gil Peyrot 4964a359e1 Core: Cleanup hw includes. 2015-06-28 00:46:39 +01:00
Emmanuel Gil Peyrot f48b28ad27 Core, VideoCore: Replace or fix exit() calls. 2015-06-28 00:36:55 +01:00
Emmanuel Gil Peyrot 596b7c4f63 Common: Cleanup key_map includes. 2015-06-28 00:36:54 +01:00
Emmanuel Gil Peyrot 94fc644430 VideoCore: Log the GL driver’s vendor and renderer. 2015-06-16 00:02:23 +01:00
tfarley 26bc816d7a Renderer formatting edits 2015-06-08 19:19:15 -04:00
tfarley 66b0d799ee Render-to-texture flush, interval math fix 2015-06-08 19:18:20 -04:00
tfarley 5025b35563 Liberal texture unbind (clout menu) 2015-06-08 19:18:19 -04:00
tfarley fa2c92a3ac Depth format fix (crush3d intro/black screens) 2015-06-08 19:18:18 -04:00
tfarley d42275f11c Implemented glColorMask 2015-06-08 19:18:17 -04:00
archshift 0414ad20cb Merge pull request #811 from archshift/commonify
Commonify video_core utility headers
2015-05-31 09:55:29 -07:00
bunnei 33b9abb91e Pica: Use zero for the SecondaryFragmentColor source.
- This is a workaround until we support fragment lighting.
2015-05-31 01:52:42 -04:00
bunnei e6ace38815 Pica: Implement LogicOp function. 2015-05-31 01:52:41 -04:00
archshift 76690392bf Move video_core/color.h to common/color.h 2015-05-30 11:17:37 -07:00
archshift 5df2d1b5f7 Move video_core/math.h to common/vector_math.h
The file only contained vector manipulation code, and such widely-useable code doesn't belong in video_core.
2015-05-30 11:17:36 -07:00
Emmanuel Gil Peyrot b1503b2020 Remove every trailing whitespace from the project (but externals). 2015-05-29 21:59:29 +01:00
Lioncash 951353558e gl_state: Remove unnecessary const specifier on Apply 2015-05-23 00:58:32 -04:00
bunnei 1b42d55a9d Pica: Create 'State' structure and move state memory there. 2015-05-22 22:59:42 -04:00
Lioncash 23d5df9d9c gl_state: Fix a condition typo in Apply 2015-05-22 19:49:12 -04:00
tfarley 05dc633a8c OpenGL renderer 2015-05-22 15:51:18 -07:00
Yuri Kunde Schlesner 7ada357b2d Memmap: Re-organize memory function in two files
memory.cpp/h contains definitions related to acessing memory and
configuring the address space
mem_map.cpp/h contains higher-level definitions related to configuring
the address space accoording to the kernel and allocating memory.
2015-05-15 00:04:38 -03:00
Yuri Kunde Schlesner 17a8cae003 Memory: Add GetPhysicalPointer helper function 2015-05-09 04:02:32 -03:00
Yuri Kunde Schlesner e1fbac3ca1 Common: Remove common.h 2015-05-07 15:45:22 -03:00
archshift cae89fb315 Allow the user to set the background clear color during emulation
The background color can be seen at the sides of the bottom screen or when the window is wider than normal.
2015-04-03 15:35:51 -07:00