forked from blender/blender
Changes to enable MacOS viewport. #70
@ -62,6 +62,7 @@ void RenderTaskDelegate::set_renderer_aov(pxr::TfToken const &aov)
|
|||||||
binding.aovName = aov;
|
binding.aovName = aov;
|
||||||
binding.renderBufferId = buffer_id;
|
binding.renderBufferId = buffer_id;
|
||||||
binding.aovSettings = aov_desc.aovSettings;
|
binding.aovSettings = aov_desc.aovSettings;
|
||||||
|
binding.clearValue = pxr::VtValue(pxr::GfVec4f(0));
|
||||||
task_params_.aovBindings.push_back(binding);
|
task_params_.aovBindings.push_back(binding);
|
||||||
|
|
||||||
GetRenderIndex().GetChangeTracker().MarkTaskDirty(get_task_id(),
|
GetRenderIndex().GetChangeTracker().MarkTaskDirty(get_task_id(),
|
||||||
|
@ -136,7 +136,7 @@ pxr::GfCamera ViewSettings::gf_camera()
|
|||||||
(float)border[3] / screen_height));
|
(float)border[3] / screen_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawTexture::DrawTexture() : texture_(nullptr), width_(0), height_(0), channels_(4)
|
DrawTexture::DrawTexture() : texture_(nullptr), width_(0), height_(0), channels_(4), format_(GPU_DATA_HALF_FLOAT)
|
||||||
{
|
{
|
||||||
float coords[8] = {0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0};
|
float coords[8] = {0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0};
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ void DrawTexture::set_buffer(pxr::HdRenderBuffer *buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *data = buffer->Map();
|
void *data = buffer->Map();
|
||||||
GPU_texture_update(texture_, GPU_DATA_FLOAT, data);
|
GPU_texture_update(texture_, format_, data);
|
||||||
buffer->Unmap();
|
buffer->Unmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +204,14 @@ void DrawTexture::create(pxr::HdRenderBuffer *buffer)
|
|||||||
1,
|
1,
|
||||||
GPU_RGBA16F,
|
GPU_RGBA16F,
|
||||||
GPU_TEXTURE_USAGE_GENERAL,
|
GPU_TEXTURE_USAGE_GENERAL,
|
||||||
(float *)data);
|
nullptr);
|
||||||
|
/* Hydra Storm defaults to HdFormatFloat16Vec4 for the color AOV.
|
||||||
|
* For now, assume anything else is Float32. */
|
||||||
|
format_ = GPU_DATA_HALF_FLOAT;
|
||||||
|
if (buffer->GetFormat() != pxr::HdFormat::HdFormatFloat16Vec4) {
|
||||||
|
format_ = GPU_DATA_FLOAT;
|
||||||
|
}
|
||||||
|
GPU_texture_update(texture_, format_, data);
|
||||||
buffer->Unmap();
|
buffer->Unmap();
|
||||||
|
|
||||||
GPU_texture_filter_mode(texture_, true);
|
GPU_texture_filter_mode(texture_, true);
|
||||||
@ -240,9 +247,7 @@ void ViewportEngine::render(Depsgraph * /* depsgraph */, bContext *context)
|
|||||||
simple_light_task_delegate_->set_camera_path(free_camera_delegate_->GetCameraId());
|
simple_light_task_delegate_->set_camera_path(free_camera_delegate_->GetCameraId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bl_engine_->type->flag & RE_USE_GPU_CONTEXT) == 0) {
|
render_task_delegate_->set_renderer_aov(pxr::HdAovTokens->color);
|
||||||
|
|||||||
render_task_delegate_->set_renderer_aov(pxr::HdAovTokens->color);
|
|
||||||
}
|
|
||||||
|
|
||||||
GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_3D_IMAGE);
|
GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_3D_IMAGE);
|
||||||
GPU_shader_bind(shader);
|
GPU_shader_bind(shader);
|
||||||
@ -255,10 +260,8 @@ void ViewportEngine::render(Depsgraph * /* depsgraph */, bContext *context)
|
|||||||
|
|
||||||
engine_->Execute(render_index_.get(), &tasks);
|
engine_->Execute(render_index_.get(), &tasks);
|
||||||
|
|
||||||
if ((bl_engine_->type->flag & RE_USE_GPU_CONTEXT) == 0) {
|
draw_texture_.set_buffer(render_task_delegate_->get_renderer_aov(pxr::HdAovTokens->color));
|
||||||
Bogdan Nagirniak
commented
This has to be reverted, because it returns empty image in viewport. This has to be reverted, because it returns empty image in viewport.
|
|||||||
draw_texture_.set_buffer(render_task_delegate_->get_renderer_aov(pxr::HdAovTokens->color));
|
draw_texture_.draw(shader, view_settings.border[0], view_settings.border[1]);
|
||||||
draw_texture_.draw(shader, view_settings.border[0], view_settings.border[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
GPU_shader_unbind();
|
GPU_shader_unbind();
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ class DrawTexture {
|
|||||||
GPUTexture *texture_;
|
GPUTexture *texture_;
|
||||||
GPUBatch *batch_;
|
GPUBatch *batch_;
|
||||||
int width_, height_, channels_;
|
int width_, height_, channels_;
|
||||||
|
eGPUDataFormat format_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ViewportEngine : public Engine {
|
class ViewportEngine : public Engine {
|
||||||
|
Loading…
Reference in New Issue
Block a user
This has to be reverted, because it returns empty image in viewport.