mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-17 03:35:56 +08:00
Fixed conflicts after merge with et_opengl_3
Partial revert of 0260c81c9e2b715b69550b5c99e0cbb8d5503021 - OpenGL ES 2.0 set as minimum version Fixed shaders version
This commit is contained in:
commit
4858bf02fb
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
attribute vec3 v_position;
|
||||
attribute vec2 v_tex_coord;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
// see as reference: https://stackoverflow.com/questions/52928678/dashed-line-in-opengl3
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
uniform mat4 view_model_matrix;
|
||||
uniform mat4 projection_matrix;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
uniform mat4 view_model_matrix;
|
||||
uniform mat4 projection_matrix;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
uniform mat4 view_model_matrix;
|
||||
uniform mat4 projection_matrix;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
#extension GL_NV_fragdepth : enable
|
||||
|
||||
precision highp float;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
#define INTENSITY_CORRECTION 0.6
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
#define INTENSITY_CORRECTION 0.6
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
uniform vec4 uniform_color;
|
||||
uniform float emission_factor;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
#define INTENSITY_CORRECTION 0.6
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
uniform mat4 ProjMtx;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
#extension GL_NV_fragdepth : enable
|
||||
|
||||
precision highp float;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
uniform mat4 view_model_matrix;
|
||||
uniform mat4 projection_matrix;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
#extension GL_OES_standard_derivatives : enable
|
||||
|
||||
precision highp float;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
const vec3 ZERO = vec3(0.0, 0.0, 0.0);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
uniform mat4 view_model_matrix;
|
||||
uniform mat4 projection_matrix;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
#define INTENSITY_CORRECTION 0.6
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
#extension GL_OES_standard_derivatives : enable
|
||||
|
||||
precision highp float;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 110
|
||||
#version 100
|
||||
|
||||
#define INTENSITY_CORRECTION 0.6
|
||||
|
||||
|
@ -57,8 +57,6 @@
|
||||
#define ENABLE_LEGACY_OPENGL_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable OpenGL ES
|
||||
#define ENABLE_OPENGL_ES (1 && ENABLE_LEGACY_OPENGL_REMOVAL)
|
||||
// Enable OpenGL ES forcing ES 2.0 as min version
|
||||
#define ENABLE_OPENGL_ES_2_0 (0 && ENABLE_OPENGL_ES)
|
||||
// Enable OpenGL core profile context (tested against Mesa 20.1.8 on Windows)
|
||||
#define ENABLE_GL_CORE_PROFILE (1 && ENABLE_LEGACY_OPENGL_REMOVAL && !ENABLE_OPENGL_ES)
|
||||
// Shows an imgui dialog with GLModel statistics data
|
||||
|
@ -123,14 +123,10 @@ void GLCanvas3D::LayersEditing::init()
|
||||
{
|
||||
glsafe(::glGenTextures(1, (GLuint*)&m_z_texture_id));
|
||||
glsafe(::glBindTexture(GL_TEXTURE_2D, m_z_texture_id));
|
||||
#if _WIN32 && ENABLE_GL_CORE_PROFILE
|
||||
if (!OpenGLManager::get_gl_info().is_core_profile() || !OpenGLManager::get_gl_info().is_mesa()) {
|
||||
#endif // _WIN32 && ENABLE_GL_CORE_PROFILE
|
||||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP));
|
||||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP));
|
||||
#if _WIN32 && ENABLE_GL_CORE_PROFILE
|
||||
}
|
||||
#endif // _WIN32 && ENABLE_GL_CORE_PROFILE
|
||||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
|
||||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST));
|
||||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1));
|
||||
|
@ -66,19 +66,15 @@ const std::string& OpenGLManager::GLInfo::get_renderer() const
|
||||
return m_renderer;
|
||||
}
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
bool OpenGLManager::GLInfo::is_core_profile() const
|
||||
{
|
||||
return !GLEW_ARB_compatibility;
|
||||
}
|
||||
|
||||
#if _WIN32
|
||||
bool OpenGLManager::GLInfo::is_mesa() const
|
||||
{
|
||||
return boost::icontains(m_version, "mesa");
|
||||
}
|
||||
#endif // _WIN32
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
||||
int OpenGLManager::GLInfo::get_max_tex_size() const
|
||||
{
|
||||
@ -208,25 +204,11 @@ std::string OpenGLManager::GLInfo::to_string(bool for_github) const
|
||||
out << b_start << "GLSL version: " << b_end << m_glsl_version << line_end;
|
||||
|
||||
{
|
||||
std::vector<std::string> extensions_list;
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
std::string extensions_str;
|
||||
if (is_core_profile()) {
|
||||
GLint n = 0;
|
||||
glsafe(::glGetIntegerv(GL_NUM_EXTENSIONS, &n));
|
||||
for (GLint i = 0; i < n; ++i) {
|
||||
const char* extension = (const char*)::glGetStringi(GL_EXTENSIONS, i);
|
||||
glcheck();
|
||||
if (extension != nullptr)
|
||||
extensions_list.emplace_back(extension);
|
||||
}
|
||||
}
|
||||
else {
|
||||
extensions_str = gl_get_string_safe(GL_EXTENSIONS, "");
|
||||
boost::split(extensions_list, extensions_str, boost::is_any_of(" "), boost::token_compress_on);
|
||||
}
|
||||
std::vector<std::string> extensions_list = get_extensions_list();
|
||||
#else
|
||||
const std::string extensions_str = gl_get_string_safe(GL_EXTENSIONS, "");
|
||||
std::vector<std::string> extensions_list;
|
||||
boost::split(extensions_list, extensions_str, boost::is_any_of(" "), boost::token_compress_on);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
||||
@ -249,6 +231,31 @@ std::string OpenGLManager::GLInfo::to_string(bool for_github) const
|
||||
return out.str();
|
||||
}
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
std::vector<std::string> OpenGLManager::GLInfo::get_extensions_list() const
|
||||
{
|
||||
std::vector<std::string> ret;
|
||||
|
||||
if (is_core_profile()) {
|
||||
GLint n = 0;
|
||||
glsafe(::glGetIntegerv(GL_NUM_EXTENSIONS, &n));
|
||||
ret.reserve(n);
|
||||
for (GLint i = 0; i < n; ++i) {
|
||||
const char* extension = (const char*)::glGetStringi(GL_EXTENSIONS, i);
|
||||
glcheck();
|
||||
if (extension != nullptr)
|
||||
ret.emplace_back(extension);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const std::string extensions_str = gl_get_string_safe(GL_EXTENSIONS, "");
|
||||
boost::split(ret, extensions_str, boost::is_any_of(" "), boost::token_compress_on);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
||||
OpenGLManager::GLInfo OpenGLManager::s_gl_info;
|
||||
bool OpenGLManager::s_compressed_textures_supported = false;
|
||||
OpenGLManager::EMultisampleState OpenGLManager::s_multisample = OpenGLManager::EMultisampleState::Unknown;
|
||||
@ -316,11 +323,7 @@ bool OpenGLManager::init_gl()
|
||||
s_framebuffers_type = EFramebufferType::Unknown;
|
||||
|
||||
#if ENABLE_OPENGL_ES
|
||||
#if ENABLE_OPENGL_ES_2_0
|
||||
bool valid_version = s_gl_info.is_version_greater_or_equal_to(2, 0);
|
||||
#else
|
||||
bool valid_version = true;
|
||||
#endif // ENABLE_OPENGL_ES_2_0
|
||||
#elif ENABLE_GL_CORE_PROFILE
|
||||
bool valid_version = s_gl_info.is_core_profile() ? s_gl_info.is_version_greater_or_equal_to(3, 3) : s_gl_info.is_version_greater_or_equal_to(2, 0);
|
||||
#else
|
||||
@ -367,11 +370,7 @@ wxGLContext* OpenGLManager::init_glcontext(wxGLCanvas& canvas)
|
||||
if (m_context == nullptr) {
|
||||
#if ENABLE_OPENGL_ES
|
||||
wxGLContextAttrs attrs;
|
||||
#if ENABLE_OPENGL_ES_2_0
|
||||
attrs.ES2().MajorVersion(2).EndList();
|
||||
#else
|
||||
attrs.ES2().EndList();
|
||||
#endif // ENABLE_OPENGL_ES_2_0
|
||||
m_context = new wxGLContext(&canvas, nullptr, &attrs);
|
||||
#elif ENABLE_GL_CORE_PROFILE
|
||||
wxGLContextAttrs attrs;
|
||||
|
@ -43,12 +43,8 @@ public:
|
||||
const std::string& get_vendor() const;
|
||||
const std::string& get_renderer() const;
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
bool is_core_profile() const;
|
||||
#if _WIN32
|
||||
bool is_mesa() const;
|
||||
#endif // _WIN32
|
||||
#endif // ENABLE_OPENGL_ES
|
||||
bool is_es() {
|
||||
return
|
||||
#if ENABLE_OPENGL_ES
|
||||
@ -68,6 +64,10 @@ public:
|
||||
// Otherwise HTML formatted for the system info dialog.
|
||||
std::string to_string(bool for_github) const;
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
std::vector<std::string> get_extensions_list() const;
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
||||
private:
|
||||
void detect() const;
|
||||
};
|
||||
|
@ -55,8 +55,10 @@ static const std::string SEND_SYSTEM_INFO_DOMAIN = "prusa3d.com";
|
||||
static const std::string SEND_SYSTEM_INFO_URL = "https://files." + SEND_SYSTEM_INFO_DOMAIN + "/wp-json/v1/ps";
|
||||
|
||||
|
||||
#if !ENABLE_GL_CORE_PROFILE
|
||||
// Declaration of a free function defined in OpenGLManager.cpp:
|
||||
std::string gl_get_string_safe(GLenum param, const std::string& default_value);
|
||||
#endif // !ENABLE_GL_CORE_PROFILE
|
||||
|
||||
|
||||
// A dialog with the information text and buttons send/dont send/ask later.
|
||||
@ -507,9 +509,13 @@ static std::string generate_system_info_json()
|
||||
opengl_node.put("Vendor", OpenGLManager::get_gl_info().get_vendor());
|
||||
opengl_node.put("Renderer", OpenGLManager::get_gl_info().get_renderer());
|
||||
// Generate list of OpenGL extensions:
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
std::vector<std::string> extensions_list = OpenGLManager::get_gl_info().get_extensions_list();
|
||||
#else
|
||||
std::string extensions_str = gl_get_string_safe(GL_EXTENSIONS, "");
|
||||
std::vector<std::string> extensions_list;
|
||||
boost::split(extensions_list, extensions_str, boost::is_any_of(" "), boost::token_compress_off);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
std::sort(extensions_list.begin(), extensions_list.end());
|
||||
pt::ptree extensions_node;
|
||||
for (const std::string& s : extensions_list) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user