Skip to content
Snippets Groups Projects
Commit 85092279 authored by Alexander Rose's avatar Alexander Rose
Browse files

better handle unsupported extensions

parent d0189523
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ attribute mat4 aTransform;
attribute float aInstance;
attribute float aGroup;
#ifndef dFlatShaded
#if !defined(dFlatShaded) || !defined(enabledStandardDerivatives)
#ifdef dGeoTexture
uniform sampler2D tNormal;
#else
......@@ -38,7 +38,7 @@ void main(){
#include assign_marker_varying
#include assign_position
#ifndef dFlatShaded
#if !defined(dFlatShaded) || !defined(enabledStandardDerivatives)
#ifdef dGeoTexture
vec3 normal = readFromTexture(tNormal, aGroup, uGeoTexDim).xyz;
#else
......
......@@ -5,6 +5,7 @@
*/
import { GLRenderingContext, COMPAT_instanced_arrays, COMPAT_standard_derivatives, COMPAT_vertex_array_object, getInstancedArrays, getStandardDerivatives, getVertexArrayObject, COMPAT_element_index_uint, getElementIndexUint, COMPAT_texture_float, getTextureFloat, COMPAT_texture_float_linear, getTextureFloatLinear, COMPAT_blend_minmax, getBlendMinMax, getFragDepth, COMPAT_frag_depth, COMPAT_color_buffer_float, getColorBufferFloat, COMPAT_draw_buffers, getDrawBuffers, getShaderTextureLod, COMPAT_shader_texture_lod, getDepthTexture, COMPAT_depth_texture } from './compat';
import { isDebugMode } from '../../mol-util/debug';
export type WebGLExtensions = {
instancedArrays: COMPAT_instanced_arrays
......@@ -37,43 +38,45 @@ export function createExtensions(gl: GLRenderingContext): WebGLExtensions {
}
const standardDerivatives = getStandardDerivatives(gl)
if (standardDerivatives === null) {
// TODO handle non-support downstream (e.g. no flat shading)
// throw new Error('Could not find support for "standard_derivatives"')
if (isDebugMode && standardDerivatives === null) {
// - non-support handled downstream (flat shading option is ignored)
// - can't be a required extension because it is not supported by `headless-gl`
console.log('Could not find support for "standard_derivatives"')
}
const textureFloatLinear = getTextureFloatLinear(gl)
if (textureFloatLinear === null) {
if (isDebugMode && textureFloatLinear === null) {
// TODO handle non-support downstream (no gpu gaussian calc, no gpu mc???)
// throw new Error('Could not find support for "texture_float_linear"')
// - can't be a required extension because it is not supported by `headless-gl`
console.log('Could not find support for "texture_float_linear"')
}
const depthTexture = getDepthTexture(gl)
if (depthTexture === null) {
if (isDebugMode && depthTexture === null) {
console.log('Could not find support for "depth_texture"')
}
const blendMinMax = getBlendMinMax(gl)
if (blendMinMax === null) {
if (isDebugMode && blendMinMax === null) {
// TODO handle non-support downstream (e.g. no gpu gaussian calc)
// - can't be a required extension because it is not supported by `headless-gl`
console.log('Could not find support for "blend_minmax"')
}
const vertexArrayObject = getVertexArrayObject(gl)
if (vertexArrayObject === null) {
if (isDebugMode && vertexArrayObject === null) {
console.log('Could not find support for "vertex_array_object"')
}
const fragDepth = getFragDepth(gl)
if (fragDepth === null) {
if (isDebugMode && fragDepth === null) {
console.log('Could not find support for "frag_depth"')
}
const colorBufferFloat = getColorBufferFloat(gl)
if (colorBufferFloat === null) {
if (isDebugMode && colorBufferFloat === null) {
console.log('Could not find support for "color_buffer_float"')
}
const drawBuffers = getDrawBuffers(gl)
if (drawBuffers === null) {
if (isDebugMode && drawBuffers === null) {
console.log('Could not find support for "draw_buffers"')
}
const shaderTextureLod = getShaderTextureLod(gl)
if (shaderTextureLod === null) {
if (isDebugMode && shaderTextureLod === null) {
console.log('Could not find support for "shader_texture_lod"')
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment