Saturday, July 21, 2018

directx11 - Compiler cannot find some DX11 types (but can find DX10)?


my problem is probably trivial but I'm new to DX and have some trouble. I've found a code snippet (of a Shader class) with ID3D10Effect and ID3D10EffectTechnique types but I'm using DX11 so I changed these to ID3D11Effect and ID3D11EffectTechnique. But the compiler protested saying that it doesn't know such types. I thought: "maybe there aren't such types actually" but quick google search indicated otherwise. I cannot find any information on which header they're in, though.


So which one is it? I've also found out that there used to be a header called d3dx10math.h but there's no d3dx11math.h. Why is that? Are there any other headers/types abandoned in DX11?




Answer



The Effects framework no longer ships and you don't get headers or libs for it. What you do get is the entire source code for it (in e.g. C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Samples\C++\Effects11) so you can compile it and link to it yourself.


I expect that this is just provided for use with older programs upgrading to D3D11 however; new programs shouldn't use Effects but should instead call the raw API, as with state objects and cbuffers the old advantages of Effects are gone and in fact there are several disadvantages to using it.


The main such disadvantage would be relating to cbuffer updates; these need to be more carefully considered and planned, and by hiding this from you Effects can potentially lead to serious performance issues.


You can still use d3dx10math with D3D11. That's just a software-only math library, and you can use any such math library you wish - even the old d3d9 one, or one written for OpenGL.


There are a handful of other enums and defines that still use D3D10 prefixes but I can't recall them offhand - a quick search through the D3D11 header files should turn them up.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...