mirror of https://github.com/PCSX2/pcsx2.git
gsdx-ogl: restore gles build
Add the --gles build option to the linux main script Ifdef all gl code not supported on gles3 (note some will be reenabled for gles3.1) Note: it probably doesn't run anymore. My Nvidia driver doesn't support yet egl/gles so I can't test it. Feel free to contribute.
This commit is contained in:
parent
483b5a75e8
commit
b020bd76c6
44
build.sh
44
build.sh
|
@ -20,34 +20,26 @@ clean_build=false
|
|||
for f in $*
|
||||
do
|
||||
case $f in
|
||||
--dev|--devel)
|
||||
flags="$flags -DCMAKE_BUILD_TYPE=Devel"
|
||||
;;
|
||||
--dbg|--debug)
|
||||
flags="$flags -DCMAKE_BUILD_TYPE=Debug"
|
||||
;;
|
||||
--release)
|
||||
flags="$flags -DCMAKE_BUILD_TYPE=Release"
|
||||
;;
|
||||
--glsl)
|
||||
flags="$flags -DGLSL_API=TRUE"
|
||||
;;
|
||||
--egl)
|
||||
echo "Warning EGL needs at lesat MESA 9.0"
|
||||
flags="$flags -DEGL_API=TRUE"
|
||||
;;
|
||||
--clean)
|
||||
clean_build=true
|
||||
;;
|
||||
--dev|--devel ) flags="$flags -DCMAKE_BUILD_TYPE=Devel" ;;
|
||||
--dbg|--debug ) flags="$flags -DCMAKE_BUILD_TYPE=Debug" ;;
|
||||
--release ) flags="$flags -DCMAKE_BUILD_TYPE=Release" ;;
|
||||
--glsl ) flags="$flags -DGLSL_API=TRUE" ;;
|
||||
--egl ) flags="$flags -DEGL_API=TRUE" ;;
|
||||
--gles ) flags="$flags -DGLES_API=TRUE" ;;
|
||||
--sdl2 ) flags="$flags -DSDL2_API=TRUE" ;;
|
||||
--clean ) clean_build=true ;;
|
||||
*)
|
||||
# unknown option
|
||||
echo "Valid options are:"
|
||||
echo "--dev / --devel - Build PCSX2 as a Development build."
|
||||
echo "--debug - Build PCSX2 as a Debug build."
|
||||
echo "--release - Build PCSX2 as a Release build."
|
||||
echo "--clean - Do a clean build."
|
||||
echo "--glsl - Replace CG backend of ZZogl by GLSL"
|
||||
echo "--egl - Replace GLX by EGL (ZZogl plugins only)"
|
||||
echo "** User options **"
|
||||
echo "--dev / --devel : Build PCSX2 as a Development build."
|
||||
echo "--debug : Build PCSX2 as a Debug build."
|
||||
echo "--release : Build PCSX2 as a Release build."
|
||||
echo "--clean : Do a clean build."
|
||||
echo "** Developper option **"
|
||||
echo "--glsl : Replace CG backend of ZZogl by GLSL"
|
||||
echo "--egl : Replace GLX by EGL (ZZogl plugins only)"
|
||||
echo "--sdl2 : Build with SDL2 (crash if wx is linked to SDL1)"
|
||||
echo "--gles : Replace openGL backend of GSdx by openGLES3"
|
||||
exit 1;;
|
||||
esac
|
||||
done
|
||||
|
|
|
@ -211,7 +211,9 @@ extern PFNGLDEPTHRANGEDNVPROC gl_DepthRangedNV;
|
|||
#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
|
||||
|
|
|
@ -487,6 +487,7 @@ void GSDeviceOGL::ClearDepth(GSTexture* t, float c)
|
|||
// TODO is it possible with GL44 ClearTexture? no the API is garbage!
|
||||
// Anyway, stencil can be cleared to 0 (it will be only used for date)
|
||||
if (0 && GLLoader::found_GL_ARB_clear_texture) {
|
||||
#ifndef ENABLE_GLES
|
||||
static_cast<GSTextureOGL*>(t)->EnableUnit();
|
||||
// Yes a very nice API to mix float and integer
|
||||
struct clear {
|
||||
|
@ -498,6 +499,7 @@ void GSDeviceOGL::ClearDepth(GSTexture* t, float c)
|
|||
clear.stencil = 0;
|
||||
|
||||
gl_ClearTexImage(static_cast<GSTextureOGL*>(t)->GetID(), 0, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, &clear);
|
||||
#endif
|
||||
} else {
|
||||
OMSetFBO(m_fbo);
|
||||
OMSetWriteBuffer();
|
||||
|
@ -519,8 +521,10 @@ void GSDeviceOGL::ClearStencil(GSTexture* t, uint8 c)
|
|||
{
|
||||
// TODO is it possible with GL44 ClearTexture? no the API is garbage!
|
||||
if (GLLoader::found_GL_ARB_clear_texture) {
|
||||
#ifndef ENABLE_GLES
|
||||
static_cast<GSTextureOGL*>(t)->EnableUnit();
|
||||
gl_ClearTexImage(static_cast<GSTextureOGL*>(t)->GetID(), 0, GL_DEPTH_STENCIL, GL_BYTE, &c);
|
||||
#endif
|
||||
} else {
|
||||
OMSetFBO(m_fbo);
|
||||
OMSetWriteBuffer();
|
||||
|
@ -600,7 +604,9 @@ void GSDeviceOGL::BindDateTexture()
|
|||
// gl_BindImageTextures(2, 1, textures);
|
||||
//gl_BindImageTexture(2, 0, 0, true, 0, GL_READ_WRITE, GL_R32I);
|
||||
|
||||
#ifndef ENABLE_GLES
|
||||
gl_BindImageTexture(2, static_cast<GSTextureOGL*>(m_date.t)->GetID(), 0, false, 0, GL_READ_WRITE, GL_R32I);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GSDeviceOGL::RecycleDateTexture()
|
||||
|
@ -618,11 +624,13 @@ void GSDeviceOGL::RecycleDateTexture()
|
|||
|
||||
void GSDeviceOGL::Barrier(GLbitfield b)
|
||||
{
|
||||
#ifndef ENABLE_GLES
|
||||
gl_MemoryBarrier(b);
|
||||
//#ifdef ENABLE_OGL_STENCIL_DEBUG
|
||||
// if (m_date.t)
|
||||
// static_cast<GSTextureOGL*>(m_date.t)->Save(format("/tmp/barrier_%04ld.csv", g_draw_count));
|
||||
//#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Note: must be here because tfx_glsl is static */
|
||||
|
@ -1027,7 +1035,9 @@ void GSDeviceOGL::PSSetShaderResource(GLuint sr)
|
|||
GLState::tex_unit[0] = sr;
|
||||
|
||||
if (GLLoader::found_GL_ARB_multi_bind) {
|
||||
#ifndef ENABLE_GLES
|
||||
gl_BindTextures(0, 1, &sr);
|
||||
#endif
|
||||
} else {
|
||||
gl_ActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, sr);
|
||||
|
@ -1045,7 +1055,9 @@ void GSDeviceOGL::PSSetShaderResources(GLuint tex[2])
|
|||
GLState::tex_unit[1] = tex[1];
|
||||
|
||||
if (GLLoader::found_GL_ARB_multi_bind) {
|
||||
#ifndef ENABLE_GLES
|
||||
gl_BindTextures(0, 2, tex);
|
||||
#endif
|
||||
} else {
|
||||
gl_ActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, tex[0]);
|
||||
|
|
|
@ -106,7 +106,11 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +137,11 @@ 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) {
|
||||
|
@ -141,7 +149,11 @@ 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -522,8 +522,10 @@ 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
|
||||
}
|
||||
|
||||
if(context->TEST.DoFirstPass())
|
||||
|
|
|
@ -153,6 +153,7 @@ void GSShaderOGL::SetSamplerBinding(GLuint prog, GLchar* name, GLuint binding)
|
|||
|
||||
void GSShaderOGL::SetupRessources()
|
||||
{
|
||||
#ifndef ENABLE_GLES
|
||||
if (!GLLoader::found_GL_ARB_bindless_texture) return;
|
||||
|
||||
if (GLState::dirty_ressources) {
|
||||
|
@ -166,6 +167,7 @@ void GSShaderOGL::SetupRessources()
|
|||
gl_UniformHandleui64vARB(0, count, GLState::tex_handle);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GSShaderOGL::SetupUniform()
|
||||
|
@ -201,6 +203,7 @@ void GSShaderOGL::SetupUniform()
|
|||
|
||||
void GSShaderOGL::SetupSubroutineUniform()
|
||||
{
|
||||
#ifndef ENABLE_GLES
|
||||
if (!GLLoader::found_GL_ARB_shader_subroutine) return;
|
||||
|
||||
if (GLState::dirty_subroutine_vs && m_vs_sub_count) {
|
||||
|
@ -212,6 +215,7 @@ 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)
|
||||
|
|
|
@ -65,9 +65,11 @@ void GSDeviceOGL::CreateTextureFX()
|
|||
// 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_NV_depth_buffer_float) {
|
||||
gl_DepthRangedNV(-1.0f, 1.0f);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
GSDepthStencilOGL* GSDeviceOGL::CreateDepthStencil(OMDepthStencilSelector dssel)
|
||||
|
|
|
@ -40,11 +40,13 @@ namespace PboPool {
|
|||
const uint32 m_pbo_size = (640*480*16) << 2;
|
||||
bool m_buffer_storage = false;
|
||||
|
||||
#ifndef ENABLE_GLES
|
||||
// Option for buffer storage
|
||||
// Note there is a barrier (but maybe coherent is faster)
|
||||
const GLbitfield map_flags = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT;
|
||||
// FIXME do I need GL_DYNAMIC_STORAGE_BIT to allow write?
|
||||
const GLbitfield create_flags = map_flags | GL_DYNAMIC_STORAGE_BIT;
|
||||
#endif
|
||||
|
||||
// Normally driver must aligned the map....
|
||||
void* align_map(void* ptr) {
|
||||
|
@ -66,10 +68,12 @@ namespace PboPool {
|
|||
|
||||
// Note the +64 gives additional room to realign the buffer (buggy driver....)
|
||||
if (m_buffer_storage) {
|
||||
#ifndef ENABLE_GLES
|
||||
gl_BufferStorage(GL_PIXEL_UNPACK_BUFFER, m_pbo_size+64, NULL, create_flags);
|
||||
m_map[m_current_pbo] = (char*)align_map(gl_MapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, m_pbo_size+64, map_flags));
|
||||
// Workaround silly driver. (would be 0 otherwise)
|
||||
m_offset[m_current_pbo] = m_initial_offset[m_current_pbo];
|
||||
#endif
|
||||
} else {
|
||||
gl_BufferData(GL_PIXEL_UNPACK_BUFFER, m_pbo_size+64, NULL, GL_STREAM_COPY);
|
||||
m_map[m_current_pbo] = NULL;
|
||||
|
@ -317,8 +321,10 @@ GSTextureOGL::~GSTextureOGL()
|
|||
|
||||
void GSTextureOGL::Clear(const void *data)
|
||||
{
|
||||
#ifndef ENABLE_GLES
|
||||
EnableUnit();
|
||||
gl_ClearTexImage(m_texture_id, 0, m_int_format, m_int_type, data);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
|
||||
|
@ -380,10 +386,12 @@ 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];
|
||||
}
|
||||
|
@ -613,8 +621,10 @@ bool GSTextureOGL::Save(const string& fn, bool dds)
|
|||
gl_ActiveTexture(GL_TEXTURE0 + 6);
|
||||
glBindTexture(GL_TEXTURE_2D, m_texture_id);
|
||||
|
||||
#ifndef ENABLE_GLES
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RED_INTEGER, GL_INT, image);
|
||||
SaveRaw(fn, image, pitch);
|
||||
#endif
|
||||
|
||||
// Not supported in Save function
|
||||
status = false;
|
||||
|
|
|
@ -63,6 +63,7 @@ class GSBufferOGL {
|
|||
m_limit = 2 * 2 * 1024 * 1024 / m_stride;
|
||||
|
||||
if (m_buffer_storage) {
|
||||
#ifndef ENABLE_GLES
|
||||
bind();
|
||||
// FIXME do I need the dynamic
|
||||
const GLbitfield map_flags = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT;
|
||||
|
@ -70,6 +71,7 @@ class GSBufferOGL {
|
|||
|
||||
gl_BufferStorage(m_target, m_stride*m_limit, NULL, create_flags );
|
||||
m_buffer_ptr = (uint8*) gl_MapBufferRange(m_target, 0, m_stride*m_limit, map_flags);
|
||||
#endif
|
||||
} else {
|
||||
m_buffer_ptr = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue