search GLSL extensions

This commit is contained in:
2019-07-29 13:35:54 +02:00
parent 563b4ff86f
commit 73485cde01
4 changed files with 24 additions and 12 deletions

View File

@@ -1666,8 +1666,8 @@ Here's a list of what's available in this release.
<border id="ext-fbf" height="20" width="30" color="0 0 0 1" align="center" justify="center" margin="0 5 0 0">
<text id="txt-rec" text="FbF" color="0 0 0 1"/>
</border>
<border id="ext-flt" height="20" width="40" color="0 0 0 1" align="center" justify="center" margin="0 5 0 0">
<text id="ext-flt-text" text="flt" color="0 0 0 1"/>
<border id="ext-flt" height="20" width="30" color="0 0 0 1" align="center" justify="center" margin="0 5 0 0">
<text id="ext-flt-text" text="B8" color="0 0 0 1"/>
</border>
<border id="ext-dpi" height="20" width="60" color=".2" align="center" justify="center" margin="0 5 0 0">
<text id="txt-dpi" text="4x-dpi" color="1"/>

View File

@@ -1244,7 +1244,7 @@ void App::initLayout()
if (auto t = x->find<NodeText>("ext-flt-text"))
{
int bits = ShaderManager::ext_texture_float ? 32 : 16;
t->set_text_format("flt%d", bits);
t->set_text_format("F%d", bits);
}
x->m_color = glm::vec4(0, 1, 0, 1);
}

View File

@@ -15,21 +15,28 @@ void App::initShaders()
for (int i = 0; i < n_exts; i++)
{
std::string ext = (const char*)glGetStringi(GL_EXTENSIONS, i);
if (GLAD_GL_EXT_shader_framebuffer_fetch || GLAD_GL_EXT_shader_framebuffer_fetch_non_coherent)
{
if (ext.find("shader_framebuffer_fetch") != std::string::npos)
ShaderManager::ext_framebuffer_fetch = true;
}
else if (GLAD_GL_ARB_texture_float || GLAD_GL_ATI_texture_float)
{
#if __GLES__
if (ext.find("texture_float") != std::string::npos)
ShaderManager::ext_texture_float = true;
}
else if (GLAD_GL_NV_half_float || GLAD_GL_ARB_half_float_pixel)
{
if (ext.find("color_buffer_float") != std::string::npos)
ShaderManager::ext_texture_float = true;
if (ext.find("texture__half_float") != std::string::npos)
ShaderManager::ext_half_float_pixel = true;
}
if (ext.find("color_buffer_half_float") != std::string::npos)
ShaderManager::ext_half_float_pixel = true;
#endif
LOG("EXT: %s", ext.c_str());
}
});
#if __GL__
// In OpenGL 3.3 these should be already available
ShaderManager::ext_texture_float = true;
ShaderManager::ext_half_float_pixel = true;
#endif
LOG("Shader Extension shader_framebuffer_fetch: %s", ShaderManager::ext_framebuffer_fetch ? "enabled" : "disabled");
LOG("initializing shaders");

View File

@@ -20,6 +20,7 @@
#include <OpenGLES/ES3/gl.h>
#include <OpenGLES/ES3/glext.h>
#define SHADER_VERSION "#version 300 es\n"
#define __GLES__ 1
#define PP_OS "ios"
#else
#define __OSX__ 1
@@ -30,6 +31,7 @@
#include <OpenGL/gl3.h>
#include <OpenGL/gl3ext.h>
#define SHADER_VERSION "#version 150\n"
#define __GL__ 1
#define PP_OS "osx"
#endif
@@ -52,6 +54,7 @@
#define SHADER_VERSION "#version 300 es\n"
#define PP_OS "android"
#define __GLES__ 1
#define __block
//#define STBI_NEON
#define BT_SetTerminate void
@@ -75,6 +78,8 @@
#include <openvr.h>
#include <ppl.h>
#define __WIN__ 1
#define __GL__ 1
#define SHADER_VERSION "#version 150\n"
#define PP_OS "win"
#define __block