-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
59 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
modules/core/src/adapter-utils/split-uniforms-and-bindings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// luma.gl | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) vis.gl contributors | ||
|
||
import type {UniformValue} from '../adapter/types/types'; | ||
import type {Binding} from '../adapter/types/shader-layout'; | ||
import {isUniformValue} from './is-uniform-value'; | ||
|
||
type UniformsAndBindings = { | ||
bindings: Record<string, Binding>; | ||
uniforms: Record<string, UniformValue>; | ||
}; | ||
|
||
export function splitUniformsAndBindings( | ||
uniforms: Record<string, Binding | UniformValue> | ||
): UniformsAndBindings { | ||
const result: UniformsAndBindings = {bindings: {}, uniforms: {}}; | ||
Object.keys(uniforms).forEach(name => { | ||
const uniform = uniforms[name]; | ||
if (isUniformValue(uniform)) { | ||
result.uniforms[name] = uniform as UniformValue; | ||
} else { | ||
result.bindings[name] = uniform as Binding; | ||
} | ||
}); | ||
|
||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters