Skip to content

Commit

Permalink
Merge pull request #224 from akarimgc/fix_texture_arrays_display
Browse files Browse the repository at this point in the history
Fixes texture display when a uniforms is bound to a texture array
  • Loading branch information
sebavan committed Jan 21, 2022
2 parents 1121b4c + 7a9d88e commit 8fa804c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions documentation/changeLogs.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Please, find below the per release summary of the contribution added to the proj
* Add [spector.log support](https://github.com/BabylonJS/Spector.js/issues/171)
* Fix [Shader Type display](https://github.com/BabylonJS/Spector.js/issues/179)
* Add [Pixelated Texture on Nearest mag filter](https://github.com/BabylonJS/Spector.js/issues/107)
* Fix [Texture Display for texture arrays](https://github.com/BabylonJS/Spector.js/pull/224)

## v0.9.27
* Fixed compressed textures gathered sizes.
Expand Down
11 changes: 6 additions & 5 deletions src/backend/states/drawCalls/drawCallState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,18 @@ export class DrawCallState extends BaseState {
// Insert texture state at the end of the uniform datas.
for (let i = 0; i < uniformIndices.length; i++) {
const uniformState = this.currentState.uniforms[i];
if (uniformState.value !== null && uniformState.value !== undefined) {
const values = uniformState.value ?? uniformState.values;
if (values !== null && values !== undefined) {
const textureTarget = DrawCallState.samplerTypes[uniformState.typeValue];
if (textureTarget) {
if (uniformState.value.length) {
if (values.length) {
uniformState.textures = [];
for (let j = 0; j < uniformState.value.length; j++) {
uniformState.textures.push(this.readTextureFromContext(uniformState.value[j], textureTarget));
for (let j = 0; j < values.length; j++) {
uniformState.textures.push(this.readTextureFromContext(values[j].value, textureTarget));
}
}
else {
uniformState.texture = this.readTextureFromContext(uniformState.value, textureTarget);
uniformState.texture = this.readTextureFromContext(values, textureTarget);
}
}
}
Expand Down

0 comments on commit 8fa804c

Please sign in to comment.