25 texture_state_.is_outdated =
true;
27 if (!reset_rendering) {
28 driver_->next_tile_begin();
32 void PathTraceDisplay::mark_texture_updated()
34 texture_state_.is_outdated =
false;
43 DCHECK(!update_state_.is_active);
45 if (update_state_.is_active) {
46 LOG(ERROR) <<
"Attempt to re-activate update process.";
57 texture_state_.size =
make_int2(texture_width, texture_height);
60 if (!driver_->update_begin(
params, texture_width, texture_height)) {
61 LOG(ERROR) <<
"PathTraceDisplay implementation could not begin update.";
65 update_state_.is_active =
true;
72 DCHECK(update_state_.is_active);
74 if (!update_state_.is_active) {
75 LOG(ERROR) <<
"Attempt to deactivate inactive update process.";
79 driver_->update_end();
81 update_state_.is_active =
false;
86 return texture_state_.size;
94 const half4 *rgba_pixels,
int texture_x,
int texture_y,
int pixels_width,
int pixels_height)
96 DCHECK(update_state_.is_active);
98 if (!update_state_.is_active) {
99 LOG(ERROR) <<
"Attempt to copy pixels data outside of PathTraceDisplay update.";
103 mark_texture_updated();
112 if (!mapped_rgba_pixels) {
116 const int texture_width = texture_state_.size.x;
117 const int texture_height = texture_state_.size.y;
119 if (texture_x == 0 && texture_y == 0 && pixels_width == texture_width &&
120 pixels_height == texture_height) {
121 const size_t size_in_bytes =
sizeof(
half4) * texture_width * texture_height;
122 memcpy(mapped_rgba_pixels, rgba_pixels, size_in_bytes);
125 const half4 *rgba_row = rgba_pixels;
126 half4 *mapped_rgba_row = mapped_rgba_pixels + texture_y * texture_width + texture_x;
127 for (
int y = 0;
y < pixels_height;
128 ++
y, rgba_row += pixels_width, mapped_rgba_row += texture_width) {
129 memcpy(mapped_rgba_row, rgba_row,
sizeof(
half4) * pixels_width);
142 DCHECK(!texture_buffer_state_.is_mapped);
143 DCHECK(update_state_.is_active);
145 if (texture_buffer_state_.is_mapped) {
146 LOG(ERROR) <<
"Attempt to re-map an already mapped texture buffer.";
150 if (!update_state_.is_active) {
151 LOG(ERROR) <<
"Attempt to copy pixels data outside of PathTraceDisplay update.";
155 half4 *mapped_rgba_pixels = driver_->map_texture_buffer();
157 if (mapped_rgba_pixels) {
158 texture_buffer_state_.is_mapped =
true;
161 return mapped_rgba_pixels;
166 DCHECK(texture_buffer_state_.is_mapped);
168 if (!texture_buffer_state_.is_mapped) {
169 LOG(ERROR) <<
"Attempt to unmap non-mapped texture buffer.";
173 texture_buffer_state_.is_mapped =
false;
175 mark_texture_updated();
176 driver_->unmap_texture_buffer();
185 DCHECK(!texture_buffer_state_.is_mapped);
186 DCHECK(update_state_.is_active);
188 if (texture_buffer_state_.is_mapped) {
190 <<
"Attempt to use graphics interoperability mode while the texture buffer is mapped.";
194 if (!update_state_.is_active) {
195 LOG(ERROR) <<
"Attempt to use graphics interoperability outside of PathTraceDisplay update.";
200 mark_texture_updated();
202 return driver_->graphics_interop_get();
207 driver_->graphics_interop_activate();
212 driver_->graphics_interop_deactivate();
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
void reset(const BufferParams &buffer_params, bool reset_rendering)
int2 get_texture_size() const
PathTraceDisplay(unique_ptr< DisplayDriver > driver)
void graphics_interop_activate()
half4 * map_texture_buffer()
DisplayDriver::GraphicsInterop graphics_interop_get()
bool update_begin(int texture_width, int texture_height)
void graphics_interop_deactivate()
void copy_pixels_to_texture(const half4 *rgba_pixels, int texture_x, int texture_y, int pixels_width, int pixels_height)
void unmap_texture_buffer()
#define CCL_NAMESPACE_END
#define DCHECK(expression)
std::unique_lock< std::mutex > thread_scoped_lock