Difference between revisions of "SDP Files"
m
no edit summary
imported>DragoonWraith (categorizing) |
imported>Adderek m |
||
Line 26: | Line 26: | ||
0x******** // number of shaders included in the package | 0x******** // number of shaders included in the package | ||
0x000***** // shader data size (filesize-12) | 0x000***** // shader data size (filesize-12) | ||
{shader | {shader blocks} | ||
shader | shader blocks: | ||
{256 bytes with shader's name filled with 0's} | {256 bytes with shader's name filled with 0's} | ||
0x******** // shader's size | 0x******** // shader's size | ||
Line 36: | Line 36: | ||
{shader code} | {shader code} | ||
D3DXAssembleShader returns by default vertex/pixel shader code and version (1*DWORD) and the shader's code without CTAB. It can be optionally assembled with debug flag which adds DBUG table. | D3DXAssembleShader returns by default vertex/pixel shader code and version (1*DWORD) and the shader's code without CTAB. It can be optionally assembled with debug flag which adds DBUG table. Then the shader's content is returned in ID3DXBuffer->GetBufferPointer() if you compile or assemble your shader. You can add CTAB to that assembled code after assembling it. | ||
====CTAB block==== | |||
As for the shaders CTAB block - I was not able to locate any resources/documentation about it. | |||
That format is in general (note that values are saved in different "indian" order): | |||
4B: constant "CTAB" | |||
4B: 0000001C - constant value that I was not able to identify | |||
4B: size of the data block (without "CTAB" and compiler version information but with "ps_*_*" string) | |||
4B: FFFExxyy (pixel shader) or FFFFxxyy (vertex shader) token with shader model (ex. 2.1=ps_2_x) | |||
4B: Number of constants defined in the CTAB/shader | |||
4B: 0000001C - constant value that I was not able to identify | |||
2B: 0001 - constant value that I was not able to identify | |||
2B: 0000 - constant value that I was not able to identify | |||
4B: size of the data block (without "CTAB", compiler version information or "ps_*_*" string) given in bytes | |||
array of structures X: 5-DWORD's per variable | |||
array of structures Y and Z: strings (ASCIIZ) mixed with data description blocks. | |||
ASCIIZ: string with the shader's version (ex. "ps_2_x") | |||
ASCIIZ: Compiler version information (ex. "Microsoft ® D3DX9 Shader Compiler 9.08.299.0000") | |||
Sequence of n characters 0xAB (where n is between 0 and 3) to align the data to DWORD-size | |||
Every structure X is: | |||
4B: byte-based offset to the name (starting after "CTAB") | |||
2B+2B: destination register (ex. 0002+0007 is c7, 0003+0005 is s5) | |||
4B: some value that I was not able to identify (it can have different values for the same variable in different CTAB's but seems to be in some way related to the data type) | |||
4B: byte-based offset to the data type (starting after "CTAB") | |||
2B: 00000000 - constant value that I was not able to identify | |||
Every Y structure is: | |||
nB: variable names ended with 0; several names can be defined in 1 structure; structure is alligned with 0xAB characters to a DWORD-size (since the structure is DWORD-based) | |||
Every Z structure is: | |||
2B+2B: some value that I was not able to identify | |||
2B: number of rows in the data type (ex. float4 => 4, float3 => 3) | |||
2B: number of columns in the data type (ex. float4 => 1, float4x4 => 4) | |||
2B: number of elements in the array (ex. float4[5] => 5) | |||
2B+2B+2B: 0000 0000 0000 - constant values that I was not able to identify | |||
In order to export/disassemble and then assemble/import all the shaders you need to extract CTAB blocks as well. Without that step you might be missing some effects (one that I have seen is still water without any ripples). | |||
If you need help with the shaders (or some simple tools to extract/import them) you might try timeslip's shader tool (to do: verify how it handles CTAB block cause I think that it is ignoring it), use oldblivion (to do: check how it is handling CTAB block) or contact with me (adderek at bethsoft forums). | |||
[[Category: Data Files]] | [[Category: Data Files]] | ||
[[Category: Miscellaneous]] | [[Category: Miscellaneous]] |