Jump to content

  • Log In with Google      Sign In   
  • Create Account


dr4cula

Member Since 24 Jul 2013
Offline Last Active Sep 20 2014 10:01 AM

#5170934 Basic Fluid Dynamics

Posted by dr4cula on 01 August 2014 - 12:47 PM

float2 bottom = PositionToTexCoord(input.position.xy + float2(0.0f, 1.0f));
float2 top = PositionToTexCoord(input.position.xy - float2(0.0f, 1.0f));

and you are doing

float div = 0.5f * ((r.x - l.x) + (t.y - b.y));

try swapping the +/- where you define bottom and top

 

 

YES! Thank you so much! I guess debugging something for several hours has a tendency to turn out like this >.<

 

The result: http://postimg.org/image/v9kgv9m2b/

 

To be honest though, doesn't the SV_Position semantic go from [0, screenWidth] x [0, screenHeight] from the top left corner? If so, if there's a pixel at (10,10), the bottom one would be (10,11) and top (10,9), wouldn't it?

 

Thanks again!




#5133593 Smart Pointers Confusion

Posted by dr4cula on 22 February 2014 - 10:38 AM

Hello,

 

I was playing around with smart pointers in C++ (VS2010) and encountered some unexpected behavior. Best explained by this code snippet:

// allocate the memory
Test* dynamic = new Test;
 
// take over the ownership
std::unique_ptr<Test> takeOver(dynamic);
 
// wait for ENTER to continue
std::getchar();
 
// clear the memory
takeOver.reset();
 
// shouldn't this cause a crash?
dynamic->reference(1);
 
// oddly enough the following line doesn't cause an immediate crash either
// if I press ENTER next though, it crashes and the debugger says that it might be due to heap corruption
//delete dynamic;
 
std::getchar();

Output I get from the application is the following:

 

Constructing test...
 
Destroying test...
accessing func for owner 1
 
From what I can gather, the memory does get freed since a second delete call causes heap corruption. However, why is the original pointer still valid and prints out the result from that function call?
 
Any help would greatly be appreciated and thanks in advance!



#5106894 DirectX11: Reading raw texture data on the CPU

Posted by dr4cula on 04 November 2013 - 06:09 AM

1314029819767.png
 
When I was loading the textures, I used ZeroMemory() to fill in the D3DX11_IMAGE_LOAD_INFO struct and only set the format, usage and CPU access flags myself. However, this caused the full mipmap chain to be created because
 
 

MipLevels
Type: UINT
The maximum number of mipmap levels in the texture. See the remarks in D3D11_TEX1D_SRV. Using 0 or D3DX11_DEFAULT will cause a full mipmap chain to be created.

 
 
Once I changed the MipLevels value to 1, my original copying code worked. Oops!
 
Thanks for your replies though!




#5100644 DirectX11 entry point

Posted by dr4cula on 11 October 2013 - 03:59 PM

Tried the debug flag and called this right before my draw call:

p_device_->QueryInterface(__uuidof(ID3D11Debug), reinterpret_cast<void**>(&p_debugger_));
HRESULT contextValidation = p_debugger_->ValidateContext(p_deviceContext_);
if(FAILED(contextValidation)) {
MessageBox(NULL, L"Context validation failed.", L"Error", 0);
}

And still nothing...

 

Perf studio frame debugger shows me this: http://i44.tinypic.com/2wfn3ty.png

I tried changing the winding of the triangle's vertices but that didn't change much - the triangle doesn't appear in the window but it does appear in the frame debugger again, though it's a slightly different than the other one.

But the actual frame window is still showing black.

 

EDIT: So, I managed to fix it.I started comparing my configuration to the ones found online and the problem was the following line:

 

p_deviceContext_->ClearDepthStencilView(p_depthStencilView_, D3D11_CLEAR_DEPTH, 1.0f, 0);

 

I had 0.0f instead of 1.0f for the clear value, which I assume didn't match with the OP function set for the depth buffer. The depth buffer has screwed me over in OpenGL and I guess it keeps haunting me in DirectX as well :P Though, Perf studio output still is odd, considering the actual result is this: http://i43.tinypic.com/dxctva.png

 

Anyways, Juliean, thanks for the great tool suggestions! Couldn't try out nvidia's one because I needed an account (need to wait for verification) but definitely will try it out since I have an nvidia card anyways.




PARTNERS