remove texture auto_destroy flag

This commit is contained in:
2019-12-01 18:52:41 +01:00
parent f6c1194cb3
commit 94cf227704
7 changed files with 4 additions and 19 deletions

View File

@@ -14,7 +14,7 @@
<text text="Note: resolution is measured in K-pixels, so a 2K document produces\na 2048x1024 equirectangular output." margin="0 5 10 5"/>
<border dir="row" align="center" height="30" color=".2 .2 .2 1">
<text text="Project name: " margin="0 5 0 5"/>
<text-input id="txt-input" align="center" pad="5" grow="1" height="30" color=".3"/>
<text-input id="txt-input" margin="0 1 0 0" align="center" pad="5" grow="1" height="30" color=".3"/>
<combobox id="resolution" width="100" height="30" text="2K" combo-list="2K,4K,6K,8K,16K,32K" default="1"/>
</border>
<text os="win,osx" id="path" text="Workind dir: path" text-wrap-width="470" margin="10 5 10 5"/>

View File

@@ -208,7 +208,6 @@ bool Brush::load_tip(const std::string& path, const std::string& thumb)
return false;
}
m_tip_texture->create_mipmaps();
m_tip_texture->auto_destroy = true;
m_brush_path = path;
m_brush_thumb_path = thumb;
auto sz = m_tip_texture->size();
@@ -227,7 +226,6 @@ bool Brush::load_dual(const std::string& path, const std::string& thumb)
return false;
}
m_dual_texture->create_mipmaps();
m_dual_texture->auto_destroy = true;
m_dual_path = path;
m_dual_thumb_path = thumb;
return true;
@@ -244,7 +242,6 @@ bool Brush::load_pattern(const std::string& path, const std::string& thumb)
return false;
}
m_pattern_texture->create_mipmaps();
m_pattern_texture->auto_destroy = true;
m_pattern_path = path;
m_pattern_thumb_path = thumb;
return true;
@@ -265,7 +262,6 @@ bool Brush::load()
return false;
}
m_tip_texture->create_mipmaps();
m_tip_texture->auto_destroy = true;
}
if (!m_dual_path.empty() && !m_dual_texture)
{
@@ -281,7 +277,6 @@ bool Brush::load()
return false;
}
m_dual_texture->create_mipmaps();
m_dual_texture->auto_destroy = true;
}
if (!m_pattern_path.empty() && !m_pattern_texture)
{
@@ -298,7 +293,6 @@ bool Brush::load()
return false;
}
m_pattern_texture->create_mipmaps();
m_pattern_texture->auto_destroy = true;
}
return true;
}

View File

@@ -67,8 +67,6 @@ bool LayoutManager::parse(const std::string& xml_string) noexcept
LOG("parsing xml failed");
}
LOG("parsing loaded xml");
tinyxml2::XMLElement* current = xml.RootElement()->FirstChildElement();
while (current)
{

View File

@@ -40,7 +40,7 @@ void NodeDialogExportPPBR::init_controls()
btn_header_clear = find<NodeButton>("header-clear");
btn_header_clear->on_click = [this] (Node*) {
m_header_image.reset();
img_header->tex->destroy();
img_header->tex.reset();
txt_header_descr->SetVisibility(true);
};
btn_header_gen = find<NodeButton>("header-gen");
@@ -85,4 +85,5 @@ void NodeDialogExportPPBR::added(Node* parent)
NodeBorder::added(parent);
if (added_to_root())
mouse_capture();
txt_author->key_capture();
}

View File

@@ -156,7 +156,6 @@ void NodeImage::load_url(const std::string& url)
uint8_t* rgba = stbi_load_from_memory(m_remote_asset->m_data, m_remote_asset->m_len, &w, &h, &c, 4);
m_remote_texture = std::make_shared<Texture2D>();
m_remote_texture->create(w, h, GL_RGBA8, GL_RGBA, rgba);
m_remote_texture->auto_destroy = true;
if (m_use_mipmaps)
m_remote_texture->create_mipmaps();
delete rgba;

View File

@@ -149,7 +149,6 @@ Texture2D::Texture2D(Texture2D&& other) noexcept
m_height = other.m_height;
m_format = other.m_format;
m_iformat = other.m_iformat;
auto_destroy = other.auto_destroy;
has_mips = other.has_mips;
other.m_tex = false;
}
@@ -161,7 +160,6 @@ void Texture2D::operator=(Texture2D&& other) noexcept
m_height = other.m_height;
m_format = other.m_format;
m_iformat = other.m_iformat;
auto_destroy = other.auto_destroy;
has_mips = other.has_mips;
other.m_tex = false;
}
@@ -271,11 +269,7 @@ glm::vec2 Texture2D::size() const
Texture2D::~Texture2D()
{
//if (auto_destroy)
{
LOG("Texture2D auto destroy");
destroy();
}
destroy();
}
bool Sampler::create(GLint filter /*= GL_LINEAR*/, GLint wrap /*= GL_CLAMP_TO_EDGE*/)

View File

@@ -16,7 +16,6 @@ public:
void operator=(Texture2D&& other) noexcept;
~Texture2D();
bool auto_destroy = false;
bool has_mips = false;
bool create(int width, int height, GLint internal_format = GL_RGBA8, GLint format = GL_RGBA, const uint8_t* data = nullptr);
bool create(const Image& img);