diff options
| -rw-r--r-- | gfx/gl/shader.cpp | 3 | ||||
| -rw-r--r-- | gfx/gl/shaders/networkCurve.gs | 5 | ||||
| -rw-r--r-- | glsl.jam | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/gfx/gl/shader.cpp b/gfx/gl/shader.cpp index 9a4c270..21edadb 100644 --- a/gfx/gl/shader.cpp +++ b/gfx/gl/shader.cpp @@ -16,8 +16,9 @@ namespace { } using LookUpFunction = std::string (*)(GLenum); - constexpr std::array<std::tuple<std::string_view, GLenum, LookUpFunction>, 1> LOOKUPS {{ + constexpr std::array<std::tuple<std::string_view, GLenum, LookUpFunction>, 2> LOOKUPS {{ {"GL_MAX_GEOMETRY_OUTPUT_VERTICES", GL_MAX_GEOMETRY_OUTPUT_VERTICES, getInt}, + {"GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS", GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS, getInt}, }}; struct ShaderCompileError : public MsgException<std::invalid_argument> { diff --git a/gfx/gl/shaders/networkCurve.gs b/gfx/gl/shaders/networkCurve.gs index 7cb6c42..ba93542 100644 --- a/gfx/gl/shaders/networkCurve.gs +++ b/gfx/gl/shaders/networkCurve.gs @@ -24,8 +24,9 @@ getRot(float angle) void main() { - float segs = clamp( - round(reps[0] * radius[0] / 1000), 4, floor(uint(GL_MAX_GEOMETRY_OUTPUT_VERTICES) / (profileLength * 2u))); + float segs = clamp(round(reps[0] * radius[0] / 1000), 4, + min(floor(uint(GL_MAX_GEOMETRY_OUTPUT_VERTICES) / (profileLength * 2u)), + floor(uint(GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS) / 5u))); vec3 arcstep = vec3((bangle[0] - aangle[0]), // angle reps[0], // texture (bpos[0].z - apos[0].z)) // height @@ -35,7 +35,7 @@ actions glsl.embed set -e m4 -I$(2:D) -DSOURCE=$(2) -DOUTPUT=$(1[3]) -DNAME=$(2:B) -DTYPE=$(2:S) -DGLTYPE=$(OPTIONS) $(2) > $(1[3]) STAGE=$(OPTIONS:L) - glslangValidator -S ${STAGE:3:4} -DGL_MAX_GEOMETRY_OUTPUT_VERTICES=64 -l $(1[3]) + glslangValidator -S ${STAGE:3:4} -DGL_MAX_GEOMETRY_OUTPUT_VERTICES=64 -DGL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS=64 -l $(1[3]) clang-format -i $(1[3]) m4 -I$(2:D) -DSOURCE=$(1[3]) -DOUTPUT=$(1[3]) -DNAME=$(2:B) -DTYPE=$(2:S) -DGLTYPE=$(OPTIONS) lib/embed-glsl.h.m4 > $(1[2]) m4 -I$(2:D) -DSOURCE=$(1[3]) -DOUTPUT=$(1[3]) -DNAME=$(2:B) -DTYPE=$(2:S) -DGLTYPE=$(OPTIONS) lib/embed-glsl.cpp.m4 > $(1[1]) |
