Commit graph

1181 commits

Author SHA1 Message Date
OatmealDome
b36c866398 OGLTexture: Only set texture name if supported 2022-01-31 01:17:40 -05:00
OatmealDome
ea1ac73c38 OGLShader: Only set shader name if supported 2022-01-31 01:17:40 -05:00
OatmealDome
390cc13834 OGLRender: Set object name support on GL >4.3 and GL ES 3.2 2022-01-31 01:17:40 -05:00
Léo Lam
83c5446d85
Fix static initialisation order fiasco issue for Version variables
Fixes a crash that could occur if the static constructor function for
the MainSettings.cpp TU happened to run before the variables in
Common/Version.cpp are initialised. (This is known as the static
initialisation order fiasco.)

By using wrapper functions, those variables are now guaranteed to be
constructed on first use.
2022-01-14 00:04:22 +01:00
Pokechu22
161c627466 Treewide: Remove unused inclusions of <cinttypes>
Most of these became unneeded when fmt was introduced.
2022-01-09 12:43:11 -08:00
Léo Lam
13939b13d7
Merge pull request #10311 from JosJuice/gles-sampler2dmsarray
GLES: Fix missing precision for sampler2DMSArray
2022-01-01 16:49:34 +01:00
JosJuice
76b508557e GLES: Fix missing precision for sampler2DMSArray
We don't use sampler2DMS, but we do use sampler2DMSArray.

I can't reproduce it on my phone, but a user who was running GLES
on a Tegra X1 reported a shader compilation error related to this.
2021-12-28 11:36:11 +01:00
OatmealDome
91cdeb5aa6 SamplerCache: Check for bSupportsLodBiasInSampler instead of IsGLES 2021-12-25 15:17:19 -05:00
OatmealDome
08396c56e5 VideoConfig: Add bool for sampler LOD bias support 2021-12-25 15:16:27 -05:00
JMC47
b1f79d9ecf
Merge pull request #10215 from OatmealDome/shader-logic-ops
VideoCommon: Support shader logic ops on Metal (Apple GPUs) and OpenGL ES
2021-12-22 16:39:54 -05:00
Pokechu22
27cb704466 Eliminate VarType for ComponentFormat 2021-12-18 15:21:48 -08:00
Pokechu22
2025763420 Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
OatmealDome
1c421444ae ProgramShaderCache: Don't define FB_FETCH_VALUE for GL_EXT_shader_framebuffer_fetch
We will automatically choose between real_ocol0 and ocol0 in the fragment shader.
2021-12-06 22:36:40 -05:00
Pokechu22
1adff1c467 VideoCommon: Skip textureQueryLevels if it doesn't exist 2021-11-17 21:28:39 -08:00
Pokechu22
51e3334526 VideoCommon: Use coarse derivatives for Manual Texture Sampling if possible 2021-11-17 20:04:34 -08:00
Pokechu22
4a9b26de86 VideoCommon: Expose SamplerState to shaders
The benefit to exposing this over the raw BP state is that adjustments Dolphin makes, such as LOD biases from arbitrary mipmap detection, will work properly.
2021-11-17 20:04:34 -08:00
Pokechu22
6236a0d494 Eliminate SamplerCommon 2021-11-17 20:04:34 -08:00
Pokechu22
04d8cdfe88 Convert LOG_TYPE and LOG_LEVELS to enum class 2021-10-24 11:48:36 -07:00
Pokechu22
78bfd25964 Fix all uninitialized variable warnings (C26495) 2021-10-13 12:32:16 -07:00
Techjar
1161af8059 VideoCommon: Abstract bounding box
This moves much of the duplicated bounding box code into VideoCommon,
leaving only the specific buffer implementations in each backend.
2021-10-04 15:51:24 -04:00
iwubcode
1f2f505373 VideoBackends / VideoCommon: allow the ability to set debug names for shaders / textures. These names are visible in applications like RenderDoc 2021-08-30 13:47:48 -05:00
Léo Lam
815b590dfe
Update clang-format to version 12
12 is the latest release and various editors (VS, VSCode and CLion)
ship with clang-format 12 by default.
2021-08-30 00:20:18 +02:00
Pierre Bourdon
e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Léo Lam
2898cf5121
Merge pull request #9784 from PEmu2/master
Update buffer_storage warning message
2021-06-13 12:56:26 +02:00
Techjar
4866002c9b VideoCommon: Perform OpenGL bounding box inversion in pixel shader
Running the min/max operation on the upside down, quad-rounded pixel
coordinates before inverting them to the standard upper-left origin
produces wrong results. Therefore, we need to do the inversion before
rounding to pixel quads.
2021-06-06 20:55:06 -04:00
PEmu2
44206b7702
Update buffer_storage warning message 2021-06-05 15:08:47 -07:00
Techjar
2f1b639f0a VideoCommon: Restore BBox* forwarding functions 2021-05-31 18:01:47 -04:00
Connor McLaughlin
b3a414ea9d
Merge pull request #9766 from stenzek/ogl-bbox-memory-barrier
OGL: Force memory barrier when reading back bounding box values
2021-05-29 17:04:57 +10:00
Connor McLaughlin
6393f157f0 OGL: Force memory barrier when reading back bounding box values
We also need to ensure the the CPU does not receive stale values
which have been updated by the GPU. Apparently the buffer here
is not coherent on NVIDIA drivers. Not sure if this is a driver
bug/spec violation or not, one would think that
glGetBufferSubData() would invalidate any caches as needed, but
this path is only used on NVIDIA anyway, so it's fine. A point
to note is that according to ARB_debug_report, it's moved from
video to host memory, which would explain why it needs the
cache invalidate.
2021-05-29 16:57:40 +10:00
Techjar
a24e78b3cf VideoCommon: Remove BBox* forwarding functions 2021-05-29 01:45:21 -04:00
Connor McLaughlin
7fd0a526e1 VideoBackends/OGL: Cache bounding box values between reads 2021-05-28 19:30:46 +10:00
Techjar
0f17990137 VideoCommon: Split BBox* functions into common and backend implementation variants
This will allow for some aspects of bounding box to be handled in
VideoCommon instead of individual backends.
2021-05-22 01:11:57 -04:00
JosJuice
1d3b9fdec2 Fix perf query regression
When trying to do a small optimization in 8a0f5ea, I failed to
take into account that WeakFlush and FlushOne update m_query_count.

Only D3D11 and OGL had this problem, not D3D12 and Vulkan.
2021-05-21 13:39:59 +02:00
JosJuice
8a0f5ea04a Remove all remaining volatile qualifiers 2021-05-15 09:52:04 +02:00
JosJuice
b93983b50a Remove Atomic.h
The STL has everything we need nowadays.

I have tried to not alter any behavior or semantics with this
change wherever possible. In particular, WriteLow and WriteHigh
in CommandProcessor retain the ability to accidentally undo
another thread's write to the upper half or lower half
respectively. If that should be fixed, it should be done in a
separate commit for clarity. One thing did change: The places
where we were using += on a volatile variable (not an atomic
operation) are now using fetch_add (actually an atomic operation).

Tested with single core and dual core on x86-64 and AArch64.
2021-05-13 18:56:27 +02:00
Pokechu22
70f9fc4e75 Convert BPMemory to BitField and enum class
Additional changes:
- For TevStageCombiner's ColorCombiner and AlphaCombiner, op/comparison and scale/compare_mode have been split as there are different meanings and enums if bias is set to compare.  (Shift has also been renamed to scale)
- In TexMode0, min_filter has been split into min_mip and min_filter.
- In TexImage1, image_type is now cache_manually_managed.
- The unused bit in GenMode is now exposed.
- LPSize's lineaspect is now named adjust_for_aspect_ratio.
2021-03-06 19:27:19 -08:00
Shawn Hoffman
500a694ca8 msbuild: bundle all dolphin "core" code into single library 2021-01-27 14:29:49 -08:00
Shawn Hoffman
ff4f67492b normalize common filenames in VideoBackends/OGL 2021-01-27 14:29:48 -08:00
Lioncash
139d4fc76e General: Convert PanicAlerts over to fmt equivalent
Converts lingering panic alert calls over to the fmt-capable ones.
2020-12-02 13:38:33 -05:00
blåhaj
bf0fe0281a Fix bounding box incorrectly disabled on OpenGL ES 3.1, 3.2 2020-11-24 21:22:39 +01:00
Lioncash
413d64e7fc OpenGL: Migrate logging over to fmt
Migrates over to the fmt-capable logger.
2020-11-09 03:09:09 -05:00
JosJuice
6eefc3c524 Make default graphics backend not show up as empty
Fixes https://bugs.dolphin-emu.org/issues/12245.

