This demo uses Direct2D to write some Unicode text.
If you want to edit the files be aware that dxmain.inc contains UTF8 charaters, so will be better to use an editor that supports it (notepad+, for example), otherwise the chinese chars will become garbled.
Another point in this demo is that it contains a function to draw a sphere. DirectX 11 does not contain that, Directx 9 did.
Now, I have concentrated in one single include file all the DirectX include stuff. I could have subdivided in a few tens of includes as Microsoft did or in any other arbitrary number. I think one is a good number at this moment.
In the previous examples I had copied to the demo folder all the Microsoft DirectX libraries. Since the number was keeping growing, now I simply set a variable in the build batch file to the hopefully correct path:
@echo off
SET DX11LIB="C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64"
\masm32\bin\ml64 -c -Zp8 dx11_64App3.asm
\masm32\bin\link /ENTRY:WinMain /SUBSYSTEM:WINDOWS /FIXED /LIBPATH:%DX11LIB% /MACHINE:X64 dx11_64App3.obj
(http://www.atelierweb.com/a/dx11_3.png)
Cool 8)
I have the messagebox declaring that direct3d failed to initialize. Are there some user runtimes libraries that i need to download for this program?
I already have the ones of version 9... :idea:
Thank you very much. :icon14:
Builds ok, btw. :icon14:
Hi Felipe,
The application is running in DirectX 11 Debug mode, so you may need the DirectX 11 SDK installed.
You will know the exact error if you launch dbgview.exe and watch the message.
The situation is like this: You need the SDK installed to use the DEBUG flags as I am doing. If you remove the flags it may run but if there is a problem it will be very difficult to know the reason. I.e, you are between a rock and a hard place.
AW as far as i know the Directx 11 sdk is already included in a general sdk or similar for windows 8 and above? :idea:
Siekmanski any tip on how you were able of running the program successfully in your system? :idea:
I already have the latest windows sdk installed (which comes with the build tools). :idea:
Thanks a lot. :icon14:
Felipe,
As I said, you will be probably be able to see the error message with DbgView.exe from Microsoft if you have all the required SDKs.
However, I believe that it has to do with the the arrangement for using Direct2D with DirectX 11, which requires the flag D3D11_CREATE_DEVICE_BGRA_SUPPORT. I will have to make some tests and see if there is a way around it when a system does not support that flag. If not we can always use bitmap/sprite fonts.
Quote from: felipe on June 05, 2018, 04:32:24 AM
Siekmanski any tip on how you were able of running the program successfully in your system? :idea:
First check if your videocard is capable running DirectX 11.
As AW said, install the DirectX 11 SDK.
I have executed all the demos (or programs) of AW here in the game dev subforum, so i guess must the card be capable. :idea:
Any link where to get the sdk (if this is not already part of the one which comes with the build tools)? :idea:
Thanks. :icon14:
DirectX Software Development Kit
https://www.microsoft.com/en-us/download/details.aspx?id=6812
Isn't that the version 9 of the sdk? :idea:
I have runned dxdiag and it says: DirectX version=Directx 11... :idea:
Odd problem... :(
Quote from: felipe on June 05, 2018, 08:03:51 AM
Isn't that the version 9 of the sdk? :idea:
version 9, 10 and 11
I'm almost sure that's the version of the sdk i have (the name is also june 10). Maybe this is really a graphic card problem. This demo-program seems (maybe) that requires more capabilities of the card. And i actually have an "internal one" which is an Intel graphics card (i mean it was in the motherboard by default)... :idea:
One more reason for me to stick with Direct3D9. :biggrin:
:biggrin: I installed (reinstalled :P) that sdk but i had the same problem. Yes, i guess is the graphics card. If i have time i will check where the program firstdetects an error. :idea:
Quote from: felipe on June 05, 2018, 09:02:55 AM
:biggrin: I installed (reinstalled :P) that sdk but i had the same problem. Yes, i guess is the graphics card. If i have time i will check where the program firstdetects an error. :idea:
I tested in a Windows 8.1 64-bit virtual machine and could not run the program, same error you got. dxdiag also reports Directx 11 but I know from experience that applications always fall back to 9.3 because the graphics card is some "virtual crapware", I mean vmWare.
I had to install the Windows DirectX 11 SDK June 2010 AND the Windows SDK 8.1 in order for the debug build of my demo start reporting on dbgview.exe. It reports this:
[4080] D3D11 ERROR: ID3D11Device::CreateVertexShader: Invalid shader version provided: vs_4_0 [ STATE_CREATION ERROR #167: CREATEVERTEXSHADER_INVALIDSHADERTYPE]
I could not make any sense of it (yet).
I placed a break point after this instructions:
; Create shader objects: 1) Vertex Shader
coinvoke d3d11Device, ID3D11Device, CreateVertexShader, r12, r13, NULL, offset VS
and the return value is:
0x80070057
I have no idea of what is wrong and what error 0x80070057 has to do with CREATEVERTEXSHADER_INVALIDSHADERTYPE
QuoteI have no idea of what is wrong and what error 0x80070057 has to do with CREATEVERTEXSHADER_INVALIDSHADERTYPE
If it falls back to direct3D9 then the highest shader version available is 3.0
Works fine for me :t
I noticed that you aren't releasing a few things on exit though, which is causing a bit of a leak.
Quote
D3D11 WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Producer at 0x00000000035640E0, Refcount: 6. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003AA9D90, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003D8E2B0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003B97920, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003B97B30, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003B97500, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003B96AB0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003D9AD30, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003D9AF50, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003D9C310, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003D9DF80, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000000599BD0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F356B0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F60D30, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F60FA0, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F656C0, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F65AC0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F65D60, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F8A730, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F92E80, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F93280, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F8F3D0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F939A0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F325F0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F929F0, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F7F9E0, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F80C70, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F7EF90, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0000000003F34E90, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object : 28 [ STATE_CREATION WARNING #0: UNKNOWN]
The program '[524] dx11_64App3.exe' has exited with code 0 (0x0).
Felipe's problem may be caused by a three things that come to mind.
- If his device is falling back to a 9.3 device the shader creation will fail as Siekmanski mentioned.
- His GPU might not support hardware acceleration on DX11. I'd recommend 'failing back' to a WARP device on device creation failure. This will immediately expand your target audience.
- Build as non-debug device. There are no-redistributables for the debug library. The end user would have to have the same version of SDK installed for the program to run.
:biggrin: Hey ascended, is nice to see you contributing with your knowledge to the forum. Thank you very much! :icon14:
Now this could be a little weird, the control panel from the intel graphics and multimedia says in the section of information system:
DirectX Version= 10.1
Even if dxdiag still shows directx 11... :idea:
From this site: http://www.hb-studios.com/forum/index.php?topic=2100.0 (http://www.hb-studios.com/forum/index.php?topic=2100.0)
QuoteYou need to look under the 'Display Devices' details and see what DDI Version is shown. This will give you the version of Direct X your card supports.
Here's an example from a Radeon HD 5800 card. As you can see, it is only DX 10.1 compatible.
Graphics cards and System Settings are not always the same when it comes to DX compatibility. Most system theses days are DX 11 but not all graphics cards are.
So, probably this is my case. :(
And dxdiag shows in ddi= 10.0, 9.1
:(
The WARP adapter fall back suggestion will fix that. :t
This explains why my exe don't work for you either as I still need to add this myself.
Thanks ascended, if is really possible, will be great that fix so i can play with directx 11 programs too. :bgrin:
If not i will have to wait until i get a better gpu. :idea:
Quote from: felipe on June 05, 2018, 01:08:03 PM
Thanks ascended, if is really possible, will be great that fix so i can play with directx 11 programs too. :bgrin:
If not i will have to wait until i get a better gpu. :idea:
Yep, WARP will run on any hardware where it is DirectX compatible or not.
https://msdn.microsoft.com/en-us/library/windows/desktop/gg615082(v=vs.85).aspx
I still can't run this program (i have the same video card yet). I tried to use the warp trick but didn't work. But maybe because in my system it's the d3d10warp.dll but not the d3d11warp.dll. Anyone know where to find (or how to install) this later dll? Thanks. :thup:
Hi felipe
I think the OP has taken a ride on Halley's comet.
With that being said, this is how you may solve your issue.
First things first, or last. You need to properly set up your window, the one you will
send to D3D in SwapChainDesc.OutputWindow. See how Siekmanski sets up the
window here.
Require advice in wrapping DX11 please : Reply #17
http://masm32.com/board/index.php?topic=7026.15
In DX11_test.zip/DX11.Asm
The emphasis is on SetRect and AdjustWindowRectEx.
OK now before you call D3D11CreateDeviceAndSwapChain make an array with all the
feature sets in them like this
local FeatureLevels[4]:dword
local NumElements:qword
local Feature:qword
...
and Feature, null ; Shows which D3D_FEATURE_LEVEL was selected
mov NumElements, LENGTHOF FeatureLevels
mov FeatureLevels[0*dword], D3D_FEATURE_LEVEL_11_1
mov FeatureLevels[1*dword], D3D_FEATURE_LEVEL_11_0
mov FeatureLevels[2*dword], D3D_FEATURE_LEVEL_10_1
mov FeatureLevels[3*dword], D3D_FEATURE_LEVEL_10_0
then send this array in the call.
lea rdx, (CDirect3d ptr[r15]).m_DeviceContext
mov qword ptr[rsp+58h], rdx
lea rdx, Feature
mov qword ptr[rsp+50h], rdx
lea rdx, (CDirect3d ptr[r15]).m_Device
mov qword ptr[rsp+48h], rdx
lea rdx, (CDirect3d ptr[r15]).m_SwapChain
mov qword ptr[rsp+40h], rdx
lea rdx, SwapChainDesc
mov qword ptr[rsp+38h], rdx
mov qword ptr[rsp+30h], D3D11_SDK_VERSION
mov rdx, NumElements
mov qword ptr[rsp+28h], rdx
lea rdx, FeatureLevels
mov qword ptr[rsp+20h], rdx
mov r9, D3D11_CREATE_DEVICE_SINGLETHREADED
xor r8, r8
mov rdx, D3D_DRIVER_TYPE_HARDWARE
xor rcx, rcx
call D3D11CreateDeviceAndSwapChain
test eax, eax
jz @F
invoke Direct3d.ErrMessage, 04
@@:
Now D3D can chose the latest level supported by your gfx. The value returned in Feature
will indicate which D3D_FEATURE_LEVEL_XX_X was selected.
If this helps don't forget to like, share and subscribe.
There are some undefined symbols in your code, like: D3D_FEATURE_LEVEL_11_1 or CDirect3d which for now i can't work to put in an include file (if i understood well :icon_idea:). Unfortunately i still don't have extra time to code programs in assembly :undecided:. Thanks for your help anyway :thup:.
No worries felipe. Thanks for the like.
It turns out D3D_FEATURE_LEVEL_11_1 is a TYPEDEF which
should reside in a (your) d3dcommon.inc file, see below.
TITLE d3dcommon.inc
...
D3D_FEATURE_LEVEL TYPEDEF DWORD
D3D_FEATURE_LEVEL_9_1 EQU 09100h
D3D_FEATURE_LEVEL_9_2 EQU 09200h
D3D_FEATURE_LEVEL_9_3 EQU 09300h
D3D_FEATURE_LEVEL_10_0 EQU 0A000h
D3D_FEATURE_LEVEL_10_1 EQU 0A100h
D3D_FEATURE_LEVEL_11_0 EQU 0B000h
D3D_FEATURE_LEVEL_11_1 EQU 0B100h
D3D_FEATURE_LEVEL_12_0 EQU 0C000h
D3D_FEATURE_LEVEL_12_1 EQU 0C100h
...
So you should add this
D3D_FEATURE_LEVEL_11_1 EQU 0B100h
into AW's d3d11.inc file, line 161. Level - Easy.
Don't sweat about _THIS CDirect3d. It's just a structure with methods and variables (Class Template)
which when instanced on the Heap makes for an object that serves your application (OOP).
This CDirect3d structure has nothing to do with D3D or any of its COM based methods.
It is in house and belongs to one's own framework/engine. Structures like this proved
abstraction capability for components like Actor, Camera, Scene and so on and so forth
and things like that.
Updated code for copy 'n past into AW's dxMain.inc file. Level - Intermediate.
InitializeDirect3d11App proc
...
local FeatureLevels[4]:dword
local NumElements:qword
local Feature:qword
and rsp, -10h
add rsp, -60h
...
and Feature, null
mov NumElements, LENGTHOF FeatureLevels ; Number of Elements = 4
mov FeatureLevels[0*dword], D3D_FEATURE_LEVEL_11_1 ; Highest FEATURE_LEVEL aimed for in first element.
mov FeatureLevels[1*dword], D3D_FEATURE_LEVEL_11_0
mov FeatureLevels[2*dword], D3D_FEATURE_LEVEL_10_1
mov FeatureLevels[3*dword], D3D_FEATURE_LEVEL_10_0
; Create our SwapChain
mov rcx, NULL
mov rdx, D3D_DRIVER_TYPE_HARDWARE
mov r8, NULL
mov r9, 0
lea rax, FeatureLevels ; <--- Note change No.1
mov qword ptr [rsp+20h], rax
mov rax, NumElements ; <--- Note change No.2
mov qword ptr [rsp+28h], rax ; 'or' mov qword ptr[rsp+28h], LENGTHOF FeatureLevels
mov dword ptr [rsp+30h], D3D11_SDK_VERSION
lea rax, swapChainDesc
mov qword ptr [rsp+38h], rax
lea rax, SwapChain
mov qword ptr [rsp+40h], rax
lea rax, d3d11Device
mov qword ptr [rsp+48h], rax
lea rax, Feature ; <--- Note change No.3
mov qword ptr [rsp+50h], rax
lea rax, d3d11DevCon
mov qword ptr [rsp+58h], rax
call D3D11CreateDeviceAndSwapChain ; Create our SwapChain
cmp eax, 0
jnz @exit
...
After the D3D11CreateDeviceAndSwapChain call returns, if the
local variable Feature has the value 0A000h or 0A100h
( D3D_FEATURE_LEVEL_10_0 'or' D3D_FEATURE_LEVEL_10_1 ) then
your gfx is running DX11 'on' DX10 and you can access
all the, wait for it
Common COM Components.
I have no idea what I said there, but it sounds intelligent.
Things for DX11 only, like Hardware Tessellation will BREAK.
Also Shader Modal 5 is a no no. Use 4.0 or 4.1 instead.
Hope that clears things up for you and all is well.
Hi caché gb, thanks for your reply with code to test. i did the copy paste changes provided for you. apart from changing this as you suggested:
D3D_FEATURE_LEVEL_11_1 EQU 0B100h
i changed null by NULL and all assembled well.
After that i tested the "new" program and it showed the same error. I checked the value in the local variable feature as you indicated and the value (after the call to D3D11CreateDeviceAndSwapChain) was 0A000h.
so if you are right about this statement:
Quotethen your gfx is running DX11 'on' DX10 and you can access all the, wait for it Common COM Components...Things for DX11 only, like Hardware Tessellation will BREAK.
Also Shader Modal 5 is a no no. Use 4.0 or 4.1 instead.
i guess this means that my graphics card has full support for dx10. but my question is: the support for dx11 is none or just limited to the more basic stuffs?
Thanks a lot for your help and time. :thumbsup:
Hi felipe, all good.
"your gfx is running DX11 'on' DX10" - Caché GB
Did I say that?
Just goes to show I should refrain from posting in the
forum while Dr. Bell's is conducting a home consultation.
Re Reply #11, #20
From Google
How to determine the version of DirectX by using the DirectX Diagnostic Tool
1. Click Start, and then click Run.
2. Type dxdiag, and then click OK.
3. On the System tab, note the version of DirectX that is displayed on the DirectX Version line.
Solving felipe's graphics card problems telepathically. Level - ???
I've gone through AW's code for you (reminds me of "Pair Programming")
https://www.youtube.com/watch?v=hc7jHnH5ijE
and noticed a potential problem.
In the DXGI.inc file, line 224, is the define for the DXGI_SWAP_CHAIN_DESC STRUCT.
Make it QWORD aligned like this
DXGI_SWAP_CHAIN_DESC STRUCT QWORD
BufferDesc DXGI_MODE_DESC <>
SampleDesc DXGI_SAMPLE_DESC <>
...
Yes, that it, align it to QWORD.
Talking about qWord, where is he. O'well probably got hijacked by blond twins.
Quote from: felipe on September 22, 2020, 12:01:36 AM
so if you are right about this statement: Quotethen your gfx is running DX11 'on' DX10 and you can access all the, wait for it Common COM Components...Things for DX11 only, like Hardware Tessellation will BREAK.
Also Shader Modal 5 is a no no. Use 4.0 or 4.1 instead.
i guess this means that my graphics card has full support for dx10. but my question is: the support for dx11 is none or just limited to the more basic stuffs?
Thanks a lot for your help and time. :thumbsup:
maybe this explains whats different caps between the different dx versions
https://docs.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-devices-downlevel-intro (https://docs.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-devices-downlevel-intro)
I changed the struct aligment in the dxinc file, but the program shows the same error.
Quote from: Caché GB on September 22, 2020, 03:56:29 AM
I've gone through AW's code for you (reminds me of "Pair Programming")
https://www.youtube.com/watch?v=hc7jHnH5ijE
Althought this video is funny, what do you mean by this? are you hinting that i'm a complete useless programmer? please don't feel any kind of pressure with this, noone is forcing you to help in any kind of way. i really don't have the time to dedicate to this problem for now, so don't you worry if i can't solve the problem. anyway is just a "demo" program. :icon_idea:
No felipe, I think you are great programmer and I give my help willingly.
I was having a dig at AW's code because he does that to other members.
Maybe a bit Geeky of me since his acc. is deleted and he can't respond.
ok caché gb, sorry. thanks a lot by the way. :thup:
Quotehis acc. is deleted
didn't know that. was "auto-deleted" or "admin-deleted"?
just curious hutch :bgrin:
by the way, that ex-google guy from youtube has some funny videos :tongue:. thanks for the tip caché gb :azn: