[Mesa-dev] [PATCH 2/4] glsl: trivial change of the file extension matching
Vlad Golovkin
vlad.golovkin.mail at gmail.com
Tue May 30 22:45:14 UTC 2017
---
src/compiler/glsl/standalone.cpp | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp
index 52554bb92a..b9cee23642 100644
--- a/src/compiler/glsl/standalone.cpp
+++ b/src/compiler/glsl/standalone.cpp
@@ -459,19 +459,22 @@ standalone_compile_shader(const struct standalone_options *_options,
if (len < 6)
goto fail;
- const char *const ext = & files[i][len - 5];
+ const char *ext = & files[i][len - 5];
/* TODO add support to read a .shader_test */
- if (strncmp(".vert", ext, 5) == 0 || strncmp(".glsl", ext, 5) == 0)
+ if (*ext != '.')
+ goto fail;
+ ++ext;
+ if (memcmp("vert", ext, 4) == 0 || memcmp("glsl", ext, 4) == 0)
shader->Type = GL_VERTEX_SHADER;
- else if (strncmp(".tesc", ext, 5) == 0)
+ else if (memcmp("tesc", ext, 4) == 0)
shader->Type = GL_TESS_CONTROL_SHADER;
- else if (strncmp(".tese", ext, 5) == 0)
+ else if (memcmp("tese", ext, 4) == 0)
shader->Type = GL_TESS_EVALUATION_SHADER;
- else if (strncmp(".geom", ext, 5) == 0)
+ else if (memcmp("geom", ext, 4) == 0)
shader->Type = GL_GEOMETRY_SHADER;
- else if (strncmp(".frag", ext, 5) == 0)
+ else if (memcmp("frag", ext, 4) == 0)
shader->Type = GL_FRAGMENT_SHADER;
- else if (strncmp(".comp", ext, 5) == 0)
+ else if (memcmp("comp", ext, 4) == 0)
shader->Type = GL_COMPUTE_SHADER;
else
goto fail;
--
2.11.0
More information about the mesa-dev
mailing list