49 DCHECK(!update_state_.is_active);
51 if (update_state_.is_active) {
52 LOG_ERROR <<
"Attempt to re-activate update process.";
63 texture_state_.
size =
make_int2(texture_width, texture_height);
66 if (!driver_->update_begin(params, texture_width, texture_height)) {
67 LOG_ERROR <<
"PathTraceDisplay implementation could not begin update.";
71 update_state_.is_active =
true;
102 const int pixels_width,
103 const int pixels_height)
105 DCHECK(update_state_.is_active);
107 if (!update_state_.is_active) {
108 LOG_ERROR <<
"Attempt to copy pixels data outside of PathTraceDisplay update.";
112 mark_texture_updated();
121 if (!mapped_rgba_pixels) {
125 const int texture_width = texture_state_.size.x;
126 const int texture_height = texture_state_.size.y;
128 if (texture_x == 0 && texture_y == 0 && pixels_width == texture_width &&
129 pixels_height == texture_height)
131 const size_t size_in_bytes =
sizeof(
half4) * texture_width * texture_height;
132 memcpy(mapped_rgba_pixels, rgba_pixels, size_in_bytes);
135 const half4 *rgba_row = rgba_pixels;
136 half4 *mapped_rgba_row = mapped_rgba_pixels + texture_y * texture_width + texture_x;
137 for (
int y = 0;
y < pixels_height;
138 ++
y, rgba_row += pixels_width, mapped_rgba_row += texture_width)
140 memcpy(mapped_rgba_row, rgba_row,
sizeof(
half4) * pixels_width);
153 DCHECK(!texture_buffer_state_.is_mapped);
154 DCHECK(update_state_.is_active);
156 if (texture_buffer_state_.is_mapped) {
157 LOG_ERROR <<
"Attempt to re-map an already mapped texture buffer.";
161 if (!update_state_.is_active) {
162 LOG_ERROR <<
"Attempt to copy pixels data outside of PathTraceDisplay update.";
166 half4 *mapped_rgba_pixels = driver_->map_texture_buffer();
168 if (mapped_rgba_pixels) {
169 texture_buffer_state_.is_mapped =
true;
172 return mapped_rgba_pixels;
202 DCHECK(!texture_buffer_state_.is_mapped);
203 DCHECK(update_state_.is_active);
205 if (texture_buffer_state_.is_mapped) {
207 <<
"Attempt to use graphics interoperability mode while the texture buffer is mapped.";
208 interop_buffer.
clear();
209 return interop_buffer;
212 if (!update_state_.is_active) {
213 LOG_ERROR <<
"Attempt to use graphics interoperability outside of PathTraceDisplay update.";
214 interop_buffer.
clear();
215 return interop_buffer;
219 mark_texture_updated();
221 driver_->graphics_interop_update_buffer();
222 return interop_buffer;