@hwnd%

Discussions related to graphics (2D and 3D), animation and games programming
Richard Russell
Posts: 692
Joined: Tue 18 Jun 2024, 09:32

Re: @hwnd%

Post by Richard Russell »

Richard Russell wrote: Thu 23 Apr 2026, 13:15 (these are 32-bits values, not 64):
Compiled for 64-bits:

sizeof(D3D11_DEPTH_STENCIL_DESC) = 52
sizeof(D3D11_DEPTH_STENCIL_VIEW_DESC) = 24

Confirming that they are indeed unchanged in size from 32-bits.
User avatar
JeremyNicoll
Posts: 92
Joined: Sun 26 Jul 2020, 22:22
Location: Edinburgh

Re: @hwnd%

Post by JeremyNicoll »

Richard Russell wrote: Thu 23 Apr 2026, 13:01
I commonly check the sizes of structures by compiling them. You don't need entire SDKs or IDEs for that, just the relevant header (.h) file which can usually be found at GitHub. Here's an extract from the output from just such a program of mine:
...
sizeof(WSADATA) = 400
sizeof(DXGI_SWAP_CHAIN_DESC) = 60

The only reason I thought of VS CE is that some of the StackOverflow posts I read seemed to imply that it comes with many/most/some sets of standard header files & would presumably install itself already knowing where those were & might be able to compile something with minimal subsequent setup.

Which compiler are you using for this? Do you just run it from the CLI?

Can one tell from a header file what the length of different data-types (for a specific architecture) is & what the alignment rules are?
Richard Russell
Posts: 692
Joined: Tue 18 Jun 2024, 09:32

Re: @hwnd%

Post by Richard Russell »

JeremyNicoll wrote: Thu 23 Apr 2026, 15:41 The only reason I thought of VS CE is that some of the StackOverflow posts I read seemed to imply that it comes with many/most/some sets of standard header files...
That's true, but it's a massive install and I would have concerns about it interfering with existing development tools (e.g. C compilers and linkers) if utilities or files with the same name were to be added to the PATH by that installation. Anybody developing Windows applications will already have all the relevant header files (in my case installed automatically by MinGW).
Which compiler are you using for this? Do you just run it from the CLI?
GCC, it's by far the most popular non-proprietary (i.e. non-Microsoft and non-Intel) compiler (I know there's Clang, but as discussed in a recent thread here that lacks the global register variables feature which is so valuable to an interpreter). :D
Can one tell from a header file what the length of different data-types (for a specific architecture) is & what the alignment rules are?
Not typically, no, because everything will relate back to the native C data types like char and int and only the compiler knows what their sizes are on any given platform and configuration.

Even if you can deduce the size from header files alone, doing this 'manually' is a nightmare because it can involve tracing through a hierarchy of dozens of dependent header files. Letting the compiler do it for you is much easier and safer!
Ric
Posts: 313
Joined: Tue 17 Apr 2018, 21:03

Re: @hwnd%

Post by Ric »

I have been using Meta AI to try and solve my problem and it has come up with this
FNf4(1.0) returns integer &3F800000. BBCSDL32 pushes that 32-bit int on the stack. D3D11 reads it as a 32-bit float = 1.0. All good.

In BBCSDL64, FNf4(1.0) still returns integer &3F800000, but SYS passes all integers as 64-bit. So D3D11 gets 0x000000003F800000.

The x64 calling convention puts the 5th parameter Depth in the XMM3 register for floats. But because you passed an integer, BBCSDL64 puts 0x000000003F800000 in R9, not XMM3. D3D11 looks in XMM3 and finds 0.0 or garbage that reads as -0.0.

Rule: For COM SYS calls in 64-bit, if the parameter is FLOAT, DOUBLE, or any struct-by-value, you MUST pass a float variable, not an integer with the bits.

Fix line 3670
Don’t use FNf4 in the SYS. Use a real float variable:
does anyone know if this is true, and if it is, can you suggest a solution
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Richard Russell
Posts: 692
Joined: Tue 18 Jun 2024, 09:32

Re: @hwnd%

Post by Richard Russell »

Ric wrote: Sun 26 Apr 2026, 16:23 does anyone know if this is true, and if it is, can you suggest a solution
What specific API function(s) are you referring to here? Certainly care must be taken when passing float parameters (that is scalar values, not arrays) to SYS calls; this is called out in the 'differences' document: "when running in 64-bits they must be passed as a single parameter, with special precautions in the event of the value being zero". There's example code in that document.
Ric
Posts: 313
Joined: Tue 17 Apr 2018, 21:03

Re: @hwnd%

Post by Ric »

Thanks for all your help guys, i now have my landscape up and running using d3d11 in bbcdsl64. When i was working in bb4w it was possible to output to the screen using basic ooutput, whuch made testing variables at run time easy. With bbcsdl I havent found the same success, is ther a way of using basic output as well as d3d, maybe with a separate output window like visual studios consol output for c++? I have tried creating a child window but it doesnt seem to work. Can anyone help?
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Richard Russell
Posts: 692
Joined: Tue 18 Jun 2024, 09:32

Re: @hwnd%

Post by Richard Russell »

Ric wrote: Sat 20 Jun 2026, 20:30 is ther a way of using basic output as well as d3d, maybe with a separate output window like visual studios consol output for c++?
I honestly have no idea. It's not surprising that you can't mix your D3D11 graphics output with the OpenGL text output from BBCSDL, the two different 3D drivers probably can't coexist. I tend to fall back on displaying diagnostic information in the title bar, which I assume will work for you, but obviously the 'real estate' in the title bar is very limited.

I wonder if it might be possible to use the recently-developed spawnlib library to spawn another process in which you display your diagnostic output. I have no idea whether that would work, but you could try it.