Skip to content

Commit 3c98e4f

Browse files
committed
add WEBGL_debug_renderer_info
1 parent 73574dc commit 3c98e4f

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

src/browser/canvas/WebGLRenderingContext.zig

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,17 @@ pub const Extension = union(enum) {
105105

106106
/// Extension types.
107107
pub const Type = struct {
108-
pub const WEBGL_debug_renderer_info = packed struct(u64) {
109-
UNMASKED_RENDERER_WEBGL: u32 = 0,
110-
UNMASKED_VENDOR_WEBGL: u32 = 0,
108+
pub const WEBGL_debug_renderer_info = struct {
109+
pub const UNMASKED_VENDOR_WEBGL: u64 = 0x9245;
110+
pub const UNMASKED_RENDERER_WEBGL: u64 = 0x9246;
111+
112+
pub fn get_UNMASKED_VENDOR_WEBGL() u64 {
113+
return UNMASKED_VENDOR_WEBGL;
114+
}
115+
116+
pub fn get_UNMASKED_RENDERER_WEBGL() u64 {
117+
return UNMASKED_RENDERER_WEBGL;
118+
}
111119
};
112120
};
113121
};

src/tests/html/canvas.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,16 @@
9090
}
9191
}
9292
</script>
93+
94+
<script id=WebGLRenderingCanvas#getExtension>
95+
// WEBGL_debug_renderer_info
96+
{
97+
const element = document.createElement("canvas");
98+
const ctx = element.getContext("webgl");
99+
const rendererInfo = ctx.getExtension("WEBGL_debug_renderer_info");
100+
testing.expectEqual(true, rendererInfo instanceof WEBGL_debug_renderer_info);
101+
102+
testing.expectEqual(rendererInfo.UNMASKED_VENDOR_WEBGL, 0x9245);
103+
testing.expectEqual(rendererInfo.UNMASKED_RENDERER_WEBGL, 0x9246);
104+
}
105+
</script>

0 commit comments

Comments
 (0)