| OLD | NEW |
| 1 // Copyright 2011, Google Inc. | 1 // Copyright 2011, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 fail: | 387 fail: |
| 388 Dart_ThrowException(exception); | 388 Dart_ThrowException(exception); |
| 389 ASSERT_NOT_REACHED(); | 389 ASSERT_NOT_REACHED(); |
| 390 } | 390 } |
| 391 | 391 |
| 392 void getAttachedShadersCallback(Dart_NativeArguments args) | 392 void getAttachedShadersCallback(Dart_NativeArguments args) |
| 393 { | 393 { |
| 394 Dart_Handle exception = 0; | 394 Dart_Handle exception = 0; |
| 395 { | 395 { |
| 396 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); | 396 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); |
| 397 WebGLProgram* program = DartWebGLProgram::toNative(Dart_GetNativeArgumen
t(args, 1), exception); | 397 WebGLProgram* program = DartWebGLProgram::toNativeWithNullCheck(Dart_Get
NativeArgument(args, 1), exception); |
| 398 if (exception) | 398 if (exception) |
| 399 goto fail; | 399 goto fail; |
| 400 | 400 |
| 401 Vector<RefPtr<WebGLShader> > shaders; | 401 Vector<RefPtr<WebGLShader> > shaders; |
| 402 bool succeed = context->getAttachedShaders(program, shaders); | 402 bool succeed = context->getAttachedShaders(program, shaders); |
| 403 if (!succeed) { | 403 if (!succeed) { |
| 404 Dart_SetReturnValue(args, Dart_Null()); | 404 Dart_SetReturnValue(args, Dart_Null()); |
| 405 return; | 405 return; |
| 406 } | 406 } |
| 407 Dart_Handle result; | 407 Dart_Handle result; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 fail: | 497 fail: |
| 498 Dart_ThrowException(exception); | 498 Dart_ThrowException(exception); |
| 499 ASSERT_NOT_REACHED(); | 499 ASSERT_NOT_REACHED(); |
| 500 } | 500 } |
| 501 | 501 |
| 502 void getProgramParameterCallback(Dart_NativeArguments args) | 502 void getProgramParameterCallback(Dart_NativeArguments args) |
| 503 { | 503 { |
| 504 Dart_Handle exception = 0; | 504 Dart_Handle exception = 0; |
| 505 { | 505 { |
| 506 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); | 506 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); |
| 507 WebGLProgram* program = DartWebGLProgram::toNative(Dart_GetNativeArgumen
t(args, 1), exception); | 507 WebGLProgram* program = DartWebGLProgram::toNativeWithNullCheck(Dart_Get
NativeArgument(args, 1), exception); |
| 508 if (exception) | 508 if (exception) |
| 509 goto fail; | 509 goto fail; |
| 510 int pname = DartUtilities::dartToInt(Dart_GetNativeArgument(args, 2), ex
ception); | 510 int pname = DartUtilities::dartToInt(Dart_GetNativeArgument(args, 2), ex
ception); |
| 511 if (exception) | 511 if (exception) |
| 512 goto fail; | 512 goto fail; |
| 513 | 513 |
| 514 WebGLGetInfo info = context->getProgramParameter(program, pname); | 514 WebGLGetInfo info = context->getProgramParameter(program, pname); |
| 515 Dart_Handle result = webGLGetInfoToDart(info); | 515 Dart_Handle result = webGLGetInfoToDart(info); |
| 516 if (!DartUtilities::checkResult(result, exception)) | 516 if (!DartUtilities::checkResult(result, exception)) |
| 517 goto fail; | 517 goto fail; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 528 void getRenderbufferParameterCallback(Dart_NativeArguments args) | 528 void getRenderbufferParameterCallback(Dart_NativeArguments args) |
| 529 { | 529 { |
| 530 getObjectParameter(args, kRenderbuffer); | 530 getObjectParameter(args, kRenderbuffer); |
| 531 } | 531 } |
| 532 | 532 |
| 533 void getShaderParameterCallback(Dart_NativeArguments args) | 533 void getShaderParameterCallback(Dart_NativeArguments args) |
| 534 { | 534 { |
| 535 Dart_Handle exception = 0; | 535 Dart_Handle exception = 0; |
| 536 { | 536 { |
| 537 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); | 537 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); |
| 538 WebGLShader* shader = DartWebGLShader::toNative(Dart_GetNativeArgument(a
rgs, 1), exception); | 538 WebGLShader* shader = DartWebGLShader::toNativeWithNullCheck(Dart_GetNat
iveArgument(args, 1), exception); |
| 539 if (exception) | 539 if (exception) |
| 540 goto fail; | 540 goto fail; |
| 541 int pname = DartUtilities::dartToInt(Dart_GetNativeArgument(args, 2), ex
ception); | 541 int pname = DartUtilities::dartToInt(Dart_GetNativeArgument(args, 2), ex
ception); |
| 542 if (exception) | 542 if (exception) |
| 543 goto fail; | 543 goto fail; |
| 544 | 544 |
| 545 WebGLGetInfo info = context->getShaderParameter(shader, pname); | 545 WebGLGetInfo info = context->getShaderParameter(shader, pname); |
| 546 Dart_Handle result = webGLGetInfoToDart(info); | 546 Dart_Handle result = webGLGetInfoToDart(info); |
| 547 if (!DartUtilities::checkResult(result, exception)) | 547 if (!DartUtilities::checkResult(result, exception)) |
| 548 goto fail; | 548 goto fail; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); | 633 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); |
| 634 int index = -1; | 634 int index = -1; |
| 635 WebGLUniformLocation* location = 0; | 635 WebGLUniformLocation* location = 0; |
| 636 | 636 |
| 637 if (isFunctionToCallForAttribute(functionToCall)) { | 637 if (isFunctionToCallForAttribute(functionToCall)) { |
| 638 int indexParam = DartUtilities::dartToInt(Dart_GetNativeArgument(arg
s, 1), exception); | 638 int indexParam = DartUtilities::dartToInt(Dart_GetNativeArgument(arg
s, 1), exception); |
| 639 if (exception) | 639 if (exception) |
| 640 goto fail; | 640 goto fail; |
| 641 index = indexParam; | 641 index = indexParam; |
| 642 } else { | 642 } else { |
| 643 WebGLUniformLocation* locationParam = DartWebGLUniformLocation::toNa
tive(Dart_GetNativeArgument(args, 1), exception); | 643 WebGLUniformLocation* locationParam = DartWebGLUniformLocation::toNa
tiveWithNullCheck(Dart_GetNativeArgument(args, 1), exception); |
| 644 if (exception) | 644 if (exception) |
| 645 goto fail; | 645 goto fail; |
| 646 location = locationParam; | 646 location = locationParam; |
| 647 } | 647 } |
| 648 | 648 |
| 649 RefPtr<Float32Array> array = DartUtilities::dartToFloat32Array(Dart_GetN
ativeArgument(args, 2), exception); | 649 RefPtr<Float32Array> array = DartUtilities::dartToFloat32Array(Dart_GetN
ativeArgument(args, 2), exception); |
| 650 if (exception) | 650 if (exception) |
| 651 goto fail; | 651 goto fail; |
| 652 | 652 |
| 653 switch (functionToCall) { | 653 switch (functionToCall) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 // Forms: | 691 // Forms: |
| 692 // * glUniform1iv(GLUniformLocation location, Array data); | 692 // * glUniform1iv(GLUniformLocation location, Array data); |
| 693 // * glUniform1iv(GLUniformLocation location, Int32Array data); | 693 // * glUniform1iv(GLUniformLocation location, Int32Array data); |
| 694 // * glUniform2iv(GLUniformLocation location, Array data); | 694 // * glUniform2iv(GLUniformLocation location, Array data); |
| 695 // * glUniform2iv(GLUniformLocation location, Int32Array data); | 695 // * glUniform2iv(GLUniformLocation location, Int32Array data); |
| 696 // * glUniform3iv(GLUniformLocation location, Array data); | 696 // * glUniform3iv(GLUniformLocation location, Array data); |
| 697 // * glUniform3iv(GLUniformLocation location, Int32Array data); | 697 // * glUniform3iv(GLUniformLocation location, Int32Array data); |
| 698 // * glUniform4iv(GLUniformLocation location, Array data); | 698 // * glUniform4iv(GLUniformLocation location, Array data); |
| 699 // * glUniform4iv(GLUniformLocation location, Int32Array data); | 699 // * glUniform4iv(GLUniformLocation location, Int32Array data); |
| 700 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); | 700 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); |
| 701 WebGLUniformLocation* location = DartWebGLUniformLocation::toNative(Dart
_GetNativeArgument(args, 1), exception); | 701 WebGLUniformLocation* location = DartWebGLUniformLocation::toNativeWithN
ullCheck(Dart_GetNativeArgument(args, 1), exception); |
| 702 if (exception) | 702 if (exception) |
| 703 goto fail; | 703 goto fail; |
| 704 | 704 |
| 705 RefPtr<Int32Array> array = DartUtilities::dartToInt32Array(Dart_GetNativ
eArgument(args, 2), exception); | 705 RefPtr<Int32Array> array = DartUtilities::dartToInt32Array(Dart_GetNativ
eArgument(args, 2), exception); |
| 706 if (exception) | 706 if (exception) |
| 707 goto fail; | 707 goto fail; |
| 708 | 708 |
| 709 switch (functionToCall) { | 709 switch (functionToCall) { |
| 710 case kUniform1v: | 710 case kUniform1v: |
| 711 context->uniform1iv(location, array.get()); | 711 context->uniform1iv(location, array.get()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 737 { | 737 { |
| 738 // Forms: | 738 // Forms: |
| 739 // * glUniformMatrix2fv(GLint location, GLboolean transpose, Array data)
; | 739 // * glUniformMatrix2fv(GLint location, GLboolean transpose, Array data)
; |
| 740 // * glUniformMatrix2fv(GLint location, GLboolean transpose, Float32Arra
y data); | 740 // * glUniformMatrix2fv(GLint location, GLboolean transpose, Float32Arra
y data); |
| 741 // * glUniformMatrix3fv(GLint location, GLboolean transpose, Array data)
; | 741 // * glUniformMatrix3fv(GLint location, GLboolean transpose, Array data)
; |
| 742 // * glUniformMatrix3fv(GLint location, GLboolean transpose, Float32Arra
y data); | 742 // * glUniformMatrix3fv(GLint location, GLboolean transpose, Float32Arra
y data); |
| 743 // * glUniformMatrix4fv(GLint location, GLboolean transpose, Array data)
; | 743 // * glUniformMatrix4fv(GLint location, GLboolean transpose, Array data)
; |
| 744 // * glUniformMatrix4fv(GLint location, GLboolean transpose, Float32Arra
y data); | 744 // * glUniformMatrix4fv(GLint location, GLboolean transpose, Float32Arra
y data); |
| 745 // | 745 // |
| 746 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); | 746 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); |
| 747 WebGLUniformLocation* location = DartWebGLUniformLocation::toNative(Dart
_GetNativeArgument(args, 1), exception); | 747 WebGLUniformLocation* location = DartWebGLUniformLocation::toNativeWithN
ullCheck(Dart_GetNativeArgument(args, 1), exception); |
| 748 if (exception) | 748 if (exception) |
| 749 goto fail; | 749 goto fail; |
| 750 bool transpose = DartUtilities::dartToBool(Dart_GetNativeArgument(args,
2), exception); | 750 bool transpose = DartUtilities::dartToBool(Dart_GetNativeArgument(args,
2), exception); |
| 751 if (exception) | 751 if (exception) |
| 752 goto fail; | 752 goto fail; |
| 753 | 753 |
| 754 RefPtr<Float32Array> array = DartUtilities::dartToFloat32Array(Dart_GetN
ativeArgument(args, 3), exception); | 754 RefPtr<Float32Array> array = DartUtilities::dartToFloat32Array(Dart_GetN
ativeArgument(args, 3), exception); |
| 755 if (exception) | 755 if (exception) |
| 756 goto fail; | 756 goto fail; |
| 757 | 757 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 } | 848 } |
| 849 | 849 |
| 850 void vertexAttrib4fvCallback(Dart_NativeArguments args) | 850 void vertexAttrib4fvCallback(Dart_NativeArguments args) |
| 851 { | 851 { |
| 852 vertexAttribAndUniformHelperf(args, kVertexAttrib4v); | 852 vertexAttribAndUniformHelperf(args, kVertexAttrib4v); |
| 853 } | 853 } |
| 854 | 854 |
| 855 } | 855 } |
| 856 | 856 |
| 857 } | 857 } |
| OLD | NEW |