Any way to check if device can create render target? (DEF-3782)(SOLVED)

E.g. we try to create render target that isn’t supported by device. Is there any way to catch this error (to set different render mode?)

pcall is not working, I still got

Assertion failed: (params.m_Width <= g_Context->m_MaxTextureSize), function SetTexture, file …/src/opengl/graphics_opengl.cpp, line 1879

Oh, yeah, that is not very nice of us! @jhonny.goransson, @sven can we make this throw a Lua error instead?

3 Likes

Yikes, yes we shouldn’t do an assert, a Lua error sounds more reasonable!

Sadly I don’t think we expose the max texture size currently (but internally we try to get it in runtime). You might be able to query it yourself in a native extension though?

(Added a ticket for the assert issue: DEF-3782. Maybe we could discuss in the team if it makes sense to expose the “max texture size”, @britzl?)

2 Likes

Ok, I will try. But please make render target creation without asserts as well - so it will be possible to catch any problems there at early stage. E.g. if device doesn’t support not POT textures.

3 Likes

DEF-3782 is for generating a Lua error. I’ll bring it to our next planning session. It is likely a quickwin.

2 Likes

Here is the small NE I made as @sven suggested.

6 Likes

Released in 1.2.148

1 Like