From 335695bd0e09e1781ddf5abf5ee70103897b3235 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Fri, 1 May 2015 19:16:18 +0200 Subject: [PATCH] purge GLES from GSdx ! mobile will use vulkan (or any new API) anyway --- build.sh | 2 - cmake/BuildParameters.cmake | 1 - cmake/SearchForStuff.cmake | 1 - plugins/GSdx/CMakeLists.txt | 19 ++------ plugins/GSdx/GLLoader.cpp | 23 +-------- plugins/GSdx/GLLoader.h | 78 ------------------------------- plugins/GSdx/GS.cpp | 4 -- plugins/GSdx/GSDeviceOGL.cpp | 29 ------------ plugins/GSdx/GSDeviceOGL.h | 12 ----- plugins/GSdx/GSRendererOGL.cpp | 11 ----- plugins/GSdx/GSShaderOGL.cpp | 35 -------------- plugins/GSdx/GSTextureOGL.cpp | 8 ---- plugins/GSdx/GSVertexArrayOGL.h | 27 ----------- plugins/GSdx/GSWnd.cpp | 3 -- plugins/GSdx/GSWndEGL.cpp | 18 ------- plugins/GSdx/GSWndOGL.cpp | 2 +- plugins/GSdx/GSWndOGL.h | 2 +- plugins/GSdx/res/glsl/tfx_fs.glsl | 15 ------ plugins/GSdx/res/glsl_source.h | 15 ------ plugins/GSdx/stdafx.h | 5 -- 20 files changed, 7 insertions(+), 303 deletions(-) diff --git a/build.sh b/build.sh index 83e115e5f7..f66f5a154f 100755 --- a/build.sh +++ b/build.sh @@ -33,7 +33,6 @@ for ARG in "$@"; do --release ) flags+=(-DCMAKE_BUILD_TYPE=Release) ;; --glsl ) flags+=(-DGLSL_API=TRUE) ;; --egl ) flags+=(-DEGL_API=TRUE) ;; - --gles ) flags+=(-DGLES_API=TRUE) ;; --sdl2 ) flags+=(-DSDL2_API=TRUE) ;; --extra ) flags+=(-DEXTRA_PLUGINS=TRUE) ;; --asan ) flags+=(-DUSE_ASAN=TRUE) ;; @@ -60,7 +59,6 @@ for ARG in "$@"; do echo "--glsl : Replace CG backend of ZZogl by GLSL" echo "--egl : Replace GLX by EGL (ZZogl plugins only)" echo "--sdl2 : Build with SDL2 (crashes if wx is linked to SDL1.2)" - echo "--gles : Replace openGL backend of GSdx by openGLES3.1" echo "--cross-multilib: Build a 32bit PCSX2 on a 64bit machine using multilib." echo echo "** Expert Developer option **" diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index 48b167c428..02f639b54c 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -27,7 +27,6 @@ option(DISABLE_SVU "Disable superVU (don't use it)") #------------------------------------------------------------------------------- option(GLSL_API "Replace zzogl CG backend by GLSL (experimental option)") option(EGL_API "Use EGL on zzogl (experimental/developer option)") -option(GLES_API "Use GLES on GSdx (experimental/developer option)") option(REBUILD_SHADER "Rebuild glsl/cg shader (developer option)") option(BUILD_REPLAY_LOADERS "Build GS replayer to ease testing (developer option)") diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 8c8918e72a..2dd786e551 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -70,7 +70,6 @@ if(Linux) check_lib(AIO aio libaio.h) endif() check_lib(EGL EGL EGL/egl.h) -check_lib(GLESV2 GLESv2 GLES3/gl3ext.h) # NOTE: looking for GLESv3, not GLESv2 check_lib(PORTAUDIO portaudio portaudio.h pa_linux_alsa.h) check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h) diff --git a/plugins/GSdx/CMakeLists.txt b/plugins/GSdx/CMakeLists.txt index e5bbef53ae..a646d2ad6c 100644 --- a/plugins/GSdx/CMakeLists.txt +++ b/plugins/GSdx/CMakeLists.txt @@ -38,10 +38,6 @@ if(XDG_STD) set(GSdxFinalFlags ${GSdxFinalFlags} -DXDG_STD) endif() -if(GLES_API AND GLESV2_FOUND) - set(GSdxFinalFlags ${GSdxFinalFlags} -DENABLE_GLES) -endif() - #Clang doesn't support a few common flags that GCC does. if(NOT USE_CLANG) set(GSdxFinalFlags ${GSdxFinalFlags} -fabi-version=6) @@ -199,17 +195,10 @@ set(GSdxFinalLibs ${X11_LIBRARIES} ) -if(GLES_API AND GLESV2_FOUND) - set(GSdxFinalLibs - ${GSdxFinalLibs} - ${GLESV2_LIBRARIES} - ) -else() - set(GSdxFinalLibs - ${GSdxFinalLibs} - ${OPENGL_LIBRARIES} - ) -endif() +set(GSdxFinalLibs + ${GSdxFinalLibs} + ${OPENGL_LIBRARIES} + ) set(GSdxFinalLibs ${GSdxFinalLibs} diff --git a/plugins/GSdx/GLLoader.cpp b/plugins/GSdx/GLLoader.cpp index 4b17971dc3..55d30e6deb 100644 --- a/plugins/GSdx/GLLoader.cpp +++ b/plugins/GSdx/GLLoader.cpp @@ -22,7 +22,6 @@ #include "GLLoader.h" #include "GSdx.h" -#ifndef ENABLE_GLES PFNGLACTIVETEXTUREPROC gl_ActiveTexture = NULL; PFNGLBLENDCOLORPROC gl_BlendColor = NULL; PFNGLATTACHSHADERPROC gl_AttachShader = NULL; @@ -146,8 +145,6 @@ PFNGLCREATEPROGRAMPIPELINESPROC gl_CreateProgramPipelines = NU PFNGLCLIPCONTROLPROC gl_ClipControl = NULL; PFNGLTEXTUREBARRIERPROC gl_TextureBarrier = NULL; -#endif - namespace Emulate_DSA { // Texture entry point void APIENTRY BindTextureUnit(GLuint unit, GLuint texture) { @@ -337,9 +334,6 @@ namespace GLLoader { bool found_GL_ARB_clip_control = false; bool found_GL_ARB_direct_state_access = false; - // Mandatory for opengl ES (allow to use GL code) - bool found_GL_EXT_shader_io_blocks = false; - // Mandatory bool found_GL_ARB_texture_storage = false; bool found_GL_ARB_shading_language_420pack = false; @@ -380,9 +374,7 @@ namespace GLLoader { const char* vendor = (const char*)glGetString(GL_VENDOR); fprintf(stderr, "Supported Opengl version: %s on GPU: %s. Vendor: %s\n", s, glGetString(GL_RENDERER), vendor); -#ifndef ENABLE_GLES fprintf(stderr, "Note: the maximal version supported by GSdx is 3.3 (even if you driver support more)!\n"); -#endif // Name change but driver is still bad! if (strstr(vendor, "ATI") || strstr(vendor, "Advanced Micro Devices")) @@ -403,7 +395,6 @@ namespace GLLoader { GLuint major_gl = s[dot-1]-'0'; GLuint minor_gl = s[dot+1]-'0'; -#ifndef ENABLE_GLES if (mesa_amd_buggy_driver || intel_buggy_driver) { fprintf(stderr, "Buggy driver detected. Geometry shaders will be disabled\n"); found_geometry_shader = false; @@ -412,15 +403,10 @@ namespace GLLoader { found_geometry_shader = !!theApp.GetConfig("override_geometry_shader", -1); fprintf(stderr, "Override geometry shaders detection\n"); } -#else - found_geometry_shader = false; -#endif -#ifndef ENABLE_GLES if ( (major_gl < major) || ( major_gl == major && minor_gl < minor ) ) { fprintf(stderr, "OPENGL %d.%d is not supported\n", major, minor); return false; } -#endif return true; } @@ -432,7 +418,6 @@ namespace GLLoader { if (gl_GetStringi && max_ext) { for (GLint i = 0; i < max_ext; i++) { string ext((const char*)gl_GetStringi(GL_EXTENSIONS, i)); -#ifndef ENABLE_GLES // GL4.0 if (ext.compare("GL_ARB_gpu_shader5") == 0) found_GL_ARB_gpu_shader5 = true; // GL4.1 @@ -470,9 +455,6 @@ namespace GLLoader { if (ext.compare("GL_ARB_direct_state_access") == 0) found_GL_ARB_direct_state_access = true; if (ext.compare("GL_ARB_clip_control") == 0) found_GL_ARB_clip_control = true; if (ext.compare("GL_ARB_texture_barrier") == 0) found_GL_ARB_texture_barrier = true; -#else // ENABLE_GLES - if (ext.compare("GL_EXT_shader_io_blocks") == 0) found_GL_EXT_shader_io_blocks = true; -#endif //fprintf(stderr, "DEBUG ext: %s\n", ext.c_str()); } @@ -481,7 +463,6 @@ namespace GLLoader { bool status = true; fprintf(stderr, "\n"); -#ifndef ENABLE_GLES // GL4.0 status &= status_and_override(found_GL_ARB_gpu_shader5,"GL_ARB_gpu_shader5"); // GL4.1 @@ -501,9 +482,7 @@ namespace GLLoader { status &= status_and_override(found_GL_ARB_clip_control, "GL_ARB_clip_control"); status &= status_and_override(found_GL_ARB_direct_state_access, "GL_ARB_direct_state_access"); status &= status_and_override(found_GL_ARB_texture_barrier, "GL_ARB_texture_barrier"); -#else // ENABLE_GLES - status &= status_and_override(found_GL_EXT_shader_io_blocks, "GL_EXT_shader_io_blocks", true); -#endif + if (!found_GL_ARB_direct_state_access) { Emulate_DSA::Init(); } diff --git a/plugins/GSdx/GLLoader.h b/plugins/GSdx/GLLoader.h index 7f9f0382ef..114367f677 100644 --- a/plugins/GSdx/GLLoader.h +++ b/plugins/GSdx/GLLoader.h @@ -26,7 +26,6 @@ #define GL_FB_DEFAULT (0) #define GL_BUFFER_0 (0) -#ifndef ENABLE_GLES // FIX compilation issue with Mesa 10 // Note it might be possible to do better with the right include // in the rigth order but I don't have time @@ -207,10 +206,6 @@ typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, #endif /* GL_VERSION_4_5 */ - -#endif - -#ifndef ENABLE_GLES extern PFNGLACTIVETEXTUREPROC gl_ActiveTexture; extern PFNGLBLENDCOLORPROC gl_BlendColor; extern PFNGLATTACHSHADERPROC gl_AttachShader; @@ -334,79 +329,6 @@ extern PFNGLCREATEPROGRAMPIPELINESPROC gl_CreateProgramPipelines; extern PFNGLCLIPCONTROLPROC gl_ClipControl; extern PFNGLTEXTUREBARRIERPROC gl_TextureBarrier; -#else -#define gl_ActiveTexture glActiveTexture -#define gl_BlendColor glBlendColor -#define gl_AttachShader glAttachShader -#define gl_BindBuffer glBindBuffer -#define gl_BindBufferBase glBindBufferBase -#define gl_BindFramebuffer glBindFramebuffer -#define gl_BindSampler glBindSampler -#define gl_BindVertexArray glBindVertexArray -#define gl_BlendEquationSeparate glBlendEquationSeparate -#define gl_BlendFuncSeparate glBlendFuncSeparate -#define gl_BlitFramebuffer glBlitFramebuffer -#define gl_BufferData glBufferData -#define gl_CheckFramebufferStatus glCheckFramebufferStatus -#define gl_ClearBufferfv glClearBufferfv -#define gl_ClearBufferiv glClearBufferiv -#define gl_ClearBufferuiv glClearBufferuiv -#define gl_CompileShader glCompileShader -#define gl_ColorMask glColorMask -#define gl_CreateProgram glCreateProgram -#define gl_CreateShader glCreateShader -#define gl_CreateShaderProgramv glCreateShaderProgramv -#define gl_DeleteBuffers glDeleteBuffers -#define gl_DeleteFramebuffers glDeleteFramebuffers -#define gl_DeleteProgram glDeleteProgram -#define gl_DeleteSamplers glDeleteSamplers -#define gl_DeleteShader glDeleteShader -#define gl_DeleteVertexArrays glDeleteVertexArrays -#define gl_DetachShader glDetachShader -#define gl_DrawBuffers glDrawBuffers -#define gl_DrawElementsBaseVertex glDrawElementsBaseVertex -#define gl_EnableVertexAttribArray glEnableVertexAttribArray -#define gl_FramebufferRenderbuffer glFramebufferRenderbuffer -#define gl_FramebufferTexture2D glFramebufferTexture2D -#define gl_GenBuffers glGenBuffers -#define gl_GenFramebuffers glGenFramebuffers -#define gl_GenSamplers glGenSamplers -#define gl_GenVertexArrays glGenVertexArrays -#define gl_GetBufferParameteriv glGetBufferParameteriv -#define gl_GetDebugMessageLogARB glGetDebugMessageLogARB -#define gl_GetProgramInfoLog glGetProgramInfoLog -#define gl_GetProgramiv glGetProgramiv -#define gl_GetShaderiv glGetShaderiv -#define gl_GetStringi glGetStringi -#define gl_IsFramebuffer glIsFramebuffer -#define gl_LinkProgram glLinkProgram -#define gl_MapBuffer glMapBuffer -#define gl_MapBufferRange glMapBufferRange -#define gl_ProgramParameteri glProgramParameteri -#define gl_SamplerParameterf glSamplerParameterf -#define gl_SamplerParameteri glSamplerParameteri -#define gl_ShaderSource glShaderSource -#define gl_Uniform1i glUniform1i -#define gl_UnmapBuffer glUnmapBuffer -#define gl_UseProgramStages glUseProgramStages -#define gl_VertexAttribIPointer glVertexAttribIPointer -#define gl_VertexAttribPointer glVertexAttribPointer -#define gl_TexStorage2D glTexStorage2D -#define gl_BufferSubData glBufferSubData - -#define gl_BindProgramPipeline glBindProgramPipeline -#define gl_DeleteProgramPipelines glDeleteProgramPipelines -#define gl_GenProgramPipelines glGenProgramPipelines -#define gl_GetProgramPipelineiv glGetProgramPipelineiv -#define gl_ValidateProgramPipeline glValidateProgramPipeline -#define gl_GetProgramPipelineInfoLog glGetProgramPipelineInfoLog - -#define gl_UseProgram glUseProgram -#define gl_GetShaderInfoLog glGetShaderInfoLog -#define gl_ProgramUniform1i glProgramUniform1i - -#endif - namespace Emulate_DSA { extern void SetFramebufferTarget(GLenum target); extern void SetBufferTarget(GLenum target); diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 8008a965d2..42fb028113 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -290,12 +290,8 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1) s_gs->m_wnd = new GSWndDX(); break; } -#else -#ifdef ENABLE_GLES - wnd[0] = NULL; #else wnd[0] = new GSWndOGL(); -#endif wnd[1] = new GSWndEGL(); #endif } diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 779149f901..bd8712df21 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -182,11 +182,9 @@ bool GSDeviceOGL::Create(GSWnd* wnd) // **************************************************************** // Debug helper // **************************************************************** -#ifndef ENABLE_GLES #ifdef ENABLE_OGL_DEBUG gl_DebugMessageCallback((GLDEBUGPROC)DebugOutputToFile, NULL); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); -#endif #endif // **************************************************************** @@ -277,16 +275,10 @@ bool GSDeviceOGL::Create(GSWnd* wnd) // **************************************************************** // rasterization configuration // **************************************************************** -#ifndef ENABLE_GLES glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); -#endif glDisable(GL_CULL_FACE); glEnable(GL_SCISSOR_TEST); - // FIXME enable it when multisample code will be here - // DX: rd.MultisampleEnable = true; -#ifndef ENABLE_GLES glDisable(GL_MULTISAMPLE); -#endif #ifdef ONLY_LINES glLineWidth(5.0); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); @@ -321,12 +313,10 @@ bool GSDeviceOGL::Create(GSWnd* wnd) // because of -1 we loose lot of precision for small GS value // This extension allow FS depth to range from -1 to 1. So // gl_position.z could range from [0, 1] -#ifndef ENABLE_GLES if (GLLoader::found_GL_ARB_clip_control) { // Change depth convention gl_ClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE); } -#endif // **************************************************************** // HW renderer shader @@ -560,9 +550,7 @@ void GSDeviceOGL::InitPrimDateTexture(GSTexture* rt) ClearRenderTarget_ui(m_date.t, 0x0FFFFFFF); -#ifndef ENABLE_GLES gl_BindImageTexture(2, static_cast(m_date.t)->GetID(), 0, false, 0, GL_READ_WRITE, GL_R32I); -#endif } void GSDeviceOGL::RecycleDateTexture() @@ -578,9 +566,7 @@ void GSDeviceOGL::RecycleDateTexture() void GSDeviceOGL::Barrier(GLbitfield b) { -#ifndef ENABLE_GLES gl_MemoryBarrier(b); -#endif } /* Note: must be here because tfx_glsl is static */ @@ -604,11 +590,7 @@ GLuint GSDeviceOGL::CompileGS() int unscale_sprite = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_UnscaleSprite", 0) : 0; std::string macro = format("#define GS_SPRITE %d\n", unscale_sprite); -#ifdef ENABLE_GLES - return 0; -#else return m_shader->Compile("tfx_vgs.glsl", "gs_main", GL_GEOMETRY_SHADER, tfx_vgs_glsl, macro); -#endif } /* Note: must be here because tfx_glsl is static */ @@ -686,13 +668,11 @@ void GSDeviceOGL::CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r) ASSERT(st && dt); if (GLLoader::found_GL_ARB_copy_image) { -#ifndef ENABLE_GLES gl_CopyImageSubData( static_cast(st)->GetID(), GL_TEXTURE_2D, 0, r.x, r.y, 0, static_cast(dt)->GetID(), GL_TEXTURE_2D, 0, r.x, r.y, 0, r.width(), r.height(), 1); -#endif } else { GSTextureOGL* st_ogl = (GSTextureOGL*) st; @@ -1113,7 +1093,6 @@ void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVecto void GSDeviceOGL::CheckDebugLog() { -#ifndef ENABLE_GLES unsigned int count = 16; // max. num. of messages that will be read from the log int bufsize = 2048; unsigned int sources[16] = {}; @@ -1136,13 +1115,11 @@ void GSDeviceOGL::CheckDebugLog() } delete[] messageLog; -#endif } // Note: used as a callback of DebugMessageCallback. Don't change the signature void GSDeviceOGL::DebugOutputToFile(GLenum gl_source, GLenum gl_type, GLuint id, GLenum gl_severity, GLsizei gl_length, const GLchar *gl_message, const void* userParam) { -#ifndef ENABLE_GLES std::string message(gl_message, gl_length); std::string type, severity, source; static int sev_counter = 0; @@ -1182,7 +1159,6 @@ void GSDeviceOGL::DebugOutputToFile(GLenum gl_source, GLenum gl_type, GLuint id, fclose(f); } ASSERT(sev_counter < 5); -#endif } // (A - B) * C + D @@ -1212,13 +1188,8 @@ void GSDeviceOGL::DebugOutputToFile(GLenum gl_source, GLenum gl_type, GLuint id, #define D3DBLEND_BLENDFACTOR GL_CONSTANT_COLOR #define D3DBLEND_INVBLENDFACTOR GL_ONE_MINUS_CONSTANT_COLOR -#ifdef ENABLE_GLES -#define D3DBLEND_SRCALPHA GL_SRC_ALPHA -#define D3DBLEND_INVSRCALPHA GL_ONE_MINUS_SRC_ALPHA -#else #define D3DBLEND_SRCALPHA GL_SRC1_ALPHA #define D3DBLEND_INVSRCALPHA GL_ONE_MINUS_SRC1_ALPHA -#endif const GSDeviceOGL::D3D9Blend GSDeviceOGL::m_blendMapD3D9[3*3*3*3] = { diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index a543c4697f..71ca9ff452 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -107,11 +107,7 @@ public: GLState::b_msk = m_b_msk; GLState::a_msk = m_a_msk; -#ifdef ENABLE_GLES - gl_ColorMask(m_r_msk, m_g_msk, m_b_msk, m_a_msk); -#else gl_ColorMaski(0, m_r_msk, m_g_msk, m_b_msk, m_a_msk); -#endif } } @@ -138,11 +134,7 @@ public: if (GLState::eq_RGB != m_equation_RGB || GLState::eq_A != m_equation_A) { GLState::eq_RGB = m_equation_RGB; GLState::eq_A = m_equation_A; -#ifdef ENABLE_GLES - gl_BlendEquationSeparate(m_equation_RGB, m_equation_A); -#else gl_BlendEquationSeparateiARB(0, m_equation_RGB, m_equation_A); -#endif } // FIXME align then SSE if (GLState::f_sRGB != m_func_sRGB || GLState::f_dRGB != m_func_dRGB || GLState::f_sA != m_func_sA || GLState::f_dA != m_func_dA) { @@ -150,11 +142,7 @@ public: GLState::f_dRGB = m_func_dRGB; GLState::f_sA = m_func_sA; GLState::f_dA = m_func_dA; -#ifdef ENABLE_GLES - gl_BlendFuncSeparate(m_func_sRGB, m_func_dRGB, m_func_sA, m_func_dA); -#else gl_BlendFuncSeparateiARB(0, m_func_sRGB, m_func_dRGB, m_func_sA, m_func_dA); -#endif } } } diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index 66e2ece39b..4a189604af 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -44,10 +44,6 @@ bool GSRendererOGL::CreateDevice(GSDevice* dev) if(!GSRenderer::CreateDevice(dev)) return false; -#ifdef ENABLE_GLES - fprintf(stderr, "FIXME Creation of FBA dss/bs state is not yet implemented\n"); -#endif - return true; } @@ -558,10 +554,8 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour dev->SetupPS(ps_sel); // Be sure that first pass is finished ! -#ifndef ENABLE_GLES if (!UserHacks_DateGL4) dev->Barrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); -#endif } dev->OMSetRenderTargets(rt, ds, &scissor); @@ -648,9 +642,4 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour void GSRendererOGL::UpdateFBA(GSTexture* rt) { -#ifdef ENABLE_GLES -#ifdef _DEBUG - fprintf(stderr, "FIXME UpdateFBA not yet implemented\n"); -#endif -#endif } diff --git a/plugins/GSdx/GSShaderOGL.cpp b/plugins/GSdx/GSShaderOGL.cpp index 7550e8a593..a511d2df5e 100644 --- a/plugins/GSdx/GSShaderOGL.cpp +++ b/plugins/GSdx/GSShaderOGL.cpp @@ -33,20 +33,16 @@ GSShaderOGL::GSShaderOGL(bool debug) : memset(&m_ps_sub, 0, countof(m_ps_sub)*sizeof(m_ps_sub[0])); m_single_prog.clear(); -#ifndef ENABLE_GLES if (GLLoader::found_GL_ARB_separate_shader_objects) { gl_GenProgramPipelines(1, &m_pipeline); gl_BindProgramPipeline(m_pipeline); } -#endif } GSShaderOGL::~GSShaderOGL() { -#ifndef ENABLE_GLES if (GLLoader::found_GL_ARB_separate_shader_objects) gl_DeleteProgramPipelines(1, &m_pipeline); -#endif for (auto it = m_single_prog.begin(); it != m_single_prog.end() ; it++) gl_DeleteProgram(it->second); m_single_prog.clear(); @@ -61,10 +57,8 @@ void GSShaderOGL::VS(GLuint s, GLuint sub_count) GLState::vs = s; GLState::dirty_prog = true; GLState::dirty_subroutine_vs = true; -#ifndef ENABLE_GLES if (GLLoader::found_GL_ARB_separate_shader_objects) gl_UseProgramStages(m_pipeline, GL_VERTEX_SHADER_BIT, s); -#endif } } @@ -111,11 +105,9 @@ void GSShaderOGL::PS(GLuint s, GLuint sub_count) GLState::dirty_prog = true; GLState::dirty_subroutine_ps = true; GLState::dirty_ressources = true; -#ifndef ENABLE_GLES if (GLLoader::found_GL_ARB_separate_shader_objects) { gl_UseProgramStages(m_pipeline, GL_FRAGMENT_SHADER_BIT, s); } -#endif } } @@ -125,16 +117,13 @@ void GSShaderOGL::GS(GLuint s) { GLState::gs = s; GLState::dirty_prog = true; -#ifndef ENABLE_GLES if (GLLoader::found_GL_ARB_separate_shader_objects) gl_UseProgramStages(m_pipeline, GL_GEOMETRY_SHADER_BIT, s); -#endif } } void GSShaderOGL::SetupRessources() { -#ifndef ENABLE_GLES if (!GLLoader::found_GL_ARB_bindless_texture) return; if (GLState::dirty_ressources) { @@ -149,12 +138,10 @@ void GSShaderOGL::SetupRessources() gl_UniformHandleui64vARB(1, 1, &GLState::tex_handle[1]); } } -#endif } void GSShaderOGL::SetupSubroutineUniform() { -#ifndef ENABLE_GLES if (!GLLoader::found_GL_ARB_shader_subroutine) return; if (GLState::dirty_subroutine_vs && m_vs_sub_count) { @@ -166,7 +153,6 @@ void GSShaderOGL::SetupSubroutineUniform() gl_UniformSubroutinesuiv(GL_FRAGMENT_SHADER, m_ps_sub_count, m_ps_sub); GLState::dirty_subroutine_ps = false; } -#endif } bool GSShaderOGL::ValidateShader(GLuint s) @@ -213,7 +199,6 @@ bool GSShaderOGL::ValidateProgram(GLuint p) bool GSShaderOGL::ValidatePipeline(GLuint p) { -#ifndef ENABLE_GLES if (!m_debug_shader) return true; // FIXME: might be mandatory to validate the pipeline @@ -233,8 +218,6 @@ bool GSShaderOGL::ValidatePipeline(GLuint p) } fprintf(stderr, "\n"); -#endif - return false; } @@ -298,7 +281,6 @@ void GSShaderOGL::UseProgram() std::string GSShaderOGL::GenGlslHeader(const std::string& entry, GLenum type, const std::string& macro) { std::string header; -#ifndef ENABLE_GLES header = "#version 330 core\n"; // Need GL version 420 header += "#extension GL_ARB_shading_language_420pack: require\n"; @@ -329,34 +311,21 @@ std::string GSShaderOGL::GenGlslHeader(const std::string& entry, GLenum type, co if (GLLoader::found_GL_ARB_clip_control) { header += "#define ZERO_TO_ONE_DEPTH\n"; } -#else // ENABLE_GLES - header = "#version 310 es\n"; - header += "#extension GL_EXT_shader_io_blocks: require\n"; - // Disable full GL features (actually GLES3.1 could support it) - header += "#define DISABLE_GL42_image\n"; -#endif // Stupid GL implementation (can't use GL_ES) // AMD/nvidia define it to 0 // intel window don't define it // intel linux refuse to define it -#ifdef ENABLE_GLES - header += "#define pGL_ES 1\n"; - header += "precision highp float;\n"; -#else header += "#define pGL_ES 0\n"; -#endif // Allow to puts several shader in 1 files switch (type) { case GL_VERTEX_SHADER: header += "#define VERTEX_SHADER 1\n"; break; -#ifndef ENABLE_GLES case GL_GEOMETRY_SHADER: header += "#define GEOMETRY_SHADER 1\n"; break; -#endif case GL_FRAGMENT_SHADER: header += "#define FRAGMENT_SHADER 1\n"; break; @@ -377,11 +346,9 @@ GLuint GSShaderOGL::Compile(const std::string& glsl_file, const std::string& ent GLuint program = 0; -#ifndef ENABLE_GLES if (type == GL_GEOMETRY_SHADER && !GLLoader::found_geometry_shader) { return program; } -#endif // Note it is better to separate header and source file to have the good line number // in the glsl compiler report @@ -398,9 +365,7 @@ GLuint GSShaderOGL::Compile(const std::string& glsl_file, const std::string& ent #endif if (GLLoader::found_GL_ARB_separate_shader_objects) { -#ifndef ENABLE_GLES program = gl_CreateShaderProgramv(type, shader_nb, sources); -#endif } else { program = gl_CreateShader(type); gl_ShaderSource(program, shader_nb, sources, NULL); diff --git a/plugins/GSdx/GSTextureOGL.cpp b/plugins/GSdx/GSTextureOGL.cpp index 4d29d5fb90..1478f1f77b 100644 --- a/plugins/GSdx/GSTextureOGL.cpp +++ b/plugins/GSdx/GSTextureOGL.cpp @@ -41,7 +41,6 @@ namespace PboPool { const uint32 m_pbo_size = 4*1024*1024; uint8* m_gpu_texture; -#ifndef ENABLE_GLES // Option for buffer storage // Note there is a barrier (but maybe coherent is faster) // XXX: actually does I really need coherent and barrier??? @@ -50,7 +49,6 @@ namespace PboPool { const GLbitfield common_flags = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT; const GLbitfield map_flags = common_flags | GL_MAP_FLUSH_EXPLICIT_BIT; const GLbitfield create_flags = common_flags | GL_CLIENT_STORAGE_BIT; -#endif void Init() { gl_GenBuffers(countof(m_pool), m_pool); @@ -60,10 +58,8 @@ namespace PboPool { BindPbo(); if (m_texture_storage) { -#ifndef ENABLE_GLES gl_BufferStorage(GL_PIXEL_UNPACK_BUFFER, m_pbo_size, NULL, create_flags); m_map[m_current_pbo] = (char*)gl_MapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, m_pbo_size, map_flags); -#endif } else { gl_BufferData(GL_PIXEL_UNPACK_BUFFER, m_pbo_size, NULL, GL_STREAM_COPY); m_map[m_current_pbo] = NULL; @@ -343,12 +339,10 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch) GLuint64 GSTextureOGL::GetHandle(GLuint sampler_id) { ASSERT(sampler_id < 12); -#ifndef ENABLE_GLES if (!m_handles[sampler_id]) { m_handles[sampler_id] = gl_GetTextureSamplerHandleARB(m_texture_id, sampler_id); gl_MakeTextureHandleResidentARB(m_handles[sampler_id]); } -#endif return m_handles[sampler_id]; } @@ -604,10 +598,8 @@ bool GSTextureOGL::Save(const string& fn, bool dds) gl_BindFramebuffer(GL_READ_FRAMEBUFFER, 0); } else if(m_format == GL_R32I) { -#ifndef ENABLE_GLES gl_GetTextureImage(m_texture_id, 0, GL_RED_INTEGER, GL_INT, buf_size, image); SaveRaw(fn, image, pitch); -#endif // Not supported in Save function status = false; diff --git a/plugins/GSdx/GSVertexArrayOGL.h b/plugins/GSdx/GSVertexArrayOGL.h index cd5aef02ea..9322e99f95 100644 --- a/plugins/GSdx/GSVertexArrayOGL.h +++ b/plugins/GSdx/GSVertexArrayOGL.h @@ -67,7 +67,6 @@ class GSBufferOGL { // TODO: if we do manually the synchronization, I'm not sure size is important. It worths to investigate it. // => bigger buffer => less sync -#ifndef ENABLE_GLES bind(); // coherency will be done by flushing const GLbitfield common_flags = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT; @@ -80,7 +79,6 @@ class GSBufferOGL { fprintf(stderr, "Failed to map buffer\n"); throw GSDXError(); } -#endif } else { m_buffer_ptr = NULL; } @@ -201,21 +199,8 @@ class GSBufferOGL { gl_FlushMappedBufferRange(m_target, offset, length); } -#ifdef ENABLE_GLES - void upload(const void* src, uint32 count, uint32 basevertex = 0) -#else void upload(const void* src, uint32 count) -#endif { -#ifdef ENABLE_GLES - // Emulate gl_DrawElementsBaseVertex... Maybe GLES 4 you know! - if (basevertex) { - uint32* data = (uint32*) src; - for (uint32 i = 0; i < count; i++) { - data[i] += basevertex; - } - } -#endif #ifdef ENABLE_OGL_DEBUG_MEM_BW g_vertex_upload_byte += count*m_stride; #endif @@ -242,20 +227,12 @@ class GSBufferOGL { void Draw(GLenum mode, GLint basevertex) { -#ifdef ENABLE_GLES - glDrawElements(mode, m_count, GL_UNSIGNED_INT, (void*)(m_start * m_stride)); -#else gl_DrawElementsBaseVertex(mode, m_count, GL_UNSIGNED_INT, (void*)(m_start * m_stride), basevertex); -#endif } void Draw(GLenum mode, GLint basevertex, int offset, int count) { -#ifdef ENABLE_GLES - glDrawElements(mode, count, GL_UNSIGNED_INT, (void*)((m_start + offset) * m_stride)); -#else gl_DrawElementsBaseVertex(mode, count, GL_UNSIGNED_INT, (void*)((m_start + offset) * m_stride), basevertex); -#endif } size_t GetStart() { return m_start; } @@ -338,11 +315,7 @@ public: void UploadVB(const void* vertices, size_t count) { m_vb->upload(vertices, count); } void UploadIB(const void* index, size_t count) { -#ifdef ENABLE_GLES - m_ib->upload(index, count, m_vb->GetStart()); -#else m_ib->upload(index, count); -#endif } ~GSVertexBufferStateOGL() diff --git a/plugins/GSdx/GSWnd.cpp b/plugins/GSdx/GSWnd.cpp index 9c41ca16f1..96248a5417 100644 --- a/plugins/GSdx/GSWnd.cpp +++ b/plugins/GSdx/GSWnd.cpp @@ -25,7 +25,6 @@ void GSWndGL::PopulateGlFunction() { -#ifndef ENABLE_GLES *(void**)&(gl_ActiveTexture) = GetProcAddress("glActiveTexture"); *(void**)&(gl_BlendColor) = GetProcAddress("glBlendColor"); *(void**)&(gl_AttachShader) = GetProcAddress("glAttachShader"); @@ -152,6 +151,4 @@ void GSWndGL::PopulateGlFunction() if (gl_CreateFramebuffers == NULL) { Emulate_DSA::Init(); } - -#endif } diff --git a/plugins/GSdx/GSWndEGL.cpp b/plugins/GSdx/GSWndEGL.cpp index 491f34f741..be06f550e8 100644 --- a/plugins/GSdx/GSWndEGL.cpp +++ b/plugins/GSdx/GSWndEGL.cpp @@ -37,12 +37,10 @@ void GSWndEGL::CreateContext(int major, int minor) { EGL_CONTEXT_MAJOR_VERSION_KHR, major, EGL_CONTEXT_MINOR_VERSION_KHR, minor, -#ifndef ENABLE_GLES #ifdef ENABLE_OGL_DEBUG EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, #endif EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR, -#endif EGL_NONE }; EGLint NullContextAttribs[] = { EGL_NONE }; @@ -51,15 +49,11 @@ void GSWndEGL::CreateContext(int major, int minor) EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_DEPTH_SIZE, 24, -#ifndef ENABLE_GLES EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, -#endif EGL_NONE }; -#ifndef ENABLE_GLES eglBindAPI(EGL_OPENGL_API); -#endif eglChooseConfig(m_eglDisplay, attrList, &eglConfig, 1, &numConfigs); if ( numConfigs == 0 ) @@ -102,9 +96,7 @@ void GSWndEGL::AttachContext() if (!IsContextAttached()) { // The setting of the API is local to a thread. This function // can be called from 2 threads. -#ifndef ENABLE_GLES eglBindAPI(EGL_OPENGL_API); -#endif //fprintf(stderr, "Attach the context\n"); eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext); @@ -135,12 +127,7 @@ bool GSWndEGL::Attach(void* handle, bool managed) m_NativeDisplay = XOpenDisplay(NULL); OpenEGLDisplay(); -#ifdef ENABLE_GLES - // FIXME: update it to GLES 3.1 when they support it - CreateContext(3, 1); -#else CreateContext(3, 3); -#endif AttachContext(); @@ -187,12 +174,7 @@ bool GSWndEGL::Create(const string& title, int w, int h) m_NativeWindow = XCreateSimpleWindow(m_NativeDisplay, DefaultRootWindow(m_NativeDisplay), 0, 0, w, h, 0, 0, 0); XMapWindow (m_NativeDisplay, m_NativeWindow); -#ifdef ENABLE_GLES - // FIXME: update it to GLES 3.1 when they support it - CreateContext(3, 1); -#else CreateContext(3, 3); -#endif AttachContext(); diff --git a/plugins/GSdx/GSWndOGL.cpp b/plugins/GSdx/GSWndOGL.cpp index b1881acb42..e89b7ae9a3 100644 --- a/plugins/GSdx/GSWndOGL.cpp +++ b/plugins/GSdx/GSWndOGL.cpp @@ -22,7 +22,7 @@ #include "stdafx.h" #include "GSWndOGL.h" -#if defined(__linux__) && !defined(ENABLE_GLES) +#if defined(__linux__) GSWndOGL::GSWndOGL() : m_NativeWindow(0), m_NativeDisplay(NULL), m_swapinterval(NULL) { diff --git a/plugins/GSdx/GSWndOGL.h b/plugins/GSdx/GSWndOGL.h index ab832be250..95f7575a64 100644 --- a/plugins/GSdx/GSWndOGL.h +++ b/plugins/GSdx/GSWndOGL.h @@ -21,7 +21,7 @@ #include "GSWnd.h" -#if defined(__linux__) && !defined(ENABLE_GLES) +#if defined(__linux__) #include #include diff --git a/plugins/GSdx/res/glsl/tfx_fs.glsl b/plugins/GSdx/res/glsl/tfx_fs.glsl index 4ddaf100d3..9f3fc1aae6 100644 --- a/plugins/GSdx/res/glsl/tfx_fs.glsl +++ b/plugins/GSdx/res/glsl/tfx_fs.glsl @@ -60,12 +60,8 @@ in SHADER #define PSin_fc (PSin.fc) // Same buffer but 2 colors for dual source blending -#if pGL_ES -layout(location = 0) out vec4 SV_Target0; -#else layout(location = 0, index = 0) out vec4 SV_Target0; layout(location = 0, index = 1) out vec4 SV_Target1; -#endif #ifdef ENABLE_BINDLESS_TEX layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler; @@ -423,16 +419,6 @@ vec4 ps_color() return c; } -#if pGL_ES -void ps_main() -{ - vec4 c = ps_color(); - c.a *= 2.0; - SV_Target0 = c; -} -#endif - -#if !pGL_ES void ps_main() { #if (PS_DATE & 3) == 1 && !defined(DISABLE_GL42_image) @@ -511,6 +497,5 @@ void ps_main() #endif } -#endif // !pGL_ES #endif diff --git a/plugins/GSdx/res/glsl_source.h b/plugins/GSdx/res/glsl_source.h index 268d773937..40cece3ba9 100644 --- a/plugins/GSdx/res/glsl_source.h +++ b/plugins/GSdx/res/glsl_source.h @@ -801,12 +801,8 @@ static const char* tfx_fs_all_glsl = "#define PSin_fc (PSin.fc)\n" "\n" "// Same buffer but 2 colors for dual source blending\n" - "#if pGL_ES\n" - "layout(location = 0) out vec4 SV_Target0;\n" - "#else\n" "layout(location = 0, index = 0) out vec4 SV_Target0;\n" "layout(location = 0, index = 1) out vec4 SV_Target1;\n" - "#endif\n" "\n" "#ifdef ENABLE_BINDLESS_TEX\n" "layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;\n" @@ -1164,16 +1160,6 @@ static const char* tfx_fs_all_glsl = " return c;\n" "}\n" "\n" - "#if pGL_ES\n" - "void ps_main()\n" - "{\n" - " vec4 c = ps_color();\n" - " c.a *= 2.0;\n" - " SV_Target0 = c;\n" - "}\n" - "#endif\n" - "\n" - "#if !pGL_ES\n" "void ps_main()\n" "{\n" "#if (PS_DATE & 3) == 1 && !defined(DISABLE_GL42_image)\n" @@ -1252,7 +1238,6 @@ static const char* tfx_fs_all_glsl = "#endif\n" "\n" "}\n" - "#endif // !pGL_ES\n" "\n" "#endif\n" "//#version 420 // Keep it for text editor detection\n" diff --git a/plugins/GSdx/stdafx.h b/plugins/GSdx/stdafx.h index 5726d9c623..8670ba92c5 100644 --- a/plugins/GSdx/stdafx.h +++ b/plugins/GSdx/stdafx.h @@ -192,14 +192,9 @@ using namespace std; //#include //#include -#ifdef ENABLE_GLES - #include - #include -#else // Note use GL/glcorearb.h on the future #include #include -#endif #include "GLLoader.h" //using namespace __gnu_cxx;