Skip to content

Commit

Permalink
Change alias table buffer in PowerLightSampler back to separate buffe…
Browse files Browse the repository at this point in the history
…r object
  • Loading branch information
LeonKang130 committed May 2, 2024
1 parent 833ef85 commit c0fb181
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/lightsamplers/power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class PowerLightSampler final : public LightSampler {
class PowerLightSamplerInstance final : public LightSampler::Instance {

private:
BufferView<AliasEntry> _alias_table_buffer;
BufferView<float> _pdf_buffer;
luisa::shared_ptr<Shader1D<uint>> _clear_light_power;
luisa::shared_ptr<Shader1D<uint, float>> _compute_light_power;
Buffer<AliasEntry> _alias_table_buffer;
Buffer<float> _pdf_buffer;
uint _light_handle_buffer_id{0u};
uint _tag_lut_buffer_id{0u};
float _env_prob{0.f};
Expand All @@ -45,10 +45,8 @@ class PowerLightSamplerInstance final : public LightSampler::Instance {
_light_handle_buffer_id = light_handle_buffer_id;
auto [tag_lut_buffer_view, tag_lut_buffer_id] = pipeline.bindless_arena_buffer<uint>(num_inst);
_tag_lut_buffer_id = tag_lut_buffer_id;
auto [alias_table_buffer_view, alias_table_buffer_id] = pipeline.bindless_arena_buffer<AliasEntry>(num_light_inst);
_alias_table_buffer = alias_table_buffer_view;
auto [pdf_buffer_view, pdf_buffer_id] = pipeline.bindless_arena_buffer<float>(num_light_inst);
_pdf_buffer = pdf_buffer_view;
_alias_table_buffer = pipeline.device().create_buffer<AliasEntry>(num_light_inst);
_pdf_buffer = pipeline.device().create_buffer<float>(num_light_inst);
command_buffer << light_handle_buffer_view.copy_from(pipeline.geometry()->light_instances().data()) << commit();
luisa::vector<uint> tag_lut(num_inst);
for (auto i = 0u; i < num_light_inst; i++) {
Expand Down

0 comments on commit c0fb181

Please sign in to comment.