Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct3D renderer should set D3DCREATE_FPU_PRESERVE for not behaving vastly different on doubles (causes 3rd party lib crashes!) #507

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.0
Reported for operating system, platform: Windows (All), x86

Comments on the original bug report:

On 2011-11-29 12:28:02 +0000, Ellie wrote:

Direct3D renderer should set D3DCREATE_FPU_PRESERVE for not behaving vastly different to OpenGL/software rendering on doubles and break some libraries really badly.

Most notable affected example: Lua, which does the most unpredictable things which are really almost impossible to debug/find out for beginners who never heard this culprit exists.

Since I believe all renderers should behave the same on that doubles simply work as expected in a program, this should really be changed! (also this wasted a few days of my life wondering why everything in my program was so broken)

Please change src/render/direct3d/SDL_render_direct3d.c:441 from:

result = IDirect3D9_CreateDevice(data->d3d, data->adapter,
D3DDEVTYPE_HAL,
pparams.hDeviceWindow,
(caps.
DevCaps &
D3DDEVCAPS_HWTRANSFORMANDLIGHT) ?
D3DCREATE_HARDWARE_VERTEXPROCESSING :
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&pparams, &data->device);

to:

result = IDirect3D9_CreateDevice(data->d3d, data->adapter,
D3DDEVTYPE_HAL,
pparams.hDeviceWindow,
D3DCREATE_FPU_PRESERVE | ((caps.
DevCaps &
D3DDEVCAPS_HWTRANSFORMANDLIGHT) ?
D3DCREATE_HARDWARE_VERTEXPROCESSING :
D3DCREATE_SOFTWARE_VERTEXPROCESSING),
&pparams, &data->device);

Please note this currently makes any accelerated (non-software) SDL Texture renderers inoperable in Lua applications on some Windows configurations in combination with bug # 1331

Of course there might be other ways to fix this I am not aware of, I am not a Windows/Direct3D guru. But if you can't think of any, please take this route soon.

On 2011-12-20 23:13:18 +0000, Ellie wrote:

Any chance we can get this added soon? It's such a little change, yet meaning much e.g. to Lua applications (for which this bug is somewhat of a blocker).

On 2011-12-29 02:18:38 +0000, Sam Lantinga wrote:

Fixed, thanks!
http://hg.libsdl.org/SDL/rev/d4621a7e0faa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant