Jump to content

  • Log In with Google      Sign In   
  • Create Account

MadrMan

Member Since 30 Oct 2009
Offline Last Active Mar 29 2012 03:35 AM

Posts I've Made

In Topic: D3DXCreateTextureFromFile == D3D_OK but crashing.

06 October 2011 - 02:20 AM

Creating a thread from DllMain is actually the correct way to do it.

However, unless you created your device with D3DCREATE_MULTITHREADED there's a good chance it will crash when you load the texture as resource creation in dx9 is not threadsafe and should only done from the main thread (correct me if i'm wrong)

Are you trying to make some sort of plugin system for your game or a generic dll that you can plug into any dx9 game?

What error are you getting anyway?

In Topic: [noob] Upgrade to DX11

05 April 2011 - 11:39 AM

For DX11 you need Windows 7


or Vista with the platform update (included with SP1)

In Topic: Draw a quad, why texture is blur?

08 July 2010 - 09:25 PM

In DX9, if you draw a fullscreen quad you must give the quad a slight offset so it isnt rendered halfway all the pixels, see article:

Directly Mapping Texels to Pixels (Direct3D 9)


In Topic: [DX11] Instancing slows down instead of speeding up

12 April 2010 - 07:15 AM

Well i expected the cbuffers to work well because the nvidia instancing demo works really fast here, but i guess it was rendering less than i am, and it does more stuff than just rendering plain meshes..

I just stumbled across this piece of info in the "A to Z of DX Performance" presentation of Nvidia, and it says this:

Instance data:
ATI: Ideally should come from additional streams (up to 32 with DX10.1)
NVIDIA: Ideally should come from CB indexing


So I guess 'CB indexing' which is what i am doing is faster on Nvidia cards than on ATI cards, but i didnt expect THIS much of a performance decrease. I'll add instancing streams to my engine for ATI and see if it works better or not (if i figure out how, anyway)

In Topic: [DX11] Instancing slows down instead of speeding up

12 April 2010 - 02:57 AM

@ET3D:
I'll have a look at doing it the 'normal' way, with a seperate stream.
The Nvidia "SkinnedInstancing" demo does it using a huge cbuffer so i figured that was a fast way to do it.

@Xeile:
I don't think it would be that much work to see what happens if i try it with a texture, but isn't writing to a texture on the gpu a lot slower than working with a cbuffer? (which are meant to be written to). I guess it would make an interesting test code though.

Here's some code:

Cbuffer creation:

D3D11_BUFFER_DESC gpuBufDesc;
gpuBufDesc.Usage = D3D11_USAGE_DEFAULT;
gpuBufDesc.ByteWidth = desc.Size;
gpuBufDesc.CPUAccessFlags = 0;
gpuBufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
gpuBufDesc.MiscFlags = 0;
gpuBufDesc.StructureByteStride = 0;

dev->CreateBuffer(&gpuBufDesc, nullptr, &gpuBuffer))


Updating of the cbuffer with new data:

context->UpdateSubresource(gpuBuffer, 0, nullptr, memoryBuffer->getBuffer(), memoryBuffer->getSize(), 0);


And here's the draw:

if(instancing)
context->DrawIndexedInstanced(mat.getMeshBuffer()->getIndexCount(), instanceCount, 0, 0, 0);
else
context->DrawIndexed(mat.getMeshBuffer()->getIndexCount(), 0 , 0);


Some of the HLSL:

struct InstanceStruct
{
matrix World : World;
};

cbuffer PerInstanceCB
{
InstanceStruct InstanceData[MAX_INSTANCE_CONSTANTS] : InstanceData;
}

output.Pos = mul(input.Pos, InstanceData[input.IID].World);
output.Pos = mul(output.Pos, View);
output.Pos = mul(output.Pos, Projection);

(And yes i know its faster to make a ViewProjection and multiply with that instead :))


@ROBERTREAD1:
I have a HD4850 with the latest catalyst drivers, so i believe it is support. It may be possible however that the dx11 drivers dont quite support it properly yet though. But wouldn't my cpu usage be skyrocketing then?

PARTNERS