@hwnd%

Discussions related to graphics (2D and 3D), animation and games programming
Ric
Posts: 297
Joined: Tue 17 Apr 2018, 21:03

Re: @hwnd%

Post by Ric »

Thanks Richard, I have set the debug flag, but have not worked out how to retrieve the info yet, working on that.
You do need to be careful because even the best LLM chatbots are still not good at counting
My son has 1st hand experience of this :shock:

I have changed the next few lines of code to :

Code: Select all

         
   |(^SwapChain{}+8) = |SwapChain%% 
   |(^Dev{}+8)       = |Dev%%                          
   |(^DevCon{}+8)    = |DevCon%%                  
   PRINT "SW ";SwapChain%%
   PRINT "D  ";Dev%%
   PRINT "DC ";DevCon%%
   PRINT SwapChain{}.QueryInterface%%,SwapChain{}.AddRef%%,SwapChain{}.Release%%,SwapChain{}.SetPrivateData%%, \
  \ SwapChain{}.SetPrivateDataInterface%%,SwapChain{}.GetPrivateData%%,SwapChain{}.GetParent%%,SwapChain{}.GetDevice%%
 SYS SwapChain.GetBuffer%%, SwapChain%%, NULL%, GUID_ID3D11Texture2D%%, ^pBackBuffer%% TO hRESULT% 
   PRINT hRESULT%
   PRINT "pointer address BackBuffer ";^pBackBuffer%%
   PRINT "pointer value   BackBuffer ";pBackBuffer%%
   SYS Dev.CreateRenderTargetView%%, Dev%%, pBackBuffer%%, NULL%%, ^BackBuffer%% TO hRESULT%
   PRINT hRESULT%
   PRINT "address BackBuffer         ";^BackBuffer%%
   PRINT "value   BackBuffer         ";BackBuffer%%
360   SYS |(|pBackBuffer%%+16), pBackBuffer%%                                 
inserting PRINT statements as you advised, even though the value of BackBuffer%% is set I still get address out of range at line 360
I have also made all the members of the swapchain,device and device context structures %% variables as these are all pointers(i think).
I cant see where I have gone wrong in the conversion from 32 to 64 bits. Could you please take a look and advise?
Kind Regards Ric.

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

Re: @hwnd%

Post by Richard Russell »

Ric wrote: Fri 13 Mar 2026, 17:13 I cant see where I have gone wrong in the conversion from 32 to 64 bits. Could you please take a look and advise?

Code: Select all

360   SYS |(|pBackBuffer%%+16), pBackBuffer%%                                 
Those 'pipe' characters (|) are very wrong, they are floating point indirection and you shouldn't be doing any floating point operations there! Possibly just a typo, but one guaranteed to cause a catastrophic failure. :oops:

Perhaps you need stronger glasses; I admit I didn't immediately spot the mistake until I enlarged it. :lol:
Ric
Posts: 297
Joined: Tue 17 Apr 2018, 21:03

Re: @hwnd%

Post by Ric »

Thank you, as you point out a typo or should that be many typos. Works so far. Viewports next🤞
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Ric
Posts: 297
Joined: Tue 17 Apr 2018, 21:03

Re: @hwnd%

Post by Ric »

I have got the viewports working as well as the loading of the shaders, but i cant seem to get the input layouts to work. I have changed the address of the semantic name to %% but all the other elements are UINT. It says in the documentation that the best way to create the input element is to keep it to 32 or 64 bytes of which they are currently 32 bytes. (I have tried padding to 64 bytes). When the program is run it simply crashes at the SYS Dev.CreateInputElements%% statement. I know how much you like masses of code so below is the input element code alone. Shoud you require the whole program for reference I would be happy to send it over.

I have looked in to the DEBUG flag, but all the documentation i can find points to running code in visual studio, which obviously im not. How do i get access to the DEBUG info?

