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
4 changed files with 16 additions and 14 deletions
Showing only changes of commit e1fe0b9cd3 - Show all commits

View File

@ -55,16 +55,19 @@ Engine::Engine(RenderEngine *bl_engine, const std::string &render_delegate_name)
free_camera_delegate_ = std::make_unique<pxr::HdxFreeCameraSceneDelegate>(
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("freeCamera"));
if (bl_engine->type->flag & RE_USE_GPU_CONTEXT) {
// render_task_delegate_ = std::make_unique<GPURenderTaskDelegate>(
// render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
#ifdef __APPLE__
render_task_delegate_ = std::make_unique<RenderTaskDelegate>(
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
#else
if (bl_engine->type->flag & RE_USE_GPU_CONTEXT) {
render_task_delegate_ = std::make_unique<GPURenderTaskDelegate>(
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
}
else {
render_task_delegate_ = std::make_unique<RenderTaskDelegate>(
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
}
#endif
render_task_delegate_->set_camera(free_camera_delegate_->GetCameraId());
if (render_delegate_name_ == "HdStormRendererPlugin") {

View File

@ -37,6 +37,7 @@ static PyObject *engine_create_func(PyObject * /*self*/, PyObject *args)
RenderEngine *bl_engine = pyrna_to_pointer<RenderEngine>(pyengine, &RNA_RenderEngine);
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %s", engine_type);
Engine *engine = nullptr;
try {
if (STREQ(engine_type, "VIEWPORT")) {
@ -53,9 +54,7 @@ static PyObject *engine_create_func(PyObject * /*self*/, PyObject *args)
CLOG_ERROR(LOG_RENDER_HYDRA, "%s", e.what());
}
if (engine) {
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %p %s", engine, engine_type);
}
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %p", engine);
return PyLong_FromVoidPtr(engine);
}
@ -67,9 +66,9 @@ static PyObject *engine_free_func(PyObject * /*self*/, PyObject *args)
}
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %p", engine);
delete engine;
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %p", engine);
Py_RETURN_NONE;
}

View File

@ -199,8 +199,6 @@ void GPURenderTaskDelegate::set_viewport(pxr::GfVec4d const &viewport)
void GPURenderTaskDelegate::add_aov(pxr::TfToken const &aov_key)
{
RenderTaskDelegate::add_aov(aov_key);
eGPUTextureFormat format;
GPUTexture **tex;
if (aov_key == pxr::HdAovTokens->color) {

View File

@ -240,9 +240,11 @@ void ViewportEngine::render(Depsgraph *depsgraph, bContext *context)
pxr::HdTaskSharedPtrVector tasks;
if (light_tasks_delegate_) {
// if (scene->r.alphamode != R_ALPHAPREMUL) {
// tasks.push_back(light_tasks_delegate_->skydome_task());
// }
#ifndef __APPLE__
if (scene->r.alphamode != R_ALPHAPREMUL) {
tasks.push_back(light_tasks_delegate_->skydome_task());
}
#endif
tasks.push_back(light_tasks_delegate_->simple_task());
}
tasks.push_back(render_task_delegate_->task());