@@ -35,27 +35,25 @@ void WrappedOpenGL::ShaderData::Compile(WrappedOpenGL &gl, ResourceId id)
35
35
if (type == eGL_VERTEX_SHADER)
36
36
CheckVertexOutputUses (sources, pointSizeUsed, clipDistanceUsed);
37
37
38
- {
39
- string concatenated;
38
+ string concatenated;
40
39
41
- for (size_t i = 0 ; i < sources.size (); i++)
40
+ for (size_t i = 0 ; i < sources.size (); i++)
41
+ {
42
+ if (sources.size () > 1 )
42
43
{
43
- if (sources.size () > 1 )
44
- {
45
- if (i > 0 )
46
- concatenated += " \n " ;
47
- concatenated += " /////////////////////////////" ;
48
- concatenated += StringFormat::Fmt (" // Source file %u" , (uint32_t )i);
49
- concatenated += " /////////////////////////////" ;
44
+ if (i > 0 )
50
45
concatenated += " \n " ;
51
- }
52
-
53
- concatenated += sources[i];
46
+ concatenated += " /////////////////////////////" ;
47
+ concatenated += StringFormat::Fmt (" // Source file %u" , (uint32_t )i);
48
+ concatenated += " /////////////////////////////" ;
49
+ concatenated += " \n " ;
54
50
}
55
51
56
- create_array_init (reflection. RawBytes , concatenated. size (), (byte *)concatenated. c_str ()) ;
52
+ concatenated += sources[i] ;
57
53
}
58
54
55
+ create_array_init (reflection.RawBytes , concatenated.size (), (byte *)concatenated.c_str ());
56
+
59
57
GLuint sepProg = prog;
60
58
61
59
if (sepProg == 0 )
@@ -85,13 +83,9 @@ void WrappedOpenGL::ShaderData::Compile(WrappedOpenGL &gl, ResourceId id)
85
83
reflection.ID = id;
86
84
reflection.EntryPoint = " main" ;
87
85
88
- // TODO sort these so that the first file contains the entry point
89
- create_array_uninit (reflection.DebugInfo .files , sources.size ());
90
- for (size_t i = 0 ; i < sources.size (); i++)
91
- {
92
- reflection.DebugInfo .files [i].first = StringFormat::Fmt (" source%u.glsl" , (uint32_t )i);
93
- reflection.DebugInfo .files [i].second = sources[i];
94
- }
86
+ create_array_uninit (reflection.DebugInfo .files , 1 );
87
+ reflection.DebugInfo .files [0 ].first = " main.glsl" ;
88
+ reflection.DebugInfo .files [0 ].second = concatenated;
95
89
}
96
90
}
97
91
0 commit comments