SFML community forums

Help => Graphics => Topic started by: BTregit on November 12, 2020, 01:45:22 pm

Title: RenderTexture does not get destroyed properly when antialiasing is set
Post by: BTregit on November 12, 2020, 01:45:22 pm
When RenderTexture is created inside member function with big size(5000, 1000) and antialiasing is set it deos not get destoryed correctly, i checked ram usage using Windows Task Manager.

SFML version: 2.5.1
Microsoft Visual Studio Community 2019 - Version 16.7.3
Debug x64


Includes:

#include "SFML/Graphics.hpp"
#include "Windows.h"


Here is test class with 2 tests:
test1 - antialiasing is turned on(4)
test2 - antialiasing is turned off(0)

class TestRenderTexture {
public:
        void test1() {
                sf::RenderTexture tex;
                tex.create(5000, 1000, sf::ContextSettings(0, 0, 4, 1, 1, 0, false));
                tex.clear(sf::Color::Transparent);
                tex.display();
        }
        void test2() {
                sf::RenderTexture tex;
                tex.create(5000, 1000, sf::ContextSettings(0, 0, 0, 1, 1, 0, false));
                tex.clear(sf::Color::Transparent);
                tex.display();
        }
};


My main:

int main() {
        TestRenderTexture test;
        test.test1(); // run test1 or test2 here

        sf::RenderWindow window(sf::VideoMode(1200, 675), "Test");

        //loop keeps program open
        while (window.isOpen()) {
                Sleep(400);
                sf::Event ev;
                while (window.pollEvent(ev)) {
                        if (ev.type == sf::Event::Closed) {
                                window.close();
                        }
                }
        }
}

Ram usage results after 30sec:
test1 - 65 Mb
test2 - 28 Mb
Title: Re: RenderTexture does not get destroyed properly when antialiasing is set
Post by: binary1248 on November 12, 2020, 11:02:35 pm
This should already be fixed in master.

Can you give master a try?
Title: Re: RenderTexture does not get destroyed properly when antialiasing is set
Post by: eXpl0it3r on November 13, 2020, 12:01:37 pm
Don't forget you can get snapshot builds for the master branch here (https://artifacts.sfml-dev.org/by-branch/master/) as well ;)
Title: Re: RenderTexture does not get destroyed properly when antialiasing is set
Post by: BTregit on November 13, 2020, 03:46:45 pm
I built master from 20 september, runned my test code and results are the same.

Anyway i tested it few more times and found out that behaviour depends on size and antialiasing level:
  -size 8000x1200, antialiasing 8             works
  -size 8000x1200, antialiasing 4             does not work
  -size 14000x1200, antialiasing 4 or 8   works
  -size 1200x5000, antialiasing 4 or 8     doesn not work
  -size 3300x5000, antialiasing 4 or 8     works
  -size 3300x7000, antialiasing 4 or 8     works
  -size 5480x2000, antialiasing 4             doesn not work
  -size 5480x2000, antialiasing 8              works

works -  RAM freed
does not works -  RAM not freed


Maybe its hardware/software specific or somthing in openGL.
Title: Re: RenderTexture does not get destroyed properly when antialiasing is set
Post by: binary1248 on November 14, 2020, 12:42:47 pm
Since we pass the anti-aliasing level directly to the driver and this behaviour depends on its value, this sounds more like a driver bug.