forked from blender/blender
Fixed rendering for MacOS #82
@ -55,16 +55,19 @@ Engine::Engine(RenderEngine *bl_engine, const std::string &render_delegate_name)
|
|||||||
free_camera_delegate_ = std::make_unique<pxr::HdxFreeCameraSceneDelegate>(
|
free_camera_delegate_ = std::make_unique<pxr::HdxFreeCameraSceneDelegate>(
|
||||||
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) {
|
#ifdef __APPLE__
|
||||||
// render_task_delegate_ = std::make_unique<GPURenderTaskDelegate>(
|
|
||||||
// render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
|
|
||||||
render_task_delegate_ = std::make_unique<RenderTaskDelegate>(
|
render_task_delegate_ = std::make_unique<RenderTaskDelegate>(
|
||||||
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
|
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 {
|
else {
|
||||||
render_task_delegate_ = std::make_unique<RenderTaskDelegate>(
|
render_task_delegate_ = std::make_unique<RenderTaskDelegate>(
|
||||||
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
|
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
render_task_delegate_->set_camera(free_camera_delegate_->GetCameraId());
|
render_task_delegate_->set_camera(free_camera_delegate_->GetCameraId());
|
||||||
|
|
||||||
if (render_delegate_name_ == "HdStormRendererPlugin") {
|
if (render_delegate_name_ == "HdStormRendererPlugin") {
|
||||||
|
@ -37,6 +37,7 @@ static PyObject *engine_create_func(PyObject * /*self*/, PyObject *args)
|
|||||||
|
|
||||||
RenderEngine *bl_engine = pyrna_to_pointer<RenderEngine>(pyengine, &RNA_RenderEngine);
|
RenderEngine *bl_engine = pyrna_to_pointer<RenderEngine>(pyengine, &RNA_RenderEngine);
|
||||||
|
|
||||||
|
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %s", engine_type);
|
||||||
Engine *engine = nullptr;
|
Engine *engine = nullptr;
|
||||||
try {
|
try {
|
||||||
if (STREQ(engine_type, "VIEWPORT")) {
|
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());
|
CLOG_ERROR(LOG_RENDER_HYDRA, "%s", e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine) {
|
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %p", engine);
|
||||||
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %p %s", engine, engine_type);
|
|
||||||
}
|
|
||||||
return PyLong_FromVoidPtr(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));
|
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
|
||||||
|
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %p", engine);
|
||||||
delete engine;
|
delete engine;
|
||||||
|
|
||||||
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %p", engine);
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,8 +199,6 @@ 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) {
|
||||||
|
@ -240,9 +240,11 @@ 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) {
|
#ifndef __APPLE__
|
||||||
// tasks.push_back(light_tasks_delegate_->skydome_task());
|
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(light_tasks_delegate_->simple_task());
|
||||||
}
|
}
|
||||||
tasks.push_back(render_task_delegate_->task());
|
tasks.push_back(render_task_delegate_->task());
|
||||||
|
Loading…
Reference in New Issue
Block a user