Default DX9Settings.ini

From Bo3b's School for Shaderhackers
Revision as of 04:06, 31 August 2014 by Bo3b admin (Talk | contribs)

Jump to: navigation, search
[General]

// 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.
UseRenderedShaders=true

// 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.
DumpAll=false

// 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.
[KEY1]
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
[PRES1]
Const1 = 0x3f800000
[PRES2]
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 turn effect off, else leave it on
mov r30.x, c220.x
if_eq r30.x, c200.x
   mov oC0.xyzw, c200.wwww
endif


References:

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