Default DX9Settings.ini

From Bo3b's School for Shaderhackers
Revision as of 08:41, 7 October 2014 by Bo3b admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

// UseRenderedShaders=true is nearly always useful, because it trims the 
// list of shaders seen while hunting down to just those active in the 
// current scene.  Disable this only if you get crashes during hunting.

// DumpAll will generate ASM text files for every shader seen by the game.
// This is usually worth doing once, but not useful for every run.

// Constant registers that will arrive in Vertex and Pixel Shaders, as
// c220.  The constants below will be assigned, based on the key preset.
DefVSConst1 = 220  		
DefPSConst1 = 220

// The PresetKeysList specifies which KEYs will be used.
// Multiple keys lists are supported.
PresetsKeysList = 1;

// For this single key example, we only need one keylist, KEY1. This specifies
// that the Numpad 0 keyboard key (Key=96) should act as a toggle. And toggle
// between the two Presets of PRES1, PRES2.  Which will change the Const1 being 
// passed to the shader code from 1.0 to 0.0 as floating point numbers.
// Type=1 is toggle, Type=2 is momentary.
Key = 96
Presets = 1;2;
Type = 1

// Constants that will be sent to every shader through constant register c220.
// The Const1 tells us that we'll need to use c220.x to compare against these
// values.  Const2 would be seen as c220.y.
// 0x3f800000 is 1.0 in floating point hex, 0x00000000 is 0.0 in hex
// UseByDef specifies which constant is the default starting value.
Const1 = 0x3f800000
Const1 = 0x00000000

To use these constants in the shader add code like:

//def c220, Const1, Const2, Const3, Const4
def c200, 0, 1, 0.0625, 0	// x=0 for comparison to Const1

// if Const1 = 0 disable effect, else leave it on
mov r30.x, c220.x
if_eq r30.x, c200.x
   mov oC0.xyzw, c200.wwww

// enable/disable in one if block
mov r30.x, c220.x
if_eq r30.x, c200.x
  mov r30, c200.wwww	// disable
  mov r30, v0		// enable


Microsoft virtual keycodes for Key= use. Especially helpful for those odd keys like Insert, or Pause or F-Keys or Numpad. Must be converted from Hexadecimal to Decimal. keycodes

ASCII table for normal keyboard keys. Use the Dec column. ASCII

Floating point to Hex converter, to make floating point hex constants. At shader runtime, constants are always float. FloatToHex