Skip to content

Commit

Permalink
remove half.h and use luisa::half instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-Leo-Smith committed Jun 2, 2024
1 parent 9cf1625 commit e0dbb60
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 112 deletions.
1 change: 0 additions & 1 deletion src/base/shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#pragma once

#include <runtime/rtx/mesh.h>
#include <util/half.h>
#include <util/vertex.h>
#include <base/scene_node.h>
#include <base/scene.h>
Expand Down
1 change: 0 additions & 1 deletion src/base/texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <dsl/syntax.h>
#include <util/spec.h>
#include <util/imageio.h>
#include <util/half.h>
#include <base/scene_node.h>
#include <base/spectrum.h>

Expand Down
2 changes: 0 additions & 2 deletions src/textures/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

#include <util/thread_pool.h>
#include <util/imageio.h>
#include <util/half.h>
#include <base/texture.h>
#include <base/pipeline.h>
#include <base/scene.h>

namespace luisa::render {

Expand Down
1 change: 0 additions & 1 deletion src/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ add_library(luisa-render-util SHARED
xform.cpp xform.h
spec.cpp spec.h
colorspace.h
half.cpp half.h
u64.cpp u64.h
rng.cpp rng.h
ies.cpp ies.h
Expand Down
83 changes: 0 additions & 83 deletions src/util/half.cpp

This file was deleted.

17 changes: 0 additions & 17 deletions src/util/half.h

This file was deleted.

9 changes: 3 additions & 6 deletions src/util/imageio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
#include <tinyexr.h>
#include <stb/stb_image.h>
#include <stb/stb_image_write.h>
#include <stb/stb_image_resize2.h>

#include <core/logging.h>
#include <util/imageio.h>
#include <util/half.h>

namespace luisa::render {

Expand Down Expand Up @@ -236,16 +234,15 @@ LoadedImage LoadedImage::_load_half(const std::filesystem::path &path, LoadedIma
"Failed to load HALF image '{}': {}.",
filename, stbi_failure_reason());
}
auto half_pixels = luisa::allocate_with_allocator<uint16_t>(w * h * expected_channels);
auto half_pixels = luisa::allocate_with_allocator<luisa::half>(w * h * expected_channels);
for (auto i = 0u; i < w * h * expected_channels; i++) {
half_pixels[i] = float_to_half(
reinterpret_cast<const float *>(pixels)[i]);
half_pixels[i] = static_cast<luisa::half>(reinterpret_cast<const float *>(pixels)[i]);
}
stbi_image_free(pixels);
return {
half_pixels, storage, make_uint2(w, h),
[](void *p) noexcept {
luisa::deallocate_with_allocator(static_cast<uint16_t *>(p));
luisa::deallocate_with_allocator(static_cast<luisa::half *>(p));
}};
}

Expand Down
1 change: 0 additions & 1 deletion src/util/imageio.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <filesystem>

#include <core/stl.h>
#include <util/half.h>
#include <runtime/rhi/pixel.h>

namespace luisa::render {
Expand Down

0 comments on commit e0dbb60

Please sign in to comment.