|
@@ -27,7 +27,7 @@ ContextAttributes :: distinct bit_set[ContextAttribute; u32]
|
|
|
|
|
|
DEFAULT_CONTEXT_ATTRIBUTES :: ContextAttributes{}
|
|
DEFAULT_CONTEXT_ATTRIBUTES :: ContextAttributes{}
|
|
|
|
|
|
-@(default_calling_convention="c")
|
|
|
|
|
|
+@(default_calling_convention="contextless")
|
|
foreign webgl {
|
|
foreign webgl {
|
|
// CreateCurrentContextById must be called before `GetCurrentContextAttributes` if the user wants to
|
|
// CreateCurrentContextById must be called before `GetCurrentContextAttributes` if the user wants to
|
|
// set specific attributes, otherwise the default attributes will be set for the WebGL context
|
|
// set specific attributes, otherwise the default attributes will be set for the WebGL context
|
|
@@ -168,61 +168,59 @@ foreign webgl {
|
|
Viewport :: proc(x, y, w, h: i32) ---
|
|
Viewport :: proc(x, y, w, h: i32) ---
|
|
}
|
|
}
|
|
|
|
|
|
-Uniform1fv :: proc "c" (location: i32, v: f32) { Uniform1f(location, v) }
|
|
|
|
-Uniform2fv :: proc "c" (location: i32, v: glm.vec2) { Uniform2f(location, v.x, v.y) }
|
|
|
|
-Uniform3fv :: proc "c" (location: i32, v: glm.vec3) { Uniform3f(location, v.x, v.y, v.z) }
|
|
|
|
-Uniform4fv :: proc "c" (location: i32, v: glm.vec4) { Uniform4f(location, v.x, v.y, v.z, v.w) }
|
|
|
|
-Uniform1iv :: proc "c" (location: i32, v: i32) { Uniform1i(location, v) }
|
|
|
|
-Uniform2iv :: proc "c" (location: i32, v: glm.ivec2) { Uniform2i(location, v.x, v.y) }
|
|
|
|
-Uniform3iv :: proc "c" (location: i32, v: glm.ivec3) { Uniform3i(location, v.x, v.y, v.z) }
|
|
|
|
-Uniform4iv :: proc "c" (location: i32, v: glm.ivec4) { Uniform4i(location, v.x, v.y, v.z, v.w) }
|
|
|
|
|
|
+Uniform1fv :: proc "contextless" (location: i32, v: f32) { Uniform1f(location, v) }
|
|
|
|
+Uniform2fv :: proc "contextless" (location: i32, v: glm.vec2) { Uniform2f(location, v.x, v.y) }
|
|
|
|
+Uniform3fv :: proc "contextless" (location: i32, v: glm.vec3) { Uniform3f(location, v.x, v.y, v.z) }
|
|
|
|
+Uniform4fv :: proc "contextless" (location: i32, v: glm.vec4) { Uniform4f(location, v.x, v.y, v.z, v.w) }
|
|
|
|
+Uniform1iv :: proc "contextless" (location: i32, v: i32) { Uniform1i(location, v) }
|
|
|
|
+Uniform2iv :: proc "contextless" (location: i32, v: glm.ivec2) { Uniform2i(location, v.x, v.y) }
|
|
|
|
+Uniform3iv :: proc "contextless" (location: i32, v: glm.ivec3) { Uniform3i(location, v.x, v.y, v.z) }
|
|
|
|
+Uniform4iv :: proc "contextless" (location: i32, v: glm.ivec4) { Uniform4i(location, v.x, v.y, v.z, v.w) }
|
|
|
|
|
|
-VertexAttrib1fv :: proc "c" (index: i32, v: f32) { VertexAttrib1f(index, v) }
|
|
|
|
-VertexAttrib2fv :: proc "c" (index: i32, v: glm.vec2){ VertexAttrib2f(index, v.x, v.y) }
|
|
|
|
-VertexAttrib3fv :: proc "c" (index: i32, v: glm.vec3){ VertexAttrib3f(index, v.x, v.y, v.z) }
|
|
|
|
-VertexAttrib4fv :: proc "c" (index: i32, v: glm.vec4){ VertexAttrib4f(index, v.x, v.y, v.z, v.w) }
|
|
|
|
|
|
+VertexAttrib1fv :: proc "contextless" (index: i32, v: f32) { VertexAttrib1f(index, v) }
|
|
|
|
+VertexAttrib2fv :: proc "contextless" (index: i32, v: glm.vec2){ VertexAttrib2f(index, v.x, v.y) }
|
|
|
|
+VertexAttrib3fv :: proc "contextless" (index: i32, v: glm.vec3){ VertexAttrib3f(index, v.x, v.y, v.z) }
|
|
|
|
+VertexAttrib4fv :: proc "contextless" (index: i32, v: glm.vec4){ VertexAttrib4f(index, v.x, v.y, v.z, v.w) }
|
|
|
|
|
|
-UniformMatrix2fv :: proc "c" (location: i32, m: glm.mat2) {
|
|
|
|
|
|
+UniformMatrix2fv :: proc "contextless" (location: i32, m: glm.mat2) {
|
|
foreign webgl {
|
|
foreign webgl {
|
|
@(link_name="UniformMatrix2fv")
|
|
@(link_name="UniformMatrix2fv")
|
|
- _UniformMatrix2fv :: proc "c" (location: i32, value: [^]f32) ---
|
|
|
|
|
|
+ _UniformMatrix2fv :: proc "contextless" (location: i32, value: [^]f32) ---
|
|
}
|
|
}
|
|
value := transmute([2*2]f32)m
|
|
value := transmute([2*2]f32)m
|
|
_UniformMatrix2fv(location, &value[0])
|
|
_UniformMatrix2fv(location, &value[0])
|
|
}
|
|
}
|
|
-UniformMatrix3fv :: proc "c" (location: i32, m: glm.mat3) {
|
|
|
|
|
|
+UniformMatrix3fv :: proc "contextless" (location: i32, m: glm.mat3) {
|
|
foreign webgl {
|
|
foreign webgl {
|
|
@(link_name="UniformMatrix3fv")
|
|
@(link_name="UniformMatrix3fv")
|
|
- _UniformMatrix3fv :: proc "c" (location: i32, value: [^]f32) ---
|
|
|
|
|
|
+ _UniformMatrix3fv :: proc "contextless" (location: i32, value: [^]f32) ---
|
|
}
|
|
}
|
|
value := transmute([3*3]f32)m
|
|
value := transmute([3*3]f32)m
|
|
_UniformMatrix3fv(location, &value[0])
|
|
_UniformMatrix3fv(location, &value[0])
|
|
}
|
|
}
|
|
-UniformMatrix4fv :: proc "c" (location: i32, m: glm.mat4) {
|
|
|
|
|
|
+UniformMatrix4fv :: proc "contextless" (location: i32, m: glm.mat4) {
|
|
foreign webgl {
|
|
foreign webgl {
|
|
@(link_name="UniformMatrix4fv")
|
|
@(link_name="UniformMatrix4fv")
|
|
- _UniformMatrix4fv :: proc "c" (location: i32, value: [^]f32) ---
|
|
|
|
|
|
+ _UniformMatrix4fv :: proc "contextless" (location: i32, value: [^]f32) ---
|
|
}
|
|
}
|
|
value := transmute([4*4]f32)m
|
|
value := transmute([4*4]f32)m
|
|
_UniformMatrix4fv(location, &value[0])
|
|
_UniformMatrix4fv(location, &value[0])
|
|
}
|
|
}
|
|
|
|
|
|
-GetShaderiv :: proc "c" (shader: Shader, pname: Enum) -> (p: i32) {
|
|
|
|
- @(default_calling_convention="c")
|
|
|
|
|
|
+GetShaderiv :: proc "contextless" (shader: Shader, pname: Enum) -> (p: i32) {
|
|
foreign webgl {
|
|
foreign webgl {
|
|
@(link_name="GetShaderiv")
|
|
@(link_name="GetShaderiv")
|
|
- _GetShaderiv :: proc "c" (shader: Shader, pname: Enum, p: ^i32) ---
|
|
|
|
|
|
+ _GetShaderiv :: proc "contextless" (shader: Shader, pname: Enum, p: ^i32) ---
|
|
}
|
|
}
|
|
_GetShaderiv(shader, pname, &p)
|
|
_GetShaderiv(shader, pname, &p)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-GetProgramInfoLog :: proc "c" (program: Program, buf: []byte) -> string {
|
|
|
|
- @(default_calling_convention="c")
|
|
|
|
|
|
+GetProgramInfoLog :: proc "contextless" (program: Program, buf: []byte) -> string {
|
|
foreign webgl {
|
|
foreign webgl {
|
|
@(link_name="GetProgramInfoLog")
|
|
@(link_name="GetProgramInfoLog")
|
|
- _GetProgramInfoLog :: proc "c" (program: Program, buf: []byte, length: ^int) ---
|
|
|
|
|
|
+ _GetProgramInfoLog :: proc "contextless" (program: Program, buf: []byte, length: ^int) ---
|
|
}
|
|
}
|
|
|
|
|
|
length: int
|
|
length: int
|
|
@@ -230,11 +228,10 @@ GetProgramInfoLog :: proc "c" (program: Program, buf: []byte) -> string {
|
|
return string(buf[:length])
|
|
return string(buf[:length])
|
|
}
|
|
}
|
|
|
|
|
|
-GetShaderInfoLog :: proc "c" (shader: Shader, buf: []byte) -> string {
|
|
|
|
- @(default_calling_convention="c")
|
|
|
|
|
|
+GetShaderInfoLog :: proc "contextless" (shader: Shader, buf: []byte) -> string {
|
|
foreign webgl {
|
|
foreign webgl {
|
|
@(link_name="GetShaderInfoLog")
|
|
@(link_name="GetShaderInfoLog")
|
|
- _GetShaderInfoLog :: proc "c" (shader: Shader, buf: []byte, length: ^int) ---
|
|
|
|
|
|
+ _GetShaderInfoLog :: proc "contextless" (shader: Shader, buf: []byte, length: ^int) ---
|
|
}
|
|
}
|
|
|
|
|
|
length: int
|
|
length: int
|
|
@@ -244,27 +241,27 @@ GetShaderInfoLog :: proc "c" (shader: Shader, buf: []byte) -> string {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-BufferDataSlice :: proc "c" (target: Enum, slice: $S/[]$E, usage: Enum) {
|
|
|
|
|
|
+BufferDataSlice :: proc "contextless" (target: Enum, slice: $S/[]$E, usage: Enum) {
|
|
BufferData(target, len(slice)*size_of(E), raw_data(slice), usage)
|
|
BufferData(target, len(slice)*size_of(E), raw_data(slice), usage)
|
|
}
|
|
}
|
|
-BufferSubDataSlice :: proc "c" (target: Enum, offset: uintptr, slice: $S/[]$E) {
|
|
|
|
|
|
+BufferSubDataSlice :: proc "contextless" (target: Enum, offset: uintptr, slice: $S/[]$E) {
|
|
BufferSubData(target, offset, len(slice)*size_of(E), raw_data(slice), usage)
|
|
BufferSubData(target, offset, len(slice)*size_of(E), raw_data(slice), usage)
|
|
}
|
|
}
|
|
|
|
|
|
-CompressedTexImage2DSlice :: proc "c" (target: Enum, level: i32, internalformat: Enum, width, height: i32, border: i32, slice: $S/[]$E) {
|
|
|
|
|
|
+CompressedTexImage2DSlice :: proc "contextless" (target: Enum, level: i32, internalformat: Enum, width, height: i32, border: i32, slice: $S/[]$E) {
|
|
CompressedTexImage2DSlice(target, level, internalformat, width, height, border, len(slice)*size_of(E), raw_data(slice))
|
|
CompressedTexImage2DSlice(target, level, internalformat, width, height, border, len(slice)*size_of(E), raw_data(slice))
|
|
}
|
|
}
|
|
-CompressedTexSubImage2DSlice :: proc "c" (target: Enum, level: i32, xoffset, yoffset, width, height: i32, format: Enum, slice: $S/[]$E) {
|
|
|
|
|
|
+CompressedTexSubImage2DSlice :: proc "contextless" (target: Enum, level: i32, xoffset, yoffset, width, height: i32, format: Enum, slice: $S/[]$E) {
|
|
CompressedTexSubImage2DSlice(target, level, level, xoffset, yoffset, width, height, format, len(slice)*size_of(E), raw_data(slice))
|
|
CompressedTexSubImage2DSlice(target, level, level, xoffset, yoffset, width, height, format, len(slice)*size_of(E), raw_data(slice))
|
|
}
|
|
}
|
|
|
|
|
|
-ReadPixelsSlice :: proc "c" (x, y, width, height: i32, format: Enum, type: Enum, slice: $S/[]$E) {
|
|
|
|
|
|
+ReadPixelsSlice :: proc "contextless" (x, y, width, height: i32, format: Enum, type: Enum, slice: $S/[]$E) {
|
|
ReadnPixels(x, y, width, height, format, type, len(slice)*size_of(E), raw_data(slice))
|
|
ReadnPixels(x, y, width, height, format, type, len(slice)*size_of(E), raw_data(slice))
|
|
}
|
|
}
|
|
|
|
|
|
-TexImage2DSlice :: proc "c" (target: Enum, level: i32, internalformat: Enum, width, height: i32, border: i32, format, type: Enum, slice: $S/[]$E) {
|
|
|
|
|
|
+TexImage2DSlice :: proc "contextless" (target: Enum, level: i32, internalformat: Enum, width, height: i32, border: i32, format, type: Enum, slice: $S/[]$E) {
|
|
TexImage2D(target, level, internalformat, width, height, border, format, type, len(slice)*size_of(E), raw_data(slice))
|
|
TexImage2D(target, level, internalformat, width, height, border, format, type, len(slice)*size_of(E), raw_data(slice))
|
|
}
|
|
}
|
|
-TexSubImage2DSlice :: proc "c" (target: Enum, level: i32, xoffset, yoffset, width, height: i32, format, type: Enum, slice: $S/[]$E) {
|
|
|
|
|
|
+TexSubImage2DSlice :: proc "contextless" (target: Enum, level: i32, xoffset, yoffset, width, height: i32, format, type: Enum, slice: $S/[]$E) {
|
|
TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, len(slice)*size_of(E), raw_data(slice))
|
|
TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, len(slice)*size_of(E), raw_data(slice))
|
|
}
|
|
}
|