Difference between revisions of "Default DX9Settings.ini"

From Bo3b's School for Shaderhackers
Jump to: navigation, search
Line 48: Line 48:
// if Const1 = 0 turn effect off, else leave it on
// if Const1 = 0 turn effect off, else leave it on
mov r30.x, c200.x
mov r30.x, c250.x
if_eq r30.x, c200.x
if_eq r30.x, c200.x
   mov oC0.xyzw, c200.wwww
   mov oC0.xyzw, c200.wwww

Revision as of 03:32, 31 August 2014


// 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
// c250.  The constants below will be assigned, based on the key preset.
DefVSConst1 = 250  		
DefPSConst1 = 250

// 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 c250.
// The Const1 tells us that we'll need to use c250.x to compare against these
// values.  Const2 would be seen as c250.y.
// 0x3f800000 is 1.0 in floating point hex, 0x00000000 is 0.0 in hex
Const1 = 0x3f800000
Const1 = 0x00000000

To use these constants in the shader add code like:

//def c250, 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, c250.x
if_eq r30.x, c200.x
   mov oC0.xyzw, c200.wwww


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