Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
compat: Support firefox (2/2)
Browse files Browse the repository at this point in the history
Shader programs can now be compiled without KHR_parallel_shader_compile extension which Firefox is yet to support
See: https://developer.mozilla.org/en-US/docs/Web/API/KHR_parallel_shader_compile
  • Loading branch information
0b5vr committed Jul 7, 2023
1 parent b6b2a52 commit 91d6f2e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/gl/glLazyProgram.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GL_COMPILE_STATUS, GL_COMPLETION_STATUS_KHR, GL_FRAGMENT_SHADER, GL_LINK_STATUS, GL_SEPARATE_ATTRIBS, GL_VERTEX_SHADER } from './constants';
import { gl } from '../globals/canvas';
import { extParallel, gl } from '../globals/canvas';

export interface LazyProgramOptions {
tfVaryings?: string[],
Expand Down Expand Up @@ -63,6 +63,13 @@ export function glLazyProgram(
gl.linkProgram( program );

return new Promise( ( resolve, reject ) => {
// if the environment doesn't support parallel shader compilation,
// just return the program synchronously
if ( !extParallel ) {
resolve( program! );
return;
}

const update = (): void => {
if ( gl.getProgramParameter( program!, GL_COMPLETION_STATUS_KHR ) ) {
if ( import.meta.env.DEV ) {
Expand Down

0 comments on commit 91d6f2e

Please sign in to comment.