video_core: Bump OpenGL version to 4.3 on desktop

* The current backend heavily depends on many extensions for shadow
  rendering and texture cubes in the fragment shaders. All these
  extensions were incorporated to core in 4.3. Support is practically
  ubiquitous and requiring support for it makes things a lot easier
master
emufan4568 2022-08-21 01:39:16 +07:00
parent 02d1fa2e0f
commit 025cd31420
6 changed files with 21 additions and 19 deletions

@ -143,14 +143,16 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
SDL_SetMainReady();
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
if (Settings::values.use_gles) {
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
} else {
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
}
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);

@ -9,7 +9,7 @@
#include <QOffscreenSurface>
#include <QOpenGLContext>
#include <QOpenGLFunctions>
#include <QOpenGLFunctions_3_3_Core>
#include <QOpenGLFunctions_4_3_Core>
#include <fmt/format.h>
#include "citra_qt/bootmanager.h"
#include "citra_qt/main.h"
@ -143,7 +143,7 @@ void OpenGLWindow::Present() {
VideoCore::g_renderer->TryPresent(100);
}
context->swapBuffers(this);
auto f = context->versionFunctions<QOpenGLFunctions_3_3_Core>();
auto f = context->versionFunctions<QOpenGLFunctions_4_3_Core>();
f->glFinish();
QWindow::requestUpdate();
}

@ -2441,7 +2441,7 @@ int main(int argc, char* argv[]) {
QCoreApplication::setApplicationName(QStringLiteral("Citra"));
QSurfaceFormat format;
format.setVersion(3, 3);
format.setVersion(4, 3);
format.setProfile(QSurfaceFormat::CoreProfile);
format.setSwapInterval(0);
// TODO: expose a setting for buffer value (ie default/single/double/triple)

@ -45,8 +45,8 @@ class RasterizerCacheOpenGL;
class CachedSurface : public SurfaceParams, public std::enable_shared_from_this<CachedSurface> {
public:
CachedSurface(RasterizerCacheOpenGL& owner, TextureRuntime& runtime) :
owner(owner), runtime(runtime) {}
CachedSurface(SurfaceParams params, RasterizerCacheOpenGL& owner,TextureRuntime& runtime) :
SurfaceParams(params), owner(owner), runtime(runtime) {}
~CachedSurface();
/// Read/Write data in 3DS memory to/from gl_buffer

@ -731,13 +731,14 @@ SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces(
}
Surface RasterizerCacheOpenGL::GetFillSurface(const GPU::Regs::MemoryFillConfig& config) {
Surface new_surface = std::make_shared<CachedSurface>(*this, runtime);
SurfaceParams params;
params.addr = config.GetStartAddress();
params.end = config.GetEndAddress();
params.size = params.end - params.addr;
params.type = SurfaceType::Fill;
params.res_scale = std::numeric_limits<u16>::max();
new_surface->addr = config.GetStartAddress();
new_surface->end = config.GetEndAddress();
new_surface->size = new_surface->end - new_surface->addr;
new_surface->type = SurfaceType::Fill;
new_surface->res_scale = std::numeric_limits<u16>::max();
Surface new_surface = std::make_shared<CachedSurface>(params, *this, runtime);
std::memcpy(&new_surface->fill_data[0], &config.value_32bit, 4);
if (config.fill_32bit) {
@ -1085,14 +1086,13 @@ void RasterizerCacheOpenGL::InvalidateRegion(PAddr addr, u32 size, const Surface
}
Surface RasterizerCacheOpenGL::CreateSurface(const SurfaceParams& params) {
Surface surface = std::make_shared<CachedSurface>(*this, runtime);
static_cast<SurfaceParams&>(*surface) = params;
Surface surface = std::make_shared<CachedSurface>(params, *this, runtime);
surface->invalid_regions.insert(surface->GetInterval());
surface->texture =
AllocateSurfaceTexture(GetFormatTuple(surface->pixel_format), surface->GetScaledWidth(),
surface->GetScaledHeight());
// Allocate surface texture
const FormatTuple& tuple = GetFormatTuple(surface->pixel_format);
surface->texture = AllocateSurfaceTexture(tuple, surface->GetScaledWidth(),
surface->GetScaledHeight());
return surface;
}

@ -26,7 +26,7 @@ GLuint LoadShader(const char* source, GLenum type) {
#extension GL_EXT_clip_cull_distance : enable
#endif // defined(GL_EXT_clip_cull_distance)
)"
: "#version 330\n";
: "#version 450 core\n";
const char* debug_type;
switch (type) {