init log before everything else, use WMI to read machine and system info, rtt fixed on Samsung A3, try to create different EGL context config

This commit is contained in:
2017-04-02 15:02:45 +01:00
parent 0dfb458c71
commit b6c9429b89
8 changed files with 241 additions and 24 deletions

View File

@@ -21,6 +21,8 @@
#include <jni.h>
#include <errno.h>
#include <cassert>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "pch.h"
#include "app.h"
@@ -77,6 +79,7 @@ struct engine {
*/
static int engine_init_display(struct engine* engine) {
// initialize OpenGL ES and EGL
App::I.initLog();
/*
* Here specify the attributes of the desired configuration.
@@ -142,6 +145,57 @@ static int engine_init_display(struct engine* engine) {
context = eglCreateContext(display, config, EGL_NO_CONTEXT, attribs_test);
if (context == EGL_NO_CONTEXT)
{
LOG("EGL: debug and forward context failed");
const EGLint attribs_test[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR,
EGL_NONE
};
context = eglCreateContext(display, config, EGL_NO_CONTEXT, attribs_test);
if (context == EGL_NO_CONTEXT)
{
LOG("EGL: only forward context failed");
const EGLint attribs_test[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR,
//EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
EGL_NONE
};
context = eglCreateContext(display, config, EGL_NO_CONTEXT, attribs_test);
if (context == EGL_NO_CONTEXT)
{
LOG("EGL: only debug context failed");
const EGLint attribs_test[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
context = eglCreateContext(display, config, EGL_NO_CONTEXT, attribs_test);
if (context == EGL_NO_CONTEXT)
{
LOG("EGL: all the context creation failed");
}
else
{
LOG("EGL: created simple context");
}
}
else
{
LOG("EGL: created only debug context");
}
}
else
{
LOG("EGL: created only forward context");
}
}
else
{
LOG("EGL: created debug and forward context");
}
if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) {
LOG("Unable to eglMakeCurrent");
return -1;
@@ -164,25 +218,32 @@ static int engine_init_display(struct engine* engine) {
LOG("OpenGL Info: %s", info);
}
const char* ext = (const char*) glGetString(GL_EXTENSIONS);
int ext_len = strlen(ext);
GLint n_exts;
std::map<std::string, bool> ext_map;
static char ext_name[256];
int ext_name_i = 0;
for (int i = 0; i < ext_len; i++)
glGetIntegerv(GL_NUM_EXTENSIONS, &n_exts);
for (int i = 0; i < n_exts; i++)
{
char c = ext[i];
if (c == ' ')
{
ext_map.emplace(std::string(ext_name, ext_name_i), true);
ext_name_i = 0;
}
else
{
ext_name[ext_name_i++] = c;
}
ext_map.emplace(glGetStringi(GL_EXTENSIONS, i), true);
}
//const char* ext = (const char*) glGetString(GL_EXTENSIONS);
//int ext_len = strlen(ext);
//static char ext_name[256];
//int ext_name_i = 0;
//for (int i = 0; i < ext_len; i++)
//{
// char c = ext[i];
// if (c == ' ')
// {
// ext_map.emplace(std::string(ext_name, ext_name_i), true);
// ext_name_i = 0;
// }
// else
// {
// ext_name[ext_name_i++] = c;
// }
//}
if (ext_map.count("GL_KHR_debug"))
{
LOG("GL_KHR_debug supported");