Jump to content

  • Log In with Google      Sign In   
  • Create Account


Muzzy A

Member Since 25 May 2007
Offline Last Active Jul 12 2014 11:17 AM

Topics I've Started

DirectX 11 Drawing multiple instances of the same object

03 April 2014 - 08:54 PM

I'm trying to set up Direct X 11 and I have a cube that I'm trying to render multiple times in different places.  The problem is only the last one being drawn gets rendered.

 

 

Here is how I set my constant buffers

struct objData
{
    Matrix4x4 world;
    Matrix4x4 viewProj;
};

// I do this for every object
void CRenderer::setPerObjectData( const Matrix4x4& world,const Matrix4x4& viewProj )
{
    D3D11* d3d = g_Engine->getD3D();
 
    objData d = { world,viewProj };
 
    D3D11_MAPPED_SUBRESOURCE edit;
    d3d->getDeviceContext()->Map(_pObjectData, 0, D3D11_MAP_WRITE_DISCARD, 0, &edit);

    memcpy(edit.pData, &d, sizeof( objData ) );

    d3d->getDeviceContext()->Unmap(_pObjectData, 0);
 
    // '_pObjectData' is the same buffer for all the objects being rendered
    d3d->getDeviceContext()->VSSetConstantBuffers(0, 1, &_pObjectData);
}

A question about where to store the Camera!

29 March 2014 - 01:09 PM

Hi, I'm building my own little renderer and there's a couple things that I get undecided about.

 

Where exactly do most of you store things like the Camera and Projection matrix?

I've seen and tried several different ways of doing so, but I'm not satisfied by any of them.

  • Save it in the renderer, pass them as parameters to the render functions - Probably the best way, but I don't want Parameters!
  • Make a singleton for the camera ( HORRIBLE! ) to access it anytime.
  • Make a static variable in the render objects that holds a reference to the camera and projection matrix.

 

I'm just a little curious at how others would do this minor little thing.


SIMD Function - Illegal instruction?

12 January 2014 - 09:35 PM

I made a particle emitter that will use SIMD

But it crashes on the first load in SIMD - Illegal Instruction

// Particle struct

struct Particle
{
__declspec(align(32)) float x[MAX_PARTICLES];
__declspec(align(32)) float y[MAX_PARTICLES];
__declspec(align(32)) float z[MAX_PARTICLES];
__declspec(align(32)) float dirX[MAX_PARTICLES];
__declspec(align(32)) float dirY[MAX_PARTICLES];
__declspec(align(32)) float dirZ[MAX_PARTICLES];
 
__declspec(align(32)) float m_Rate[MAX_PARTICLES];
__declspec(align(32)) int m_RandQuality[MAX_PARTICLES];
__declspec(align(32)) float m_RemainingLifetime[MAX_PARTICLES];
};
 
// The list of particles
Particle m_Particle;
 
 

for( int i=0;i<MAX_PARTICLES; i += 4 )
{
// use SIMD
Particle* pPart = &m_Particle;
 
__m128 x = _mm256_load_ps(pPart->dirX + i);   // Breaks on this line and says "Illegal Instruction" and I have no clue why
__m128 y = _mm256_load_ps(pPart->dirY + i);


// ..
// ..
// ..
}

Any suggesetions?


D3D11 XMVECTOR - Is it safe to always keep loaded?

06 December 2013 - 03:58 PM

I'm making a math library to make doing the XMVECTOR and XMMATRIX math a bit simpler, I want it optimized as much as possible so I want to load the vector as few times as possible... unless it's fast enough I don't have to worry about it?

 

Is it safe to always have data loaded for SIMD instructions? If not, is it going to slow the process down if I Load the XMVECTOR every time I do an operation?

 

I haven't messed with SIMD instructions much..


std::vector<> vs cli::array<>

02 August 2013 - 10:32 PM

Hey I've been messing around with CLR stuff and noticed the 'array' object in there. I looked online for performance comparisons between that and the standard array in c++ and the std::vector class, but couldn't find anything useful.

 

Does anyone know if this class basically a .NET version of the vector class? If it's faster/slower than std::vector? Faster/Slower than standard C++ arrays?

 

 

 

Oh and on a side note, the carets they use '^' are smart pointers right? are these compatible with normal pointers?


PARTNERS