Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Nov 2010
Offline Last Active Oct 14 2016 03:33 PM

Posts I've Made

In Topic: [Solved] Terrain tessellation and depth buffer

15 December 2013 - 11:48 PM

Nevermind. I solved this, I didnt see this post http://www.gamedev.net/topic/603052-slimdx-direct3d10-depth-buffer-only-works-backwards/ which prompted me to check my perspective projection matrix. I had the near and far plane's flipped.

In Topic: Increment texture values using render to texture

15 December 2013 - 06:00 PM

Just want to make sure I understand what you are describing so I'll write up a bit of pseudo code.


Texture2D texA = CreateTexture();
Texture2D texB = CreateTexture();
RenderTarget texARTV = CreateRenderTarget(texA);
ShaderResource texASRV = CreateShaderResource(texA);
RenderTarget texBRTV = CreateRenderTarget(texB);
ShaderResource texBSRV = CreateShaderResource(texB);

// then when rendering

// pass 1


//pass 2

... and so on?

In Topic: [Solved] DX11 Updating texture data

18 July 2011 - 11:14 AM

Well I figured out what the problem was. It was my HR macro that I was using around the map call.

#define HR(x)													\
	{																\
		HRESULT hr = (x);											\
		if(FAILED(x))												\
		{															\
			DXTrace(__FILE__, (DWORD)__LINE__, hr, L#x, true);		\
		}															\

No Idea why this was causing the issue with map, but everything seems to work once i removed it.

In Topic: [Solved] DX11 Updating texture data

15 July 2011 - 12:57 PM

I changed up the program to see if some other part of my code was indirectly causing the mapping issue. Now, all I am doing is initializing D3D then calling this
//Fill out texture desc
	td.ArraySize = 1;
	td.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
	td.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
	td.Height = 500;
	td.MipLevels = 1;
	td.MiscFlags = 0;
	td.SampleDesc.Count = 1;
	td.SampleDesc.Quality = 0;
	td.Usage = D3D11_USAGE_DYNAMIC;
	td.Width = 500;

	HR(device->CreateTexture2D(&td, 0, &m_texture));

	D3D11_MAPPED_SUBRESOURCE mappedResource;
	HR(dc->Map(m_texture, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource));

	BYTE* mappedData = reinterpret_cast<BYTE*>(mappedResource.pData);
	for(UINT i = 0; i < m_buffer.height; ++i)
		memcpy(mappedData, m_buffer.buffer, m_buffer.rowspan);
		mappedData += mappedResource.RowPitch;
		m_buffer.buffer += m_buffer.rowspan;

	dc->Unmap(m_texture, 0);
And I am getting the "already mapped error." Now I am really confused. How can it be already mapped if this the first and only map call I am making. To quote msdn for initializing a dynamic texture

Dynamic Usage
To fill a dynamic texture (one created with D3D11_USAGE_DYNAMIC):

Thats exactly what you guys are telling me and what I am doing haha.
Could it be possible that I am initializing my devices incorrectly?

Tried it on a different computer and also got out of memory error, so pretty obvious now that im doing something wrong haha.

In Topic: DirectX SDK strange bug

15 July 2011 - 11:56 AM

for the lib, try linking to ..\Lib\x86 instead of just \Lib.

I was able to recreate your issued in VS2010 with d3dx10.lib. In the VC++ directories->Library Directories I changed mine to $(DXSDK_DIR)Lib then restarted VS and got the linking error. I changed it back to what i had, $(DXSDK_DIR)Lib\x86 and it worked fine.