mirror of https://github.com/PCSX2/pcsx2.git
gsdx ogl: GLes
* use gles header file, disable opengl code (mainly GLX, ARB_sso, geometry shader) * Define properly the function pointer, GLES use basic linking whereas GL must get the symbol dynamically * cmake: properly search and set libglesv2.so * don't use dual source blending => HW renderer work (only miss unimportant FBA) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5701 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
bd5f379044
commit
916a091f8a
|
@ -0,0 +1,27 @@
|
||||||
|
# Try to find GLESV2
|
||||||
|
# Once done, this will define
|
||||||
|
#
|
||||||
|
# GLESV2_FOUND - system has GLESV2
|
||||||
|
# GLESV2_INCLUDE_DIR - the GLESV2 include directories
|
||||||
|
# GLESV2_LIBRARIES - link these to use GLESV2
|
||||||
|
|
||||||
|
if(GLESV2_INCLUDE_DIR AND GLESV2_LIBRARIES)
|
||||||
|
set(GLESV2_FIND_QUIETLY TRUE)
|
||||||
|
endif(GLESV2_INCLUDE_DIR AND GLESV2_LIBRARIES)
|
||||||
|
|
||||||
|
INCLUDE(CheckCXXSymbolExists)
|
||||||
|
|
||||||
|
# include dir
|
||||||
|
find_path(GLESV2_INCLUDE_DIR GLES3/gl3ext.h)
|
||||||
|
|
||||||
|
# finally the library itself
|
||||||
|
find_library(libGLESV2 NAMES GLESv2)
|
||||||
|
set(GLESV2_LIBRARIES ${libGLESV2})
|
||||||
|
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set GLESV2_FOUND to TRUE if
|
||||||
|
# all listed variables are TRUE
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(GLESV2 DEFAULT_MSG GLESV2_LIBRARIES GLESV2_INCLUDE_DIR)
|
||||||
|
|
||||||
|
mark_as_advanced(GLESV2_LIBRARIES GLESV2_INCLUDE_DIR)
|
||||||
|
|
|
@ -56,6 +56,7 @@ include(FindAio)
|
||||||
include(FindCg)
|
include(FindCg)
|
||||||
#endif(NOT GLSL_API)
|
#endif(NOT GLSL_API)
|
||||||
include(FindEGL)
|
include(FindEGL)
|
||||||
|
include(FindGLES2)
|
||||||
include(FindGlew)
|
include(FindGlew)
|
||||||
include(FindLibc)
|
include(FindLibc)
|
||||||
include(FindPortAudio)
|
include(FindPortAudio)
|
||||||
|
@ -115,6 +116,10 @@ if(GLEW_FOUND)
|
||||||
include_directories(${GLEW_INCLUDE_DIR})
|
include_directories(${GLEW_INCLUDE_DIR})
|
||||||
endif(GLEW_FOUND)
|
endif(GLEW_FOUND)
|
||||||
|
|
||||||
|
if(GLESV2_FOUND)
|
||||||
|
include_directories(${GLESV2_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(OPENGL_FOUND)
|
if(OPENGL_FOUND)
|
||||||
include_directories(${OPENGL_INCLUDE_DIR})
|
include_directories(${OPENGL_INCLUDE_DIR})
|
||||||
endif(OPENGL_FOUND)
|
endif(OPENGL_FOUND)
|
||||||
|
|
|
@ -44,7 +44,7 @@ if(XDG_STD)
|
||||||
add_definitions(-DXDG_STD)
|
add_definitions(-DXDG_STD)
|
||||||
endif(XDG_STD)
|
endif(XDG_STD)
|
||||||
|
|
||||||
if(GLES_API)
|
if(GLES_API AND GLESV2_FOUND)
|
||||||
add_definitions(-DENABLE_GLES)
|
add_definitions(-DENABLE_GLES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -193,10 +193,9 @@ endif()
|
||||||
add_library(${Output} SHARED ${GSdxSources} ${GSdxHeaders})
|
add_library(${Output} SHARED ${GSdxSources} ${GSdxHeaders})
|
||||||
|
|
||||||
target_link_libraries(${Output} ${X11_LIBRARIES})
|
target_link_libraries(${Output} ${X11_LIBRARIES})
|
||||||
message(INFO "DEBUG ${OPENGL_LIBRARIES}")
|
|
||||||
|
|
||||||
if (GLES)
|
if(GLES_API AND GLESV2_FOUND)
|
||||||
target_link_libraries(${Output} /usr/lib/i386-linux-gnu/libGLU.so;/usr/lib/i386-linux-gnu/libGLESv2.so;/usr/lib/i386-linux-gnu/libSM.so;/usr/lib/i386-linux-gnu/libICE.so;/usr/lib/i386-linux-gnu/libX11.so;/usr/lib/i386-linux-gnu/libXext.so)
|
target_link_libraries(${Output} ${GLESV2_LIBRARIES})
|
||||||
else()
|
else()
|
||||||
target_link_libraries(${Output} ${OPENGL_LIBRARIES})
|
target_link_libraries(${Output} ${OPENGL_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "GLLoader.h"
|
#include "GLLoader.h"
|
||||||
#include "GSdx.h"
|
#include "GSdx.h"
|
||||||
|
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
PFNGLACTIVETEXTUREPROC gl_ActiveTexture = NULL;
|
PFNGLACTIVETEXTUREPROC gl_ActiveTexture = NULL;
|
||||||
PFNGLBLENDCOLORPROC gl_BlendColor = NULL;
|
PFNGLBLENDCOLORPROC gl_BlendColor = NULL;
|
||||||
PFNGLATTACHSHADERPROC gl_AttachShader = NULL;
|
PFNGLATTACHSHADERPROC gl_AttachShader = NULL;
|
||||||
|
@ -98,6 +99,7 @@ PFNGLPROGRAMUNIFORM1IPROC gl_ProgramUniform1i = NULL;
|
||||||
PFNGLGETUNIFORMBLOCKINDEXPROC gl_GetUniformBlockIndex = NULL;
|
PFNGLGETUNIFORMBLOCKINDEXPROC gl_GetUniformBlockIndex = NULL;
|
||||||
PFNGLUNIFORMBLOCKBINDINGPROC gl_UniformBlockBinding = NULL;
|
PFNGLUNIFORMBLOCKBINDINGPROC gl_UniformBlockBinding = NULL;
|
||||||
PFNGLGETUNIFORMLOCATIONPROC gl_GetUniformLocation = NULL;
|
PFNGLGETUNIFORMLOCATIONPROC gl_GetUniformLocation = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace GLLoader {
|
namespace GLLoader {
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
extern PFNGLACTIVETEXTUREPROC gl_ActiveTexture;
|
extern PFNGLACTIVETEXTUREPROC gl_ActiveTexture;
|
||||||
extern PFNGLBLENDCOLORPROC gl_BlendColor;
|
extern PFNGLBLENDCOLORPROC gl_BlendColor;
|
||||||
extern PFNGLATTACHSHADERPROC gl_AttachShader;
|
extern PFNGLATTACHSHADERPROC gl_AttachShader;
|
||||||
|
@ -96,6 +97,83 @@ extern PFNGLPROGRAMUNIFORM1IPROC gl_ProgramUniform1i;
|
||||||
extern PFNGLGETUNIFORMBLOCKINDEXPROC gl_GetUniformBlockIndex;
|
extern PFNGLGETUNIFORMBLOCKINDEXPROC gl_GetUniformBlockIndex;
|
||||||
extern PFNGLUNIFORMBLOCKBINDINGPROC gl_UniformBlockBinding;
|
extern PFNGLUNIFORMBLOCKBINDINGPROC gl_UniformBlockBinding;
|
||||||
extern PFNGLGETUNIFORMLOCATIONPROC gl_GetUniformLocation;
|
extern PFNGLGETUNIFORMLOCATIONPROC gl_GetUniformLocation;
|
||||||
|
#else
|
||||||
|
#define gl_ActiveTexture glActiveTexture
|
||||||
|
#define gl_BlendColor glBlendColor
|
||||||
|
#define gl_AttachShader glAttachShader
|
||||||
|
#define gl_BindBuffer glBindBuffer
|
||||||
|
#define gl_BindBufferBase glBindBufferBase
|
||||||
|
#define gl_BindFragDataLocationIndexed glBindFragDataLocationIndexed
|
||||||
|
#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_CompileShader glCompileShader
|
||||||
|
#define gl_CopyImageSubDataNV glCopyImageSubDataNV
|
||||||
|
#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_GetFragDataIndex glGetFragDataIndex
|
||||||
|
#define gl_GetFragDataLocation glGetFragDataLocation
|
||||||
|
#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
|
||||||
|
|
||||||
|
#define gl_GetUniformBlockIndex glGetUniformBlockIndex
|
||||||
|
#define gl_UniformBlockBinding glUniformBlockBinding
|
||||||
|
#define gl_GetUniformLocation glGetUniformLocation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace GLLoader {
|
namespace GLLoader {
|
||||||
|
|
|
@ -287,8 +287,12 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
|
||||||
s_gs->m_wnd = new GSWndWGL();
|
s_gs->m_wnd = new GSWndWGL();
|
||||||
else
|
else
|
||||||
s_gs->m_wnd = new GSWndDX();
|
s_gs->m_wnd = new GSWndDX();
|
||||||
|
#else
|
||||||
|
#ifdef ENABLE_GLES
|
||||||
|
wnd[0] = NULL;
|
||||||
#else
|
#else
|
||||||
wnd[0] = new GSWndOGL();
|
wnd[0] = new GSWndOGL();
|
||||||
|
#endif
|
||||||
wnd[1] = new GSWndEGL();
|
wnd[1] = new GSWndEGL();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -554,7 +554,11 @@ GLuint GSDeviceOGL::CompileGS(GSSelector sel)
|
||||||
std::string macro = format("#define GS_IIP %d\n", sel.iip)
|
std::string macro = format("#define GS_IIP %d\n", sel.iip)
|
||||||
+ format("#define GS_PRIM %d\n", sel.prim);
|
+ format("#define GS_PRIM %d\n", sel.prim);
|
||||||
|
|
||||||
|
#ifdef ENABLE_GLES
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
return m_shader->Compile("tfx.glsl", "gs_main", GL_GEOMETRY_SHADER, tfx_glsl, macro);
|
return m_shader->Compile("tfx.glsl", "gs_main", GL_GEOMETRY_SHADER, tfx_glsl, macro);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint GSDeviceOGL::CompilePS(PSSelector sel)
|
GLuint GSDeviceOGL::CompilePS(PSSelector sel)
|
||||||
|
@ -667,11 +671,13 @@ void GSDeviceOGL::CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r)
|
||||||
// uint32 dstName, enum dstTarget, int dstLevel, int dstX, int dstY, int dstZ,
|
// uint32 dstName, enum dstTarget, int dstLevel, int dstX, int dstY, int dstZ,
|
||||||
// sizei width, sizei height, sizei depth);
|
// sizei width, sizei height, sizei depth);
|
||||||
if (GLLoader::found_GL_NV_copy_image) {
|
if (GLLoader::found_GL_NV_copy_image) {
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
gl_CopyImageSubDataNV( static_cast<GSTextureOGL*>(st)->GetID(), static_cast<GSTextureOGL*>(st)->GetTarget(),
|
gl_CopyImageSubDataNV( static_cast<GSTextureOGL*>(st)->GetID(), static_cast<GSTextureOGL*>(st)->GetTarget(),
|
||||||
0, r.x, r.y, 0,
|
0, r.x, r.y, 0,
|
||||||
static_cast<GSTextureOGL*>(dt)->GetID(), static_cast<GSTextureOGL*>(dt)->GetTarget(),
|
static_cast<GSTextureOGL*>(dt)->GetID(), static_cast<GSTextureOGL*>(dt)->GetTarget(),
|
||||||
0, r.x, r.y, 0,
|
0, r.x, r.y, 0,
|
||||||
r.width(), r.height(), 1);
|
r.width(), r.height(), 1);
|
||||||
|
#endif
|
||||||
} else if (GLLoader::found_GL_ARB_copy_image) {
|
} else if (GLLoader::found_GL_ARB_copy_image) {
|
||||||
// Would need an update of GL definition. For the moment it isn't supported by driver anyway.
|
// Would need an update of GL definition. For the moment it isn't supported by driver anyway.
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -1152,6 +1158,7 @@ void GSDeviceOGL::CheckDebugLog()
|
||||||
|
|
||||||
void GSDeviceOGL::DebugOutputToFile(unsigned int source, unsigned int type, unsigned int id, unsigned int severity, const char* message)
|
void GSDeviceOGL::DebugOutputToFile(unsigned int source, unsigned int type, unsigned int id, unsigned int severity, const char* message)
|
||||||
{
|
{
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
char debType[20], debSev[5];
|
char debType[20], debSev[5];
|
||||||
static int sev_counter = 0;
|
static int sev_counter = 0;
|
||||||
|
|
||||||
|
@ -1190,6 +1197,7 @@ void GSDeviceOGL::DebugOutputToFile(unsigned int source, unsigned int type, unsi
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
//if (sev_counter > 2) assert(0);
|
//if (sev_counter > 2) assert(0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// (A - B) * C + D
|
// (A - B) * C + D
|
||||||
|
@ -1219,8 +1227,13 @@ void GSDeviceOGL::DebugOutputToFile(unsigned int source, unsigned int type, unsi
|
||||||
#define D3DBLEND_BLENDFACTOR GL_CONSTANT_COLOR
|
#define D3DBLEND_BLENDFACTOR GL_CONSTANT_COLOR
|
||||||
#define D3DBLEND_INVBLENDFACTOR GL_ONE_MINUS_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_SRCALPHA GL_SRC1_ALPHA
|
||||||
#define D3DBLEND_INVSRCALPHA GL_ONE_MINUS_SRC1_ALPHA
|
#define D3DBLEND_INVSRCALPHA GL_ONE_MINUS_SRC1_ALPHA
|
||||||
|
#endif
|
||||||
|
|
||||||
const GSDeviceOGL::D3D9Blend GSDeviceOGL::m_blendMapD3D9[3*3*3*3] =
|
const GSDeviceOGL::D3D9Blend GSDeviceOGL::m_blendMapD3D9[3*3*3*3] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -123,12 +123,14 @@ public:
|
||||||
case GL_FUNC_REVERSE_SUBTRACT: return "REV SUB";
|
case GL_FUNC_REVERSE_SUBTRACT: return "REV SUB";
|
||||||
case GL_ONE: return "ONE";
|
case GL_ONE: return "ONE";
|
||||||
case GL_ZERO: return "ZERO";
|
case GL_ZERO: return "ZERO";
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
case GL_SRC1_ALPHA: return "SRC1 ALPHA";
|
case GL_SRC1_ALPHA: return "SRC1 ALPHA";
|
||||||
|
case GL_ONE_MINUS_SRC1_ALPHA: return "1 - SRC1 ALPHA";
|
||||||
|
#endif
|
||||||
case GL_SRC_ALPHA: return "SRC ALPHA";
|
case GL_SRC_ALPHA: return "SRC ALPHA";
|
||||||
case GL_ONE_MINUS_DST_ALPHA: return "1 - DST ALPHA";
|
case GL_ONE_MINUS_DST_ALPHA: return "1 - DST ALPHA";
|
||||||
case GL_DST_ALPHA: return "DST ALPHA";
|
case GL_DST_ALPHA: return "DST ALPHA";
|
||||||
case GL_DST_COLOR: return "DST COLOR";
|
case GL_DST_COLOR: return "DST COLOR";
|
||||||
case GL_ONE_MINUS_SRC1_ALPHA: return "1 - SRC1 ALPHA";
|
|
||||||
case GL_ONE_MINUS_SRC_ALPHA: return "1 - SRC ALPHA";
|
case GL_ONE_MINUS_SRC_ALPHA: return "1 - SRC ALPHA";
|
||||||
case GL_CONSTANT_COLOR: return "CST";
|
case GL_CONSTANT_COLOR: return "CST";
|
||||||
case GL_ONE_MINUS_CONSTANT_COLOR: return "1 - CST";
|
case GL_ONE_MINUS_CONSTANT_COLOR: return "1 - CST";
|
||||||
|
|
|
@ -43,6 +43,10 @@ bool GSRendererOGL::CreateDevice(GSDevice* dev)
|
||||||
if(!GSRenderer::CreateDevice(dev))
|
if(!GSRenderer::CreateDevice(dev))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#ifdef ENABLE_GLES
|
||||||
|
fprintf(stderr, "FIXME Creation of FBA dss/bs state is not yet implemented\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,14 +421,14 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
||||||
// to only draw pixels which would cause the destination alpha test to fail in the future once.
|
// to only draw pixels which would cause the destination alpha test to fail in the future once.
|
||||||
// Unfortunately this also means only drawing those pixels at all, which is why this is a hack.
|
// Unfortunately this also means only drawing those pixels at all, which is why this is a hack.
|
||||||
// The interaction with FBA in D3D9 is probably less than ideal.
|
// The interaction with FBA in D3D9 is probably less than ideal.
|
||||||
if (UserHacks_AlphaStencil && DATE && dev->HasStencil() && om_bsel.wa && (!context->TEST.ATE || context->TEST.ATST == 1))
|
if (UserHacks_AlphaStencil && DATE && dev->HasStencil() && om_bsel.wa && (!context->TEST.ATE || context->TEST.ATST == ATST_ALWAYS))
|
||||||
{
|
{
|
||||||
if (!context->FBA.FBA)
|
if (!context->FBA.FBA)
|
||||||
{
|
{
|
||||||
if (context->TEST.DATM == 0)
|
if (context->TEST.DATM == 0)
|
||||||
ps_sel.atst = 5; // >=
|
ps_sel.atst = ATST_GEQUAL; // >=
|
||||||
else
|
else
|
||||||
ps_sel.atst = 2; // <
|
ps_sel.atst = ATST_LESS; // <
|
||||||
ps_cb.FogColor_AREF.a = (float)0x80;
|
ps_cb.FogColor_AREF.a = (float)0x80;
|
||||||
}
|
}
|
||||||
if (!(context->FBA.FBA && context->TEST.DATM == 1))
|
if (!(context->FBA.FBA && context->TEST.DATM == 1))
|
||||||
|
@ -545,10 +549,10 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
||||||
|
|
||||||
switch(context->TEST.AFAIL)
|
switch(context->TEST.AFAIL)
|
||||||
{
|
{
|
||||||
case 0: z = r = g = b = a = false; break; // none
|
case AFAIL_KEEP: z = r = g = b = a = false; break; // none
|
||||||
case 1: z = false; break; // rgba
|
case AFAIL_FB_ONLY: z = false; break; // rgba
|
||||||
case 2: r = g = b = a = false; break; // z
|
case AFAIL_ZB_ONLY: r = g = b = a = false; break; // z
|
||||||
case 3: z = a = false; break; // rgb
|
case AFAIL_RGB_ONLY: z = a = false; break; // rgb
|
||||||
default: __assume(0);
|
default: __assume(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,3 +588,12 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
||||||
|
|
||||||
if(om_dssel.fba) UpdateFBA(rt);
|
if(om_dssel.fba) UpdateFBA(rt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GSRendererOGL::UpdateFBA(GSTexture* rt)
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_GLES
|
||||||
|
#ifdef _DEBUG
|
||||||
|
fprintf(stderr, "FIXME UpdateFBA not yet implemented\n");
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ class GSRendererOGL : public GSRendererHW
|
||||||
|
|
||||||
bool CreateDevice(GSDevice* dev);
|
bool CreateDevice(GSDevice* dev);
|
||||||
|
|
||||||
void UpdateFBA(GSTexture* rt) {}
|
void UpdateFBA(GSTexture* rt);
|
||||||
|
|
||||||
void DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* tex);
|
void DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* tex);
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,16 +32,20 @@ GSShaderOGL::GSShaderOGL(bool debug, bool sso, bool glsl420) :
|
||||||
m_glsl420(glsl420)
|
m_glsl420(glsl420)
|
||||||
{
|
{
|
||||||
m_single_prog.clear();
|
m_single_prog.clear();
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
if (sso) {
|
if (sso) {
|
||||||
gl_GenProgramPipelines(1, &m_pipeline);
|
gl_GenProgramPipelines(1, &m_pipeline);
|
||||||
gl_BindProgramPipeline(m_pipeline);
|
gl_BindProgramPipeline(m_pipeline);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
GSShaderOGL::~GSShaderOGL()
|
GSShaderOGL::~GSShaderOGL()
|
||||||
{
|
{
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
if (m_sso)
|
if (m_sso)
|
||||||
gl_DeleteProgramPipelines(1, &m_pipeline);
|
gl_DeleteProgramPipelines(1, &m_pipeline);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (auto it = m_single_prog.begin(); it != m_single_prog.end() ; it++) gl_DeleteProgram(it->second);
|
for (auto it = m_single_prog.begin(); it != m_single_prog.end() ; it++) gl_DeleteProgram(it->second);
|
||||||
m_single_prog.clear();
|
m_single_prog.clear();
|
||||||
|
@ -52,8 +56,10 @@ void GSShaderOGL::VS(GLuint s)
|
||||||
if (m_vs != s)
|
if (m_vs != s)
|
||||||
{
|
{
|
||||||
m_vs = s;
|
m_vs = s;
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
if (m_sso)
|
if (m_sso)
|
||||||
gl_UseProgramStages(m_pipeline, GL_VERTEX_SHADER_BIT, s);
|
gl_UseProgramStages(m_pipeline, GL_VERTEX_SHADER_BIT, s);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +68,10 @@ void GSShaderOGL::PS(GLuint s)
|
||||||
if (m_ps != s)
|
if (m_ps != s)
|
||||||
{
|
{
|
||||||
m_ps = s;
|
m_ps = s;
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
if (m_sso)
|
if (m_sso)
|
||||||
gl_UseProgramStages(m_pipeline, GL_FRAGMENT_SHADER_BIT, s);
|
gl_UseProgramStages(m_pipeline, GL_FRAGMENT_SHADER_BIT, s);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,8 +80,10 @@ void GSShaderOGL::GS(GLuint s)
|
||||||
if (m_gs != s)
|
if (m_gs != s)
|
||||||
{
|
{
|
||||||
m_gs = s;
|
m_gs = s;
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
if (m_sso)
|
if (m_sso)
|
||||||
gl_UseProgramStages(m_pipeline, GL_GEOMETRY_SHADER_BIT, s);
|
gl_UseProgramStages(m_pipeline, GL_GEOMETRY_SHADER_BIT, s);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +101,9 @@ void GSShaderOGL::SetSamplerBinding(GLuint prog, GLchar* name, GLuint binding)
|
||||||
GLint loc = gl_GetUniformLocation(prog, name);
|
GLint loc = gl_GetUniformLocation(prog, name);
|
||||||
if (loc != -1) {
|
if (loc != -1) {
|
||||||
if (m_sso) {
|
if (m_sso) {
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
gl_ProgramUniform1i(prog, loc, binding);
|
gl_ProgramUniform1i(prog, loc, binding);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
gl_Uniform1i(loc, binding);
|
gl_Uniform1i(loc, binding);
|
||||||
}
|
}
|
||||||
|
@ -173,6 +185,7 @@ bool GSShaderOGL::ValidateProgram(GLuint p)
|
||||||
|
|
||||||
bool GSShaderOGL::ValidatePipeline(GLuint p)
|
bool GSShaderOGL::ValidatePipeline(GLuint p)
|
||||||
{
|
{
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
if (!m_debug_shader) return true;
|
if (!m_debug_shader) return true;
|
||||||
|
|
||||||
// FIXME: might be mandatory to validate the pipeline
|
// FIXME: might be mandatory to validate the pipeline
|
||||||
|
@ -192,6 +205,8 @@ bool GSShaderOGL::ValidatePipeline(GLuint p)
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,9 +297,11 @@ std::string GSShaderOGL::GenGlslHeader(const std::string& entry, GLenum type, co
|
||||||
case GL_VERTEX_SHADER:
|
case GL_VERTEX_SHADER:
|
||||||
header += "#define VERTEX_SHADER 1\n";
|
header += "#define VERTEX_SHADER 1\n";
|
||||||
break;
|
break;
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
case GL_GEOMETRY_SHADER:
|
case GL_GEOMETRY_SHADER:
|
||||||
header += "#define GEOMETRY_SHADER 1\n";
|
header += "#define GEOMETRY_SHADER 1\n";
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case GL_FRAGMENT_SHADER:
|
case GL_FRAGMENT_SHADER:
|
||||||
header += "#define FRAGMENT_SHADER 1\n";
|
header += "#define FRAGMENT_SHADER 1\n";
|
||||||
break;
|
break;
|
||||||
|
@ -303,10 +320,11 @@ GLuint GSShaderOGL::Compile(const std::string& glsl_file, const std::string& ent
|
||||||
{
|
{
|
||||||
GLuint program = 0;
|
GLuint program = 0;
|
||||||
|
|
||||||
// Not supported
|
#ifndef ENABLE_GLES
|
||||||
if (type == GL_GEOMETRY_SHADER && !GLLoader::found_geometry_shader) {
|
if (type == GL_GEOMETRY_SHADER && !GLLoader::found_geometry_shader) {
|
||||||
return program;
|
return program;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Note it is better to separate header and source file to have the good line number
|
// Note it is better to separate header and source file to have the good line number
|
||||||
// in the glsl compiler report
|
// in the glsl compiler report
|
||||||
|
@ -321,14 +339,15 @@ GLuint GSShaderOGL::Compile(const std::string& glsl_file, const std::string& ent
|
||||||
sources[1] = '\0';
|
sources[1] = '\0';
|
||||||
|
|
||||||
if (m_sso) {
|
if (m_sso) {
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
#if 0
|
#if 0
|
||||||
// Could be useful one day
|
|
||||||
const GLchar* ShaderSource[1];
|
const GLchar* ShaderSource[1];
|
||||||
ShaderSource[0] = header.append(glsl_h_code).c_str();
|
ShaderSource[0] = header.append(glsl_h_code).c_str();
|
||||||
program = gl_CreateShaderProgramv(type, 1, &ShaderSource[0]);
|
program = gl_CreateShaderProgramv(type, 1, &ShaderSource[0]);
|
||||||
#else
|
#else
|
||||||
program = gl_CreateShaderProgramv(type, 2, sources);
|
program = gl_CreateShaderProgramv(type, 2, sources);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
program = gl_CreateShader(type);
|
program = gl_CreateShader(type);
|
||||||
gl_ShaderSource(program, 2, sources, NULL);
|
gl_ShaderSource(program, 2, sources, NULL);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
void GSWndGL::PopulateGlFunction()
|
void GSWndGL::PopulateGlFunction()
|
||||||
{
|
{
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
*(void**)&(gl_ActiveTexture) = GetProcAddress("glActiveTexture");
|
*(void**)&(gl_ActiveTexture) = GetProcAddress("glActiveTexture");
|
||||||
*(void**)&(gl_BlendColor) = GetProcAddress("glBlendColor");
|
*(void**)&(gl_BlendColor) = GetProcAddress("glBlendColor");
|
||||||
*(void**)&(gl_AttachShader) = GetProcAddress("glAttachShader");
|
*(void**)&(gl_AttachShader) = GetProcAddress("glAttachShader");
|
||||||
|
@ -99,4 +100,5 @@ void GSWndGL::PopulateGlFunction()
|
||||||
*(void**)&(gl_GetUniformBlockIndex) = GetProcAddress("glGetUniformBlockIndex");
|
*(void**)&(gl_GetUniformBlockIndex) = GetProcAddress("glGetUniformBlockIndex");
|
||||||
*(void**)&(gl_UniformBlockBinding) = GetProcAddress("glUniformBlockBinding");
|
*(void**)&(gl_UniformBlockBinding) = GetProcAddress("glUniformBlockBinding");
|
||||||
*(void**)&(gl_GetUniformLocation) = GetProcAddress("glGetUniformLocation");
|
*(void**)&(gl_GetUniformLocation) = GetProcAddress("glGetUniformLocation");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "GSWndOGL.h"
|
#include "GSWndOGL.h"
|
||||||
|
|
||||||
#ifdef _LINUX
|
#if defined(_LINUX) && !defined(ENABLE_GLES)
|
||||||
GSWndOGL::GSWndOGL()
|
GSWndOGL::GSWndOGL()
|
||||||
: m_NativeWindow(0), m_NativeDisplay(NULL), m_swapinterval(NULL)
|
: m_NativeWindow(0), m_NativeDisplay(NULL), m_swapinterval(NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "GSWnd.h"
|
#include "GSWnd.h"
|
||||||
|
|
||||||
#ifdef _LINUX
|
#if defined(_LINUX) && !defined(ENABLE_GLES)
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
|
|
||||||
|
|
|
@ -349,8 +349,12 @@ layout(location = 2) in vec4 SHADERc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Same buffer but 2 colors for dual source blending
|
// Same buffer but 2 colors for dual source blending
|
||||||
|
#if GL_ES
|
||||||
|
layout(location = 0) out vec4 SV_Target0;
|
||||||
|
#else
|
||||||
layout(location = 0, index = 0) out vec4 SV_Target0;
|
layout(location = 0, index = 0) out vec4 SV_Target0;
|
||||||
layout(location = 0, index = 1) out vec4 SV_Target1;
|
layout(location = 0, index = 1) out vec4 SV_Target1;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DISABLE_GL42
|
#ifdef DISABLE_GL42
|
||||||
uniform sampler2D TextureSampler;
|
uniform sampler2D TextureSampler;
|
||||||
|
@ -724,6 +728,13 @@ void ps_main()
|
||||||
{
|
{
|
||||||
vec4 c = ps_color();
|
vec4 c = ps_color();
|
||||||
|
|
||||||
|
#if GL_ES
|
||||||
|
|
||||||
|
c.a *= 2.0;
|
||||||
|
SV_Target0 = c;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
float alpha = c.a * 2.0;
|
float alpha = c.a * 2.0;
|
||||||
|
|
||||||
if(PS_AOUT != 0) // 16 bit output
|
if(PS_AOUT != 0) // 16 bit output
|
||||||
|
@ -739,5 +750,8 @@ void ps_main()
|
||||||
|
|
||||||
SV_Target0 = c;
|
SV_Target0 = c;
|
||||||
SV_Target1 = vec4(alpha, alpha, alpha, alpha);
|
SV_Target1 = vec4(alpha, alpha, alpha, alpha);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -186,8 +186,13 @@ using namespace std;
|
||||||
//#include <ext/hash_map>
|
//#include <ext/hash_map>
|
||||||
//#include <ext/hash_set>
|
//#include <ext/hash_set>
|
||||||
|
|
||||||
|
#ifdef ENABLE_GLES
|
||||||
|
#include <GLES3/gl3.h>
|
||||||
|
#include <GLES3/gl3ext.h>
|
||||||
|
#else
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
|
#endif
|
||||||
#include "GLLoader.h"
|
#include "GLLoader.h"
|
||||||
|
|
||||||
//using namespace __gnu_cxx;
|
//using namespace __gnu_cxx;
|
||||||
|
|
Loading…
Reference in New Issue