Jump to content


Member Since 18 Jun 2013
Offline Last Active Sep 22 2015 01:05 PM

Topics I've Started

Fast sqrt for 64bit

20 August 2015 - 05:20 AM

The following code is a very fast method of computing sqrt but in 32bit application.

double inline __declspec (naked) __fastcall sqrt_asm(double n)
    _asm fld qword ptr [esp+4]
    _asm fsqrt
    _asm ret 8

what is the equivalent (in speed) for 64bit application?

Visual studio 2013 (exe release) runs slower compare to VS2010

24 December 2014 - 04:17 AM

Hello, I convert a project that was in VS 2010 to VS2013, everything went smoothly, but the performance (for the release exe, with same exact code, and optimization settings) drop almost in half compared to VS2010. Also the cpu usage was reduced to half compared to VS2010. Any ideas of what is going on?


In detail:


Both have the same code, SDK, scene, optimization settings.


VS2010 release exe (launched outside (and inside) Visual Studio yields same results)

105fps, cpu usage 8-9% (single thread, 100%(usage) / 12(threads) = 8.3% full using a single thread, makes perfect sense, since the application is single thread for the time being)


VS2013 release exe (launched outside (and inside) Visual Studio yields same results)

65fps, cpu usage 4-5% (it only using around half the power of a single thread)

Why discard pixel take a noticeable performance hit?

16 April 2014 - 11:02 AM

something as simple as that

if(textureColor.a < 0.5f)

take around 25% hit in frame rate (assuming all the objects on your scene use that)

Smooth normals

09 November 2013 - 09:47 AM

How do you smooth normals?

Picking triangle

10 September 2013 - 12:26 PM

Based on this tutorial I have try to make it work with triangles with no success.

this tutorial is demonstrating how to how to do picking on the a sphere, so in theory if i take the rayOrigin and rayDirection can work with a  triangle.(without the MatrixTranslation for the center of the sphere), but don't because something needs to be changed regarding the rayOrigin / rayDirection.

all i want is to get the intersection point on the triangle.

struct triangle {
        D3DXVECTOR3 V0;
        D3DXVECTOR3 V1;
        D3DXVECTOR3 V2;
struct Ray {
            D3DXVECTOR3 P0;
            D3DXVECTOR3 P1;
intersect3D_RayTriangle(Ray, triangle, out intersection point);//this method works fine, if you don't put the ray data that comes from this tutorial