diff options
Diffstat (limited to 'intern/cycles/blender/display_driver.h')
-rw-r--r-- | intern/cycles/blender/display_driver.h | 67 |
1 files changed, 8 insertions, 59 deletions
diff --git a/intern/cycles/blender/display_driver.h b/intern/cycles/blender/display_driver.h index 66cfc8cffcc..b9773f5eadf 100644 --- a/intern/cycles/blender/display_driver.h +++ b/intern/cycles/blender/display_driver.h @@ -26,6 +26,7 @@ #include "util/thread.h" #include "util/unique_ptr.h" +#include "util/vector.h" CCL_NAMESPACE_BEGIN @@ -112,6 +113,8 @@ class BlenderDisplayDriver : public DisplayDriver { void set_zoom(float zoom_x, float zoom_y); protected: + virtual void next_tile_begin() override; + virtual bool update_begin(const Params ¶ms, int texture_width, int texture_height) override; virtual void update_end() override; @@ -128,27 +131,9 @@ class BlenderDisplayDriver : public DisplayDriver { void gl_context_disable(); void gl_context_dispose(); - /* Make sure texture is allocated and its initial configuration is performed. */ - bool gl_texture_resources_ensure(); - - /* Ensure all runtime GPU resources needed for drawing are allocated. - * Returns true if all resources needed for drawing are available. */ - bool gl_draw_resources_ensure(); - /* Destroy all GPU resources which are being used by this object. */ void gl_resources_destroy(); - /* Update GPU texture dimensions and content if needed (new pixel data was provided). - * - * NOTE: The texture needs to be bound. */ - void texture_update_if_needed(); - - /* Update vertex buffer with new coordinates of vertex positions and texture coordinates. - * This buffer is used to render texture in the viewport. - * - * NOTE: The buffer needs to be bound. */ - void vertex_buffer_update(const Params ¶ms); - BL::RenderEngine b_engine_; /* OpenGL context which is used the render engine doesn't have its own. */ @@ -159,50 +144,14 @@ class BlenderDisplayDriver : public DisplayDriver { /* Mutex used to guard the `gl_context_`. */ thread_mutex gl_context_mutex_; - /* Texture which contains pixels of the render result. */ - struct { - /* Indicates whether texture creation was attempted and succeeded. - * Used to avoid multiple attempts of texture creation on GPU issues or GPU context - * misconfiguration. */ - bool creation_attempted = false; - bool is_created = false; - - /* OpenGL resource IDs of the texture itself and Pixel Buffer Object (PBO) used to write - * pixels to it. - * - * NOTE: Allocated on the engine's context. */ - uint gl_id = 0; - uint gl_pbo_id = 0; - - /* Is true when new data was written to the PBO, meaning, the texture might need to be resized - * and new data is to be uploaded to the GPU. */ - bool need_update = false; - - /* Content of the texture is to be filled with zeroes. */ - std::atomic<bool> need_clear = true; - - /* Dimensions of the texture in pixels. */ - int width = 0; - int height = 0; - - /* Dimensions of the underlying PBO. */ - int buffer_width = 0; - int buffer_height = 0; - - /* Display parameters the texture has been updated for. */ - Params params; - } texture_; + /* Content of the display is to be filled with zeroes. */ + std::atomic<bool> need_clear_ = true; unique_ptr<BlenderDisplayShader> display_shader_; - /* Special track of whether GPU resources were attempted to be created, to avoid attempts of - * their re-creation on failure on every redraw. */ - bool gl_draw_resource_creation_attempted_ = false; - bool gl_draw_resources_created_ = false; - - /* Vertex buffer which hold vertices of a triangle fan which is textures with the texture - * holding the render result. */ - uint vertex_buffer_ = 0; + /* Opaque storage for an internal state and data for tiles. */ + struct Tiles; + unique_ptr<Tiles> tiles_; void *gl_render_sync_ = nullptr; void *gl_upload_sync_ = nullptr; |