Skip to content

Commit 0b85abd

Browse files
committed
- Changed version to 1.8.8-rc
- Fixed problem with thick lines shader: gl_ClipDistance was written by both vertex and geometry shaders, which is normally an error (not captured by Nvidia Linux driver, but captured by NVidia Windows driver) - Now shader compiler writes all shader sources to files when gfx:GL_debug is set, so that one can inspect them and test them with glslangValidator
1 parent 74dfb16 commit 0b85abd

File tree

4 files changed

+52
-4
lines changed

4 files changed

+52
-4
lines changed

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ cmake_minimum_required(VERSION 3.0)
66
cmake_policy(SET CMP0048 NEW)
77

88
##############################################################################
9-
set(VORPALINE_VERSION_RC FALSE)
9+
set(VORPALINE_VERSION_RC TRUE)
1010
set(VORPALINE_VERSION_MAJOR 1)
1111
set(VORPALINE_VERSION_MINOR 8)
12-
set(VORPALINE_VERSION_PATCH 7)
12+
set(VORPALINE_VERSION_PATCH 8)
1313

1414
set(VORPALINE_VERSION_PLAIN ${VORPALINE_VERSION_MAJOR}.${VORPALINE_VERSION_MINOR}.${VORPALINE_VERSION_PATCH})
1515
if(VORPALINE_VERSION_RC)

src/lib/geogram_gfx/GLUP/shaders/GLUPGLSL/vertex_shader.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ void main(void) {
4242

4343
#if GLUP_PRIMITIVE_DIMENSION==1
4444

45-
#ifndef GLUP_NO_GL_CLIPPING
45+
#ifndef GLUP_NO_GL_CLIPPING
46+
// For GLUP_THICK_LINES, gl_ClipDistance is computed in
47+
// geometry shader (and it is an error to write to it
48+
// both in vertex and geometry shaders).
49+
#if (GLUP_PRIMITIVE != GLUP_THICK_LINES)
4650
if(glupIsEnabled(GLUP_CLIPPING)) {
4751
gl_ClipDistance[0] = dot(
4852
vertex_in, GLUP.world_clip_plane
@@ -51,6 +55,7 @@ void main(void) {
5155
gl_ClipDistance[0] = 0.0;
5256
}
5357
#endif
58+
#endif
5459

5560
#elif GLUP_PRIMITIVE_DIMENSION==2
5661

src/lib/geogram_gfx/GLUP/shaders/embedded_shaders.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,11 @@ namespace GLUP {
16191619
" \n"
16201620
"#if GLUP_PRIMITIVE_DIMENSION==1 \n"
16211621
" \n"
1622-
"#ifndef GLUP_NO_GL_CLIPPING \n"
1622+
"#ifndef GLUP_NO_GL_CLIPPING \n"
1623+
"// For GLUP_THICK_LINES, gl_ClipDistance is computed in \n"
1624+
"// geometry shader (and it is an error to write to it \n"
1625+
"// both in vertex and geometry shaders). \n"
1626+
"#if (GLUP_PRIMITIVE != GLUP_THICK_LINES) \n"
16231627
" if(glupIsEnabled(GLUP_CLIPPING)) { \n"
16241628
" gl_ClipDistance[0] = dot( \n"
16251629
" vertex_in, GLUP.world_clip_plane \n"
@@ -1628,6 +1632,7 @@ namespace GLUP {
16281632
" gl_ClipDistance[0] = 0.0; \n"
16291633
" } \n"
16301634
"#endif \n"
1635+
"#endif \n"
16311636
" \n"
16321637
"#elif GLUP_PRIMITIVE_DIMENSION==2 \n"
16331638
" \n"

src/lib/geogram_gfx/basic/GLSL.cpp

+38
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,44 @@ namespace GEO {
10751075
sources_texts[i] = sources[i].text();
10761076
}
10771077

1078+
// If GL_debug is set, save shaders to file
1079+
// It makes it easier testing and debugging
1080+
// them with glslangValidator
1081+
if(CmdLine::get_arg_bool("gfx:GL_debug")) {
1082+
static int index = 0;
1083+
++index;
1084+
std::string filename = String::format("shader_%03d",index);
1085+
switch(target) {
1086+
case GL_VERTEX_SHADER:
1087+
filename += ".vert";
1088+
break;
1089+
case GL_TESS_CONTROL_SHADER:
1090+
filename += ".tesc";
1091+
break;
1092+
case GL_TESS_EVALUATION_SHADER:
1093+
filename += ".tese";
1094+
break;
1095+
case GL_GEOMETRY_SHADER:
1096+
filename += ".geom";
1097+
break;
1098+
case GL_FRAGMENT_SHADER:
1099+
filename += ".frag";
1100+
break;
1101+
case GL_COMPUTE_SHADER:
1102+
filename += ".comp";
1103+
break;
1104+
default:
1105+
filename += ".shader";
1106+
break;
1107+
}
1108+
1109+
std::ofstream out(filename.c_str());
1110+
Logger::out("GLSLdbg") << "Saving shader " << filename << std::endl;
1111+
for(index_t i=0; i<sources_texts.size(); ++i) {
1112+
out << sources_texts[i];
1113+
}
1114+
}
1115+
10781116
return compile_shader(
10791117
target, &sources_texts[0], index_t(sources_texts.size())
10801118
);

0 commit comments

Comments
 (0)