Skip to content

Commit 34cffac

Browse files
authored
int(iv): Add raw string syntax modifier for VSCode and Cursor to understand its glsl (#4796)
Sorry for not doing it in a first PR. I thought to see if I can make VSCode / Cursor to actually syntax highlight that raw string literal content. And I found a way. Seems like if you change the delimiter using language of content syntax name you make VSCode to syntax highlight it: ![Screenshot 2025-06-08 at 11 12 45 pm](https://github.com/user-attachments/assets/278ac078-e895-4565-9e68-8f5b80f3f3c6) I don't think those clang exceptions are needed now. Signed-off-by: Aleksandr Motsjonov <soswow@gmail.com>
1 parent 8f83072 commit 34cffac

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/iv/ivgl.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ IvGL::create_textures(void)
190190
const char*
191191
IvGL::color_func_shader_text()
192192
{
193-
// clang-format off
194-
return R"(
193+
return R"glsl(
195194
uniform float gain;
196195
uniform float gamma;
197196
@@ -202,8 +201,7 @@ IvGL::color_func_shader_text()
202201
C.xyz = pow (C.xyz, vec3 (invgamma, invgamma, invgamma));
203202
return C;
204203
}
205-
)";
206-
// clang-format on
204+
)glsl";
207205
}
208206

209207
void
@@ -235,16 +233,14 @@ IvGL::create_shaders(void)
235233
GLint status;
236234

237235
if (!m_vertex_shader) {
238-
// clang-format off
239-
static const GLchar* vertex_source = R"(
236+
static const GLchar* vertex_source = R"glsl(
240237
varying vec2 vTexCoord;
241238
void main ()
242239
{
243240
vTexCoord = gl_MultiTexCoord0.xy;
244241
gl_Position = ftransform();
245242
}
246-
)";
247-
// clang-format on
243+
)glsl";
248244

249245
m_vertex_shader = glCreateShader(GL_VERTEX_SHADER);
250246
glShaderSource(m_vertex_shader, 1, &vertex_source, NULL);
@@ -259,8 +255,7 @@ IvGL::create_shaders(void)
259255
}
260256
}
261257

262-
// clang-format off
263-
static const GLchar* fragment_source = R"(
258+
static const GLchar* fragment_source = R"glsl(
264259
uniform sampler2D imgtex;
265260
varying vec2 vTexCoord;
266261
uniform int startchannel;
@@ -371,8 +366,7 @@ IvGL::create_shaders(void)
371366
C = ColorFunc(C);
372367
gl_FragColor = C;
373368
}
374-
)";
375-
// clang-format on
369+
)glsl";
376370

377371
const char* fragment_sources[] = { "#version 120\n", color_shader,
378372
fragment_source };

0 commit comments

Comments
 (0)