What does the message "WEBGL_debug_renderer_info is deprecated in Firefox and will be removed. Please use RENDERER." mean?

Viewed 2983

On Firefox 92, if you do something like

var canvas = document.createElement('canvas');
var gl = canvas.getContext('webgl');

var debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
var vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
var renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);

console.log(vendor);
console.log(renderer);

It will show a message saying WEBGL_debug_renderer_info is deprecated in Firefox and will be removed. Please use RENDERER.

What does it mean?

The relevant MDN docs didn't even mention anything about it being deprecated like it normally does.

And there's no WebGL extentions or methods in the WebGL API called RENDERER. Google isn't any help either.

2 Answers

Apparently, you're meant to do this:

var canvas = document.createElement('canvas');
var gl = canvas.getContext('webgl');

gl.getParameter(gl.RENDERER)

Anyway, feel free to delete this question.

But I'm leaving it because there's no results when you google that warning message and hope this question can change that.

I ran into a similar issue where I was not calling

gl.getExtension('WEBGL_debug_renderer_info');

first. I had just been calling

const vendor = gl.getParameter(37455);  // Underlying value of debugInfo.UNMASKED_VENDOR_WEBGL
const renderer = gl.getParameter(37456); // Underlying value of debugInfo.UNMASKED_RENDERER_WEBGL

And this gave me the error: getParameter: invalid parameter name WEBGL_debug_renderer_info not enabled.

I had tried using the suggested gl.RENDERER, but that was not specific enough for what I wanted to do. The answer did help point me in the right direction of enabling the extension first (with getExtension), even when I know what the magic numbers will be.

Related