Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Fullscreen + Antialiasing = Slow  (Read 3340 times)

0 Members and 2 Guests are viewing this topic.

VinZy

  • Newbie
  • *
  • Posts: 6
    • View Profile
Fullscreen + Antialiasing = Slow
« on: September 19, 2013, 06:25:13 pm »
Hi there,
Thats my first thread here, so first I want to say : thanks a lot for the great lib!

Today I encountered, that Antialiasing is slowing down the fullscreen mode much more than it is slowing down the windowed mode (on a system with WinXP).

With Antialiasing turned off, the FPS fo the rendered window or screen were just depending on the number of pixels, that were shown, so no significant difference between Fullscreen and window mode.

But in a testapplication, with an Antialiasinglevel of 8 for example,
the frames droped down from 3700 to 2000 frames in window mode and from 3000 to 380 in Fullscreen mode!

I tried it on a program, that just draws sfml-text and on a more complex opengl program, different AAlevelss, with a very similar result, it was about the same for SFML 1.6 and 2.1.

How can this be, I´d rather had expected the opposite behaviour.

Greetings
VinZy




eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
AW: Fullscreen + Antialiasing = Slow
« Reply #1 on: September 19, 2013, 07:25:05 pm »
I'd rather ask that your graphics card driver vendor. Performance differences on a single machine with a rathef specific setup is mostly a driver issue.

What graphics card are you using?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

VinZy

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Fullscreen + Antialiasing = Slow
« Reply #2 on: September 20, 2013, 01:27:40 am »
EDIT: Sorry, made a mistake here, ignore this and see my next post.
Hi,
I was using a GeForce 660GTX,
just tested it on a GeForce 525M on Windows 7, even worse here.
maxed window no AA: ~ 3500
maxed window 8x  AA: ~ 3000

Fullscreen no AA: ~ 1500
Fullscreen 8x  AA: ~ 300

wich means, that Fullscreen is at least 2 times slower than window mode,
didnt have that behaviour on the other system though.
Wierd ey?
Can someone please test this on another machine?
« Last Edit: September 20, 2013, 01:52:34 pm by VinZy »

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Fullscreen + Antialiasing = Slow
« Reply #3 on: September 20, 2013, 02:31:37 am »
I modified my non-trivial application to test this instead of making a stub, so the base framerate is more like 300 than 3000.

Fullscreen no AA: ~300-400
Fullscreen 8x AA: ~160-200

Maxed Window no AA: ~150-250
Maxed Window 8x AA: ~100-150

So for me fullscreen has the better performance, and 8x AA hurts a lot in both modes, but it only cuts the performance roughly in half for me rather than in fifths like you report.

I'm using a Dell Vostro laptop with Intel HD Graphics 4000 running Windows 7 64-bit Professional, compiling with Visual C++ 2010 Express using the pre-compiled 32-bit SFML binaries for VS 2010, and using FRAPS's FPS overlay to eyeball/guesstimate the framerate ranges I'm getting.

Whatever you're experiencing, it's probably not SFML's fault.
« Last Edit: September 20, 2013, 02:56:23 am by Ixrec »

VinZy

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Fullscreen + Antialiasing = Slow
« Reply #4 on: September 20, 2013, 01:55:38 pm »
Thanks, looks better.

I made some further test all with the same program, the problem was only with WinXP an Geforce 660,
 i´m going test another machine and give the result soon.

VinZy

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Fullscreen + Antialiasing = Slow
« Reply #5 on: September 20, 2013, 03:22:21 pm »
So I wanted to test it on another XP-System, but the only one I had access to had a crappy on board GPU wich didnt do any AA at all.

Instead I went back to the original driver for the GTX 660, wich gave the same result.
Can someone check this on Windows XP please?

The Results I got are:
Win7
       Geforce 525 M
        Maxed Window :
                      0 x AA: ~400
                      8 x AA: ~80
          Fullscreen:
                      0 x AA: ~400
                      8 x AA: ~110
       Geforce GTX 660
       Maxed Window :
                      0 x AA: ~6000
                      8 x AA: ~2400
          Fullscreen:
                      0 x AA: ~4000
                      8 x AA: ~2500
WinXP
       Geforce GTX 660
       Maxed Window :
                      0 x AA: ~6700
                      8 x AA: ~2500
          Fullscreen:
                      0 x AA: ~4100
                      8 x AA: ~ 520
(with both drivers, original and recent)


VinZy

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Fullscreen + Antialiasing = Slow
« Reply #6 on: September 20, 2013, 03:50:01 pm »
The code I used, to test it is:


#include <SFML/System.hpp>
#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include<stdio.h>

int main()
{ bool fullscreen;
  std::cout<< "fullscreen"<< std::endl;
  std::cin>> fullscreen;

  int antialiasing;
  std::cout<< "antialiasing"<< std::endl;
  std::cin>> antialiasing;

  sf::ContextSettings context;
  context.antialiasingLevel = antialiasing;
  std::vector<sf::VideoMode> modes;
  modes = sf::VideoMode::getFullscreenModes();
  sf::RenderWindow App;
  if(!fullscreen)
   App.create(sf::VideoMode(800,600),"Window",6,context);
  else
   App.create(modes[0],"Fullscreen",sf::Style::Fullscreen,context);

  sf::CircleShape shape(100.f);
  shape.setFillColor(sf::Color::Green);
  sf::Clock Clock;
  float t0;
  float t;
  sf::Font font;
  if (!font.loadFromFile("C:/WINDOWS/Fonts/Arial.ttf"))
   return EXIT_FAILURE;

  while (App.isOpen())
  {
    t = Clock.getElapsedTime().asSeconds();
    float tm = t-t0;
    t0 = Clock.getElapsedTime().asSeconds();
    //static int counter = 0;
    //if(++counter % 100 == 0) std::cout<<1/tm<<std::endl;
    sf::Event event;
    while (App.pollEvent(event))
    {
      if (event.type == sf::Event::Closed)
       App.close();
      if (event.type == sf::Event::KeyPressed)
       App.close();
    }

    char show_time[64];
    sprintf(show_time,"Antialiasing %d   FPS %f",antialiasing, 1/tm);
    sf::Text Text(show_time, font);
    Text.setPosition(50, 500);
    Text.setColor(sf::Color(128, 128, 0));
    App.draw(Text);

    App.clear();
    App.draw(Text);
    App.draw(shape);
    App.display();
  }

    return 0;
}


 

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Fullscreen + Antialiasing = Slow
« Reply #7 on: September 20, 2013, 04:21:48 pm »
You should use the same size for both fullscreen and windowed mode. sf::VideoMode::getFullscreenModes() is likely to return a bigger size, which directly impacts anti-aliasing.
Laurent Gomila - SFML developer