rend: define GLES2 and GLES3
GLES2 will only use GL ES 2.0 API functions, compile-time linked GLES3 loads functions dynamically and supports both GL ES 2.0 and 3.0
This commit is contained in:
parent
0dd555c5c8
commit
d9f2f9ae1d
|
@ -431,3 +431,7 @@
|
|||
#define SH4_RAM_CLOCK (100*1000*1000) //[100000000] XTal(13.5) -> PLL (33.3) -> PLL 1:3 (100) , also suplied to HOLLY chip
|
||||
#define G2_BUS_CLOCK (25*1000*1000) //[25000000] from Holly, from SH4_RAM_CLOCK w/ 2 2:1 plls
|
||||
|
||||
#if defined(GLES) && !defined(GLES3)
|
||||
// Only use GL ES 2.0 API functions
|
||||
#define GLES2
|
||||
#endif
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
#include <GLES32/gl32.h>
|
||||
#include <EGL/egl.h>
|
||||
#include "gl32funcs.h"
|
||||
#include "build.h"
|
||||
|
||||
void load_gles_symbols()
|
||||
{
|
||||
#ifdef _ANDROID
|
||||
#ifndef GLES2
|
||||
for (int i = 0; rglgen_symbol_map[i].sym != NULL; i++)
|
||||
*(void **)rglgen_symbol_map[i].ptr = eglGetProcAddress(rglgen_symbol_map[i].sym);
|
||||
#endif
|
||||
|
|
|
@ -948,7 +948,7 @@ void SetMVS_Mode(ModifierVolumeMode mv_mode, ISP_Modvol ispc)
|
|||
|
||||
static void SetupMainVBO()
|
||||
{
|
||||
#if !defined(GLES) || defined(_ANDROID)
|
||||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3)
|
||||
glBindVertexArray(gl.vbo.vao);
|
||||
#endif
|
||||
|
@ -971,7 +971,7 @@ static void SetupMainVBO()
|
|||
|
||||
void SetupModvolVBO()
|
||||
{
|
||||
#if !defined(GLES) || defined(_ANDROID)
|
||||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3)
|
||||
glBindVertexArray(gl.vbo.vao);
|
||||
#endif
|
||||
|
|
|
@ -565,9 +565,7 @@ GLuint fogTextureId;
|
|||
}
|
||||
#ifdef GLES
|
||||
// EGL only supports runtime loading with android? TDB
|
||||
#ifdef _ANDROID
|
||||
load_gles_symbols();
|
||||
#endif
|
||||
#else
|
||||
egl_makecurrent();
|
||||
if (gl3wInit())
|
||||
|
@ -1205,7 +1203,7 @@ bool gl_create_resources()
|
|||
//create vao
|
||||
//This is really not "proper", vaos are supposed to be defined once
|
||||
//i keep updating the same one to make the es2 code work in 3.1 context
|
||||
#if !defined(GLES) || defined(_ANDROID)
|
||||
#ifndef GLES2
|
||||
glGenVertexArrays(1, &gl.vbo.vao);
|
||||
#endif
|
||||
}
|
||||
|
@ -2006,7 +2004,7 @@ struct glesrend : Renderer
|
|||
|
||||
void DrawOSD(bool clear_screen)
|
||||
{
|
||||
#if !defined(GLES) || defined(_ANDROID)
|
||||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3)
|
||||
glBindVertexArray(gl.vbo.vao);
|
||||
#endif
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#endif
|
||||
#include <GLES32/gl32.h>
|
||||
#include <GLES32/gl2ext.h>
|
||||
#ifdef _ANDROID
|
||||
#ifndef GLES2
|
||||
#include "gl32funcs.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data, bool save_backgr
|
|||
|
||||
if (save_background)
|
||||
{
|
||||
#if !defined(GLES) || defined(_ANDROID)
|
||||
#ifndef GLES2
|
||||
if (!gl.is_gles && glReadBuffer != NULL)
|
||||
glReadBuffer(GL_FRONT);
|
||||
|
||||
|
@ -190,12 +190,12 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data, bool save_backgr
|
|||
glcache.UseProgram(g_ShaderHandle);
|
||||
glUniform1i(g_AttribLocationTex, 0);
|
||||
glUniformMatrix4fv(g_AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]);
|
||||
#if !defined(GLES) || defined(_ANDROID)
|
||||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3 && glBindSampler != NULL)
|
||||
glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise.
|
||||
#endif
|
||||
GLuint vao_handle = 0;
|
||||
#if !defined(GLES) || defined(_ANDROID)
|
||||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3)
|
||||
{
|
||||
// Recreate the VAO every time
|
||||
|
@ -252,7 +252,7 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data, bool save_backgr
|
|||
idx_buffer_offset += pcmd->ElemCount;
|
||||
}
|
||||
}
|
||||
#if !defined(GLES) || defined(_ANDROID)
|
||||
#ifndef GLES2
|
||||
if (vao_handle != 0)
|
||||
glDeleteVertexArrays(1, &vao_handle);
|
||||
#endif
|
||||
|
|
|
@ -76,19 +76,15 @@ ifdef CHD5_FLAC
|
|||
endif
|
||||
|
||||
ifdef NAOMI
|
||||
LOCAL_CFLAGS += -DTARGET_NAOMI=1
|
||||
LOCAL_CPPFLAGS += -DTARGET_NAOMI=1
|
||||
LOCAL_CXXFLAGS += -DTARGET_NAOMI=1
|
||||
LOCAL_CFLAGS += -DTARGET_NAOMI=1
|
||||
endif
|
||||
|
||||
# LOCAL_CFLAGS += -std=c++11
|
||||
LOCAL_CFLAGS += -DGLES3
|
||||
LOCAL_CXXFLAGS += -std=c++11 -fopenmp
|
||||
LOCAL_LDFLAGS += -fopenmp
|
||||
|
||||
ifeq ($(TARGET_ARCH_ABI),x86)
|
||||
LOCAL_CFLAGS+= -DTARGET_NO_AREC -DTARGET_NO_OPENMP
|
||||
LOCAL_CXXFLAGS+= -DTARGET_NO_AREC -fpermissive -DTARGET_NO_OPENMP
|
||||
LOCAL_CPPFLAGS+= -DTARGET_NO_AREC -DTARGET_NO_OPENMP
|
||||
endif
|
||||
|
||||
LOCAL_CPP_FEATURES :=
|
||||
|
|
|
@ -171,8 +171,7 @@ else ifneq (,$(findstring rpi,$(platform)))
|
|||
INCS += -I/opt/vc/include/ -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads
|
||||
LIBS += -L/opt/vc/lib/ -lbcm_host -ldl
|
||||
LIBS += -lbrcmEGL -lbrcmGLESv2
|
||||
CFLAGS += -D TARGET_VIDEOCORE
|
||||
CXXFLAGS += -DGLES
|
||||
CFLAGS += -D TARGET_VIDEOCORE -DGLES
|
||||
USE_OMX := 1
|
||||
USE_DISPMANX := 1
|
||||
endif
|
||||
|
@ -208,7 +207,7 @@ else ifneq (,$(findstring odroid,$(platform)))
|
|||
ifneq (,$(findstring odroidxu3,$(platform)))
|
||||
MFLAGS += -march=armv7ve -mtune=cortex-a15.cortex-a7
|
||||
ASFLAGS += -march=armv7ve
|
||||
|
||||
CFLAGS += -DGLES3
|
||||
# Other ODROIDs
|
||||
else
|
||||
MFLAGS += -march=armv7-a
|
||||
|
@ -382,7 +381,7 @@ endif
|
|||
|
||||
# GLES on x11?
|
||||
ifdef USE_GLES
|
||||
CXXFLAGS += -DGLES
|
||||
CFLAGS += -DGLES
|
||||
LIBS += -lEGL -lGLESv2
|
||||
else ifdef FOR_LINUX
|
||||
LIBS += -ldl -lGL #for desktop gl
|
||||
|
|
Loading…
Reference in New Issue