No hardware accelation in MacBook Pro Retina (Intel Iris)

Hello everyone.

This is my first post in the mailing list for sdl2. Nice to meet you all.
By the way, the work accomplished by SDL2 is great! Keep going with
this hard work.

I would like to point here the issue I am having, which seems to be
mac-specific.

I have some code like this (I am using c++ std::unique_ptr, that’s why
you see reset):

sdlWindow_.reset(SDL_CreateWindow(“Guinyote”,
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
0, 0,
SDL_WINDOW_FULLSCREEN_DESKTOP));
sdlRenderer_.reset(SDL_CreateRenderer(sdlWindow_.get(), -1,
SDL_RENDERER_ACCELERATED));

This holds true:

assert (sdlWindow_ != nullptr);
assert (sdlRenderer_ != nullptr);

But THIS is not working:

game_screen_ = SDL_GetWindowSurface(sdlWindow_.get());
assert (game_screen_ != nullptr);

This used to work in different windows and linux machines, but in my
MacBook Pro I get
the following error:

" No hardware accelerated renderers available".

If I use SDL_RENDERER_SOFTWARE, everything works fine, but this code
worked with hardware
acceleration under windows and linux.

Question:

1.- am I doing anything wrong or there is a bug?

Thanks in advance.

Jeffrey Carpenter <@Jeffrey_Carpenter>

Hello everyone.

This is my first post in the mailing list for sdl2. Nice to meet you all.

Greetings! My first post, too. :slight_smile:

By the way, the work accomplished by SDL2 is great! Keep going with
this hard work.

I would like to point here the issue I am having, which seems to be
mac-specific.

I have some code like this (I am using c++ std::unique_ptr, that’s why you see reset):

sdlWindow_.reset(SDL_CreateWindow(“Guinyote”,
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
0, 0,
SDL_WINDOW_FULLSCREEN_DESKTOP));
sdlRenderer_.reset(SDL_CreateRenderer(sdlWindow_.get(), -1, SDL_RENDERER_ACCELERATED));

This holds true:

assert (sdlWindow_ != nullptr);
assert (sdlRenderer_ != nullptr);

But THIS is not working:

game_screen_ = SDL_GetWindowSurface(sdlWindow_.get());
assert (game_screen_ != nullptr);

This used to work in different windows and linux machines, but in my MacBook Pro I get
the following error:

…used to work? Please specify further on this detail, if you could?

" No hardware accelerated renderers available".

If I use SDL_RENDERER_SOFTWARE, everything works fine, but this code worked with hardware
acceleration under windows and linux.

Question:

1.- am I doing anything wrong or there is a bug?

Thanks in advance.

It seems like you might be encountering something similar to an issue I ran into some time back. If you read the remarks section of the wiki documentation for SDL_GetWindowSurface – http://wiki.libsdl.org/SDL_GetWindowSurface?highlight=(\bCategoryAPI\b)|(SDLFunctionTemplate) – you’ll notice it mentioning that you are unable to combine the function call with SDL2’s 3D renderer API.

In my scenario, I was trying to call SDL_SaveBMP with a surface returned from SDL_GetWindowSurface with the 3D renderer API; glorious segmentation faults resulting! I was able to use the SDL_RenderReadPixels function call to successfully achieve my goal…

Do note that my experience is on exclusively Mac OS X; I dunno about Windows & Linux systems. I’m still new to SDL2, too … and I could be totally off the mark on what your problem is, but I hope that this helps lead in the right direction. Good luck! :slight_smile:

Cheers!On 2013/12/ 24, at 2:34, Germ?n Diago G?mez wrote:

Thanks Jeffrey. It seems that this might be the issue. I am using a
renderer and getting the surface from the window. I saw a
SDL_CreateRenderer example and they don’t SDL_GetWindowSurface anywhere.

So the mistake must be here. Though, now I have not time for this issue. I
will check and confirm.

Best Regards

2013/12/27 Jeffrey Carpenter >

Jeffrey Carpenter

On 2013/12/ 24, at 2:34, Germ?n Diago G?mez <@German_Diago_Gomez> wrote:

Hello everyone.

This is my first post in the mailing list for sdl2. Nice to meet you all.

Greetings! My first post, too. :slight_smile:

By the way, the work accomplished by SDL2 is great! Keep going with
this hard work.

I would like to point here the issue I am having, which seems to be
mac-specific.

I have some code like this (I am using c++ std::unique_ptr, that’s why
you see reset):

sdlWindow_.reset(SDL_CreateWindow(“Guinyote”,
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
0, 0,
SDL_WINDOW_FULLSCREEN_DESKTOP));
sdlRenderer_.reset(SDL_CreateRenderer(sdlWindow_.get(), -1,
SDL_RENDERER_ACCELERATED));

This holds true:

assert (sdlWindow_ != nullptr);
assert (sdlRenderer_ != nullptr);

But THIS is not working:

game_screen_ = SDL_GetWindowSurface(sdlWindow_.get());
assert (game_screen_ != nullptr);

This used to work in different windows and linux machines, but in my
MacBook Pro I get
the following error:

…used to work? Please specify further on this detail, if you could?

" No hardware accelerated renderers available".

If I use SDL_RENDERER_SOFTWARE, everything works fine, but this code
worked with hardware
acceleration under windows and linux.

Question:

1.- am I doing anything wrong or there is a bug?

Thanks in advance.

It seems like you might be encountering something similar to an issue I
ran into some time back. If you read the remarks section of the wiki
documentation for SDL_GetWindowSurface –
http://wiki.libsdl.org/SDL_GetWindowSurface?highlight=(\bCategoryAPI\b)|(SDLFunctionTemplate)-- you’ll notice it mentioning that you are unable to combine the function
call with SDL2’s 3D renderer API.

In my scenario, I was trying to call SDL_SaveBMP with a surface returned
from SDL_GetWindowSurface with the 3D renderer API; glorious segmentation
faults resulting! I was able to use the SDL_RenderReadPixels function call
to successfully achieve my goal…

Do note that my experience is on exclusively Mac OS X; I dunno about
Windows & Linux systems. I’m still new to SDL2, too … and I could be
totally off the mark on what your problem is, but I hope that this helps
lead in the right direction. Good luck! :slight_smile:

Cheers!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yeah, an SDL_Surface is not going to give you access to the framebuffer of
an SDL_RENDERER_ACCELERATED renderer (e.g. OpenGL or Direct3D). I think
that’s the rule. If you use SDL_RENDERER_SOFTWARE instead, you can
reliably use SDL_GetWindowSurface(). I would recommend that you stick with
accelerated renderers unless you really, really need that functionality.

Jonny DOn Fri, Dec 27, 2013 at 5:32 AM, Germ?n Diago wrote:

Thanks Jeffrey. It seems that this might be the issue. I am using a
renderer and getting the surface from the window. I saw a
SDL_CreateRenderer example and they don’t SDL_GetWindowSurface anywhere.

So the mistake must be here. Though, now I have not time for this issue. I
will check and confirm.

Best Regards

2013/12/27 Jeffrey Carpenter

Jeffrey Carpenter

On 2013/12/ 24, at 2:34, Germ?n Diago G?mez wrote:

Hello everyone.

This is my first post in the mailing list for sdl2. Nice to meet you
all.

Greetings! My first post, too. :slight_smile:

By the way, the work accomplished by SDL2 is great! Keep going with
this hard work.

I would like to point here the issue I am having, which seems to be
mac-specific.

I have some code like this (I am using c++ std::unique_ptr, that’s why
you see reset):

sdlWindow_.reset(SDL_CreateWindow(“Guinyote”,
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
0, 0,
SDL_WINDOW_FULLSCREEN_DESKTOP));
sdlRenderer_.reset(SDL_CreateRenderer(sdlWindow_.get(), -1,
SDL_RENDERER_ACCELERATED));

This holds true:

assert (sdlWindow_ != nullptr);
assert (sdlRenderer_ != nullptr);

But THIS is not working:

game_screen_ = SDL_GetWindowSurface(sdlWindow_.get());
assert (game_screen_ != nullptr);

This used to work in different windows and linux machines, but in my
MacBook Pro I get
the following error:

…used to work? Please specify further on this detail, if you could?

" No hardware accelerated renderers available".

If I use SDL_RENDERER_SOFTWARE, everything works fine, but this code
worked with hardware
acceleration under windows and linux.

Question:

1.- am I doing anything wrong or there is a bug?

Thanks in advance.

It seems like you might be encountering something similar to an issue I
ran into some time back. If you read the remarks section of the wiki
documentation for SDL_GetWindowSurface –
http://wiki.libsdl.org/SDL_GetWindowSurface?highlight=(\bCategoryAPI\b)|(SDLFunctionTemplate)-- you’ll notice it mentioning that you are unable to combine the function
call with SDL2’s 3D renderer API.

In my scenario, I was trying to call SDL_SaveBMP with a surface returned
from SDL_GetWindowSurface with the 3D renderer API; glorious segmentation
faults resulting! I was able to use the SDL_RenderReadPixels function call
to successfully achieve my goal…

Do note that my experience is on exclusively Mac OS X; I dunno about
Windows & Linux systems. I’m still new to SDL2, too … and I could be
totally off the mark on what your problem is, but I hope that this helps
lead in the right direction. Good luck! :slight_smile:

Cheers!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I changed it. Everything is working correctly with acceleration. No more
SDL_GetWindowSurface(). Instead I create a SDL_CreateTexture for the screen
image and I RenderCopy into it.

2013/12/27 Jonathan Dearborn > Yeah, an SDL_Surface is not going to give you access to the framebuffer of

an SDL_RENDERER_ACCELERATED renderer (e.g. OpenGL or Direct3D). I think
that’s the rule. If you use SDL_RENDERER_SOFTWARE instead, you can
reliably use SDL_GetWindowSurface(). I would recommend that you stick with
accelerated renderers unless you really, really need that functionality.

Jonny D

On Fri, Dec 27, 2013 at 5:32 AM, Germ?n Diago <@German_Diago_Gomez>wrote:

Thanks Jeffrey. It seems that this might be the issue. I am using a
renderer and getting the surface from the window. I saw a
SDL_CreateRenderer example and they don’t SDL_GetWindowSurface anywhere.

So the mistake must be here. Though, now I have not time for this issue.
I will check and confirm.

Best Regards

2013/12/27 Jeffrey Carpenter

Jeffrey Carpenter

On 2013/12/ 24, at 2:34, Germ?n Diago G?mez <@German_Diago_Gomez> wrote:

Hello everyone.

This is my first post in the mailing list for sdl2. Nice to meet you
all.

Greetings! My first post, too. :slight_smile:

By the way, the work accomplished by SDL2 is great! Keep going with
this hard work.

I would like to point here the issue I am having, which seems to be
mac-specific.

I have some code like this (I am using c++ std::unique_ptr, that’s why
you see reset):

sdlWindow_.reset(SDL_CreateWindow(“Guinyote”,
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
0, 0,
SDL_WINDOW_FULLSCREEN_DESKTOP));
sdlRenderer_.reset(SDL_CreateRenderer(sdlWindow_.get(), -1,
SDL_RENDERER_ACCELERATED));

This holds true:

assert (sdlWindow_ != nullptr);
assert (sdlRenderer_ != nullptr);

But THIS is not working:

game_screen_ = SDL_GetWindowSurface(sdlWindow_.get());
assert (game_screen_ != nullptr);

This used to work in different windows and linux machines, but in my
MacBook Pro I get
the following error:

…used to work? Please specify further on this detail, if you could?

" No hardware accelerated renderers available".

If I use SDL_RENDERER_SOFTWARE, everything works fine, but this code
worked with hardware
acceleration under windows and linux.

Question:

1.- am I doing anything wrong or there is a bug?

Thanks in advance.

It seems like you might be encountering something similar to an issue I
ran into some time back. If you read the remarks section of the wiki
documentation for SDL_GetWindowSurface –
http://wiki.libsdl.org/SDL_GetWindowSurface?highlight=(\bCategoryAPI\b)|(SDLFunctionTemplate)-- you’ll notice it mentioning that you are unable to combine the function
call with SDL2’s 3D renderer API.

In my scenario, I was trying to call SDL_SaveBMP with a surface returned
from SDL_GetWindowSurface with the 3D renderer API; glorious segmentation
faults resulting! I was able to use the SDL_RenderReadPixels function call
to successfully achieve my goal…

Do note that my experience is on exclusively Mac OS X; I dunno about
Windows & Linux systems. I’m still new to SDL2, too … and I could be
totally off the mark on what your problem is, but I hope that this helps
lead in the right direction. Good luck! :slight_smile:

Cheers!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org