@@ -229,25 +229,45 @@ void WebGL2RenderingContextImpl::tex_sub_image3d(WebIDL::UnsignedLong target, We
229229void WebGL2RenderingContextImpl::uniform1ui (GC::Root<WebGLUniformLocation> location, WebIDL::UnsignedLong v0)
230230{
231231 m_context->make_current ();
232- glUniform1ui (location ? location->handle () : 0 , v0);
232+
233+ GLuint location_handle = 0 ;
234+ if (location)
235+ location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
236+
237+ glUniform1ui (location_handle, v0);
233238}
234239
235240void WebGL2RenderingContextImpl::uniform2ui (GC::Root<WebGLUniformLocation> location, WebIDL::UnsignedLong v0, WebIDL::UnsignedLong v1)
236241{
237242 m_context->make_current ();
238- glUniform2ui (location ? location->handle () : 0 , v0, v1);
243+
244+ GLuint location_handle = 0 ;
245+ if (location)
246+ location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
247+
248+ glUniform2ui (location_handle, v0, v1);
239249}
240250
241251void WebGL2RenderingContextImpl::uniform3ui (GC::Root<WebGLUniformLocation> location, WebIDL::UnsignedLong v0, WebIDL::UnsignedLong v1, WebIDL::UnsignedLong v2)
242252{
243253 m_context->make_current ();
244- glUniform3ui (location ? location->handle () : 0 , v0, v1, v2);
254+
255+ GLuint location_handle = 0 ;
256+ if (location)
257+ location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
258+
259+ glUniform3ui (location_handle, v0, v1, v2);
245260}
246261
247262void WebGL2RenderingContextImpl::uniform4ui (GC::Root<WebGLUniformLocation> location, WebIDL::UnsignedLong v0, WebIDL::UnsignedLong v1, WebIDL::UnsignedLong v2, WebIDL::UnsignedLong v3)
248263{
249264 m_context->make_current ();
250- glUniform4ui (location ? location->handle () : 0 , v0, v1, v2, v3);
265+
266+ GLuint location_handle = 0 ;
267+ if (location)
268+ location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
269+
270+ glUniform4ui (location_handle, v0, v1, v2, v3);
251271}
252272
253273void WebGL2RenderingContextImpl::uniform1uiv (GC::Root<WebGLUniformLocation> location, Uint32List values, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
@@ -257,8 +277,10 @@ void WebGL2RenderingContextImpl::uniform1uiv(GC::Root<WebGLUniformLocation> loca
257277 if (!location)
258278 return ;
259279
280+ GLuint location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
281+
260282 auto span = SET_ERROR_VALUE_IF_ERROR (span_from_uint32_list (values, src_offset, src_length), GL_INVALID_VALUE);
261- glUniform1uiv (location-> handle () , span.size (), span.data ());
283+ glUniform1uiv (location_handle , span.size (), span.data ());
262284}
263285
264286void WebGL2RenderingContextImpl::uniform2uiv (GC::Root<WebGLUniformLocation> location, Uint32List values, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
@@ -268,12 +290,14 @@ void WebGL2RenderingContextImpl::uniform2uiv(GC::Root<WebGLUniformLocation> loca
268290 if (!location)
269291 return ;
270292
293+ GLuint location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
294+
271295 auto span = SET_ERROR_VALUE_IF_ERROR (span_from_uint32_list (values, src_offset, src_length), GL_INVALID_VALUE);
272296 if (span.size () % 2 != 0 ) [[unlikely]] {
273297 set_error (GL_INVALID_VALUE);
274298 return ;
275299 }
276- glUniform2uiv (location-> handle () , span.size () / 2 , span.data ());
300+ glUniform2uiv (location_handle , span.size () / 2 , span.data ());
277301}
278302
279303void WebGL2RenderingContextImpl::uniform3uiv (GC::Root<WebGLUniformLocation> location, Uint32List values, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
@@ -283,12 +307,14 @@ void WebGL2RenderingContextImpl::uniform3uiv(GC::Root<WebGLUniformLocation> loca
283307 if (!location)
284308 return ;
285309
310+ GLuint location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
311+
286312 auto span = SET_ERROR_VALUE_IF_ERROR (span_from_uint32_list (values, src_offset, src_length), GL_INVALID_VALUE);
287313 if (span.size () % 3 != 0 ) [[unlikely]] {
288314 set_error (GL_INVALID_VALUE);
289315 return ;
290316 }
291- glUniform3uiv (location-> handle () , span.size () / 3 , span.data ());
317+ glUniform3uiv (location_handle , span.size () / 3 , span.data ());
292318}
293319
294320void WebGL2RenderingContextImpl::uniform4uiv (GC::Root<WebGLUniformLocation> location, Uint32List values, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
@@ -298,12 +324,14 @@ void WebGL2RenderingContextImpl::uniform4uiv(GC::Root<WebGLUniformLocation> loca
298324 if (!location)
299325 return ;
300326
327+ GLuint location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
328+
301329 auto span = SET_ERROR_VALUE_IF_ERROR (span_from_uint32_list (values, src_offset, src_length), GL_INVALID_VALUE);
302330 if (span.size () % 4 != 0 ) [[unlikely]] {
303331 set_error (GL_INVALID_VALUE);
304332 return ;
305333 }
306- glUniform4uiv (location-> handle () , span.size () / 4 , span.data ());
334+ glUniform4uiv (location_handle , span.size () / 4 , span.data ());
307335}
308336
309337void WebGL2RenderingContextImpl::uniform_matrix3x2fv (GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
@@ -313,13 +341,15 @@ void WebGL2RenderingContextImpl::uniform_matrix3x2fv(GC::Root<WebGLUniformLocati
313341 if (!location)
314342 return ;
315343
344+ GLuint location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
345+
316346 constexpr auto matrix_size = 3 * 2 ;
317347 auto span = SET_ERROR_VALUE_IF_ERROR (span_from_float32_list (data, src_offset, src_length), GL_INVALID_VALUE);
318348 if (span.size () % matrix_size != 0 ) [[unlikely]] {
319349 set_error (GL_INVALID_VALUE);
320350 return ;
321351 }
322- glUniformMatrix3x2fv (location-> handle () , span.size () / matrix_size, transpose, span.data ());
352+ glUniformMatrix3x2fv (location_handle , span.size () / matrix_size, transpose, span.data ());
323353}
324354
325355void WebGL2RenderingContextImpl::uniform_matrix4x2fv (GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
@@ -329,13 +359,15 @@ void WebGL2RenderingContextImpl::uniform_matrix4x2fv(GC::Root<WebGLUniformLocati
329359 if (!location)
330360 return ;
331361
362+ GLuint location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
363+
332364 constexpr auto matrix_size = 4 * 2 ;
333365 auto span = SET_ERROR_VALUE_IF_ERROR (span_from_float32_list (data, src_offset, src_length), GL_INVALID_VALUE);
334366 if (span.size () % matrix_size != 0 ) [[unlikely]] {
335367 set_error (GL_INVALID_VALUE);
336368 return ;
337369 }
338- glUniformMatrix4x2fv (location-> handle () , span.size () / matrix_size, transpose, span.data ());
370+ glUniformMatrix4x2fv (location_handle , span.size () / matrix_size, transpose, span.data ());
339371}
340372
341373void WebGL2RenderingContextImpl::uniform_matrix2x3fv (GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
@@ -345,13 +377,15 @@ void WebGL2RenderingContextImpl::uniform_matrix2x3fv(GC::Root<WebGLUniformLocati
345377 if (!location)
346378 return ;
347379
380+ GLuint location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
381+
348382 constexpr auto matrix_size = 2 * 3 ;
349383 auto span = SET_ERROR_VALUE_IF_ERROR (span_from_float32_list (data, src_offset, src_length), GL_INVALID_VALUE);
350384 if (span.size () % matrix_size != 0 ) [[unlikely]] {
351385 set_error (GL_INVALID_VALUE);
352386 return ;
353387 }
354- glUniformMatrix2x3fv (location-> handle () , span.size () / matrix_size, transpose, span.data ());
388+ glUniformMatrix2x3fv (location_handle , span.size () / matrix_size, transpose, span.data ());
355389}
356390
357391void WebGL2RenderingContextImpl::uniform_matrix4x3fv (GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
@@ -361,13 +395,15 @@ void WebGL2RenderingContextImpl::uniform_matrix4x3fv(GC::Root<WebGLUniformLocati
361395 if (!location)
362396 return ;
363397
398+ GLuint location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
399+
364400 constexpr auto matrix_size = 4 * 3 ;
365401 auto span = SET_ERROR_VALUE_IF_ERROR (span_from_float32_list (data, src_offset, src_length), GL_INVALID_VALUE);
366402 if (span.size () % matrix_size != 0 ) [[unlikely]] {
367403 set_error (GL_INVALID_VALUE);
368404 return ;
369405 }
370- glUniformMatrix4x3fv (location-> handle () , span.size () / matrix_size, transpose, span.data ());
406+ glUniformMatrix4x3fv (location_handle , span.size () / matrix_size, transpose, span.data ());
371407}
372408
373409void WebGL2RenderingContextImpl::uniform_matrix2x4fv (GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
@@ -377,13 +413,15 @@ void WebGL2RenderingContextImpl::uniform_matrix2x4fv(GC::Root<WebGLUniformLocati
377413 if (!location)
378414 return ;
379415
416+ GLuint location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
417+
380418 constexpr auto matrix_size = 2 * 4 ;
381419 auto span = SET_ERROR_VALUE_IF_ERROR (span_from_float32_list (data, src_offset, src_length), GL_INVALID_VALUE);
382420 if (span.size () % matrix_size != 0 ) [[unlikely]] {
383421 set_error (GL_INVALID_VALUE);
384422 return ;
385423 }
386- glUniformMatrix2x4fv (location-> handle () , span.size () / matrix_size, transpose, span.data ());
424+ glUniformMatrix2x4fv (location_handle , span.size () / matrix_size, transpose, span.data ());
387425}
388426
389427void WebGL2RenderingContextImpl::uniform_matrix3x4fv (GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
@@ -393,13 +431,15 @@ void WebGL2RenderingContextImpl::uniform_matrix3x4fv(GC::Root<WebGLUniformLocati
393431 if (!location)
394432 return ;
395433
434+ GLuint location_handle = SET_ERROR_VALUE_IF_ERROR (location->handle (m_current_program), GL_INVALID_OPERATION);
435+
396436 constexpr auto matrix_size = 3 * 4 ;
397437 auto span = SET_ERROR_VALUE_IF_ERROR (span_from_float32_list (data, src_offset, src_length), GL_INVALID_VALUE);
398438 if (span.size () % matrix_size != 0 ) [[unlikely]] {
399439 set_error (GL_INVALID_VALUE);
400440 return ;
401441 }
402- glUniformMatrix3x4fv (location-> handle () , span.size () / matrix_size, transpose, span.data ());
442+ glUniformMatrix3x4fv (location_handle , span.size () / matrix_size, transpose, span.data ());
403443}
404444
405445void WebGL2RenderingContextImpl::vertex_attrib_i4i (WebIDL::UnsignedLong index, WebIDL::Long x, WebIDL::Long y, WebIDL::Long z, WebIDL::Long w)
0 commit comments