Skip to content

Commit

Permalink
fix ConcatTexture channels
Browse files Browse the repository at this point in the history
  • Loading branch information
OldNew777 committed Apr 18, 2024
1 parent c6f8496 commit 4e2203f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/textures/concat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ConcatTexture final : public Texture {
case 1u: s[index++] = v.x; break;
case 2u: s[index] = v.x; s[index + 1u] = v.y; index += 2u; break;
case 3u: s[index] = v.x; s[index + 1u] = v.y; s[index + 2u] = v.z; index += 3u; break;
case 4u: s[index] = v.x; s[index + 1u] = v.y; s[index + 2u] = v.z; s[index + 3u] = v.w; break;
case 4u: s[index] = v.x; s[index + 1u] = v.y; s[index + 2u] = v.z; s[index + 3u] = v.w; index += 4u; break;
default: LUISA_ERROR_WITH_LOCATION("Unreachable");
}
}
Expand Down Expand Up @@ -111,7 +111,6 @@ class ConcatTextureInstance final : public Texture::Instance {
[[nodiscard]] Float4 evaluate(const Interaction &it,
const SampledWavelengths &swl,
Expr<float> time) const noexcept override {
// TODO: incorrect implementation
auto s = def(make_float4(0.f));
auto index = 0u;
for (auto i = 0u; i < _sub_textures.size() - 1; i++) {
Expand All @@ -131,7 +130,7 @@ class ConcatTextureInstance final : public Texture::Instance {
case 1u: s[index++] = v.x; break;
case 2u: s[index] = v.x; s[index + 1u] = v.y; index += 2u; break;
case 3u: s[index] = v.x; s[index + 1u] = v.y; s[index + 2u] = v.z; index += 3u; break;
case 4u: s[index] = v.x; s[index + 1u] = v.y; s[index + 2u] = v.z; s[index + 3u] = v.w; break;
case 4u: s[index] = v.x; s[index + 1u] = v.y; s[index + 2u] = v.z; s[index + 3u] = v.w; index += 4u; break;
default: LUISA_ERROR_WITH_LOCATION("Unreachable");
}
}
Expand Down

0 comments on commit 4e2203f

Please sign in to comment.