flat assembler
Message board for the users of flat assembler.
Index
> Windows > Direct3D 12 Example |
Author |
|
randall 28 Aug 2015, 21:36
I have implemented basic Direct3D 12 application. This is just an example that displays single triangle. Application code, trivial shaders and D3D12 header (not complete) are all in my github repo. Windows 10 is ofcourse required to run this program.
https://github.com/michal-z/asmart/tree/master/d3d12tri |
|||
28 Aug 2015, 21:36 |
|
PeExecutable 28 Aug 2015, 23:42
Thanks for this
|
|||
28 Aug 2015, 23:42 |
|
Roman 29 Aug 2015, 14:10
Its cool ! Dude
I recommend using more macros. For Directx 12 functions. Easier and quicker to write code. I do this for Directx 11 |
|||
29 Aug 2015, 14:10 |
|
Roman 29 Aug 2015, 14:13
randall
Why many asm commands begin symbol $ ? |
|||
29 Aug 2015, 14:13 |
|
PeExecutable 29 Aug 2015, 14:37
Macros don't make it quicker to write code, it's an illusion.
|
|||
29 Aug 2015, 14:37 |
|
randall 29 Aug 2015, 14:38
Roman wrote: randall I prefix asm instructions with $ to force FASMW to highlight them. |
|||
29 Aug 2015, 14:38 |
|
Roman 29 Aug 2015, 16:12
Thanks to macros FASM become the great asm editor
|
|||
29 Aug 2015, 16:12 |
|
PeExecutable 29 Aug 2015, 16:43
You have to understand me better than that. The reason I say that the benefits of macros is an illusion is because of the overloaded impression you create if you forget to talk bad about them. (And I do mean that seriously, I've seen people spend 11 years doing macros without producing any program worth the word 'seriousness')
People overdo them, balance out the impression. I don't like to be pessimistic, but when it comes to your macros, they're fine, but when you need to perform an action repeatedly, like setting a texture for example, you don't want to put that in a macro and repeat the code in your render loop. You want to create tiny very compact c-call functions so it gets a nice small place in the cache. The benefits of omitting one call up against the waste of cache use is absolutely not worth it when it comes to actions that needs to be done repeatedly in critical code. Macros are excellent in non-critical code, because you can waste as much memory you want with non critical code, because it will eventually flush out of the cache anyway. The design principles are: 1. Initialization code goes here 2. Cleanup code goes here 3. Non critical library function include file here 4. Main window procedure included here 5. Critical library functions goes here 6. Main game/program code here 7. Render and Message Loop here Point 1-3 (Use heavy macros, waste as much memory as you want) Point 4-7 (Specialize everything, be careful with expensive macros) You want to flush out 1-3 from cache by placing it away from 4-7. That means if you have a library, you should split that library up into two include files. One include file with non-critical functions and the other with critical functions. Include the critical include file right above the main loop. Normally the critical functions will get cached properly anyway, but by ordering it like this you reduce the chance of an address collision and cache pollution. There is nothing wrong with macros, but one shouldn't forget its use, primarily macro's are made to simplify and reduce the work that the coder needs to do, but when it comes to special places in your code, you need to bring out some manual labour to get the basics perfect. Personally, I use macros but not very extensively because they make the code very specific to fasm and can't easily be ported to other assemblers or other languages. One useful thing to do with macros is to implement Text to speech with macros when debugging a direct3d app, to have windows "say" the error message loud, so you can hear it in a full screen program. Simple but useful. Use match with DEBUG equ TRUE/FALSE, if TRUE it will say the error loud, if FALSE it will print the error. |
|||
29 Aug 2015, 16:43 |
|
Roman 30 Aug 2015, 05:21
randall
How many do you have FPS, on your computer ? I talk about Directx 12 example. And please , tell about your model CPU and Video Card. |
|||
30 Aug 2015, 05:21 |
|
PeExecutable 30 Aug 2015, 09:08
I have a VERY powerful one.
Last edited by PeExecutable on 30 Aug 2015, 09:37; edited 1 time in total |
|||
30 Aug 2015, 09:08 |
|
randall 30 Aug 2015, 09:21
Roman wrote: randall Almost 7000 fps (147-150 micro seconds per frame). Haswell i7, AMD Radeon 260X. |
|||
30 Aug 2015, 09:21 |
|
Roman 30 Aug 2015, 10:40
randall
Thanks ! |
|||
30 Aug 2015, 10:40 |
|
PeExecutable 30 Aug 2015, 10:49
Tiny ! ( Not Randall's )
Based on the card it's a very clever card, I've seen cards that are incredibly stupid choices, but that one is a good one, and I have a tremendeously good one myself. Then there are the mid range clever cards. |
|||
30 Aug 2015, 10:49 |
|
randall 30 Aug 2015, 10:56
I have updated my program to use macros for function calls. Code is shorter and easier to read now.
|
|||
30 Aug 2015, 10:56 |
|
PeExecutable 30 Aug 2015, 10:59
Are you absolutely sure that is what you want?
10-18 (50) Macros ftw. |
|||
30 Aug 2015, 10:59 |
|
randall 30 Aug 2015, 20:01
PeExecutable wrote: Are you absolutely sure that is what you want? Well, I am absolutely sure that I shouldn't listen to you. |
|||
30 Aug 2015, 20:01 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.