@@ -142,25 +142,18 @@ pub(super) unsafe fn texture_program(
142
142
let program = unsafe { link_program ( gl, shaders:: VERTEX_SHADER , & shader) ? } ;
143
143
let debug_program = unsafe { link_program ( gl, shaders:: VERTEX_SHADER , debug_shader. as_ref ( ) ) ? } ;
144
144
145
- let vert = CStr :: from_bytes_with_nul ( b"vert\0 " ) . expect ( "NULL terminated" ) ;
146
- let vert_position = CStr :: from_bytes_with_nul ( b"vert_position\0 " ) . expect ( "NULL terminated" ) ;
147
- let tex = CStr :: from_bytes_with_nul ( b"tex\0 " ) . expect ( "NULL terminated" ) ;
148
- let matrix = CStr :: from_bytes_with_nul ( b"matrix\0 " ) . expect ( "NULL terminated" ) ;
149
- let tex_matrix = CStr :: from_bytes_with_nul ( b"tex_matrix\0 " ) . expect ( "NULL terminated" ) ;
150
- let alpha = CStr :: from_bytes_with_nul ( b"alpha\0 " ) . expect ( "NULL terminated" ) ;
151
- let tint = CStr :: from_bytes_with_nul ( b"tint\0 " ) . expect ( "NULL terminated" ) ;
152
-
153
145
Ok ( GlesTexProgramVariant {
154
146
normal : GlesTexProgramInternal {
155
147
program,
156
- uniform_tex : gl. GetUniformLocation ( program, tex. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
157
- uniform_matrix : gl. GetUniformLocation ( program, matrix. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
148
+ uniform_tex : gl. GetUniformLocation ( program, c"tex" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
149
+ uniform_matrix : gl
150
+ . GetUniformLocation ( program, c"matrix" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
158
151
uniform_tex_matrix : gl
159
- . GetUniformLocation ( program, tex_matrix. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
160
- uniform_alpha : gl. GetUniformLocation ( program, alpha. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
161
- attrib_vert : gl. GetAttribLocation ( program, vert. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
152
+ . GetUniformLocation ( program, c" tex_matrix" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
153
+ uniform_alpha : gl. GetUniformLocation ( program, c" alpha" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
154
+ attrib_vert : gl. GetAttribLocation ( program, c" vert" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
162
155
attrib_vert_position : gl
163
- . GetAttribLocation ( program, vert_position. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
156
+ . GetAttribLocation ( program, c" vert_position" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
164
157
additional_uniforms : additional_uniforms
165
158
. iter ( )
166
159
. map ( |uniform| {
@@ -179,16 +172,20 @@ pub(super) unsafe fn texture_program(
179
172
} ,
180
173
debug : GlesTexProgramInternal {
181
174
program : debug_program,
182
- uniform_tex : gl. GetUniformLocation ( debug_program, tex. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
175
+ uniform_tex : gl
176
+ . GetUniformLocation ( debug_program, c"tex" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
183
177
uniform_matrix : gl
184
- . GetUniformLocation ( debug_program, matrix. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
178
+ . GetUniformLocation ( debug_program, c" matrix" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
185
179
uniform_tex_matrix : gl
186
- . GetUniformLocation ( debug_program, tex_matrix. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
180
+ . GetUniformLocation ( debug_program, c" tex_matrix" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
187
181
uniform_alpha : gl
188
- . GetUniformLocation ( debug_program, alpha. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
189
- attrib_vert : gl. GetAttribLocation ( debug_program, vert. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
190
- attrib_vert_position : gl
191
- . GetAttribLocation ( debug_program, vert_position. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
182
+ . GetUniformLocation ( debug_program, c"alpha" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
183
+ attrib_vert : gl
184
+ . GetAttribLocation ( debug_program, c"vert" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
185
+ attrib_vert_position : gl. GetAttribLocation (
186
+ debug_program,
187
+ c"vert_position" . as_ptr ( ) as * const ffi:: types:: GLchar ,
188
+ ) ,
192
189
additional_uniforms : additional_uniforms
193
190
. iter ( )
194
191
. map ( |uniform| {
@@ -206,7 +203,7 @@ pub(super) unsafe fn texture_program(
206
203
. collect ( ) ,
207
204
} ,
208
205
// debug flags
209
- uniform_tint : gl. GetUniformLocation ( debug_program, tint. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
206
+ uniform_tint : gl. GetUniformLocation ( debug_program, c" tint" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
210
207
} )
211
208
} ;
212
209
@@ -223,16 +220,11 @@ pub(super) unsafe fn texture_program(
223
220
pub ( super ) unsafe fn solid_program ( gl : & ffi:: Gles2 ) -> Result < GlesSolidProgram , GlesError > {
224
221
let program = link_program ( gl, shaders:: VERTEX_SHADER_SOLID , shaders:: FRAGMENT_SHADER_SOLID ) ?;
225
222
226
- let matrix = CStr :: from_bytes_with_nul ( b"matrix\0 " ) . expect ( "NULL terminated" ) ;
227
- let color = CStr :: from_bytes_with_nul ( b"color\0 " ) . expect ( "NULL terminated" ) ;
228
- let vert = CStr :: from_bytes_with_nul ( b"vert\0 " ) . expect ( "NULL terminated" ) ;
229
- let position = CStr :: from_bytes_with_nul ( b"position\0 " ) . expect ( "NULL terminated" ) ;
230
-
231
223
Ok ( GlesSolidProgram {
232
224
program,
233
- uniform_matrix : gl. GetUniformLocation ( program, matrix. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
234
- uniform_color : gl. GetUniformLocation ( program, color. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
235
- attrib_vert : gl. GetAttribLocation ( program, vert. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
236
- attrib_position : gl. GetAttribLocation ( program, position. as_ptr ( ) as * const ffi:: types:: GLchar ) ,
225
+ uniform_matrix : gl. GetUniformLocation ( program, c" matrix" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
226
+ uniform_color : gl. GetUniformLocation ( program, c" color" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
227
+ attrib_vert : gl. GetAttribLocation ( program, c" vert" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
228
+ attrib_position : gl. GetAttribLocation ( program, c" position" . as_ptr ( ) as * const ffi:: types:: GLchar ) ,
237
229
} )
238
230
}
0 commit comments