Skip to content

Commit 0f7486a

Browse files
tweak
1 parent 12e98e2 commit 0f7486a

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

js/webgl.js

+14-15
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const WebGLConstants = [
2424
'RENDERER',
2525
'SHADING_LANGUAGE_VERSION',
2626
'STENCIL_BITS',
27+
'VENDOR',
2728
'VERSION'
2829
]
2930

@@ -65,10 +66,6 @@ const Categories = {
6566
'MAX_COMBINED_UNIFORM_BLOCKS',
6667
'MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS',
6768
],
68-
'debugRendererInfo': [
69-
'UNMASKED_VENDOR_WEBGL',
70-
'UNMASKED_RENDERER_WEBGL',
71-
],
7269
'fragmentShader': [
7370
'MAX_FRAGMENT_UNIFORM_VECTORS',
7471
'MAX_TEXTURE_IMAGE_UNITS',
@@ -124,7 +121,11 @@ const Categories = {
124121
'MAJOR_PERFORMANCE_CAVEAT',
125122
'RENDERER',
126123
'SHADING_LANGUAGE_VERSION',
124+
'VENDOR',
127125
'VERSION',
126+
'UNMASKED_VENDOR_WEBGL',
127+
'UNMASKED_RENDERER_WEBGL',
128+
128129
],
129130
}
130131

@@ -194,13 +195,14 @@ const getShaderPrecisionFormat = (context, shaderType) => {
194195
}
195196

196197
// https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info
197-
const getUnmasked = (context, constant) => {
198+
const getUnmasked = (contextType, context, constant) => {
198199
try {
199200
const extension = context.getExtension('WEBGL_debug_renderer_info')
200201
const unmasked = context.getParameter(extension[constant])
201202
return unmasked
202-
} catch (error) {
203-
return undefined
203+
} catch (e) {
204+
log_error(10, contextType +'_'+ constant, e)
205+
return zErr
204206
}
205207
}
206208

@@ -266,8 +268,8 @@ function getWebGL(contextType) {
266268
VERTEX_SHADER_BEST_FLOAT_PRECISION: Object.values(VERTEX_SHADER.HIGH_FLOAT),
267269
FRAGMENT_SHADER,
268270
FRAGMENT_SHADER_BEST_FLOAT_PRECISION: Object.values(FRAGMENT_SHADER.HIGH_FLOAT),
269-
UNMASKED_VENDOR_WEBGL: getUnmasked(context, 'UNMASKED_VENDOR_WEBGL'),
270-
UNMASKED_RENDERER_WEBGL: getUnmasked(context, 'UNMASKED_RENDERER_WEBGL')
271+
UNMASKED_VENDOR_WEBGL: getUnmasked(contextType, context, 'UNMASKED_VENDOR_WEBGL'),
272+
UNMASKED_RENDERER_WEBGL: getUnmasked(contextType, context, 'UNMASKED_RENDERER_WEBGL')
271273
}
272274

273275
const glConstants = [...WebGLConstants, ...(supportsWebGL2 ? WebGL2Constants : [])]
@@ -299,9 +301,6 @@ function getWebGL(contextType) {
299301
errors.push(['parameters', e+'']) // 'parameters blocked'
300302
}
301303

302-
const gpuVendor = parameters.UNMASKED_VENDOR_WEBGL
303-
const gpuRenderer = parameters.UNMASKED_RENDERER_WEBGL
304-
305304
// Structure parameter data
306305
let components = {}
307306
if (parameters) {
@@ -320,16 +319,16 @@ function getWebGL(contextType) {
320319
}
321320

322321
data = {
323-
gpuRenderer,
324-
gpuVendor,
325322
...components,
326323
webGLExtensions
327324
}
328325
return [data, errors]
329326
}
330327

331328
const outputWebGL = () => new Promise(resolve => {
332-
//return resolve()
329+
if (isFile) {
330+
return resolve()
331+
}
333332

334333
Promise.all([
335334
getWebGL('webgl'),

0 commit comments

Comments
 (0)