зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #20396 - Replace `object` function arguments in WebGL with typed arrays (from Xanewok:webgl-typed-arrays); r=jdm
<!-- Please describe your changes on the following line: --> Could use a https://github.com/servo/rust-mozjs/pull/402 in some places, as this should simplify a little bit and remove unnecessary `#[allow(unsafe_code)]` attributes. I sort of hacked my way through for https://github.com/servo/servo/issues/20394 since I encountered this issue as well. I agree that the comment above makes me feel uneasy about this and feels like I'm missing something and this shouldn't be the way we eventually resolve the overloads with auto rootable types (talking about this: https://github.com/servo/servo/pull/20396/files#diff-60d01595cff328c165842fea9e4ccbc2R428). r? @jdm --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #20342 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because if the bindings compile now, it works! <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e8fdc677f440919507209ed42d0ea042c700042c --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9b2dfaed17d9383feffc8607235e52e97bb5953a
This commit is contained in:
Родитель
c1d66520bf
Коммит
64fc3e98ae
|
@ -422,7 +422,8 @@ class CGMethodCall(CGThing):
|
||||||
template,
|
template,
|
||||||
{"val": distinguishingArg},
|
{"val": distinguishingArg},
|
||||||
declType,
|
declType,
|
||||||
"arg%d" % distinguishingIndex)
|
"arg%d" % distinguishingIndex,
|
||||||
|
needsAutoRoot=type_needs_auto_root(type))
|
||||||
|
|
||||||
# Indent by 4, since we need to indent further than our "do" statement
|
# Indent by 4, since we need to indent further than our "do" statement
|
||||||
caseBody.append(CGIndenter(testCode, 4))
|
caseBody.append(CGIndenter(testCode, 4))
|
||||||
|
@ -1211,7 +1212,8 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
||||||
|
|
||||||
|
|
||||||
def instantiateJSToNativeConversionTemplate(templateBody, replacements,
|
def instantiateJSToNativeConversionTemplate(templateBody, replacements,
|
||||||
declType, declName):
|
declType, declName,
|
||||||
|
needsAutoRoot=False):
|
||||||
"""
|
"""
|
||||||
Take the templateBody and declType as returned by
|
Take the templateBody and declType as returned by
|
||||||
getJSToNativeConversionInfo, a set of replacements as required by the
|
getJSToNativeConversionInfo, a set of replacements as required by the
|
||||||
|
@ -1236,6 +1238,8 @@ def instantiateJSToNativeConversionTemplate(templateBody, replacements,
|
||||||
else:
|
else:
|
||||||
result.append(conversion)
|
result.append(conversion)
|
||||||
|
|
||||||
|
if needsAutoRoot:
|
||||||
|
result.append(CGGeneric("auto_root!(in(cx) let %s = %s);" % (declName, declName)))
|
||||||
# Add an empty CGGeneric to get an extra newline after the argument
|
# Add an empty CGGeneric to get an extra newline after the argument
|
||||||
# conversion.
|
# conversion.
|
||||||
result.append(CGGeneric(""))
|
result.append(CGGeneric(""))
|
||||||
|
@ -1318,11 +1322,8 @@ class CGArgumentConverter(CGThing):
|
||||||
arg = "arg%d" % index
|
arg = "arg%d" % index
|
||||||
|
|
||||||
self.converter = instantiateJSToNativeConversionTemplate(
|
self.converter = instantiateJSToNativeConversionTemplate(
|
||||||
template, replacementVariables, declType, arg)
|
template, replacementVariables, declType, arg,
|
||||||
|
needsAutoRoot=type_needs_auto_root(argument.type))
|
||||||
# The auto rooting is done only after the conversion is performed
|
|
||||||
if type_needs_auto_root(argument.type):
|
|
||||||
self.converter.append(CGGeneric("auto_root!(in(cx) let %s = %s);" % (arg, arg)))
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
assert argument.optional
|
assert argument.optional
|
||||||
|
|
|
@ -472,6 +472,9 @@ impl TestBindingMethods for TestBinding {
|
||||||
fn PassStringSequence(&self, _: Vec<DOMString>) {}
|
fn PassStringSequence(&self, _: Vec<DOMString>) {}
|
||||||
fn PassInterfaceSequence(&self, _: Vec<DomRoot<Blob>>) {}
|
fn PassInterfaceSequence(&self, _: Vec<DomRoot<Blob>>) {}
|
||||||
|
|
||||||
|
fn PassOverloaded(&self, _: CustomAutoRooterGuard<typedarray::ArrayBuffer>) {}
|
||||||
|
fn PassOverloaded_(&self, _: DOMString) {}
|
||||||
|
|
||||||
fn PassNullableBoolean(&self, _: Option<bool>) {}
|
fn PassNullableBoolean(&self, _: Option<bool>) {}
|
||||||
fn PassNullableByte(&self, _: Option<i8>) {}
|
fn PassNullableByte(&self, _: Option<i8>) {}
|
||||||
fn PassNullableOctet(&self, _: Option<u8>) {}
|
fn PassNullableOctet(&self, _: Option<u8>) {}
|
||||||
|
|
|
@ -8,6 +8,7 @@ use dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding;
|
||||||
use dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextMethods;
|
use dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextMethods;
|
||||||
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
|
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
|
||||||
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
|
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
|
||||||
|
use dom::bindings::codegen::UnionTypes::ArrayBufferOrArrayBufferView;
|
||||||
use dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement;
|
use dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement;
|
||||||
use dom::bindings::error::{ErrorResult, Fallible};
|
use dom::bindings::error::{ErrorResult, Fallible};
|
||||||
use dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||||
|
@ -30,6 +31,8 @@ use dom_struct::dom_struct;
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
use js::jsapi::{JSContext, JSObject};
|
use js::jsapi::{JSContext, JSObject};
|
||||||
use js::jsval::JSVal;
|
use js::jsval::JSVal;
|
||||||
|
use js::rust::CustomAutoRooterGuard;
|
||||||
|
use js::typedarray::{ArrayBufferView, Float32Array, Int32Array};
|
||||||
use offscreen_gl_context::GLContextAttributes;
|
use offscreen_gl_context::GLContextAttributes;
|
||||||
use script_layout_interface::HTMLCanvasDataSource;
|
use script_layout_interface::HTMLCanvasDataSource;
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
@ -235,25 +238,23 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
self.base.BufferData_(target, size, usage)
|
self.base.BufferData_(target, size, usage)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
|
||||||
unsafe fn BufferSubData(&self, cx: *mut JSContext, target: u32, offset: i64, data: *mut JSObject) -> Fallible<()> {
|
fn BufferSubData(&self, target: u32, offset: i64, data: Option<ArrayBufferOrArrayBufferView>) {
|
||||||
self.base.BufferSubData(cx, target, offset, data)
|
self.base.BufferSubData(target, offset, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||||
unsafe fn CompressedTexImage2D(&self, cx: *mut JSContext, target: u32, level: i32, internal_format: u32,
|
fn CompressedTexImage2D(&self, target: u32, level: i32, internal_format: u32,
|
||||||
width: i32, height: i32, border: i32, pixels: *mut JSObject) -> Fallible<()> {
|
width: i32, height: i32, border: i32,
|
||||||
self.base.CompressedTexImage2D(cx, target, level, internal_format, width, height, border, pixels)
|
pixels: CustomAutoRooterGuard<ArrayBufferView>) {
|
||||||
|
self.base.CompressedTexImage2D(target, level, internal_format, width, height, border, pixels)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||||
unsafe fn CompressedTexSubImage2D(&self, cx: *mut JSContext, target: u32, level: i32,
|
fn CompressedTexSubImage2D(&self, target: u32, level: i32, xoffset: i32,
|
||||||
xoffset: i32, yoffset: i32, width: i32, height: i32,
|
yoffset: i32, width: i32, height: i32, format: u32,
|
||||||
format: u32, pixels: *mut JSObject) -> Fallible<()> {
|
pixels: CustomAutoRooterGuard<ArrayBufferView>) {
|
||||||
self.base.CompressedTexSubImage2D(cx, target, level, xoffset, yoffset, width, height, format, pixels)
|
self.base.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, pixels)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||||
|
@ -533,11 +534,10 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
self.base.PolygonOffset(factor, units)
|
self.base.PolygonOffset(factor, units)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.12
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.12
|
||||||
unsafe fn ReadPixels(&self, cx: *mut JSContext, x: i32, y: i32, width: i32, height: i32,
|
fn ReadPixels(&self, x: i32, y: i32, width: i32, height: i32, format: u32, pixel_type: u32,
|
||||||
format: u32, pixel_type: u32, pixels: *mut JSObject) -> Fallible<()> {
|
pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>) {
|
||||||
self.base.ReadPixels(cx, x, y, width, height, format, pixel_type, pixels)
|
self.base.ReadPixels(x, y, width, height, format, pixel_type, pixels)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
||||||
|
@ -597,161 +597,198 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform1f(&self,
|
fn Uniform1f(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
val: f32) {
|
val: f32) {
|
||||||
self.base.Uniform1f(uniform, val)
|
self.base.Uniform1f(location, val)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform1i(&self,
|
fn Uniform1i(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
val: i32) {
|
val: i32) {
|
||||||
self.base.Uniform1i(uniform, val)
|
self.base.Uniform1i(location, val)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform1iv(&self,
|
||||||
unsafe fn Uniform1iv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
v: CustomAutoRooterGuard<Int32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.base.Uniform1iv(location, v)
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
|
||||||
self.base.Uniform1iv(cx, uniform, data)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform1iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) {
|
||||||
unsafe fn Uniform1fv(&self,
|
self.base.Uniform1iv_(location, v);
|
||||||
cx: *mut JSContext,
|
}
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
self.base.Uniform1fv(cx, uniform, data)
|
fn Uniform1fv(&self,
|
||||||
|
location: Option<&WebGLUniformLocation>,
|
||||||
|
v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
|
self.base.Uniform1fv(location, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform1fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||||
|
self.base.Uniform1fv_(location, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform2f(&self,
|
fn Uniform2f(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
x: f32, y: f32) {
|
x: f32, y: f32) {
|
||||||
self.base.Uniform2f(uniform, x, y)
|
self.base.Uniform2f(location, x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform2fv(&self,
|
||||||
unsafe fn Uniform2fv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.base.Uniform2fv(location, v)
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
}
|
||||||
self.base.Uniform2fv(cx, uniform, data)
|
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform2fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||||
|
self.base.Uniform2fv_(location, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform2i(&self,
|
fn Uniform2i(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
x: i32, y: i32) {
|
x: i32, y: i32) {
|
||||||
self.base.Uniform2i(uniform, x, y)
|
self.base.Uniform2i(location, x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform2iv(&self,
|
||||||
unsafe fn Uniform2iv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
v: CustomAutoRooterGuard<Int32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.base.Uniform2iv(location, v)
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
}
|
||||||
self.base.Uniform2iv(cx, uniform, data)
|
|
||||||
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform2iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) {
|
||||||
|
self.base.Uniform2iv_(location, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform3f(&self,
|
fn Uniform3f(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
x: f32, y: f32, z: f32) {
|
x: f32, y: f32, z: f32) {
|
||||||
self.base.Uniform3f(uniform, x, y, z)
|
self.base.Uniform3f(location, x, y, z)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform3fv(&self,
|
||||||
unsafe fn Uniform3fv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.base.Uniform3fv(location, v)
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
}
|
||||||
self.base.Uniform3fv(cx, uniform, data)
|
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform3fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||||
|
self.base.Uniform3fv_(location, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform3i(&self,
|
fn Uniform3i(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
x: i32, y: i32, z: i32) {
|
x: i32, y: i32, z: i32) {
|
||||||
self.base.Uniform3i(uniform, x, y, z)
|
self.base.Uniform3i(location, x, y, z)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform3iv(&self,
|
||||||
unsafe fn Uniform3iv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
v: CustomAutoRooterGuard<Int32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.base.Uniform3iv(location, v)
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
}
|
||||||
self.base.Uniform3iv(cx, uniform, data)
|
|
||||||
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform3iv_(&self,
|
||||||
|
location: Option<&WebGLUniformLocation>,
|
||||||
|
v: Vec<i32>) {
|
||||||
|
self.base.Uniform3iv_(location, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform4i(&self,
|
fn Uniform4i(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
x: i32, y: i32, z: i32, w: i32) {
|
x: i32, y: i32, z: i32, w: i32) {
|
||||||
self.base.Uniform4i(uniform, x, y, z, w)
|
self.base.Uniform4i(location, x, y, z, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform4iv(&self,
|
||||||
unsafe fn Uniform4iv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
v: CustomAutoRooterGuard<Int32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.base.Uniform4iv(location, v)
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
}
|
||||||
self.base.Uniform4iv(cx, uniform, data)
|
|
||||||
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform4iv_(&self,
|
||||||
|
location: Option<&WebGLUniformLocation>,
|
||||||
|
v: Vec<i32>) {
|
||||||
|
self.base.Uniform4iv_(location, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform4f(&self,
|
fn Uniform4f(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
x: f32, y: f32, z: f32, w: f32) {
|
x: f32, y: f32, z: f32, w: f32) {
|
||||||
self.base.Uniform4f(uniform, x, y, z, w)
|
self.base.Uniform4f(location, x, y, z, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform4fv(&self,
|
||||||
unsafe fn Uniform4fv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.base.Uniform4fv(location, v)
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
}
|
||||||
self.base.Uniform4fv(cx, uniform, data)
|
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform4fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||||
|
self.base.Uniform4fv_(location, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn UniformMatrix2fv(&self,
|
||||||
unsafe fn UniformMatrix2fv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
|
||||||
transpose: bool,
|
transpose: bool,
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
self.base.UniformMatrix2fv(cx, uniform, transpose, data)
|
self.base.UniformMatrix2fv(location, transpose, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn UniformMatrix2fv_(&self, location: Option<&WebGLUniformLocation>, transpose: bool, value: Vec<f32>) {
|
||||||
unsafe fn UniformMatrix3fv(&self,
|
self.base.UniformMatrix2fv_(location, transpose, value);
|
||||||
cx: *mut JSContext,
|
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
|
||||||
transpose: bool,
|
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
|
||||||
self.base.UniformMatrix3fv(cx, uniform, transpose, data)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn UniformMatrix3fv(&self,
|
||||||
unsafe fn UniformMatrix4fv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
|
||||||
transpose: bool,
|
transpose: bool,
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
self.base.UniformMatrix4fv(cx, uniform, transpose, data)
|
self.base.UniformMatrix3fv(location, transpose, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn UniformMatrix3fv_(&self, location: Option<&WebGLUniformLocation>, transpose: bool, value: Vec<f32>) {
|
||||||
|
self.base.UniformMatrix3fv_(location, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn UniformMatrix4fv(&self,
|
||||||
|
location: Option<&WebGLUniformLocation>,
|
||||||
|
transpose: bool,
|
||||||
|
v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
|
self.base.UniformMatrix4fv(location, transpose, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn UniformMatrix4fv_(&self, location: Option<&WebGLUniformLocation>, transpose: bool, value: Vec<f32>) {
|
||||||
|
self.base.UniformMatrix4fv_(location, transpose, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
||||||
|
@ -770,9 +807,13 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn VertexAttrib1fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
unsafe fn VertexAttrib1fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> {
|
self.base.VertexAttrib1fv(indx, v)
|
||||||
self.base.VertexAttrib1fv(cx, indx, data)
|
}
|
||||||
|
|
||||||
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn VertexAttrib1fv_(&self, indx: u32, v: Vec<f32>) {
|
||||||
|
self.base.VertexAttrib1fv_(indx, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
@ -781,9 +822,13 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn VertexAttrib2fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
unsafe fn VertexAttrib2fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> {
|
self.base.VertexAttrib2fv(indx, v)
|
||||||
self.base.VertexAttrib2fv(cx, indx, data)
|
}
|
||||||
|
|
||||||
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn VertexAttrib2fv_(&self, indx: u32, v: Vec<f32>) {
|
||||||
|
self.base.VertexAttrib2fv_(indx, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
@ -792,9 +837,13 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn VertexAttrib3fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
unsafe fn VertexAttrib3fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> {
|
self.base.VertexAttrib3fv(indx, v)
|
||||||
self.base.VertexAttrib3fv(cx, indx, data)
|
}
|
||||||
|
|
||||||
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn VertexAttrib3fv_(&self, indx: u32, v: Vec<f32>) {
|
||||||
|
self.base.VertexAttrib3fv_(indx, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
@ -803,9 +852,13 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn VertexAttrib4fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
unsafe fn VertexAttrib4fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> {
|
self.base.VertexAttrib4fv(indx, v)
|
||||||
self.base.VertexAttrib4fv(cx, indx, data)
|
}
|
||||||
|
|
||||||
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn VertexAttrib4fv_(&self, indx: u32, v: Vec<f32>) {
|
||||||
|
self.base.VertexAttrib4fv_(indx, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
@ -820,19 +873,17 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||||
#[allow(unsafe_code)]
|
fn TexImage2D(&self,
|
||||||
unsafe fn TexImage2D(&self,
|
target: u32,
|
||||||
cx: *mut JSContext,
|
level: i32,
|
||||||
target: u32,
|
internal_format: u32,
|
||||||
level: i32,
|
width: i32,
|
||||||
internal_format: u32,
|
height: i32,
|
||||||
width: i32,
|
border: i32,
|
||||||
height: i32,
|
format: u32,
|
||||||
border: i32,
|
data_type: u32,
|
||||||
format: u32,
|
pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>) -> Fallible<()> {
|
||||||
data_type: u32,
|
self.base.TexImage2D(target, level, internal_format, width, height, border, format, data_type, pixels)
|
||||||
data_ptr: *mut JSObject) -> Fallible<()> {
|
|
||||||
self.base.TexImage2D(cx, target, level, internal_format, width, height, border, format, data_type, data_ptr)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||||
|
@ -862,19 +913,17 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||||
#[allow(unsafe_code)]
|
fn TexSubImage2D(&self,
|
||||||
unsafe fn TexSubImage2D(&self,
|
target: u32,
|
||||||
cx: *mut JSContext,
|
level: i32,
|
||||||
target: u32,
|
xoffset: i32,
|
||||||
level: i32,
|
yoffset: i32,
|
||||||
xoffset: i32,
|
width: i32,
|
||||||
yoffset: i32,
|
height: i32,
|
||||||
width: i32,
|
format: u32,
|
||||||
height: i32,
|
data_type: u32,
|
||||||
format: u32,
|
pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>) -> Fallible<()> {
|
||||||
data_type: u32,
|
self.base.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, data_type, pixels)
|
||||||
data_ptr: *mut JSObject) -> Fallible<()> {
|
|
||||||
self.base.TexSubImage2D(cx, target, level, xoffset, yoffset, width, height, format, data_type, data_ptr)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||||
|
|
|
@ -14,8 +14,9 @@ use dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2Rende
|
||||||
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{self, WebGLContextAttributes};
|
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{self, WebGLContextAttributes};
|
||||||
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
|
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
|
||||||
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
|
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
|
||||||
|
use dom::bindings::codegen::UnionTypes::ArrayBufferOrArrayBufferView;
|
||||||
use dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement;
|
use dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement;
|
||||||
use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible};
|
use dom::bindings::conversions::ToJSValConvertible;
|
||||||
use dom::bindings::error::{Error, ErrorResult, Fallible};
|
use dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||||
use dom::bindings::inheritance::Castable;
|
use dom::bindings::inheritance::Castable;
|
||||||
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
|
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
|
||||||
|
@ -46,10 +47,10 @@ use dom_struct::dom_struct;
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
use half::f16;
|
use half::f16;
|
||||||
use js::conversions::ConversionBehavior;
|
|
||||||
use js::jsapi::{JSContext, JSObject, Type};
|
use js::jsapi::{JSContext, JSObject, Type};
|
||||||
use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, UndefinedValue};
|
use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, UndefinedValue};
|
||||||
use js::typedarray::{TypedArray, TypedArrayElement, Float32, Int32};
|
use js::rust::CustomAutoRooterGuard;
|
||||||
|
use js::typedarray::{ArrayBufferView, Float32Array, Int32Array};
|
||||||
use net_traits::image::base::PixelFormat;
|
use net_traits::image::base::PixelFormat;
|
||||||
use net_traits::image_cache::ImageResponse;
|
use net_traits::image_cache::ImageResponse;
|
||||||
use offscreen_gl_context::{GLContextAttributes, GLLimits};
|
use offscreen_gl_context::{GLContextAttributes, GLLimits};
|
||||||
|
@ -823,15 +824,13 @@ impl WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(emilio): Move this logic to a validator.
|
// TODO(emilio): Move this logic to a validator.
|
||||||
#[allow(unsafe_code)]
|
fn validate_tex_image_2d_data(&self,
|
||||||
unsafe fn validate_tex_image_2d_data(&self,
|
width: u32,
|
||||||
width: u32,
|
height: u32,
|
||||||
height: u32,
|
format: TexFormat,
|
||||||
format: TexFormat,
|
data_type: TexDataType,
|
||||||
data_type: TexDataType,
|
unpacking_alignment: u32,
|
||||||
unpacking_alignment: u32,
|
data: &Option<ArrayBufferView>)
|
||||||
data: *mut JSObject,
|
|
||||||
cx: *mut JSContext)
|
|
||||||
-> Result<u32, ()> {
|
-> Result<u32, ()> {
|
||||||
let element_size = data_type.element_size();
|
let element_size = data_type.element_size();
|
||||||
let components_per_element = data_type.components_per_element();
|
let components_per_element = data_type.components_per_element();
|
||||||
|
@ -844,21 +843,16 @@ impl WebGLRenderingContext {
|
||||||
// or UNSIGNED_SHORT_5_5_5_1, a Uint16Array must be supplied.
|
// or UNSIGNED_SHORT_5_5_5_1, a Uint16Array must be supplied.
|
||||||
// or FLOAT, a Float32Array must be supplied.
|
// or FLOAT, a Float32Array must be supplied.
|
||||||
// If the types do not match, an INVALID_OPERATION error is generated.
|
// If the types do not match, an INVALID_OPERATION error is generated.
|
||||||
typedarray!(in(cx) let typedarray_u8: Uint8Array = data);
|
let received_size = match *data {
|
||||||
typedarray!(in(cx) let typedarray_u16: Uint16Array = data);
|
None => element_size,
|
||||||
typedarray!(in(cx) let typedarray_f32: Float32Array = data);
|
Some(ref buffer) => match buffer.get_array_type() {
|
||||||
let received_size = if data.is_null() {
|
Type::Uint8 => 1,
|
||||||
element_size
|
Type::Uint16 => 2,
|
||||||
} else {
|
Type::Float32 => 4,
|
||||||
if typedarray_u16.is_ok() {
|
_ => {
|
||||||
2
|
self.webgl_error(InvalidOperation);
|
||||||
} else if typedarray_u8.is_ok() {
|
return Err(());
|
||||||
1
|
}
|
||||||
} else if typedarray_f32.is_ok() {
|
|
||||||
4
|
|
||||||
} else {
|
|
||||||
self.webgl_error(InvalidOperation);
|
|
||||||
return Err(());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1165,45 +1159,13 @@ impl Drop for WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: After [1] lands and the relevant Servo and codegen PR too, we should
|
|
||||||
// convert all our raw JSObject pointers to proper types.
|
|
||||||
//
|
|
||||||
// [1]: https://github.com/servo/rust-mozjs/pull/304
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
unsafe fn typed_array_or_sequence_to_vec<T>(cx: *mut JSContext,
|
|
||||||
sequence_or_abv: *mut JSObject,
|
|
||||||
config: <T::Element as FromJSValConvertible>::Config)
|
|
||||||
-> Result<Vec<T::Element>, Error>
|
|
||||||
where T: TypedArrayElement,
|
|
||||||
T::Element: FromJSValConvertible + Clone,
|
|
||||||
<T::Element as FromJSValConvertible>::Config: Clone,
|
|
||||||
{
|
|
||||||
// TODO(servo/rust-mozjs#330): replace this with a macro that supports generic types.
|
|
||||||
let typed_array: Option<TypedArray<T, *mut JSObject>> =
|
|
||||||
TypedArray::from(sequence_or_abv).ok();
|
|
||||||
if let Some(mut typed_array) = typed_array {
|
|
||||||
return Ok(typed_array.as_slice().to_vec());
|
|
||||||
}
|
|
||||||
assert!(!sequence_or_abv.is_null());
|
|
||||||
rooted!(in(cx) let mut val = UndefinedValue());
|
|
||||||
sequence_or_abv.to_jsval(cx, val.handle_mut());
|
|
||||||
|
|
||||||
match Vec::<T::Element>::from_jsval(cx, val.handle(), config) {
|
|
||||||
Ok(ConversionResult::Success(v)) => Ok(v),
|
|
||||||
Ok(ConversionResult::Failure(error)) => Err(Error::Type(error.into_owned())),
|
|
||||||
// FIXME: What to do here? Generated code only aborts the execution of
|
|
||||||
// the script.
|
|
||||||
Err(err) => panic!("unexpected conversion error: {:?}", err),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn fallible_array_buffer_view_to_vec(cx: *mut JSContext, abv: *mut JSObject) -> Result<Vec<u8>, Error>
|
unsafe fn fallible_array_buffer_view_to_vec(cx: *mut JSContext, abv: *mut JSObject) -> Result<Vec<u8>, Error>
|
||||||
{
|
{
|
||||||
assert!(!abv.is_null());
|
assert!(!abv.is_null());
|
||||||
typedarray!(in(cx) let array_buffer_view: ArrayBufferView = abv);
|
typedarray!(in(cx) let array_buffer_view: ArrayBufferView = abv);
|
||||||
match array_buffer_view {
|
match array_buffer_view {
|
||||||
Ok(mut v) => Ok(v.as_slice().to_vec()),
|
Ok(mut v) => Ok(v.to_vec()),
|
||||||
Err(_) => Err(Error::Type("Not an ArrayBufferView".to_owned())),
|
Err(_) => Err(Error::Type("Not an ArrayBufferView".to_owned())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1647,7 +1609,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
|
|
||||||
typedarray!(in(cx) let array_buffer: ArrayBuffer = data);
|
typedarray!(in(cx) let array_buffer: ArrayBuffer = data);
|
||||||
let data_vec = match array_buffer {
|
let data_vec = match array_buffer {
|
||||||
Ok(mut data) => data.as_slice().to_vec(),
|
Ok(mut data) => data.to_vec(),
|
||||||
Err(_) => fallible_array_buffer_view_to_vec(cx, data)?,
|
Err(_) => fallible_array_buffer_view_to_vec(cx, data)?,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1706,64 +1668,53 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
|
||||||
unsafe fn BufferSubData(&self, cx: *mut JSContext, target: u32, offset: i64, data: *mut JSObject) -> Fallible<()> {
|
fn BufferSubData(&self, target: u32, offset: i64, data: Option<ArrayBufferOrArrayBufferView>) {
|
||||||
if data.is_null() {
|
let data_vec = match data {
|
||||||
return Ok(self.webgl_error(InvalidValue));
|
// Typed array is rooted, so we can safely temporarily retrieve its slice
|
||||||
}
|
Some(ArrayBufferOrArrayBufferView::ArrayBuffer(mut inner)) => inner.to_vec(),
|
||||||
|
Some(ArrayBufferOrArrayBufferView::ArrayBufferView(mut inner)) => inner.to_vec(),
|
||||||
typedarray!(in(cx) let array_buffer: ArrayBuffer = data);
|
// Spec: If data is null then an INVALID_VALUE error is generated.
|
||||||
let data_vec = match array_buffer {
|
None => return self.webgl_error(InvalidValue),
|
||||||
Ok(mut data) => data.as_slice().to_vec(),
|
|
||||||
Err(_) => fallible_array_buffer_view_to_vec(cx, data)?,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let bound_buffer = match target {
|
let bound_buffer = match target {
|
||||||
constants::ARRAY_BUFFER => self.bound_buffer_array.get(),
|
constants::ARRAY_BUFFER => self.bound_buffer_array.get(),
|
||||||
constants::ELEMENT_ARRAY_BUFFER => self.bound_buffer_element_array.get(),
|
constants::ELEMENT_ARRAY_BUFFER => self.bound_buffer_element_array.get(),
|
||||||
_ => return Ok(self.webgl_error(InvalidEnum)),
|
_ => return self.webgl_error(InvalidEnum),
|
||||||
};
|
};
|
||||||
|
|
||||||
let bound_buffer = match bound_buffer {
|
let bound_buffer = match bound_buffer {
|
||||||
Some(bound_buffer) => bound_buffer,
|
Some(bound_buffer) => bound_buffer,
|
||||||
None => return Ok(self.webgl_error(InvalidOperation)),
|
None => return self.webgl_error(InvalidOperation),
|
||||||
};
|
};
|
||||||
|
|
||||||
if offset < 0 {
|
if offset < 0 {
|
||||||
return Ok(self.webgl_error(InvalidValue));
|
return self.webgl_error(InvalidValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset as usize) + data_vec.len() > bound_buffer.capacity() {
|
if (offset as usize) + data_vec.len() > bound_buffer.capacity() {
|
||||||
return Ok(self.webgl_error(InvalidValue));
|
return self.webgl_error(InvalidValue);
|
||||||
}
|
}
|
||||||
self.send_command(WebGLCommand::BufferSubData(target, offset as isize, data_vec));
|
self.send_command(WebGLCommand::BufferSubData(target, offset as isize, data_vec));
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||||
unsafe fn CompressedTexImage2D(&self, cx: *mut JSContext, _target: u32, _level: i32, _internal_format: u32,
|
fn CompressedTexImage2D(&self, _target: u32, _level: i32, _internal_format: u32,
|
||||||
_width: i32, _height: i32, _border: i32, pixels: *mut JSObject) -> Fallible<()> {
|
_width: i32, _height: i32, _border: i32,
|
||||||
let _data = fallible_array_buffer_view_to_vec(cx, pixels)?;
|
_data: CustomAutoRooterGuard<ArrayBufferView>) {
|
||||||
// FIXME: No compressed texture format is currently supported, so error out as per
|
// FIXME: No compressed texture format is currently supported, so error out as per
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#COMPRESSED_TEXTURE_SUPPORT
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#COMPRESSED_TEXTURE_SUPPORT
|
||||||
self.webgl_error(InvalidEnum);
|
self.webgl_error(InvalidEnum);
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||||
unsafe fn CompressedTexSubImage2D(&self, cx: *mut JSContext, _target: u32, _level: i32,
|
fn CompressedTexSubImage2D(&self, _target: u32, _level: i32, _xoffset: i32,
|
||||||
_xoffset: i32, _yoffset: i32, _width: i32, _height: i32,
|
_yoffset: i32, _width: i32, _height: i32, _format: u32,
|
||||||
_format: u32, pixels: *mut JSObject) -> Fallible<()> {
|
_data: CustomAutoRooterGuard<ArrayBufferView>) {
|
||||||
let _data = fallible_array_buffer_view_to_vec(cx, pixels)?;
|
|
||||||
// FIXME: No compressed texture format is currently supported, so error out as per
|
// FIXME: No compressed texture format is currently supported, so error out as per
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#COMPRESSED_TEXTURE_SUPPORT
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#COMPRESSED_TEXTURE_SUPPORT
|
||||||
self.webgl_error(InvalidEnum);
|
self.webgl_error(InvalidEnum);
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||||
|
@ -2609,27 +2560,25 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
self.send_command(WebGLCommand::PolygonOffset(factor, units))
|
self.send_command(WebGLCommand::PolygonOffset(factor, units))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.12
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.12
|
||||||
unsafe fn ReadPixels(&self, cx: *mut JSContext, x: i32, y: i32, width: i32, height: i32,
|
#[allow(unsafe_code)]
|
||||||
format: u32, pixel_type: u32, pixels: *mut JSObject) -> Fallible<()> {
|
fn ReadPixels(&self, x: i32, y: i32, width: i32, height: i32, format: u32, pixel_type: u32,
|
||||||
if pixels.is_null() {
|
mut pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>) {
|
||||||
return Ok(self.webgl_error(InvalidValue));
|
let (array_type, data) = match *pixels {
|
||||||
}
|
// Spec: If data is null then an INVALID_VALUE error is generated.
|
||||||
|
None => return self.webgl_error(InvalidValue),
|
||||||
typedarray!(in(cx) let mut pixels_data: ArrayBufferView = pixels);
|
// The typed array is rooted and we should have a unique reference to it,
|
||||||
let (array_type, data) = match { pixels_data.as_mut() } {
|
// so retrieving its mutable slice is safe here
|
||||||
Ok(data) => (data.get_array_type(), data.as_mut_slice()),
|
Some(ref mut data) => (data.get_array_type(), unsafe { data.as_mut_slice() }),
|
||||||
Err(_) => return Err(Error::Type("Not an ArrayBufferView".to_owned())),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if !self.validate_framebuffer_complete() {
|
if !self.validate_framebuffer_complete() {
|
||||||
return Ok(());
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
match array_type {
|
match array_type {
|
||||||
Type::Uint8 => (),
|
Type::Uint8 => (),
|
||||||
_ => return Ok(self.webgl_error(InvalidOperation)),
|
_ => return self.webgl_error(InvalidOperation),
|
||||||
}
|
}
|
||||||
|
|
||||||
// From the WebGL specification, 5.14.12 Reading back pixels
|
// From the WebGL specification, 5.14.12 Reading back pixels
|
||||||
|
@ -2650,7 +2599,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
// always report RGBA/UNSIGNED_BYTE as our only supported
|
// always report RGBA/UNSIGNED_BYTE as our only supported
|
||||||
// format.
|
// format.
|
||||||
if format != constants::RGBA || pixel_type != constants::UNSIGNED_BYTE {
|
if format != constants::RGBA || pixel_type != constants::UNSIGNED_BYTE {
|
||||||
return Ok(self.webgl_error(InvalidOperation));
|
return self.webgl_error(InvalidOperation);
|
||||||
}
|
}
|
||||||
let cpp = 4;
|
let cpp = 4;
|
||||||
|
|
||||||
|
@ -2660,12 +2609,12 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
// INVALID_OPERATION error is generated."
|
// INVALID_OPERATION error is generated."
|
||||||
let stride = match width.checked_mul(cpp) {
|
let stride = match width.checked_mul(cpp) {
|
||||||
Some(stride) => stride,
|
Some(stride) => stride,
|
||||||
_ => return Ok(self.webgl_error(InvalidOperation)),
|
_ => return self.webgl_error(InvalidOperation),
|
||||||
};
|
};
|
||||||
|
|
||||||
match height.checked_mul(stride) {
|
match height.checked_mul(stride) {
|
||||||
Some(size) if size <= data.len() as i32 => {}
|
Some(size) if size <= data.len() as i32 => {}
|
||||||
_ => return Ok(self.webgl_error(InvalidOperation)),
|
_ => return self.webgl_error(InvalidOperation),
|
||||||
}
|
}
|
||||||
|
|
||||||
// "For any pixel lying outside the frame buffer, the
|
// "For any pixel lying outside the frame buffer, the
|
||||||
|
@ -2691,7 +2640,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
if width < 0 || height < 0 {
|
if width < 0 || height < 0 {
|
||||||
return Ok(self.webgl_error(InvalidValue));
|
return self.webgl_error(InvalidValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.get_current_framebuffer_size() {
|
match self.get_current_framebuffer_size() {
|
||||||
|
@ -2703,7 +2652,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
height = fb_height - y;
|
height = fb_height - y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => return Ok(self.webgl_error(InvalidOperation)),
|
_ => return self.webgl_error(InvalidOperation),
|
||||||
};
|
};
|
||||||
|
|
||||||
let (sender, receiver) = webgl_channel().unwrap();
|
let (sender, receiver) = webgl_channel().unwrap();
|
||||||
|
@ -2717,8 +2666,6 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
result[(i * width * cpp + j) as usize];
|
result[(i * width * cpp + j) as usize];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
||||||
|
@ -2821,279 +2768,269 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform1f(&self,
|
fn Uniform1f(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
val: f32) {
|
val: f32) {
|
||||||
if self.validate_uniform_parameters(uniform, UniformSetterType::Float, &[val]) {
|
if self.validate_uniform_parameters(location, UniformSetterType::Float, &[val]) {
|
||||||
self.send_command(WebGLCommand::Uniform1f(uniform.unwrap().id(), val))
|
self.send_command(WebGLCommand::Uniform1f(location.unwrap().id(), val))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform1i(&self,
|
fn Uniform1i(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
val: i32) {
|
val: i32) {
|
||||||
if self.validate_uniform_parameters(uniform, UniformSetterType::Int, &[val]) {
|
if self.validate_uniform_parameters(location, UniformSetterType::Int, &[val]) {
|
||||||
self.send_command(WebGLCommand::Uniform1i(uniform.unwrap().id(), val))
|
self.send_command(WebGLCommand::Uniform1i(location.unwrap().id(), val))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform1iv(&self,
|
||||||
unsafe fn Uniform1iv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
mut v: CustomAutoRooterGuard<Int32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.Uniform1iv_(location, v.to_vec());
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
|
||||||
assert!(!data.is_null());
|
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Int32>(cx, data, ConversionBehavior::Default)?;
|
|
||||||
|
|
||||||
if self.validate_uniform_parameters(uniform, UniformSetterType::Int, &data_vec) {
|
|
||||||
self.send_command(WebGLCommand::Uniform1iv(uniform.unwrap().id(), data_vec))
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform1iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) {
|
||||||
unsafe fn Uniform1fv(&self,
|
if self.validate_uniform_parameters(location, UniformSetterType::Int, &v) {
|
||||||
cx: *mut JSContext,
|
self.send_command(WebGLCommand::Uniform1iv(location.unwrap().id(), v))
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
|
||||||
assert!(!data.is_null());
|
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?;
|
|
||||||
|
|
||||||
if self.validate_uniform_parameters(uniform, UniformSetterType::Float, &data_vec) {
|
|
||||||
self.send_command(WebGLCommand::Uniform1fv(uniform.unwrap().id(), data_vec));
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform1fv(&self,
|
||||||
|
location: Option<&WebGLUniformLocation>,
|
||||||
|
mut v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
|
self.Uniform1fv_(location, v.to_vec());
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform1fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||||
|
if self.validate_uniform_parameters(location, UniformSetterType::Float, &v) {
|
||||||
|
self.send_command(WebGLCommand::Uniform1fv(location.unwrap().id(), v));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform2f(&self,
|
fn Uniform2f(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
x: f32, y: f32) {
|
x: f32, y: f32) {
|
||||||
if self.validate_uniform_parameters(uniform, UniformSetterType::FloatVec2, &[x, y]) {
|
if self.validate_uniform_parameters(location, UniformSetterType::FloatVec2, &[x, y]) {
|
||||||
self.send_command(WebGLCommand::Uniform2f(uniform.unwrap().id(), x, y));
|
self.send_command(WebGLCommand::Uniform2f(location.unwrap().id(), x, y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform2fv(&self,
|
||||||
unsafe fn Uniform2fv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
mut v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.Uniform2fv_(location, v.to_vec());
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
}
|
||||||
assert!(!data.is_null());
|
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?;
|
|
||||||
|
|
||||||
if self.validate_uniform_parameters(uniform,
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform2fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||||
|
if self.validate_uniform_parameters(location,
|
||||||
UniformSetterType::FloatVec2,
|
UniformSetterType::FloatVec2,
|
||||||
&data_vec) {
|
&v) {
|
||||||
self.send_command(WebGLCommand::Uniform2fv(uniform.unwrap().id(), data_vec));
|
self.send_command(WebGLCommand::Uniform2fv(location.unwrap().id(), v));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform2i(&self,
|
fn Uniform2i(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
x: i32, y: i32) {
|
x: i32, y: i32) {
|
||||||
if self.validate_uniform_parameters(uniform,
|
if self.validate_uniform_parameters(location,
|
||||||
UniformSetterType::IntVec2,
|
UniformSetterType::IntVec2,
|
||||||
&[x, y]) {
|
&[x, y]) {
|
||||||
self.send_command(WebGLCommand::Uniform2i(uniform.unwrap().id(), x, y));
|
self.send_command(WebGLCommand::Uniform2i(location.unwrap().id(), x, y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform2iv(&self,
|
||||||
unsafe fn Uniform2iv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
mut v: CustomAutoRooterGuard<Int32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.Uniform2iv_(location, v.to_vec());
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
}
|
||||||
assert!(!data.is_null());
|
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Int32>(cx, data, ConversionBehavior::Default)?;
|
|
||||||
|
|
||||||
if self.validate_uniform_parameters(uniform,
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform2iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) {
|
||||||
|
if self.validate_uniform_parameters(location,
|
||||||
UniformSetterType::IntVec2,
|
UniformSetterType::IntVec2,
|
||||||
&data_vec) {
|
&v) {
|
||||||
self.send_command(WebGLCommand::Uniform2iv(uniform.unwrap().id(), data_vec));
|
self.send_command(WebGLCommand::Uniform2iv(location.unwrap().id(), v));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform3f(&self,
|
fn Uniform3f(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
x: f32, y: f32, z: f32) {
|
x: f32, y: f32, z: f32) {
|
||||||
if self.validate_uniform_parameters(uniform,
|
if self.validate_uniform_parameters(location,
|
||||||
UniformSetterType::FloatVec3,
|
UniformSetterType::FloatVec3,
|
||||||
&[x, y, z]) {
|
&[x, y, z]) {
|
||||||
self.send_command(WebGLCommand::Uniform3f(uniform.unwrap().id(), x, y, z));
|
self.send_command(WebGLCommand::Uniform3f(location.unwrap().id(), x, y, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform3fv(&self,
|
||||||
unsafe fn Uniform3fv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
mut v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.Uniform3fv_(location, v.to_vec());
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
}
|
||||||
assert!(!data.is_null());
|
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?;
|
|
||||||
|
|
||||||
if self.validate_uniform_parameters(uniform,
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform3fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||||
|
if self.validate_uniform_parameters(location,
|
||||||
UniformSetterType::FloatVec3,
|
UniformSetterType::FloatVec3,
|
||||||
&data_vec) {
|
&v) {
|
||||||
self.send_command(WebGLCommand::Uniform3fv(uniform.unwrap().id(), data_vec))
|
self.send_command(WebGLCommand::Uniform3fv(location.unwrap().id(), v))
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform3i(&self,
|
fn Uniform3i(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
x: i32, y: i32, z: i32) {
|
x: i32, y: i32, z: i32) {
|
||||||
if self.validate_uniform_parameters(uniform,
|
if self.validate_uniform_parameters(location,
|
||||||
UniformSetterType::IntVec3,
|
UniformSetterType::IntVec3,
|
||||||
&[x, y, z]) {
|
&[x, y, z]) {
|
||||||
self.send_command(WebGLCommand::Uniform3i(uniform.unwrap().id(), x, y, z))
|
self.send_command(WebGLCommand::Uniform3i(location.unwrap().id(), x, y, z))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform3iv(&self,
|
||||||
unsafe fn Uniform3iv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
mut v: CustomAutoRooterGuard<Int32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.Uniform3iv_(location, v.to_vec());
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
}
|
||||||
assert!(!data.is_null());
|
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Int32>(cx, data, ConversionBehavior::Default)?;
|
|
||||||
|
|
||||||
if self.validate_uniform_parameters(uniform,
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform3iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) {
|
||||||
|
if self.validate_uniform_parameters(location,
|
||||||
UniformSetterType::IntVec3,
|
UniformSetterType::IntVec3,
|
||||||
&data_vec) {
|
&v) {
|
||||||
self.send_command(WebGLCommand::Uniform3iv(uniform.unwrap().id(), data_vec))
|
self.send_command(WebGLCommand::Uniform3iv(location.unwrap().id(), v))
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform4i(&self,
|
fn Uniform4i(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
x: i32, y: i32, z: i32, w: i32) {
|
x: i32, y: i32, z: i32, w: i32) {
|
||||||
if self.validate_uniform_parameters(uniform,
|
if self.validate_uniform_parameters(location,
|
||||||
UniformSetterType::IntVec4,
|
UniformSetterType::IntVec4,
|
||||||
&[x, y, z, w]) {
|
&[x, y, z, w]) {
|
||||||
self.send_command(WebGLCommand::Uniform4i(uniform.unwrap().id(), x, y, z, w))
|
self.send_command(WebGLCommand::Uniform4i(location.unwrap().id(), x, y, z, w))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform4iv(&self,
|
||||||
unsafe fn Uniform4iv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
mut v: CustomAutoRooterGuard<Int32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.Uniform4iv_(location, v.to_vec());
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
}
|
||||||
assert!(!data.is_null());
|
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Int32>(cx, data, ConversionBehavior::Default)?;
|
|
||||||
|
|
||||||
if self.validate_uniform_parameters(uniform,
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform4iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) {
|
||||||
|
if self.validate_uniform_parameters(location,
|
||||||
UniformSetterType::IntVec4,
|
UniformSetterType::IntVec4,
|
||||||
&data_vec) {
|
&v) {
|
||||||
self.send_command(WebGLCommand::Uniform4iv(uniform.unwrap().id(), data_vec))
|
self.send_command(WebGLCommand::Uniform4iv(location.unwrap().id(), v))
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform4f(&self,
|
fn Uniform4f(&self,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
location: Option<&WebGLUniformLocation>,
|
||||||
x: f32, y: f32, z: f32, w: f32) {
|
x: f32, y: f32, z: f32, w: f32) {
|
||||||
if self.validate_uniform_parameters(uniform,
|
if self.validate_uniform_parameters(location,
|
||||||
UniformSetterType::FloatVec4,
|
UniformSetterType::FloatVec4,
|
||||||
&[x, y, z, w]) {
|
&[x, y, z, w]) {
|
||||||
self.send_command(WebGLCommand::Uniform4f(uniform.unwrap().id(), x, y, z, w))
|
self.send_command(WebGLCommand::Uniform4f(location.unwrap().id(), x, y, z, w))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn Uniform4fv(&self,
|
||||||
unsafe fn Uniform4fv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
mut v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
self.Uniform4fv_(location, v.to_vec());
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
}
|
||||||
assert!(!data.is_null());
|
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?;
|
|
||||||
|
|
||||||
if self.validate_uniform_parameters(uniform,
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn Uniform4fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||||
|
if self.validate_uniform_parameters(location,
|
||||||
UniformSetterType::FloatVec4,
|
UniformSetterType::FloatVec4,
|
||||||
&data_vec) {
|
&v) {
|
||||||
self.send_command(WebGLCommand::Uniform4fv(uniform.unwrap().id(), data_vec))
|
self.send_command(WebGLCommand::Uniform4fv(location.unwrap().id(), v))
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn UniformMatrix2fv(&self,
|
||||||
unsafe fn UniformMatrix2fv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
|
||||||
transpose: bool,
|
transpose: bool,
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
mut v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
assert!(!data.is_null());
|
self.UniformMatrix2fv_(location, transpose, v.to_vec());
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?;
|
}
|
||||||
if self.validate_uniform_parameters(uniform,
|
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn UniformMatrix2fv_(&self,
|
||||||
|
location: Option<&WebGLUniformLocation>,
|
||||||
|
transpose: bool,
|
||||||
|
value: Vec<f32>) {
|
||||||
|
if self.validate_uniform_parameters(location,
|
||||||
UniformSetterType::FloatMat2,
|
UniformSetterType::FloatMat2,
|
||||||
&data_vec) {
|
&value) {
|
||||||
self.send_command(WebGLCommand::UniformMatrix2fv(uniform.unwrap().id(), transpose, data_vec));
|
self.send_command(WebGLCommand::UniformMatrix2fv(location.unwrap().id(), transpose, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn UniformMatrix3fv(&self,
|
||||||
unsafe fn UniformMatrix3fv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
|
||||||
transpose: bool,
|
transpose: bool,
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
mut v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
assert!(!data.is_null());
|
self.UniformMatrix3fv_(location, transpose, v.to_vec());
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?;
|
}
|
||||||
if self.validate_uniform_parameters(uniform,
|
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn UniformMatrix3fv_(&self,
|
||||||
|
location: Option<&WebGLUniformLocation>,
|
||||||
|
transpose: bool,
|
||||||
|
value: Vec<f32>) {
|
||||||
|
if self.validate_uniform_parameters(location,
|
||||||
UniformSetterType::FloatMat3,
|
UniformSetterType::FloatMat3,
|
||||||
&data_vec) {
|
&value) {
|
||||||
self.send_command(WebGLCommand::UniformMatrix3fv(uniform.unwrap().id(), transpose, data_vec));
|
self.send_command(WebGLCommand::UniformMatrix3fv(location.unwrap().id(), transpose, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn UniformMatrix4fv(&self,
|
||||||
unsafe fn UniformMatrix4fv(&self,
|
location: Option<&WebGLUniformLocation>,
|
||||||
cx: *mut JSContext,
|
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
|
||||||
transpose: bool,
|
transpose: bool,
|
||||||
data: *mut JSObject) -> Fallible<()> {
|
mut v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
assert!(!data.is_null());
|
self.UniformMatrix4fv_(location, transpose, v.to_vec());
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?;
|
}
|
||||||
if self.validate_uniform_parameters(uniform,
|
|
||||||
UniformSetterType::FloatMat4,
|
|
||||||
&data_vec) {
|
|
||||||
self.send_command(WebGLCommand::UniformMatrix4fv(uniform.unwrap().id(), transpose, data_vec));
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
fn UniformMatrix4fv_(&self,
|
||||||
|
location: Option<&WebGLUniformLocation>,
|
||||||
|
transpose: bool,
|
||||||
|
value: Vec<f32>) {
|
||||||
|
if self.validate_uniform_parameters(location,
|
||||||
|
UniformSetterType::FloatMat4,
|
||||||
|
&value) {
|
||||||
|
self.send_command(WebGLCommand::UniformMatrix4fv(location.unwrap().id(), transpose, value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
||||||
|
@ -3119,15 +3056,17 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn VertexAttrib1fv(&self, indx: u32, mut v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
unsafe fn VertexAttrib1fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> {
|
self.VertexAttrib1fv_(indx, v.to_vec());
|
||||||
assert!(!data.is_null());
|
}
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?;
|
|
||||||
if data_vec.len() < 1 {
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
return Ok(self.webgl_error(InvalidOperation));
|
fn VertexAttrib1fv_(&self, indx: u32, values: Vec<f32>) {
|
||||||
|
if values.len() < 1 {
|
||||||
|
return self.webgl_error(InvalidOperation);
|
||||||
}
|
}
|
||||||
self.vertex_attrib(indx, data_vec[0], 0f32, 0f32, 1f32);
|
|
||||||
Ok(())
|
self.vertex_attrib(indx, values[0], 0f32, 0f32, 1f32);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
@ -3136,15 +3075,17 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn VertexAttrib2fv(&self, indx: u32, mut v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
unsafe fn VertexAttrib2fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> {
|
self.VertexAttrib2fv_(indx, v.to_vec());
|
||||||
assert!(!data.is_null());
|
}
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?;
|
|
||||||
if data_vec.len() < 2 {
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
return Ok(self.webgl_error(InvalidOperation));
|
fn VertexAttrib2fv_(&self, indx: u32, values: Vec<f32>) {
|
||||||
|
if values.len() < 2 {
|
||||||
|
return self.webgl_error(InvalidOperation);
|
||||||
}
|
}
|
||||||
self.vertex_attrib(indx, data_vec[0], data_vec[1], 0f32, 1f32);
|
|
||||||
Ok(())
|
self.vertex_attrib(indx, values[0], values[1], 0f32, 1f32);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
@ -3153,15 +3094,17 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn VertexAttrib3fv(&self, indx: u32, mut v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
unsafe fn VertexAttrib3fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> {
|
self.VertexAttrib3fv_(indx, v.to_vec());
|
||||||
assert!(!data.is_null());
|
}
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?;
|
|
||||||
if data_vec.len() < 3 {
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
return Ok(self.webgl_error(InvalidOperation));
|
fn VertexAttrib3fv_(&self, indx: u32, values: Vec<f32>) {
|
||||||
|
if values.len() < 3 {
|
||||||
|
return self.webgl_error(InvalidOperation);
|
||||||
}
|
}
|
||||||
self.vertex_attrib(indx, data_vec[0], data_vec[1], data_vec[2], 1f32);
|
|
||||||
Ok(())
|
self.vertex_attrib(indx, values[0], values[1], values[2], 1f32);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
@ -3170,16 +3113,17 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
#[allow(unsafe_code)]
|
fn VertexAttrib4fv(&self, indx: u32, mut v: CustomAutoRooterGuard<Float32Array>) {
|
||||||
unsafe fn VertexAttrib4fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> {
|
self.VertexAttrib4fv_(indx, v.to_vec());
|
||||||
assert!(!data.is_null());
|
}
|
||||||
let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?;
|
|
||||||
if data_vec.len() < 4 {
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
return Ok(self.webgl_error(InvalidOperation));
|
fn VertexAttrib4fv_(&self, indx: u32, values: Vec<f32>) {
|
||||||
|
if values.len() < 4 {
|
||||||
|
return self.webgl_error(InvalidOperation);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.vertex_attrib(indx, data_vec[0], data_vec[1], data_vec[2], data_vec[3]);
|
self.vertex_attrib(indx, values[0], values[1], values[2], values[3]);
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
|
@ -3238,9 +3182,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||||
#[allow(unsafe_code)]
|
fn TexImage2D(&self,
|
||||||
unsafe fn TexImage2D(&self,
|
|
||||||
cx: *mut JSContext,
|
|
||||||
target: u32,
|
target: u32,
|
||||||
level: i32,
|
level: i32,
|
||||||
internal_format: u32,
|
internal_format: u32,
|
||||||
|
@ -3249,17 +3191,11 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
border: i32,
|
border: i32,
|
||||||
format: u32,
|
format: u32,
|
||||||
data_type: u32,
|
data_type: u32,
|
||||||
data_ptr: *mut JSObject) -> Fallible<()> {
|
mut pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>) -> Fallible<()> {
|
||||||
if !self.extension_manager.is_tex_type_enabled(data_type) {
|
if !self.extension_manager.is_tex_type_enabled(data_type) {
|
||||||
return Ok(self.webgl_error(InvalidEnum));
|
return Ok(self.webgl_error(InvalidEnum));
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = if data_ptr.is_null() {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(fallible_array_buffer_view_to_vec(cx, data_ptr)?)
|
|
||||||
};
|
|
||||||
|
|
||||||
let validator = TexImage2DValidator::new(self, target, level,
|
let validator = TexImage2DValidator::new(self, target, level,
|
||||||
internal_format, width, height,
|
internal_format, width, height,
|
||||||
border, format, data_type);
|
border, format, data_type);
|
||||||
|
@ -3283,16 +3219,16 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
let expected_byte_length =
|
let expected_byte_length =
|
||||||
match { self.validate_tex_image_2d_data(width, height,
|
match { self.validate_tex_image_2d_data(width, height,
|
||||||
format, data_type,
|
format, data_type,
|
||||||
unpacking_alignment, data_ptr, cx) } {
|
unpacking_alignment, &*pixels) } {
|
||||||
Ok(byte_length) => byte_length,
|
Ok(byte_length) => byte_length,
|
||||||
Err(()) => return Ok(()),
|
Err(()) => return Ok(()),
|
||||||
};
|
};
|
||||||
|
|
||||||
// If data is null, a buffer of sufficient size
|
// If data is null, a buffer of sufficient size
|
||||||
// initialized to 0 is passed.
|
// initialized to 0 is passed.
|
||||||
let buff = match data {
|
let buff = match *pixels {
|
||||||
None => vec![0u8; expected_byte_length as usize],
|
None => vec![0u8; expected_byte_length as usize],
|
||||||
Some(data) => data,
|
Some(ref mut data) => data.to_vec(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// From the WebGL spec:
|
// From the WebGL spec:
|
||||||
|
@ -3410,9 +3346,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||||
#[allow(unsafe_code)]
|
fn TexSubImage2D(&self,
|
||||||
unsafe fn TexSubImage2D(&self,
|
|
||||||
cx: *mut JSContext,
|
|
||||||
target: u32,
|
target: u32,
|
||||||
level: i32,
|
level: i32,
|
||||||
xoffset: i32,
|
xoffset: i32,
|
||||||
|
@ -3421,13 +3355,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
height: i32,
|
height: i32,
|
||||||
format: u32,
|
format: u32,
|
||||||
data_type: u32,
|
data_type: u32,
|
||||||
data_ptr: *mut JSObject) -> Fallible<()> {
|
mut pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>) -> Fallible<()> {
|
||||||
let data = if data_ptr.is_null() {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(fallible_array_buffer_view_to_vec(cx, data_ptr)?)
|
|
||||||
};
|
|
||||||
|
|
||||||
let validator = TexImage2DValidator::new(self, target, level,
|
let validator = TexImage2DValidator::new(self, target, level,
|
||||||
format, width, height,
|
format, width, height,
|
||||||
0, format, data_type);
|
0, format, data_type);
|
||||||
|
@ -3450,16 +3378,16 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
let expected_byte_length =
|
let expected_byte_length =
|
||||||
match { self.validate_tex_image_2d_data(width, height,
|
match { self.validate_tex_image_2d_data(width, height,
|
||||||
format, data_type,
|
format, data_type,
|
||||||
unpacking_alignment, data_ptr, cx) } {
|
unpacking_alignment, &*pixels) } {
|
||||||
Ok(byte_length) => byte_length,
|
Ok(byte_length) => byte_length,
|
||||||
Err(()) => return Ok(()),
|
Err(()) => return Ok(()),
|
||||||
};
|
};
|
||||||
|
|
||||||
// If data is null, a buffer of sufficient size
|
// If data is null, a buffer of sufficient size
|
||||||
// initialized to 0 is passed.
|
// initialized to 0 is passed.
|
||||||
let buff = match data {
|
let buff = match *pixels {
|
||||||
None => vec![0u8; expected_byte_length as usize],
|
None => vec![0u8; expected_byte_length as usize],
|
||||||
Some(data) => data,
|
Some(ref mut data) => data.to_vec(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// From the WebGL spec:
|
// From the WebGL spec:
|
||||||
|
|
|
@ -275,6 +275,9 @@ interface TestBinding {
|
||||||
void passStringSequence(sequence<DOMString> seq);
|
void passStringSequence(sequence<DOMString> seq);
|
||||||
void passInterfaceSequence(sequence<Blob> seq);
|
void passInterfaceSequence(sequence<Blob> seq);
|
||||||
|
|
||||||
|
void passOverloaded(ArrayBuffer arg);
|
||||||
|
void passOverloaded(DOMString arg);
|
||||||
|
|
||||||
void passNullableBoolean(boolean? arg);
|
void passNullableBoolean(boolean? arg);
|
||||||
void passNullableByte(byte? arg);
|
void passNullableByte(byte? arg);
|
||||||
void passNullableOctet(octet? arg);
|
void passNullableOctet(octet? arg);
|
||||||
|
|
|
@ -28,6 +28,7 @@ typedef (ImageData or
|
||||||
HTMLImageElement or
|
HTMLImageElement or
|
||||||
HTMLCanvasElement or
|
HTMLCanvasElement or
|
||||||
HTMLVideoElement) TexImageSource;
|
HTMLVideoElement) TexImageSource;
|
||||||
|
typedef (ArrayBuffer or ArrayBufferView) BufferDataSource;
|
||||||
|
|
||||||
|
|
||||||
dictionary WebGLContextAttributes {
|
dictionary WebGLContextAttributes {
|
||||||
|
@ -488,21 +489,15 @@ interface WebGLRenderingContextBase
|
||||||
void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
|
void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
|
||||||
GLenum srcAlpha, GLenum dstAlpha);
|
GLenum srcAlpha, GLenum dstAlpha);
|
||||||
|
|
||||||
// typedef (ArrayBuffer or ArrayBufferView) BufferDataSource;
|
// FIXME(xanewok) from CodegenRust.py:
|
||||||
// FIXME(dmarcos) The function below is the original function in the webIdl:
|
// 'No support for unions as distinguishing arguments yet' for below
|
||||||
|
// original WebIDL function definition
|
||||||
// void bufferData(GLenum target, BufferDataSource? data, GLenum usage);
|
// void bufferData(GLenum target, BufferDataSource? data, GLenum usage);
|
||||||
// The Code generator doesn't handle BufferDataSource so we're using 'object?'
|
|
||||||
// in the meantime, and marking the function as [Throws], so we can handle
|
|
||||||
// the type error from inside.
|
|
||||||
[Throws]
|
[Throws]
|
||||||
void bufferData(GLenum target, object? data, GLenum usage);
|
void bufferData(GLenum target, object? data, GLenum usage);
|
||||||
// FIXME: Codegen requires that this have [Throws] to match the other one.
|
|
||||||
[Throws]
|
[Throws]
|
||||||
void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
|
void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
|
||||||
|
void bufferSubData(GLenum target, GLintptr offset, BufferDataSource? data);
|
||||||
//void bufferSubData(GLenum target, GLintptr offset, BufferDataSource? data);
|
|
||||||
[Throws]
|
|
||||||
void bufferSubData(GLenum target, GLintptr offset, object? data);
|
|
||||||
|
|
||||||
[WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
|
[WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
|
||||||
void clear(GLbitfield mask);
|
void clear(GLbitfield mask);
|
||||||
|
@ -512,25 +507,13 @@ interface WebGLRenderingContextBase
|
||||||
void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||||
void compileShader(WebGLShader shader);
|
void compileShader(WebGLShader shader);
|
||||||
|
|
||||||
// FIXME(simartin) The Code generator doesn't handle ArrayBufferView so we're
|
|
||||||
// using 'object' in the meantime, and marking the function as Throws to
|
|
||||||
// handle the type error from inside.
|
|
||||||
// void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
|
|
||||||
// GLsizei width, GLsizei height, GLint border,
|
|
||||||
// ArrayBufferView data);
|
|
||||||
[Throws]
|
|
||||||
void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
|
void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
|
||||||
GLsizei width, GLsizei height, GLint border,
|
GLsizei width, GLsizei height, GLint border,
|
||||||
object data);
|
ArrayBufferView data);
|
||||||
// void compressedTexSubImage2D(GLenum target, GLint level,
|
|
||||||
// GLint xoffset, GLint yoffset,
|
|
||||||
// GLsizei width, GLsizei height, GLenum format,
|
|
||||||
// ArrayBufferView data);
|
|
||||||
[Throws]
|
|
||||||
void compressedTexSubImage2D(GLenum target, GLint level,
|
void compressedTexSubImage2D(GLenum target, GLint level,
|
||||||
GLint xoffset, GLint yoffset,
|
GLint xoffset, GLint yoffset,
|
||||||
GLsizei width, GLsizei height, GLenum format,
|
GLsizei width, GLsizei height, GLenum format,
|
||||||
object data);
|
ArrayBufferView data);
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||||
void copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
|
void copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
|
||||||
|
@ -623,11 +606,8 @@ interface WebGLRenderingContextBase
|
||||||
void pixelStorei(GLenum pname, GLint param);
|
void pixelStorei(GLenum pname, GLint param);
|
||||||
void polygonOffset(GLfloat factor, GLfloat units);
|
void polygonOffset(GLfloat factor, GLfloat units);
|
||||||
|
|
||||||
//void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
|
|
||||||
// GLenum format, GLenum type, ArrayBufferView? pixels);
|
|
||||||
[Throws]
|
|
||||||
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
|
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
|
||||||
GLenum format, GLenum type, object? pixels);
|
GLenum format, GLenum type, ArrayBufferView? pixels);
|
||||||
|
|
||||||
void renderbufferStorage(GLenum target, GLenum internalformat,
|
void renderbufferStorage(GLenum target, GLenum internalformat,
|
||||||
GLsizei width, GLsizei height);
|
GLsizei width, GLsizei height);
|
||||||
|
@ -643,14 +623,11 @@ interface WebGLRenderingContextBase
|
||||||
void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
|
void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
|
||||||
void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
|
void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
|
||||||
|
|
||||||
//void texImage2D(GLenum target, GLint level, GLenum internalformat,
|
// FIXME: Codegen requires that this have [Throws] to match the other one.
|
||||||
// GLsizei width, GLsizei height, GLint border, GLenum format,
|
|
||||||
// GLenum type, ArrayBufferView? pixels);
|
|
||||||
// FIXME: SM interface arguments
|
|
||||||
[Throws]
|
[Throws]
|
||||||
void texImage2D(GLenum target, GLint level, GLenum internalformat,
|
void texImage2D(GLenum target, GLint level, GLenum internalformat,
|
||||||
GLsizei width, GLsizei height, GLint border, GLenum format,
|
GLsizei width, GLsizei height, GLint border, GLenum format,
|
||||||
GLenum type, object? data);
|
GLenum type, ArrayBufferView? pixels);
|
||||||
[Throws]
|
[Throws]
|
||||||
void texImage2D(GLenum target, GLint level, GLenum internalformat,
|
void texImage2D(GLenum target, GLint level, GLenum internalformat,
|
||||||
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
|
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
|
||||||
|
@ -661,107 +638,78 @@ interface WebGLRenderingContextBase
|
||||||
void texParameterf(GLenum target, GLenum pname, GLfloat param);
|
void texParameterf(GLenum target, GLenum pname, GLfloat param);
|
||||||
void texParameteri(GLenum target, GLenum pname, GLint param);
|
void texParameteri(GLenum target, GLenum pname, GLint param);
|
||||||
|
|
||||||
|
// FIXME: Codegen requires that this have [Throws] to match the other one.
|
||||||
[Throws]
|
[Throws]
|
||||||
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||||
GLsizei width, GLsizei height,
|
GLsizei width, GLsizei height,
|
||||||
GLenum format, GLenum type, object? data);
|
GLenum format, GLenum type, ArrayBufferView? pixels);
|
||||||
[Throws]
|
[Throws]
|
||||||
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||||
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
|
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
|
||||||
|
|
||||||
void uniform1f(WebGLUniformLocation? location, GLfloat x);
|
void uniform1f(WebGLUniformLocation? location, GLfloat x);
|
||||||
//void uniform1fv(WebGLUniformLocation? location, Float32Array v);
|
void uniform1fv(WebGLUniformLocation? location, Float32Array v);
|
||||||
//void uniform1fv(WebGLUniformLocation? location, sequence<GLfloat> v);
|
void uniform1fv(WebGLUniformLocation? location, sequence<GLfloat> v);
|
||||||
[Throws]
|
|
||||||
void uniform1fv(WebGLUniformLocation? location, object v);
|
void uniform1i(WebGLUniformLocation? location, GLint x);
|
||||||
void uniform1i(WebGLUniformLocation? location, GLint x);
|
void uniform1iv(WebGLUniformLocation? location, Int32Array v);
|
||||||
//void uniform1iv(WebGLUniformLocation? location, Int32Array v);
|
void uniform1iv(WebGLUniformLocation? location, sequence<long> v);
|
||||||
//void uniform1iv(WebGLUniformLocation? location, sequence<long> v);
|
|
||||||
[Throws]
|
void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
|
||||||
void uniform1iv(WebGLUniformLocation? location, object v);
|
void uniform2fv(WebGLUniformLocation? location, Float32Array v);
|
||||||
void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
|
void uniform2fv(WebGLUniformLocation? location, sequence<GLfloat> v);
|
||||||
//void uniform2fv(WebGLUniformLocation? location, Float32Array v);
|
|
||||||
//void uniform2fv(WebGLUniformLocation? location, sequence<GLfloat> v);
|
void uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
|
||||||
[Throws]
|
void uniform2iv(WebGLUniformLocation? location, Int32Array v);
|
||||||
void uniform2fv(WebGLUniformLocation? location, object v);
|
void uniform2iv(WebGLUniformLocation? location, sequence<long> v);
|
||||||
//void uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
|
|
||||||
void uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
|
void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
|
||||||
//void uniform2iv(WebGLUniformLocation? location, Int32Array v);
|
void uniform3fv(WebGLUniformLocation? location, Float32Array v);
|
||||||
//void uniform2iv(WebGLUniformLocation? location, sequence<long> v);
|
void uniform3fv(WebGLUniformLocation? location, sequence<GLfloat> v);
|
||||||
[Throws]
|
|
||||||
void uniform2iv(WebGLUniformLocation? location, object v);
|
void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z);
|
||||||
void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
|
void uniform3iv(WebGLUniformLocation? location, Int32Array v);
|
||||||
[Throws]
|
void uniform3iv(WebGLUniformLocation? location, sequence<long> v);
|
||||||
void uniform3fv(WebGLUniformLocation? location, object v);
|
|
||||||
//void uniform3fv(WebGLUniformLocation? location, Float32Array v);
|
void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||||
//void uniform3fv(WebGLUniformLocation? location, sequence<GLfloat> v);
|
void uniform4fv(WebGLUniformLocation? location, Float32Array v);
|
||||||
void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z);
|
void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v);
|
||||||
//void uniform3iv(WebGLUniformLocation? location, Int32Array v);
|
|
||||||
//void uniform3iv(WebGLUniformLocation? location, sequence<long> v);
|
void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
|
||||||
[Throws]
|
void uniform4iv(WebGLUniformLocation? location, Int32Array v);
|
||||||
void uniform3iv(WebGLUniformLocation? location, object v);
|
void uniform4iv(WebGLUniformLocation? location, sequence<long> v);
|
||||||
void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
|
||||||
// FIXME(dmarcos) The function below is the original function in the webIdl:
|
|
||||||
//void uniform4fv(WebGLUniformLocation? location, Float32Array v);
|
|
||||||
// The Code genearator doesn't handle typed arrays, so we use object
|
|
||||||
// instead, and handle the type error ourselves.
|
|
||||||
[Throws]
|
|
||||||
void uniform4fv(WebGLUniformLocation? location, object v);
|
|
||||||
//void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v);
|
|
||||||
void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
|
|
||||||
//void uniform4iv(WebGLUniformLocation? location, Int32Array v);
|
|
||||||
//void uniform4iv(WebGLUniformLocation? location, sequence<long> v);
|
|
||||||
// See FIXME above
|
|
||||||
[Throws]
|
|
||||||
void uniform4iv(WebGLUniformLocation? location, object v);
|
|
||||||
|
|
||||||
//void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
|
|
||||||
// Float32Array value);
|
|
||||||
//void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
|
|
||||||
// sequence<GLfloat> value);
|
|
||||||
[Throws]
|
|
||||||
void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
|
void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
|
||||||
object v);
|
Float32Array value);
|
||||||
//void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
|
void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
|
||||||
// Float32Array value);
|
sequence<GLfloat> value);
|
||||||
//void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
|
|
||||||
// sequence<GLfloat> value);
|
|
||||||
[Throws]
|
|
||||||
void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
|
void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
|
||||||
object v);
|
Float32Array value);
|
||||||
//void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
|
void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
|
||||||
// Float32Array value);
|
sequence<GLfloat> value);
|
||||||
//void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
|
|
||||||
// sequence<GLfloat> value);
|
|
||||||
[Throws]
|
|
||||||
void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
|
void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
|
||||||
object v);
|
Float32Array value);
|
||||||
|
void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
|
||||||
|
sequence<GLfloat> value);
|
||||||
|
|
||||||
void useProgram(WebGLProgram? program);
|
void useProgram(WebGLProgram? program);
|
||||||
void validateProgram(WebGLProgram program);
|
void validateProgram(WebGLProgram program);
|
||||||
|
|
||||||
// FIXME(dmarcos)
|
|
||||||
// The code generator doesn't handle Float32Array so we're using 'object'
|
|
||||||
void vertexAttrib1f(GLuint indx, GLfloat x);
|
void vertexAttrib1f(GLuint indx, GLfloat x);
|
||||||
//void vertexAttrib1fv(GLuint indx, Float32Array values);
|
void vertexAttrib1fv(GLuint indx, Float32Array values);
|
||||||
[Throws]
|
void vertexAttrib1fv(GLuint indx, sequence<GLfloat> values);
|
||||||
void vertexAttrib1fv(GLuint indx, object values);
|
|
||||||
//void vertexAttrib1fv(GLuint indx, sequence<GLfloat> values);
|
|
||||||
void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
|
void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
|
||||||
//void vertexAttrib2fv(GLuint indx, Float32Array values);
|
void vertexAttrib2fv(GLuint indx, Float32Array values);
|
||||||
[Throws]
|
void vertexAttrib2fv(GLuint indx, sequence<GLfloat> values);
|
||||||
void vertexAttrib2fv(GLuint indx, object values);
|
|
||||||
//void vertexAttrib2fv(GLuint indx, sequence<GLfloat> values);
|
|
||||||
void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
|
void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
|
||||||
//void vertexAttrib3fv(GLuint indx, Float32Array values);
|
void vertexAttrib3fv(GLuint indx, Float32Array values);
|
||||||
[Throws]
|
void vertexAttrib3fv(GLuint indx, sequence<GLfloat> values);
|
||||||
void vertexAttrib3fv(GLuint indx, object values);
|
|
||||||
//void vertexAttrib3fv(GLuint indx, sequence<GLfloat> values);
|
|
||||||
void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||||
//void vertexAttrib4fv(GLuint indx, Float32Array values);
|
void vertexAttrib4fv(GLuint indx, Float32Array values);
|
||||||
[Throws]
|
void vertexAttrib4fv(GLuint indx, sequence<GLfloat> values);
|
||||||
void vertexAttrib4fv(GLuint indx, object values);
|
|
||||||
//void vertexAttrib4fv(GLuint indx, sequence<GLfloat> values);
|
|
||||||
void vertexAttribPointer(GLuint indx, GLint size, GLenum type,
|
void vertexAttribPointer(GLuint indx, GLint size, GLenum type,
|
||||||
GLboolean normalized, GLsizei stride, GLintptr offset);
|
GLboolean normalized, GLsizei stride, GLintptr offset);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче