Fixed rendering for MacOS #82

Merged
Bogdan Nagirniak merged 10 commits from BLEN-473 into hydra-render 2023-08-02 09:37:25 +02:00
3 changed files with 16 additions and 7 deletions
Showing only changes of commit ec18be01e9 - Show all commits

View File

@ -56,7 +56,9 @@ Engine::Engine(RenderEngine *bl_engine, const std::string &render_delegate_name)
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("freeCamera")); render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("freeCamera"));
if (bl_engine->type->flag & RE_USE_GPU_CONTEXT) { if (bl_engine->type->flag & RE_USE_GPU_CONTEXT) {
render_task_delegate_ = std::make_unique<GPURenderTaskDelegate>( // render_task_delegate_ = std::make_unique<GPURenderTaskDelegate>(
// render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
render_task_delegate_ = std::make_unique<RenderTaskDelegate>(
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask")); render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
} }
else { else {

View File

@ -120,7 +120,7 @@ void RenderTaskDelegate::add_aov(pxr::TfToken const &aov_key)
binding.aovName = aov_key; binding.aovName = aov_key;
binding.renderBufferId = buf_id; binding.renderBufferId = buf_id;
binding.aovSettings = aov_desc.aovSettings; binding.aovSettings = aov_desc.aovSettings;
binding.clearValue = pxr::VtValue(pxr::GfVec4f(0)); binding.clearValue = aov_desc.clearValue;
task_params_.aovBindings.push_back(binding); task_params_.aovBindings.push_back(binding);
render_index.GetChangeTracker().MarkTaskDirty(task_id_, pxr::HdChangeTracker::DirtyParams); render_index.GetChangeTracker().MarkTaskDirty(task_id_, pxr::HdChangeTracker::DirtyParams);
@ -199,10 +199,17 @@ void GPURenderTaskDelegate::set_viewport(pxr::GfVec4d const &viewport)
void GPURenderTaskDelegate::add_aov(pxr::TfToken const &aov_key) void GPURenderTaskDelegate::add_aov(pxr::TfToken const &aov_key)
{ {
RenderTaskDelegate::add_aov(aov_key);
eGPUTextureFormat format; eGPUTextureFormat format;
GPUTexture **tex; GPUTexture **tex;
if (aov_key == pxr::HdAovTokens->color) { if (aov_key == pxr::HdAovTokens->color) {
format = GPU_RGBA32F; if (buffer_descriptors_[buffer_id(aov_key)].format == pxr::HdFormat::HdFormatFloat16Vec4) {
format = GPU_RGBA16F;
}
else {
format = GPU_RGBA32F;
}
tex = &tex_color_; tex = &tex_color_;
} }
else if (aov_key == pxr::HdAovTokens->depth) { else if (aov_key == pxr::HdAovTokens->depth) {

View File

@ -183,7 +183,7 @@ void DrawTexture::write_data(int width, int height, const void *data)
width, width,
height, height,
1, 1,
GPU_RGBA32F, GPU_RGBA16F,
GPU_TEXTURE_USAGE_GENERAL, GPU_TEXTURE_USAGE_GENERAL,
(float *)data); (float *)data);
} }
@ -240,9 +240,9 @@ void ViewportEngine::render(Depsgraph *depsgraph, bContext *context)
pxr::HdTaskSharedPtrVector tasks; pxr::HdTaskSharedPtrVector tasks;
if (light_tasks_delegate_) { if (light_tasks_delegate_) {
if (scene->r.alphamode != R_ALPHAPREMUL) { // if (scene->r.alphamode != R_ALPHAPREMUL) {
tasks.push_back(light_tasks_delegate_->skydome_task()); // tasks.push_back(light_tasks_delegate_->skydome_task());
} // }
tasks.push_back(light_tasks_delegate_->simple_task()); tasks.push_back(light_tasks_delegate_->simple_task());
} }
tasks.push_back(render_task_delegate_->task()); tasks.push_back(render_task_delegate_->task());