Code: Select all

 4920 DIM ied{(2)} = D3D11_INPUT_ELEMENT_DESC{}                         : REM Create the ied structure in the form of the D3D structure D3D11_INPUT_ELEMENT_DESC{}
 4930 REM
 4940 REM      The input LAYOUT must EXACTLY equal the input structure of the VERTEX SHADER
 4950 REM
 4960 ied0$ = "POSITION" + CHR$(0)                                      : REM Create the first Semantic Name
 4970
 4980 ied{(0)}.SemanticName%%        = ]^ied0$                          : REM Set the Semantic Name
 4990 ied{(0)}.SemanticIndex%        = 0                                : REM The semantic index allows the use of multiple versions of the same name, ie 0, 1, 2, 3 etc
 5000 ied{(0)}.Format%               = DXGI_FORMAT_R32G32B32_FLOAT      : REM Set the format to Float3(RGB/XYZ)
 5010 ied{(0)}.InputSlot%            = 0                                : REM Associates the input assembler number : LEAVE IT AT 0
 5020 ied{(0)}.AlignedByteOffset%    = 0                                : REM Each input has to be offset by the inputs before it, this has none so = 0
 5030 ied{(0)}.InputSlotClass%       = D3D11_INPUT_PER_VERTEX_DATA      : REM Make the input apply to each vertex passed to the VERTEX SHADER
 5040 ied{(0)}.InstanceDataStepRate% = 0                                : REM The number of instances to perfor before moving to the next element : Must be 0 if D3D11_INPUT_PER_VERTEX_DATA
 5050
 5060 ied1$ = "NORMAL" + CHR$(0)                                        : REM Create the second Semantic Name
 5070
 5080 ied{(1)}.SemanticName%%        = ]^ied1$                          : REM Set the Semantic Name
 5090 ied{(1)}.SemanticIndex%        = 0                                : REM The semantic index allows the use of multiple versions of the same name, ie 0, 1, 2, 3 etc
 5100 ied{(1)}.Format%               = DXGI_FORMAT_R32G32B32_FLOAT      : REM Set the format to Float3(RGB/XYZ)
 5110 ied{(1)}.InputSlot%            = 0                                : REM Associates the input assembler number : LEAVE IT AT 0
 5120 ied{(1)}.AlignedByteOffset%    = 12                               : REM Each input has to be offset by the inputs before it, this has 3 so = 12
 5130 ied{(1)}.InputSlotClass%       = D3D11_INPUT_PER_VERTEX_DATA      : REM Make the input apply to each vertex passed to the VERTEX SHADER
 5140 ied{(1)}.InstanceDataStepRate% = 0                                : REM The number of instances to perfor before moving to the next element : Must be 0 if D3D11_INPUT_PER_VERTEX_DATA
 5150
 5160
 5170 ied2$ = "TEXCOORD" + CHR$(0)                                      : REM Create the third Semantic Name
 5180
 5190 ied{(2)}.SemanticName%%        = ]^ied2$                          : REM Set the Semantic Name
 5200 ied{(2)}.SemanticIndex%        = 0                                : REM The semantic index allows the use of multiple versions of the same name, ie 0, 1, 2, 3 etc
 5210 ied{(2)}.Format%               = DXGI_FORMAT_R32G32_FLOAT         : REM Set the format to Float2(RG/XY)
 5220 ied{(2)}.InputSlot%            = 0                                : REM Associates the input assembler number : LEAVE IT AT 0
 5230 ied{(2)}.AlignedByteOffset%    = 24                               : REM Each input has to be offset by the inputs before it, this has 6 so = 24
 5240 ied{(2)}.InputSlotClass%       = D3D11_INPUT_PER_VERTEX_DATA      : REM Make the input apply to each vertex passed to the VERTEX SHADER
 5250 ied{(2)}.InstanceDataStepRate% = 0                                : REM The number of instances to perfor before moving to the next element : Must be 0 if D3D11_INPUT_PER_VERTEX_DATA
 5260
 5270 REM
 5280 REM <<<< Set the LAYOUT/FORMAT of the VERTEX SHADER input elements
 5290
 5300
 5310 REM >>>> Create the INPUT LAYOUT for the VERTEX SHADER
 5320 REM
 5330
 5340 Deliberate error
 5350 SYS Dev.CreateInputLayout%%, Dev%%, ied{(0)}, 3, VBufferPointer%%, VBufferSize%%, 0 TO hRESULT%    : REM Using address 'ied{(0)}' as the start address, number of elements, pointer, and size, Create the LAYOUT to ^pLayout%
 5360 IF hRESULT% <> 0 OR pLayout%% = 0 ERROR 100, "Dev:Create Input Layout failed: "+STR$~hRESULT%               : REM Check it was created
 5370 PRINT "success"
 5380 Deliberate error
Kind Regards Ric.

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

Re: @hwnd%

Post by Richard Russell »

Ric wrote: Sat 14 Mar 2026, 21:46 When the program is run it simply crashes at the SYS Dev.CreateInputElements%% statement.
Did you install a Postmortem Debugger? That should automatically open when it crashes; post its register and stack dumps here.
How do i get access to the DEBUG info?
No idea, it's completely outside my experience. Common sense might suggest it sends the info to stdout, which in principle you should be able to see, so long as you run it from a command prompt rather than from the BBCSDL IDE.
Ric
Posts: 297
Joined: Tue 17 Apr 2018, 21:03

Re: @hwnd%

Post by Ric »

Did you install a Postmortem Debugger?
Not yet, is ther one you reccommend, or are they pretty much for much?
Kind Regards Ric.

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

Re: @hwnd%

Post by Richard Russell »

Ric wrote: Sun 15 Mar 2026, 08:48
Did you install a Postmortem Debugger?
Not yet, is there one you reccommend, or are they pretty much for much?
I'm not a good person to ask. I've only ever used Microsoft's, but I know there are others. I expect they would all give you the additional information that could be helpful in tracing the cause of your crash.
Ric
Posts: 297
Joined: Tue 17 Apr 2018, 21:03

Re: @hwnd%

Post by Ric »

Thanks, I looked at the MS one but couldn't fathom it. I will have to put the project on hold temporarily until I can find someone to download a debugger for me and show me how it works. I'll be back as soon as it's sorted.
Kind Regards Ric.

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

Re: @hwnd%

Post by Richard Russell »

Ric wrote: Sun 15 Mar 2026, 10:59 I will have to put the project on hold temporarily until I can find someone to download a debugger for me and show me how it works.
You give up ridiculously easily. Looking at your most recently listed code, there's an obvious mistake:

Code: Select all

 4980 ied{(0)}.SemanticName%%        = ]^ied0$                          : REM Set the Semantic Name
I've no idea what ]^ied0$ is supposed to mean, it's gibberish (it would return a number consisting in part of the string's relative address and in part of its length). I would have expected the code to need a pointer to the string:

Code: Select all

 4980 ied{(0)}.SemanticName%%        PTR(ied0$)                        : REM Set the Semantic Name
But, honestly, as you're so ready to give up, so am I.
Ric
Posts: 297
Joined: Tue 17 Apr 2018, 21:03

Re: @hwnd%

Post by Ric »

Far from giving up, i just need to find some one who can translate passages of text information (and has a knowledge of computing)in to a verbal form. I have not given up I just cant read the information on the web and follow the instructions.
The analogy i use when explaining(and i do very often) is:
If you were reading a book and the first 3 or 4 words of each paragraph were in English, but not necessarily in the right order, and then the rest were in Russian, how long would it be before you stop reading the book?
I am very grateful for all the help you have given, please do not withdraw it.
If i sound frustrated every now and then, it is because i have been thrown in to a world where not much textually makes sense. The person (my father) who used to help me with these issues is no longer available to help. For example i am not typing this i am dictating it to my wife who is typing it for me, as she has no knowledge (or wants any) of computing it has become extremely difficult to impossibe to deciphor the information found by googling.
I am still trying (probably harder than you think) to convert from BB4W to BBCSDL64, it is just that as of 5 months ago, things have been made difficult.

That asside,
thankyou for the help with the pointer.

You say though that

Code: Select all

"]^ied0$"
is meaningless, but i copied it from the original tutorials on D3D11 which had

Code: Select all

"!^ied0$"
is it the level of indirection that makes it so or have I misunderstood?
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023