News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Thoughts on why not to use a STRUCT

Started by Lonewolff, March 16, 2016, 06:08:14 PM

Previous topic - Next topic

Lonewolff

Hi Guys,

I am in the process of creating a blank DX11 render canvas just for learning purposes.

I have been recreating the DXGI_SWAP_CHAIN_DESC structure and the internal structures that are also depended upon, but then it occurred to me that it wouldn't really matter how I put the data into the 60 bytes that are required. Which means I could ditch the struct's altogether.

As long as what is in memory is correct, I could just pass this to D3D11CreateDeviceAndSwapChain(), right?

If my logic is correct, then initialising DirectX 11 could potentially be far easier in MASM than it is in C++.

Is my thinking correct? Love to hear your thoughts :)


[edit]
To reserve a 60 byte chunk of RAM, how do I go about this?


.data
swapChainDesc       BYTE      ??? how do I reserve 60 bytes ???


I am thinking something like above, but aren't quite sure on how to make it 60 bytes long in MASM.

jj2007

swapChainDesc db 60 dup(0)

But it's generally a bad idea not to use structures. You gain nothing, you lose readability. Try to translate the appropriate C header file (or wait until somebody pops up here who has it already :biggrin:).

For translating the occasional C/C++ structure to Masm syntax, see Convert MSDN structures to MASM format.

Attached a raw version of DXGI.inc

Lonewolff

Yeah, makes sense not to cut corners and do the job right the first time.