Difference between revisions of "Default DX9Settings.ini"

From Bo3b's School for Shaderhackers
Jump to: navigation, search
m (Protected "Default DX9Settings.ini" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
 
(3 intermediate revisions by one user not shown)
Line 34: Line 34:
 
// values.  Const2 would be seen as c220.y.
 
// values.  Const2 would be seen as c220.y.
 
// 0x3f800000 is 1.0 in floating point hex, 0x00000000 is 0.0 in hex
 
// 0x3f800000 is 1.0 in floating point hex, 0x00000000 is 0.0 in hex
 +
// UseByDef specifies which constant is the default starting value.
 
[PRES1]
 
[PRES1]
 
Const1 = 0x3f800000
 
Const1 = 0x3f800000
 
[PRES2]
 
[PRES2]
 +
UseByDef=True
 
Const1 = 0x00000000
 
Const1 = 0x00000000
 
</nowiki>
 
</nowiki>
Line 47: Line 49:
 
def c200, 0, 1, 0.0625, 0 // x=0 for comparison to Const1
 
def c200, 0, 1, 0.0625, 0 // x=0 for comparison to Const1
  
// if Const1 = 0 turn effect off, else leave it on
+
// if Const1 = 0 disable effect, else leave it on
 
mov r30.x, c220.x
 
mov r30.x, c220.x
 
if_eq r30.x, c200.x
 
if_eq r30.x, c200.x
 
   mov oC0.xyzw, c200.wwww
 
   mov oC0.xyzw, c200.wwww
 +
endif
 +
 +
// enable/disable in one if block
 +
mov r30.x, c220.x
 +
if_eq r30.x, c200.x
 +
  mov r30, c200.wwww // disable
 +
else
 +
  mov r30, v0 // enable
 
endif
 
endif
 
</nowiki>
 
</nowiki>

Latest revision as of 07:41, 7 October 2014

[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
// UseByDef specifies which constant is the default starting value.
[PRES1]
Const1 = 0x3f800000
[PRES2]
UseByDef=True
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
endif

// enable/disable in one if block
mov r30.x, c220.x
if_eq r30.x, c200.x
  mov r30, c200.wwww	// disable
else
  mov r30, v0		// enable
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