I considered making a change to DolphinQt instead of
the core, but then additional effort would've been
required to add the same fix to the Android GUI once
we start using the new config system there.
2020-09-06 12:56:45 +02:00
Shawn Hoffman
4db06bf85b ogl: init ProgramShaderCache::s_ubo_align to 1.
silences a warning that it may cause div-by-zero.
2020-08-27 15:15:52 -07:00
Shawn Hoffman
2f47f486af msbuild: re-enable standalone vcxproj processing 2020-08-22 16:17:50 -07:00
Shawn Hoffman
94bf48b67c msbuild: refactor stuff out of project files (for dolphin) 2020-08-22 16:17:50 -07:00
Shawn Hoffman
36ace8eb52 prettify some constructs in vcxproj files 2020-08-22 16:17:50 -07:00
JosJuice
6f298378a1 Reword "Please avoid forcing Dolphin to use MSAA by the driver" message
Some users who get this error don't seem to gain much understanding
of how to resolve the problem from reading the error message.
2020-07-08 11:34:36 +02:00
Lioncash
86f8768268 VideoCommon/ShaderGenCommon: Make template functions regular functions
These are only ever used with ShaderCode instances and nothing else.
Given that, we can convert these helper functions to expect that type of
object as an argument and remove the need for templates, improving
compiler throughput a marginal amount, as the template instantiation
process doesn't need to be performed.

We can also move the definitions of these functions into the cpp file,
which allows us to remove a few inclusions from the ShaderGenCommon
header. This uncovered a few instances of indirect inclusions being
relied upon in other source files.

One other benefit is this allows changes to be made to the definitions
of the functions without needing to recompile all translation units that
make use of these functions, making change testing a little quicker.

Moving the definitions into the cpp file also allows us to completely
hide DefineOutputMember() from external view, given it's only ever used
inside of GenerateVSOutputMembers().
2020-05-25 21:12:29 -04:00
Stenzek
bf74553878 FramebufferManager: Copy to color format for depth readbacks on GLES
glReadPixels() with depth formats is not supported.

Should fix broken EFB access on GLES.
2020-05-24 16:11:11 +10:00
Ryan Meredith
e5f6d9320f Add Dolphin version and current video backend to shader compilation logs 2020-01-24 03:29:38 -05:00
David Korth
05101b251c OGL/Render.cpp, InitDriverInfo(): Use std::string_view to eliminate string copies.
Consolidate the NVIDIA Tegra and non-Tegra checks into one branch.
2019-12-29 23:45:02 -05:00
Stenzek
6fcb1c6c46 Add an ARM64 target to Visual Studio projects 2019-12-28 19:20:41 +10:00
Lioncash
10f7674651 VideoCommon/IndexGenerator: Eliminate static state
Now that we've extracted all of the stateless functions that can be
hidden, it's time to make the index generator a regular class with
active data members.

This can just be a member that sits within the vertex manager base
class. By deglobalizing the state of the index generator we also get rid
of the wonky dual-initializing that was going on within the OpenGL
backend.

Since the renderer is always initialized before the vertex manager, we
now only call Init() once throughout the execution lifecycle.
2019-12-05 10:49:32 -05:00
Stenzek
dd23a1ee79 Update VS projects/solutions to VS2019 2019-11-30 13:42:52 +10:00
Lioncash
c792961000 Common: Unify logging namespace with Common
Previously the logging was a in a little bit of a disarray. Some things
were in namespaces, and other things were not.

Given this code will feature a bit of restructuring during the
transition over to fmt, this is a good time to unify it under a single
namespace and also remove functions and types from the global namespace.

