Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/device/hip/graphics_interop.cpp')
-rw-r--r--intern/cycles/device/hip/graphics_interop.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/intern/cycles/device/hip/graphics_interop.cpp b/intern/cycles/device/hip/graphics_interop.cpp
index add6dbed5e1..0d5d71019b3 100644
--- a/intern/cycles/device/hip/graphics_interop.cpp
+++ b/intern/cycles/device/hip/graphics_interop.cpp
@@ -37,11 +37,15 @@ HIPDeviceGraphicsInterop::~HIPDeviceGraphicsInterop()
}
}
-void HIPDeviceGraphicsInterop::set_destination(const DeviceGraphicsInteropDestination &destination)
+void HIPDeviceGraphicsInterop::set_display_interop(
+ const DisplayDriver::GraphicsInterop &display_interop)
{
- const int64_t new_buffer_area = int64_t(destination.buffer_width) * destination.buffer_height;
+ const int64_t new_buffer_area = int64_t(display_interop.buffer_width) *
+ display_interop.buffer_height;
- if (opengl_pbo_id_ == destination.opengl_pbo_id && buffer_area_ == new_buffer_area) {
+ need_clear_ = display_interop.need_clear;
+
+ if (opengl_pbo_id_ == display_interop.opengl_pbo_id && buffer_area_ == new_buffer_area) {
return;
}
@@ -52,12 +56,12 @@ void HIPDeviceGraphicsInterop::set_destination(const DeviceGraphicsInteropDestin
}
const hipError_t result = hipGraphicsGLRegisterBuffer(
- &hip_graphics_resource_, destination.opengl_pbo_id, hipGraphicsRegisterFlagsNone);
+ &hip_graphics_resource_, display_interop.opengl_pbo_id, hipGraphicsRegisterFlagsNone);
if (result != hipSuccess) {
LOG(ERROR) << "Error registering OpenGL buffer: " << hipewErrorString(result);
}
- opengl_pbo_id_ = destination.opengl_pbo_id;
+ opengl_pbo_id_ = display_interop.opengl_pbo_id;
buffer_area_ = new_buffer_area;
}
@@ -77,6 +81,14 @@ device_ptr HIPDeviceGraphicsInterop::map()
hip_device_assert(
device_, hipGraphicsResourceGetMappedPointer(&hip_buffer, &bytes, hip_graphics_resource_));
+ if (need_clear_) {
+ hip_device_assert(
+ device_,
+ hipMemsetD8Async(static_cast<hipDeviceptr_t>(hip_buffer), 0, bytes, queue_->stream()));
+
+ need_clear_ = false;
+ }
+
return static_cast<device_ptr>(hip_buffer);
}