Jump to content

  • Log In with Google      Sign In   
  • Create Account

cozzie

Member Since 13 Oct 2004
Offline Last Active Today, 07:56 AM

Posts I've Made

In Topic: Directx 11, 11.1, 11.2 Or Directx 12

Yesterday, 04:55 AM

Hi. Can you explanation a bit more what you want to achieve?
Are you developing your own engine now on d3d9 or 10 and do you want to upgrade/ refactor?

In Topic: Copying A D3D11 Buffer To 2D Texture Of Floats

21 July 2016 - 02:28 PM

It all works like a charm now, thanks.

Also good to know that when moving the d3d11, I need to still approach it like it did initially now.


In Topic: Copying A D3D11 Buffer To 2D Texture Of Floats

20 July 2016 - 03:17 PM

A first attempt, basically only setting SysMemPitch didn't do the trick, same values for the source and dest resources:

	// create buffer with the right data
	D3D11_BUFFER_DESC inputDesc;
	inputDesc.Usage					= D3D11_USAGE_DEFAULT;
	inputDesc.ByteWidth				= sizeof(float) * pM * pN;
	inputDesc.BindFlags				= D3D11_BIND_SHADER_RESOURCE;
	inputDesc.CPUAccessFlags		= 0;
	inputDesc.StructureByteStride	= sizeof(float);
	inputDesc.MiscFlags				= 0;	//D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;

	float *tempArrayA = new float[pM*pN];
	for(int i=0;i<pM*pN;++i) tempArrayA[i] = pPrevSolution[i].y;
	
	D3D11_SUBRESOURCE_DATA vinitDataA;
	vinitDataA.SysMemPitch = sizeof(float) * pM;
	vinitDataA.pSysMem = &tempArrayA[0];

	delete[] tempArrayA;

	ID3D11Buffer *inputBuffer = NULL;
	HR(pDevice->CreateBuffer(&inputDesc, &vinitDataA, &inputBuffer));

	dc->CopyResource(inputPrevSolTex, inputBuffer);
	ReleaseCOM(inputBuffer);

This might mean that the particular piece of code isn't doing anything anyway... will dig in deeper.

If there's something else I've messed, please shout it out :)

 

Also good to mention, I also get this warning/error with the CopyResource:

D3D11 ERROR: ID3D11DeviceContext::CopyResource: Cannot invoke CopyResource when the Formats of each Resource are not the same or at least castable to each other,

I already figured out that 102400 = 160x160x4, where the texture has 160 width and 160 height and the buffer says '102400' width and '1' height.

Bytes and pixels mixed up ?!?! btw, I'm using DXGI_FORMAT_R32_FLOAT.


In Topic: Do My Swordsmen Look Like Cyborgs?

20 July 2016 - 10:21 AM

I think the relatively big armor gives them a bit of a robocop look to me.

In Topic: Good Directx Books

20 July 2016 - 10:19 AM

My share;
- pick up a copy of Luna's d3d11 book, it's likely to be better doable for you then the d3d12 one (no offense, same goes for me)
- for some good, and even more important, practical HLSL effects, I suggest the HLSL cookbook (also d3d11)

PARTNERS