Now, all functions and types are under the Common::Log namespace. The
only outliers being, of course, the preprocessor macros.
2019-11-28 05:13:21 -05:00
Lioncash
67bd2de73e OGL/ProgramShaderCache: Convert typedef over to a using alias
Same thing, but nicer to read from left to right.
2019-07-26 18:43:44 -04:00
Lioncash
d6617d399f OGL/ProgramShaderCache: Use std::lock_guard deduction guides where applicable
Same thing, less reading.
2019-07-26 18:22:55 -04:00
Lioncash
6e69e3cf26 OGL/ProgramShaderCache: Remove unused headers
Removes a few inclusions that aren't necessary, reducing the number of
header dependencies.
2019-07-26 18:09:44 -04:00
Lioncash
fb384dec55 OGL/ProgramShaderCache: Use std::string_view where applicable 2019-07-26 18:02:00 -04:00
Lioncash
2b9389202e VideoCommon: Remove unused MathUtil.h include from VideoCommon.h
This header doesn't actually make use of MathUtil.h within itself, so
this can be removed. Many other source files used VideoCommon.h as an
indirect include to include MathUtil.h, so these includes can also be
adjusted.

While we're at it, we can also migrate valid inclusions of VideoCommon.h
into cpp files where it can feasibly be done to minimize propagating it
via other headers.
2019-07-16 20:54:34 -04:00
Lioncash
d4337eebde VideoCommon/Statistics: Rename stats global to g_stats
Makes the global variable follow our convention of prefixing g_ on
global variables to make it obvious in surrounding code that it's not a
local variable.
2019-07-10 23:34:54 -04:00
Lioncash
a99c7d01e1 VideoCommon/Statistics: Normalize statistic variable names
Normalizes all variables related to statistics so that they follow our
coding style.

These are relatively low traffic areas, so this modification isn't too
noisy.
2019-07-10 23:19:10 -04:00
Connor McLaughlin
951b66e4ac
Merge pull request #8049 from stenzek/crop
Renderer: Adjust source rectangle when crop would draw off screen
2019-06-08 20:57:52 +10:00
Lioncash
a9663669dc Common/CommonFuncs: Remove now-unneccessary ArraySize function
Since C++17, non-member std::size() is present in the standard library
which also operates on regular C arrays. Given that, we can just replace
usages of ArraySize with that where applicable.

In many cases, we can just change the actual C array ArraySize() was
called on into a std::array and just use its .size() member function
instead.

In some other cases, we can collapse the loops they were used in, into a
ranged-for loop, eliminating the need for en explicit bounds query.
2019-06-01 10:07:57 -04:00
Lioncash
115e7992c5 VideoOGL/CMakeLists: Specify headers in target sources 2019-05-31 06:54:26 -04:00
Lioncash
e60268bd42 VideoCommon/RenderBase: Use a std::string_view with CreateShaderFromSource()
Greatly simplifies the overall interface when it comes to compiling
shaders. Also allows getting rid of a std::string overload of the same
name. Now std::string and const char* both go through the same function.
2019-05-30 03:29:35 -04:00
Techjar
ff972e3673 Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
Léo Lam
99a4ca8de7
Merge pull request #7839 from ShFil119/impr/redundant
Remove redundant initialization
2019-05-04 22:50:51 +02:00
Filip Gawin
c110ffcdaa Remove redundant initialization 2019-04-30 01:22:24 +02:00
Stenzek
32359bf2bb Renderer: Adjust target rectangle in the base class 2019-04-28 23:33:24 +10:00
Stenzek
3c64f0c616 Renderer: Adjust source rectangle when crop would draw off screen
This prevents us from requiring an oversized and/or negative viewport by
shrinking the source rectangle instead.
2019-04-28 23:31:57 +10:00
Stenzek
356ebdf509 OGL: Set shared context state up to match main context
Has a better chance of avoiding recompiling if so.
2019-04-21 14:28:14 +10:00
Stenzek
6553cf8bb1 OGL: Only set GL_PROGRAM_POINT_SIZE on desktop GL
It is always enabled in GLES.
2019-04-21 14:28:14 +10:00
Stenzek
f2a594fad5 OGL: Fix binding error on shutdown
This was occurring if the imgui vertex format was bound on shutdown,
which is destroyed before the vertex buffers
2019-04-21 14:28:14 +10:00
Stenzek
5c95dc61fc OGL: Store shader source in OGLShader
So it can be dumped with info log when linking fails.
2019-04-21 14:28:14 +10:00
Stenzek
bbd1ae16db OGL: Remove unused ProgramShaderCache::CompileShader() 2019-04-21 14:28:14 +10:00
Stenzek
f8c1ba409c Replace EFBRectangle/TargetRectangle with MathUtil::Rectangle 2019-04-21 14:28:14 +10:00
Stenzek
616ad378b7 OGL: Support returning pipeline cache data 2019-04-16 00:39:43 +10:00
Stenzek
61a656570e AbstractPipeline: Support returning "cache data"
"Cache data" can be used to assist a driver with creating pipelines by
using previously-compiled shader ISA.
2019-04-16 00:09:47 +10:00
Connor McLaughlin
39139a52e7
Merge pull request #7939 from Techjar/no-more-disabled-gfx-features
Qt/HacksWidget: Fix backend feature support checks
2019-03-31 11:59:34 +10:00
Techjar
5d37b2b951 Qt/HacksWidget: Fix backend feature support checks 2019-03-29 08:45:21 -04:00
Connor McLaughlin
f3fadd7302
Merge pull request #7869 from stenzek/d3dcommon
D3D: Move sharable D3D11/D3D12 code to common library
2019-03-29 20:40:06 +10:00
Stenzek
86da282570 OGL: Support subgroup reduction operations via GL_NV_shader_thread_shuffle 2019-03-29 20:06:56 +10:00
Stenzek
3b86c93285 VertexManagerBase: Increase vertex/uniform buffer sizes
ZTP was uploading 10MB+ of uniforms per frame, reducing paralellism by
forcing GPU waits.
2019-03-29 19:52:38 +10:00
Stenzek
2a4bca8b4a VideoBackends: Verify validity before doing full renderer init
Prevents attempting to create invalid MSAA configurations, for example.
2019-03-29 19:52:38 +10:00
Stenzek
16294acd2a VideoBackends: Scale bounding box rectangle in the pixel shader 2019-03-25 18:47:58 +10:00
Stenzek
a218a794cb FramebufferManager: Implement deferred EFB cache invalidation 2019-03-09 12:24:04 +10:00
Stenzek
65216c9e87 VideoConfig: Add SupportsPartialDepthCopies to backend info
D3D11 doesn't support partial copies of depth buffers via
CopySubResource(), so we need to use a different path for the EFB cache.
2019-03-09 12:19:53 +10:00
Stenzek
21d81f99ff VideoBackends: Fix GPU decoding of XFB buffers
Was using UNORM instead of UINT, resulting in invalid values.
2019-02-28 20:35:22 +10:00
Stenzek
f039149198 Move most backend functionality to VideoCommon 2019-02-19 16:57:54 +10:00
Tilka
8d59d1bb11
Merge pull request #7798 from ShFil119/impr/empty
Use empty instead of size
2019-02-13 01:59:43 +00:00
Filip Gawin
49fe9f5db1 Use empty instead of size 2019-02-13 00:03:49 +01:00
Tilka
8aaebfa2b3
Merge pull request #7716 from stenzek/stereo
Stereoscopy regression fixes
2019-02-03 19:57:01 +00:00
Stenzek
b01df8670f Renderer: Fix throttle-disable (TAB) hotkey when vsync is enabled 2019-01-27 12:31:12 +10:00
Stenzek
e4b205c769 Decouple XFB scanout from presentation 2019-01-25 11:15:57 +10:00
Stenzek
c9c0b85056 VideoBackends: Store a backbuffer 'scale'
This is a scaling factor, used for hi-dpi configurations.
2019-01-25 11:15:57 +10:00
Stenzek
63dd91628d Remove old RasterFont classes 2019-01-25 11:15:57 +10:00
Stenzek
600d1fc0bc Renderer: Use imgui for drawing debug text and OSD 2019-01-25 11:15:57 +10:00
Stenzek
d1868d9475 RenderBase: Implement imgui rendering 2019-01-25 11:10:49 +10:00
Stenzek
396b7c2978 OGL: Invalidate tracked state when calling ResetAPIState()
Due to the current design, any of the GL state can be mutated after
calling this function, so we can't assume that the tracked state will
match if we call SetPipeline() after ResetAPIState().
2019-01-25 11:10:49 +10:00