Jump to content

  • Log In with Google      Sign In   
  • Create Account


Zaoshi Kaba

Member Since 04 Nov 2012
Offline Last Active Yesterday, 03:21 PM

Topics I've Started

How to make NOT Gate in SSE/AVX?

24 May 2014 - 03:06 AM

Hello.

// I have this
final_var = some_value < 0 ? A : B

// I need to achieve same using SSE/AVX intrinsic
// This is my attempt
mask = _mm256_cmp_ps(some_value, _mm256_set1_ps(0.0f), _CMP_LT_OQ);
part1 = _mm256_and_ps(A, mask);
not_mask = _mm256_andnot_ps(mask, mask);
part2 = _mm256_and_ps(B, not_mask);
final_var = _mm256_or_ps(part1, part2);

However I have problem with not_mask. According to Wikipedia that's the correct way of making NOT gate using NAND gate, however not_mask is always zero (whether input is 0 or -1). Maybe I misunderstood what _mm256_andnot_ps does? Maybe there is different/easier way to solve this problem?

 

Thank you in advance.


Books on clipping/culling?

26 December 2013 - 11:34 AM

Hello,

 

I need to write thesis and my topic is clipping/culling. Googling hardly gives any book results so I was wondering if anyone could recommend some books that would have something about Frustum Culling and/or Occlusion Culling?

 

Thank you in advance.


Renderer class design trouble

12 October 2013 - 03:29 AM

Generally speaking my classes look like this:

struct D3D11 {
	ID3D11Device*;
	ID3D11DeviceContext*;
	IDXGISwapChain*;
	ID3D11RenderTargetView* backbuffer; // should this even be here?
	
	// methods
};

struct HeightmapRenderer {
	D3D11*;
	// other fields
	
	void Render();
	// other methods
};

HeightmapRenderer::Render() method requires view/projection matrices from Camera in order to do it's job, however I'm not sure how to pass this data there. My first thought was to add Camera* field, however Camera might change and I'd have to set new value which I feel is somehow wrong. My second idea was to pass it as argument, but I'd have to do that all the way from Game Logic, such deep argument throwing around doesn't feel right either. Anyone have any suggestions how to handle this?


Calculating normals between heightmaps

23 May 2013 - 12:56 PM

Hello,

 

First of all I wasn't sure whether to post here or in graphics forums; it's related to graphics but problem is general programming.

I need to calculate normals for heightmap (I know how it's done), however my heightmaps are stored separately (a lot of 128x128), so if I calculate normals individually they won't connect well where heightmaps join. I store heightmap data in this structure:

struct HeightmapData {
	XMVECTOR positions[constant][constant];
	XMVECTOR triangleNormals[constant][constant];
	XMVECTOR vertexNormals[constant][constant];
};

Currently I have function vector<Vertex*> getVertex(int x, int z) which loops through all heightmaps, finds all vertexes at (x,z) (they duplicate where heightmaps connect) and returns them, allowing me to basically unite all heightmaps into one big one. However that's extremely slow. Can anyone suggest a better way to correctly calculate normals between heightmaps?

 

Thank you in advance.


Quick question on DEVICE_OMSETRENDERTARGETS_HAZARD

11 March 2013 - 01:53 AM

Hello,

 

D3D11 spews these warnings at me:

D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets: Resource being set to OM RenderTarget slot 2 is still bound on input! [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD]
D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets[AndUnorderedAccessViews]: Forcing PS shader resource slot 1 to NULL. [ STATE_SETTING WARNING #7: DEVICE_PSSETSHADERRESOURCES_HAZARD]

 

I know what they mean and why it happens, I just want to know whether should I simply ignore these warnings, or it's better to set (all?) shader resources to NULL before reusing same texture?

 

Thank you in advance.


PARTNERS