Skip to content

Commit c7973a6

Browse files
committed
Fix 1D/2D input texture bug
1 parent c483e4d commit c7973a6

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/backend/mode_gpu.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@
456456
var textureCount = 0;
457457
for (textureCount=0; textureCount<paramNames.length; textureCount++) {
458458
var paramDim, paramSize, texture;
459-
if (Array.isArray(arguments[textureCount])) {
459+
var argType = getArgumentType(arguments[textureCount]);
460+
if (argType == "Array") {
460461
paramDim = getDimensions(arguments[textureCount], true);
461462
paramSize = dimToTexSize(gpu, paramDim);
462463

@@ -496,11 +497,11 @@
496497
gl.uniform2fv(paramSizeLoc, paramSize);
497498
}
498499
gl.uniform1i(paramLoc, textureCount);
499-
} else if (typeof arguments[textureCount] == "number") {
500+
} else if (argType == "Number") {
500501
var argLoc = gl.getUniformLocation(program, "user_"+paramNames[textureCount]);
501502
gl.uniform1f(argLoc, arguments[textureCount]);
502-
} else if (arguments[textureCount] instanceof GPUTexture) {
503-
paramDim = getDimensions(arguments[textureCount]);
503+
} else if (argType == "Texture") {
504+
paramDim = getDimensions(arguments[textureCount], true);
504505
paramSize = arguments[textureCount].size;
505506
texture = arguments[textureCount].texture;
506507
textures[textureCount] = texture;

0 commit comments

Comments
 (0)