Problem with DirectX and Visual Studio 2k5
Hey,
I've noticed something very wierd. I am using Visual Studio 2k5 for sometime but I've never tried to complile my previous Direct3D relelated projects on this release of Visual Studio, maybe because it never occured because the machine that I was developing them had 2k3. Now for the Problem if you create a Win32 default application with MFC support (or not) that you try to write the following stuff you get linker errors and sometimes complier errors. I've never had them before and I don't know why they are occur. I checked for the Project Properties, altered some stuff (such the use of precompiled headers etc with no luck :S). The DirectX samples compile fine but I don't know the cause of the problems with my code. Any ideas?
The code is...
// in our includes
#include "stdafx.h"
#include "dxstdafx.h"
#include "Help_funcs.cpp"
// more includes blah bla
// the rest of the auto-generated VS studio program follows
// and say you want to declare the following function in a separate file i.e. Helper_funcs.cpp
// This is nothing much just a pretty much straight forward way to check your device function
bool CALLBACK IsDevAcceptable( D3DCAPS9* DeviceCaps, // The Device we input for Check
D3DFORMAT BackBufferFMT, // The Format of the back buffer
D3DFORMAT AdapterFMT, // The Format of the Provided Adapter
bool bWindowed, // Is our Window Full Screen or not?
void* UserContext ) // The UserContext
{
// Create our Direct3D Pointer Object and let's assign it to IDirect3D9 interface
IDirect3D9* p_D3D = DXUTGetD3DObject();
// Now first we need pixel proccessing support, let's find out if we have it!
if ( FAILED( p_D3D->CheckDeviceFormat( DeviceCaps->AdapterOrdinal,
DeviceCaps->DeviceType,
AdapterFMT,
D3DUSAGE_RENDERTARGET || D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING,
D3DRTYPE_SURFACE,
BackBufferFMT ) ) )
{
return false;
}
// Now we also need to skip those back buffer formats that don't support apha pixel blending
if ( FAILED( p_D3D->CheckDeviceFormat( DeviceCaps->AdapterOrdinal,
DeviceCaps->DeviceType,
AdapterFMT,
D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING,
D3DRTYPE_TEXTURE,
BackBufferFMT ) ) )
{
return false;
}
// We Also need floating point render target support from our inputed device so we will check
// if our device is capable of doing so.If so we need to determine how many bits we support
// we can use both 128 bit and 64 bit. In either case we will store the best we have!
if ( FAILED( p_D3D->CheckDeviceFormat( DeviceCaps->AdapterOrdinal,
DeviceCaps->DeviceType,
AdapterFMT,
D3DUSAGE_RENDERTARGET,
D3DRTYPE_TEXTURE,
D3DFMT_A32B32G32R32F ) ) )
{
if ( FAILED( p_D3D->CheckDeviceFormat( DeviceCaps->AdapterOrdinal,
DeviceCaps->DeviceType,
AdapterFMT,
D3DUSAGE_RENDERTARGET,
D3DRTYPE_TEXTURE,
D3DFMT_A16B16G16R16F ) ) )
{
// We don't support neither 64 bit nor 128 bit floating so we can't run this
// sorry pal :-(
return false;
}
}
// We will also need a ShaderModel version 3.0 Support in order to execute this sample
// so we will find if we have that too.
if ( DeviceCaps->PixelShaderVersion < D3DPS_VERSION(3,0) )
{
return false;
}
return true;
}
If you try to compile that you get linker errors, why is that? I do not know :S. So I ask if you know ;)

