Fix review comments 2 #31

Merged
Bogdan Nagirniak merged 8 commits from BLEN-397 into hydra-render 2023-04-27 09:05:38 +02:00
2 changed files with 6 additions and 6 deletions
Showing only changes of commit 550a29f5e4 - Show all commits

View File

@ -62,11 +62,11 @@ void FinalEngine::render(Depsgraph *depsgraph)
break; break;
} }
render_task_delegate_->get_renderer_aov_data(pxr::HdAovTokens->color, pixels_.data()); render_task_delegate_->get_renderer_aov_data(pxr::HdAovTokens->color, pixels_->data());
update_render_result(render_images_, layer_name_, resolution_[0], resolution_[1]); update_render_result(render_images_, layer_name_, resolution_[0], resolution_[1]);
} }
render_task_delegate_->get_renderer_aov_data(pxr::HdAovTokens->color, pixels_.data()); render_task_delegate_->get_renderer_aov_data(pxr::HdAovTokens->color, pixels_->data());
update_render_result(render_images_, layer_name_, resolution_[0], resolution_[1]); update_render_result(render_images_, layer_name_, resolution_[0], resolution_[1]);
} }
@ -138,7 +138,7 @@ void FinalEngine::prepare_for_render(Depsgraph *depsgraph)
render_images_.emplace( render_images_.emplace(
"Combined", "Combined",
std::vector<float>(resolution_[0] * resolution_[1] * 4)); /* 4 - number of channels. */ std::vector<float>(resolution_[0] * resolution_[1] * 4)); /* 4 - number of channels. */
pixels_ = render_images_["Combined"]; pixels_ = &render_images_["Combined"];
} }
void FinalEngineGL::render(Depsgraph *depsgraph) void FinalEngineGL::render(Depsgraph *depsgraph)
@ -191,13 +191,13 @@ void FinalEngineGL::render(Depsgraph *depsgraph)
} }
void *data = GPU_texture_read(texture, GPU_DATA_FLOAT, 0); void *data = GPU_texture_read(texture, GPU_DATA_FLOAT, 0);
memcpy(pixels_.data(), data, pixels_.size() * sizeof(float)); memcpy(pixels_->data(), data, pixels_->size() * sizeof(float));
MEM_freeN(data); MEM_freeN(data);
update_render_result(render_images_, layer_name_, resolution_[0], resolution_[1]); update_render_result(render_images_, layer_name_, resolution_[0], resolution_[1]);
} }
void *data = GPU_texture_read(texture, GPU_DATA_FLOAT, 0); void *data = GPU_texture_read(texture, GPU_DATA_FLOAT, 0);
memcpy(pixels_.data(), data, pixels_.size() * sizeof(float)); memcpy(pixels_->data(), data, pixels_->size() * sizeof(float));
MEM_freeN(data); MEM_freeN(data);
update_render_result(render_images_, layer_name_, resolution_[0], resolution_[1]); update_render_result(render_images_, layer_name_, resolution_[0], resolution_[1]);

View File

@ -31,7 +31,7 @@ class FinalEngine : public Engine {
std::string layer_name_; std::string layer_name_;
std::map<std::string, std::vector<float>> render_images_; std::map<std::string, std::vector<float>> render_images_;
pxr::GfVec2i resolution_; pxr::GfVec2i resolution_;
std::vector<float> pixels_; std::vector<float> *pixels_ = nullptr;
}; };
class FinalEngineGL : public FinalEngine { class FinalEngineGL : public FinalEngine {