Showing posts from August, 2010

Post-Build copy DLL to directory

首先撰寫我們的batch file - build.bat:XCOPY ..\..\folder\filename %1 /S /Y @pause 將它放在project檔案旁邊。接著在MSVC中project perporties中的Post-Build Event輸入call ./build.bat $(OutDir)。 如此一來就可以將我們的.dll copy到執行檔旁邊了。 Batch 教學


Creating a Batch File to copy a directory 
 Pre-build Event/Post-build Event Command Line Dialog Box

D3D instancing

Release Bug...


結果竟然是dll and exe的project setting中optimization設定選項問題 (fiber-safe, whole program optimization),我手邊的project沒辦法讓exe dll跟slib用一樣最佳化的參數。改天真要好好搞懂那各是代表什麼意思。

Template in .cpp file

- Compiler uses template classes to create types by substituting template parameters, and this process is called instantiation.

- The type that is created from a template class is called a  specialization.

// in main.cpp
#include "temp.h"

int main()
    Foo A;

    Foo B = A;

    return 0;

// in temp.h template < typename T>
class  Foo
    Foo() ;
    ~Foo() ;

    Foo( Foo &rhs )
        int test = 0 ;

#include "temp.cpp"

template < typename T>
   int test = 0;

template < typename T>
    int test = 0;

template class Foo ;// explicit instantiation 

With this approach, we don't have huge headers, and hence the build time will drop. Also, the header files will be "cleaner" and more readable. However, we don't have the benefits of lazy …

Shader Model 5.0

With Shader Model 5, Microsoft applies certain concepts of object-oriented programming to its shader language, HLSL. Unlike preceding versions, which introduced new capabilities (Dynamic Branching, integer support, etc.)

Increase in maximum texture size from 4K x 4K to 16K x 16K and the possibility of limiting the number of mipmaps loaded in VRAM. There’s also the possibility of changing the depth value of a pixel without disabling functionality like early Z checking, support for double-precision floating-point types, scatter memory writes, etc.

GDC 2009,

Skybox Render

Skyboxes are often frame-buffer-bandwidth bound optimize them:
(1) render them last, reading (but not writing) depth, and allow the early-z optimizations along with regular depth buffering to save bandwidth.
(2) render the skybox first, and disable all depth reads and writes. Which option will save you more bandwidth is a function of the target hardware.

If a large portion of the skybox is obscured, the first technique will likely be better; otherwise, the second one may save more bandwidth.


GPU Gems