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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Kylotan

Pages: [1]
1
This bit of code is helping me work around the issue. Anywhere you need to render text or sprites and it sometimes renders wrongly, insert a call to this function right before it to ensure the texture will get re-bound properly. It's a hacky thing that creates a 1x1 texture and draws a sprite with it offscreen.

#include <SFML\Graphics.hpp>
void WorkaroundAMDBug(sf::RenderWindow* window)
{
        static sf::Texture amdWorkaroundImage;
        static sf::Sprite sprite;

        if (amdWorkaroundImage.getSize() == sf::Vector2u(0,0))
        {
                amdWorkaroundImage.create(1, 1);
                sprite.setTexture(amdWorkaroundImage);
                sprite.setPosition(-20, -20); // offscreen
        }
        window->draw(sprite);
}
 

2
It turns out that the beta drivers crash Dishonored, so bear their experimental status in mind if you upgrade to get round this bug. I can't say I'm too happy with AMD really - seems they routinely put out drivers that break things.

3
Confirmed: updating the drivers to the 12.11 Beta version (dated 7th November 2012) fixes the problem for me.

4
NB: I typed all this out before Farmer posted!


I've tried running this example through AMD's GPU PerfStudio and it seems like everything is called from SFML the way you'd expect. There's one glDrawArrays call made for each shape and sprite, the most recent glBindTexture call is always to the texture you expect (or 0 for the shapes), and glGetError always returns GL_NO_ERROR after every single operation.

However when I grab a freeze frame under GPU PerfStudio, the frame it shows at that point always has the first 4 quads missing (whether everything has been rendering correctly or not) - not even rendered as a white block (as in Tiseno's examples above) or a black one (as I've been seeing locally with Tiseno's code).

So, it looks to me very much like a bug in the AMD drivers.

5
Anybody got any idea what can be done about this? A workaround maybe?

6
Hey, I just want to say thanks to you all for the effort put in to examining this problem.

I can confirm that I see Cire's results with his test code. With the code as posted, I get the blocky text on the second rendering. If I comment out the setOutlineThickness call, the text is fine both times.

I can also confirm thisdyingsoul's results: if I comment out the setOutlineThickness call, AND swap the order of the first 2 draw calls, the second text rendering is broken.

However, if I swap both sets of draw calls (ie. so it's text before box, both times), leaving setOutlineThickness commented out - then the text is fine both times.

7
He asked because in the latest sources there's no more default font, and you said you used the latest sources ;)
Ok, I'd rebuilt against the new headers, but forgot to copy the new DLLs over. Now I've done that, as you would expect, the text doesn't render at all - but once I add in a font and load a TTF into it, I get the same problem as I did before.

I guess Cire has shown that it's not just my system though, for which I'm thankful!

8
See the example code above - it uses the default font on Windows. (Arial?) However in my full program I get the same results with other TTF and OTF fonts.

9
Ah, thank you! I just got the latest nightly and tested with that, and I still see the same problem.

10
thisdyingsoul, did you get the same result with the latest source? I don't want to have to go through the build process unless I'm confident that it will fix the problem.

11
Windows 7, AMD Radeon HD 6800 Series (not sure exactly which model, since the Catalyst Control Center doesn't tell me!), latest drivers (12.10).

Note that I'm not using the latest source, but the most recent binary download.

12
Actually, I got lucky and found a quick repro case.


#include <SFML/Graphics.hpp>

int main()
{
        sf::RenderWindow window(sf::VideoMode(900, 900), "Test");

        sf::RectangleShape shOutline;
        sf::Text tName;

        tName.setPosition(sf::Vector2f(10,10));
        tName.setCharacterSize(20);
        tName.setString("Abcdefgh");
        shOutline.setPosition(sf::Vector2f(10,10));
        shOutline.setSize(sf::Vector2f(100,30));
        shOutline.setFillColor(sf::Color(128,128,128,128));
        shOutline.setOutlineColor(sf::Color(255,255,255));
        shOutline.setOutlineThickness(2.0);

        while (1)
        {
                sf::Color darkGreyGreen(10, 30, 10, 255);
                window.clear(darkGreyGreen);

                window.draw(shOutline);
                window.draw(tName);

                window.display();
        }
}
 

The result is shown in the image attached.

And if I comment out window.draw(shOutline), the text renders normally.

[attachment deleted by admin]

13
As mentioned above, that's unlikely to happen right now. It's a fairly complex project with lots of what gets rendered being conditional on various in-game values, and it'll be quite slow to clone it all and simplify it. However the actual rendering part is simple so I was hoping someone might have some ideas on what could be going wrong.

14
Newer versions? As far as I can tell 2.0RC is the newest version that can be downloaded without building it myself, no? And the live docs say nothing about the default font being deprecated.

As for a minimal example, that's probably not going to happen in the short term so I'm trying to find out if this is a known problem that may have been fixed since 2.0RC.

All I can say, is that we never change the RenderStates, or the Font, but sometimes the text doesn't work, and sometimes it does.

15
Graphics / sf::Shape rendering seems to break sf::Text rendering (2.0RC)
« on: October 31, 2012, 08:29:25 pm »
I am rendering a lot of text to the screen, and usually it works correctly, but I've found that when I render sf::Shapes too, especially when there are a lot of shapes, the text rendering breaks. Specifically, it looks like either the text texture gets lost or the blending is broken because each glyph is rendered as a filled white square instead of showing the character.

This isn't consistent and it appears that one text can render wrongly while the very next text can appear correctly, with no other rendering taking place between the two. But it only happens when shapes are being drawn in that frame. Commenting out calls to a shape's draw() method fixes the behaviour.

It's as if some part of the rendering state is leaking out from one call to another - but we're just calling draw() on each Drawable without passing in a RenderStates argument, so I would have thought it would reset to normal on each call.

I'm using the default font for all text, but it happened with loaded fonts also (TTF or OTF).

Is this a known bug in SFML? Or if not, is there some way I can help in tracking down what is causing this?

(Using the April 2.0RC build, on Windows 7.)

Pages: [1]