Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MCS(t) ((t).getElapsedTime().asMicroseconds())
- #define SAMPLE_SIZE 4
- sf::Clock timer;
- sf::Texture *tex[SAMPLE_SIZE];
- sf::RenderTexture *rtex[SAMPLE_SIZE];
- {
- qDebug() << "Creating" << SAMPLE_SIZE << "512x512 RENDER textures";
- for (int i = 0; i < SAMPLE_SIZE; i++)
- {
- timer.restart();
- rtex[i] = new sf::RenderTexture();
- rtex[i]->create(512, 512);
- qDebug() << i << ":" << MCS(timer);
- }
- timer.restart();
- for (int i = 0; i < SAMPLE_SIZE; i++)
- delete rtex[i];
- qDebug() << "Freeing took:" << MCS(timer) << "\n";
- }
- {
- qDebug() << "Creating" << SAMPLE_SIZE << "512x512 textures";
- for (int i = 0; i < SAMPLE_SIZE; i++)
- {
- timer.restart();
- tex[i] = new sf::Texture();
- tex[i]->create(512, 512);
- qDebug() << i << ":" << MCS(timer);
- }
- timer.restart();
- for (int i = 0; i < SAMPLE_SIZE; i++)
- delete tex[i];
- qDebug() << "Freeing took:" << MCS(timer) << "\n";
- }
- {
- qDebug() << "Creating" << SAMPLE_SIZE << "512x512 textures AND render textures, interleaved";
- for (int i = 0; i < SAMPLE_SIZE; i++)
- {
- timer.restart();
- tex[i] = new sf::Texture();
- tex[i]->create(512, 512);
- qDebug() << "tex " << i << ":" << MCS(timer);
- timer.restart();
- rtex[i] = new sf::RenderTexture();
- rtex[i]->create(512, 512);
- qDebug() << "rtex" << i << ":" << MCS(timer);
- }
- timer.restart();
- for (int i = 0; i < SAMPLE_SIZE; i++)
- {
- delete tex[i];
- delete rtex[i];
- }
- qDebug() << "Freeing took:" << MCS(timer) << "\n";
- }
- {
- qDebug() << "Creating" << SAMPLE_SIZE << "512x512 textures with immediate free";
- for (int i = 0; i < SAMPLE_SIZE; i++)
- {
- timer.restart();
- tex[i] = new sf::Texture();
- tex[i]->create(512, 512);
- qDebug() << i << ":" << MCS(timer);
- delete tex[i];
- }
- qDebug() << "\n";
- }
- {
- qDebug() << "Uploading 512x512 image data" << SAMPLE_SIZE << "times";
- sf::Texture tex;
- tex.create(512, 512);
- sf::Image image;
- image.loadFromFile("samples/512sample.png");
- for (int i = 0; i < SAMPLE_SIZE; i++)
- {
- timer.restart();
- tex.update(image);
- qDebug() << i << ":" << MCS(timer);
- }
- qDebug() << "\n";
- }
- {
- qDebug() << "Downloading 512x512 image data" << SAMPLE_SIZE << "times";
- sf::Texture tex;
- tex.loadFromFile("samples/512sample.png");
- for (int i = 0; i < SAMPLE_SIZE; i++)
- {
- timer.restart();
- tex.copyToImage();
- qDebug() << i << ":" << MCS(timer);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement