Skip to content

Commit 01aafce

Browse files
add clock for bump2normal
1 parent 47f277e commit 01aafce

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/textures/bump2normal.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,12 @@ class Bump2NormalTextureInstance final : public Texture::Instance {
117117

118118
luisa::unique_ptr<Texture::Instance> Bump2NormalTexture::build(
119119
Pipeline &pipeline, CommandBuffer &command_buffer) const noexcept {
120+
121+
Clock clk;
122+
120123
auto bump_texture = pipeline.build_texture(command_buffer, _bump_texture);
121124
auto resolution = bump_texture->node()->resolution();
122-
auto resolution_scaled = make_uint2(resolution.x * _scale, resolution.y);
125+
auto resolution_scaled = make_uint2(resolution.x * _scale, resolution.y * _scale);
123126
auto strength = std::min(resolution.x, resolution.y) * _scale;
124127

125128
auto bump_scaled = pipeline.create<Image<float>>(PixelStorage::FLOAT1, resolution_scaled, 1u);
@@ -134,11 +137,8 @@ luisa::unique_ptr<Texture::Instance> Bump2NormalTexture::build(
134137
auto uv = make_float2(
135138
dispatch_id.x / Float(resolution.x),
136139
dispatch_id.y / Float(resolution.y));
137-
auto value = bump_texture->evaluate(Interaction(uv), 0.f).x;
138-
auto value_mapped = pow(value, 2.2f);
139-
auto value_float4 = def(make_float4(0.f));
140-
value_float4.x = value_mapped;
141-
target->write(dispatch_id, value_float4);
140+
auto value = bump_texture->evaluate(Interaction(uv), 0.f);
141+
target->write(dispatch_id, value);
142142
};
143143
auto scale_shader = pipeline.device().compile<2>(scale_kernel);
144144
command_buffer << scale_shader(*bump_scaled).dispatch(resolution_scaled) << commit();
@@ -221,6 +221,7 @@ luisa::unique_ptr<Texture::Instance> Bump2NormalTexture::build(
221221
<< synchronize();
222222
auto normal_map_tex_id = pipeline.register_bindless(*normal, sampler);
223223

224+
LUISA_INFO_WITH_LOCATION("Bump2NormalTextureInstance build time: {} ms", clk.toc());
224225
return luisa::make_unique<Bump2NormalTextureInstance>(pipeline, this, normal_map_tex_id);
225226
}
226227

0 commit comments

Comments
 (0)