Bo3b's School For Shaderhackers
  44 / 88    
I saw the documentation in the d3dx.ini but I wasn't sure how to use it in a shader, thanks. I only have a desktop but I didn't think of discover mode, that is a possibility, I have the glasses. I think that you are quite young, I am probably the oldest prospective shader hacker that there is. I was a computer operator on 2nd & 3rd generation mainframes (ICL 1500, IBM 360 & ICL System 4), then I became a programmer but of commercial software although I have programmed micro code, assembler and modified a compiler. I have worked for Friden (old computer division of Singer), Nixdorf, Siemens and the last years a small software house which developed its own package on Win dows for car dealers. Now I am retired at the age of 67 (so plenty of time to do shader hacking) and my hobby is computer games. I have a 3D monitor but nowadays I always play on a projector and almost only in Stereo 3D but I have quite a few games which are completely broken and there is no fix so I thought it would be a fun idea to learn shader hacking and try to fix them myself however I am having a hard time understanding how 3D works - what are matrices in 3D terms ?. I will study your comments and try to understand them. I am an Englishman living in Holland, you are an Australian I believe so we have completely different time zones - 10 hours difference ? So now you know a bit more about the person you are helping. I could gift you the game which would make it easier to communicate, that's absolutely no problem. I don't expect you to solve it for me, just use it to give me advice.
I saw the documentation in the d3dx.ini but I wasn't sure how to use it in a shader, thanks. I only have a desktop but I didn't think of discover mode, that is a possibility, I have the glasses.

I think that you are quite young, I am probably the oldest prospective shader hacker that there is. I was a computer operator on 2nd & 3rd generation mainframes (ICL 1500, IBM 360 & ICL System 4), then I became a programmer but of commercial software although I have programmed micro code, assembler and modified a compiler. I have worked for Friden (old computer division of Singer), Nixdorf, Siemens and the last years a small software house which developed its own package on Win dows for car dealers. Now I am retired at the age of 67 (so plenty of time to do shader hacking) and my hobby is computer games.

I have a 3D monitor but nowadays I always play on a projector and almost only in Stereo 3D but I have quite a few games which are completely broken and there is no fix so I thought it would be a fun idea to learn shader hacking and try to fix them myself however I am having a hard time understanding how 3D works - what are matrices in 3D terms ?. I will study your comments and try to understand them.

I am an Englishman living in Holland, you are an Australian I believe so we have completely different time zones - 10 hours difference ?

So now you know a bit more about the person you are helping. I could gift you the game which would make it easier to communicate, that's absolutely no problem. I don't expect you to solve it for me, just use it to give me advice.

Posted 11/19/2015 01:59 PM   
Nice to meet you tonka! Your prior experience with assembly languages is sure to come in handy. I myself had experience in PPC and x86 assembly (both writing it, and reverse engineering code written by others) before I started here, which made picking up shader assembly easy. I'm 29 and currently working as a Software Engineer in one of IBM's most well regarded open source labs ([url]http://ozlabs.org/about.html[/url]). I mostly do quite low level work there close to the hardware - hacking on the Linux kernel, device drivers, PPC assembly, FPGAs, etc. Computer graphics has always been a particularly interesting subject to me, and I had dabbled in DirectX and OpenGL programming on and off for well over a decade before I joined this community, so I was already somewhat familiar with how games work which was probably an advantage when I started out shaderhacking (although I still had a lot to learn, having only ever used the fixed rendering pipeline before that). I now have a pretty good understanding of the maths involved with computer graphics, but I think a lot can still be achieved without an in depth knowledge as a lot of our fixes involve recognising patterns (like spotting a matrix multiply as a sequence of four dot products or a mul/mad/mad/add sequence with consecutive constant registers) and a whole lot of trial and error - understanding the maths has been most useful to develop new fixes for some of the harder effects in unknown games/engines. Maths has always been a fairly strong subject for me (I would have easily been in the top two of my class in high school, although my university lecturers were not cut out for teaching so I didn't formally continue with it). Unfortunately the particular field of maths most relevant to video games (linear algebra) was not taught at all in the region I grew up in, and I'd only covered the basics while dabbling with computer graphics, so this was one area I focussed on a lot and experimented with to really gain a deep understanding (some of my experiments using python and numpy: [url]https://github.com/DarkStarSword/3d-fixes/blob/master/matrix.py[/url]). If you read up on linear algebrea yourself keep in mind that video games are restricted to a relatively small practical subset of the field, so it's most useful to read resources that are aimed at game developers rather than resources aimed at pure theoretical mathematicians. In particular, games use the four dimensional homogeneous coordinate system because it allows them to use matrix multiplications to arbitrarily move, scale and rotate three dimensional coordinates between different frames of reference (things get a little more involved in the projection matrix that does actually use the homogeneous w coordinate, but only to store the coordinate's original depth). If you want to gift me the game I won't say no as long as there are no strings attached - just add me as a friend on Steam, same username as here.
Nice to meet you tonka!

Your prior experience with assembly languages is sure to come in handy. I myself had experience in PPC and x86 assembly (both writing it, and reverse engineering code written by others) before I started here, which made picking up shader assembly easy.

I'm 29 and currently working as a Software Engineer in one of IBM's most well regarded open source labs (http://ozlabs.org/about.html). I mostly do quite low level work there close to the hardware - hacking on the Linux kernel, device drivers, PPC assembly, FPGAs, etc.

Computer graphics has always been a particularly interesting subject to me, and I had dabbled in DirectX and OpenGL programming on and off for well over a decade before I joined this community, so I was already somewhat familiar with how games work which was probably an advantage when I started out shaderhacking (although I still had a lot to learn, having only ever used the fixed rendering pipeline before that).

I now have a pretty good understanding of the maths involved with computer graphics, but I think a lot can still be achieved without an in depth knowledge as a lot of our fixes involve recognising patterns (like spotting a matrix multiply as a sequence of four dot products or a mul/mad/mad/add sequence with consecutive constant registers) and a whole lot of trial and error - understanding the maths has been most useful to develop new fixes for some of the harder effects in unknown games/engines.

Maths has always been a fairly strong subject for me (I would have easily been in the top two of my class in high school, although my university lecturers were not cut out for teaching so I didn't formally continue with it). Unfortunately the particular field of maths most relevant to video games (linear algebra) was not taught at all in the region I grew up in, and I'd only covered the basics while dabbling with computer graphics, so this was one area I focussed on a lot and experimented with to really gain a deep understanding (some of my experiments using python and numpy: https://github.com/DarkStarSword/3d-fixes/blob/master/matrix.py).

If you read up on linear algebrea yourself keep in mind that video games are restricted to a relatively small practical subset of the field, so it's most useful to read resources that are aimed at game developers rather than resources aimed at pure theoretical mathematicians. In particular, games use the four dimensional homogeneous coordinate system because it allows them to use matrix multiplications to arbitrarily move, scale and rotate three dimensional coordinates between different frames of reference (things get a little more involved in the projection matrix that does actually use the homogeneous w coordinate, but only to store the coordinate's original depth).

If you want to gift me the game I won't say no as long as there are no strings attached - just add me as a friend on Steam, same username as here.

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 11/20/2015 02:54 PM   
Nice to meet you DarkStarSword, The assembly languages I used were on computers which stored programs and data on large cards with a magnetic stripe which were read in via a chute, updated and then ejected. The programs could be run and modified in the memory but had to be saved back to the cards. The save utility refused to update used cards so an essential item for programmers was a magnet which we used to clear the stripes when we saved the program. Next I worked on computers of which the hard disks were a complete cabinet. On windows I worked with a Basic language called V/Pro from an American firm called Basis who also has a 50% share in my old software house. They now have a language called BBJ which uses a Java interpreter. The HLSL code is not so difficult for me to understand but the whole structure with 4 components on a register and the matrix business is new to me, in fact programming games is a completely new experience but you are never too old to learn. Previously I used to only play adventures because I like puzzles (I played The Longest Journey and Dreamfall and I have Dreamfall Chapters which I know you fixed but I still haven't played it) but nowadays I only play 3D games. I like using motion controls so I have a Razor Hydra which I program and use for almost every game and now I am using voice control (VoiceBot) also which adds a new dimension to games. I must say shader hacking is fun but I wish that I understood a bit more of what is going on. Will you tell me the various patterns and how to react to them. I am busy with Vapour now checking all the shaders that I marked to see if they have any effect or not using Discover which was a great idea and saves a lot of time - a lot of them don't seem to have any effect. when I get stuck I will ask you for help if that's ok. I am a perfectionist from the work point of view so we will see how far I come. You have now the game.
Nice to meet you DarkStarSword,

The assembly languages I used were on computers which stored programs and data on large cards with a magnetic stripe which were read in via a chute, updated and then ejected. The programs could be run and modified in the memory but had to be saved back to the cards. The save utility refused to update used cards so an essential item for programmers was a magnet which we used to clear the stripes when we saved the program. Next I worked on computers of which the hard disks were a complete cabinet. On windows I worked with a Basic language called V/Pro from an American firm called Basis who also has a 50% share in my old software house. They now have a language called BBJ which uses a Java interpreter. The HLSL code is not so difficult for me to understand but the whole structure with 4 components on a register and the matrix business is new to me, in fact programming games is a completely new experience but you are never too old to learn.

Previously I used to only play adventures because I like puzzles (I played The Longest Journey and Dreamfall and I have Dreamfall Chapters which I know you fixed but I still haven't played it) but nowadays I only play 3D games. I like using motion controls so I have a Razor Hydra which I program and use for almost every game and now I am using voice control (VoiceBot) also which adds a new dimension to games. I must say shader hacking is fun but I wish that I understood a bit more of what is going on. Will you tell me the various patterns and how to react to them.

I am busy with Vapour now checking all the shaders that I marked to see if they have any effect or not using Discover which was a great idea and saves a lot of time - a lot of them don't seem to have any effect. when I get stuck I will ask you for help if that's ok. I am a perfectionist from the work point of view so we will see how far I come.

You have now the game.

Posted 11/20/2015 04:15 PM   
I have been trying to signup on the Wiki, it says "What is the one true name of the God of 3D?" on the signup page. I don't know what to put. It keeps saying incorrect. Frustrating. Edit: I figured it out. Its helix. BTW, is helix the same as helifax?
I have been trying to signup on the Wiki, it says "What is the one true name of the God of 3D?" on the signup page. I don't know what to put. It keeps saying incorrect. Frustrating.

Edit: I figured it out. Its helix. BTW, is helix the same as helifax?

Monitor: ASUS VG248 :: CPU: i7 4770 3.5Ghz :: Mobo: MSI Z87-G45 :: RAM: 16GB 1600Mhz :: GPU: Gigabyte GeForce GTX 770 4GB :: OS: Windows 10 64-bit :: Storage: 256GB SSD :: Wheel: Logitech G27

Posted 11/21/2015 03:47 AM   
[quote="flyoffacliff"]I have been trying to signup on the Wiki, it says "What is the one true name of the God of 3D?" on the signup page. I don't know what to put. It keeps saying incorrect. Frustrating. Edit: I figured it out. Its helix. BTW, is helix the same as helifax?[/quote] Great! Welcome. Sorry about the quiz, we needed something that those freakin' loser spamheads would get stumped on, but would be pretty clear for a 3D enthusiast. Since we put that up, no more spam, which we like. Helifax != Helix Helix was the original mastermind who came up with the idea of fixing 3D by hacking the shaders directly. This was a pretty unique idea, and we've carried it to great lengths. Helixfax is our resident OpenGL guru, and made his own wrapper+stereoization driver for OpenGL.
flyoffacliff said:I have been trying to signup on the Wiki, it says "What is the one true name of the God of 3D?" on the signup page. I don't know what to put. It keeps saying incorrect. Frustrating.

Edit: I figured it out. Its helix. BTW, is helix the same as helifax?

Great! Welcome. Sorry about the quiz, we needed something that those freakin' loser spamheads would get stumped on, but would be pretty clear for a 3D enthusiast. Since we put that up, no more spam, which we like.

Helifax != Helix Helix was the original mastermind who came up with the idea of fixing 3D by hacking the shaders directly. This was a pretty unique idea, and we've carried it to great lengths. Helixfax is our resident OpenGL guru, and made his own wrapper+stereoization driver for OpenGL.

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

Posted 11/21/2015 07:45 AM   
[quote="bo3b"][quote="flyoffacliff"]I have been trying to signup on the Wiki, it says "What is the one true name of the God of 3D?" on the signup page. I don't know what to put. It keeps saying incorrect. Frustrating. Edit: I figured it out. Its helix. BTW, is helix the same as helifax?[/quote] Great! Welcome. Sorry about the quiz, we needed something that those freakin' loser spamheads would get stumped on, but would be pretty clear for a 3D enthusiast. Since we put that up, no more spam, which we like. Helifax != Helix Helix was the original mastermind who came up with the idea of fixing 3D by hacking the shaders directly. This was a pretty unique idea, and we've carried it to great lengths. Helixfax is our resident OpenGL guru, and made his own wrapper+stereoization driver for OpenGL. [/quote] That is okay. Thank you. From the research I conducted, this is what I think so far: * Helix Mod = Supports only DX9 games. Original wrapper, no longer supported. Doesn't it have issues with Windows 8.1 and later? * 3DMigoto = Supports only DX11 games. Is it backwards compatible with DX9? * Helixfax's Wrapper - Supports only OpenGL. * Flugan's Wrapper = Similer to helixmod, but rewritten for DX10 and Windows 8.1 plus support. Is all of that correct? Thank you
bo3b said:
flyoffacliff said:I have been trying to signup on the Wiki, it says "What is the one true name of the God of 3D?" on the signup page. I don't know what to put. It keeps saying incorrect. Frustrating.

Edit: I figured it out. Its helix. BTW, is helix the same as helifax?

Great! Welcome. Sorry about the quiz, we needed something that those freakin' loser spamheads would get stumped on, but would be pretty clear for a 3D enthusiast. Since we put that up, no more spam, which we like.

Helifax != Helix Helix was the original mastermind who came up with the idea of fixing 3D by hacking the shaders directly. This was a pretty unique idea, and we've carried it to great lengths. Helixfax is our resident OpenGL guru, and made his own wrapper+stereoization driver for OpenGL.


That is okay. Thank you.

From the research I conducted, this is what I think so far:
* Helix Mod = Supports only DX9 games. Original wrapper, no longer supported. Doesn't it have issues with Windows 8.1 and later?
* 3DMigoto = Supports only DX11 games. Is it backwards compatible with DX9?
* Helixfax's Wrapper - Supports only OpenGL.
* Flugan's Wrapper = Similer to helixmod, but rewritten for DX10 and Windows 8.1 plus support.

Is all of that correct? Thank you

Monitor: ASUS VG248 :: CPU: i7 4770 3.5Ghz :: Mobo: MSI Z87-G45 :: RAM: 16GB 1600Mhz :: GPU: Gigabyte GeForce GTX 770 4GB :: OS: Windows 10 64-bit :: Storage: 256GB SSD :: Wheel: Logitech G27

Posted 11/22/2015 04:30 AM   
[quote="flyoffacliff"][quote="bo3b"][quote="flyoffacliff"]I have been trying to signup on the Wiki, it says "What is the one true name of the God of 3D?" on the signup page. I don't know what to put. It keeps saying incorrect. Frustrating. Edit: I figured it out. Its helix. BTW, is helix the same as helifax?[/quote] Great! Welcome. Sorry about the quiz, we needed something that those freakin' loser spamheads would get stumped on, but would be pretty clear for a 3D enthusiast. Since we put that up, no more spam, which we like. Helifax != Helix Helix was the original mastermind who came up with the idea of fixing 3D by hacking the shaders directly. This was a pretty unique idea, and we've carried it to great lengths. Helixfax is our resident OpenGL guru, and made his own wrapper+stereoization driver for OpenGL. [/quote] That is okay. Thank you. From the research I conducted, this is what I think so far: * Helix Mod = Supports only DX9 games. Original wrapper, no longer supported. Doesn't it have issues with Windows 8.1 and later? * 3DMigoto = Supports only DX11 games. Is it backwards compatible with DX9? * Helixfax's Wrapper - Supports only OpenGL. * Flugan's Wrapper = Similer to helixmod, but rewritten for DX10 and Windows 8.1 plus support. Is all of that correct? Thank you[/quote] Not quite right. * Helix Mod = only supports DX9. Still works on other OSes. 32 bit only. DX9 is dramatically simpler than DX11, and has no DXGI support, so it should still run fine on Win10. There is one version that runs on DX11 for Bioshock Infinite, but I think no one uses it now that we have good support in 3Dmigoto. * 3Dmigoto: DX11 only. 32 bit and 64 bit versions. No DX9 version, although I have a work in progress for someday (no real need because HelixMod is very fully featured.) Experimental DX10 version, but DX10 games are very few. * Helifax's wrapper. OpenGL only. Supports multiple generations of OpenGL (sort of like DX9-DX11), including antique ARB shaders for Star Wars. * Flugan's wrapper. Only supports DX11, and can load any 3Dmigoto fix. Uses hooking instead of wrapping, and can work in situations, especially different OSes, where 3Dmigoto will crash.
flyoffacliff said:
bo3b said:
flyoffacliff said:I have been trying to signup on the Wiki, it says "What is the one true name of the God of 3D?" on the signup page. I don't know what to put. It keeps saying incorrect. Frustrating.

Edit: I figured it out. Its helix. BTW, is helix the same as helifax?

Great! Welcome. Sorry about the quiz, we needed something that those freakin' loser spamheads would get stumped on, but would be pretty clear for a 3D enthusiast. Since we put that up, no more spam, which we like.

Helifax != Helix Helix was the original mastermind who came up with the idea of fixing 3D by hacking the shaders directly. This was a pretty unique idea, and we've carried it to great lengths. Helixfax is our resident OpenGL guru, and made his own wrapper+stereoization driver for OpenGL.


That is okay. Thank you.

From the research I conducted, this is what I think so far:
* Helix Mod = Supports only DX9 games. Original wrapper, no longer supported. Doesn't it have issues with Windows 8.1 and later?
* 3DMigoto = Supports only DX11 games. Is it backwards compatible with DX9?
* Helixfax's Wrapper - Supports only OpenGL.
* Flugan's Wrapper = Similer to helixmod, but rewritten for DX10 and Windows 8.1 plus support.

Is all of that correct? Thank you

Not quite right.

* Helix Mod = only supports DX9. Still works on other OSes. 32 bit only. DX9 is dramatically simpler than DX11, and has no DXGI support, so it should still run fine on Win10. There is one version that runs on DX11 for Bioshock Infinite, but I think no one uses it now that we have good support in 3Dmigoto.

* 3Dmigoto: DX11 only. 32 bit and 64 bit versions. No DX9 version, although I have a work in progress for someday (no real need because HelixMod is very fully featured.) Experimental DX10 version, but DX10 games are very few.

* Helifax's wrapper. OpenGL only. Supports multiple generations of OpenGL (sort of like DX9-DX11), including antique ARB shaders for Star Wars.

* Flugan's wrapper. Only supports DX11, and can load any 3Dmigoto fix. Uses hooking instead of wrapping, and can work in situations, especially different OSes, where 3Dmigoto will crash.

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

Posted 11/22/2015 11:22 AM   
@DarkStarSword, see Vapour thread.
@DarkStarSword, see Vapour thread.

Posted 11/22/2015 02:09 PM   
Hi guys;) I've been meedling in different things;) and I finally begin to understand how the magic "StereFlagsDX10" is working. Or at least (from what I've seen) what it affects except the "one eye rendering". Is related to how Compute shaders are working in stereo as well, hence the one eye WHITE image when things are not stereorized;) In any case, I am trying to enable "WorldRender.LightTilePathCsEnable 1" in Frostbyte 3 engines;) and managed to find my value for the "StereFlagsDX10" setting. Basically, this line says: Enable Tile Lighting Deferred Rendering;) The Cs comes from Compute Shader;) And, yes is using compute shaders (as I found out by 3DMigoto way). So, first this is how it looks like: [img]https://forums.geforce.com/cmd/default/download-comment-attachment/67237/[/img] (Notice the black boxes? That is the bounding area in which it calculates the light) Now same image when left+right eye are at the same parallax (both images fuse to be one, aka screen depth). Notice how the bounding boxes "fit" in both eyes. [img]https://forums.geforce.com/cmd/default/download-comment-attachment/67238/[/img] Which leads me to believe I need to stereo this compute shader. HOWEVER, when I dump I am greeted with this: [code] cbuffer cb0 : register(b0) { float4x4 invViewProjectionMatrix : packoffset(c0); uint2 resolutionMinusOne : packoffset(c4); float2 invResolutionTimesBlockSize : packoffset(c4.z); uint tileCountX : packoffset(c5); uint tileCountY : packoffset(c5.y); uint maxLightsInLightList : packoffset(c5.z); uint cullAppendPassMaterialPassType : packoffset(c5.w); uint lightInfoCount_Punctual : packoffset(c6); uint lightInfoCount_PunctualShadow : packoffset(c6.y); uint lightInfoCount_Area : packoffset(c6.z); uint lightInfoCount_AreaShadow : packoffset(c6.w); uint lightInfoCount_LocalIBL : packoffset(c7); uint lightInfoCount_LocalPR : packoffset(c7.y); uint unused1 : packoffset(c7.z); uint unused2 : packoffset(c7.w); uint2 coarseToFineTileShift : packoffset(c8); uint2 coarseToFineInputTileRes : packoffset(c8.z); } Texture2D<uint> g_materialIdTileMaskTexture : register(t0); StructuredBuffer<g_lightCullInput> g_lightCullInput : register(t1); Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main() { float4 r0,r1,r2; uint4 bitmask, uiDest; float4 fDest; r0.x = (uint)vThreadID.x < tileCountX; if (r0.x != 0) { r0.xy = vThreadID.xy; r0.zw = float2(0,0); r0.x = g_materialIdTileMaskTexture.Load(r0.xyz).x; r0.x = (int)r0.x == 1; r0.y = cullAppendPassMaterialPassType == 0; r0.x = (int)r0.y == (int)r0.x; if (r0.x != 0) { r0.x = mad((int)vThreadID.y, tileCountX, (int)vThreadID.x); // Known bad code for instruction (needs manual fix): // ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.xyz, r0.x, l(4), t1.xyzx r0.x = g_materialIdTileMaskTexture[]..swiz; r0.y = g_materialIdTileMaskTexture[]..swiz; r0.z = g_materialIdTileMaskTexture[]..swiz; r1.xyz = (uint3)r0.xyz >> int3(16,16,16); r0.xyz = r0.xyz ? 0.000000 : 0; r1.zw = (int2)r1.xz + (int2)r0.xz; r0.w = (int)r0.y + (int)r1.z; r0.w = (int)r1.y + (int)r0.w; r1.z = (uint)vThreadID.x << 16; r1.z = (int)r1.z | (int)vThreadID.y; if (r0.w != 0) { r0.x = (int)r0.w == (int)r0.x; if (r0.x != 0) { // Needs manual fix for instruction: // imm_atomic_alloc r2.x, u0 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r2.x].0 = u0.x; } else { r0.x = (int)r0.w == (int)r1.x; if (r0.x != 0) { // Needs manual fix for instruction: // imm_atomic_alloc r2.x, u1 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r2.x].0 = u1.x; } else { r0.x = (int)r0.w == (int)r0.y; if (r0.x != 0) { // Needs manual fix for instruction: // imm_atomic_alloc r2.x, u2 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r2.x].0 = u2.x; } else { r0.x = (int)r0.w == (int)r1.y; if (r0.x != 0) { // Needs manual fix for instruction: // imm_atomic_alloc r2.x, u3 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r2.x].0 = u3.x; } else { // Needs manual fix for instruction: // imm_atomic_alloc r2.x, u6 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r2.x].0 = u6.x; } } } } } if (r1.w != 0) { r0.x = (int)r0.z == (int)r1.w; if (r0.x != 0) { // Needs manual fix for instruction: // imm_atomic_alloc r0.x, u4 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r0.x].0 = u4.x; } else { // Needs manual fix for instruction: // imm_atomic_alloc r0.x, u5 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r0.x].0 = u5.x; } } } } return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // using 3Dmigoto v1.2.10 on Wed Nov 25 22:56:18 2015 // // // Buffer Definitions: // // cbuffer cb0 // { // // float4x4 invViewProjectionMatrix; // Offset: 0 Size: 64 [unused] // uint2 resolutionMinusOne; // Offset: 64 Size: 8 [unused] // float2 invResolutionTimesBlockSize;// Offset: 72 Size: 8 [unused] // uint tileCountX; // Offset: 80 Size: 4 // uint tileCountY; // Offset: 84 Size: 4 [unused] // uint maxLightsInLightList; // Offset: 88 Size: 4 [unused] // uint cullAppendPassMaterialPassType;// Offset: 92 Size: 4 // uint lightInfoCount_Punctual; // Offset: 96 Size: 4 [unused] // uint lightInfoCount_PunctualShadow;// Offset: 100 Size: 4 [unused] // uint lightInfoCount_Area; // Offset: 104 Size: 4 [unused] // uint lightInfoCount_AreaShadow; // Offset: 108 Size: 4 [unused] // uint lightInfoCount_LocalIBL; // Offset: 112 Size: 4 [unused] // uint lightInfoCount_LocalPR; // Offset: 116 Size: 4 [unused] // uint unused1; // Offset: 120 Size: 4 [unused] // uint unused2; // Offset: 124 Size: 4 [unused] // uint2 coarseToFineTileShift; // Offset: 128 Size: 8 [unused] // uint2 coarseToFineInputTileRes; // Offset: 136 Size: 8 [unused] // // } // // Resource bind info for g_lightCullInput // { // // uint4 $Element; // Offset: 0 Size: 16 // // } // // Resource bind info for g_compactTileGridUav_Punctual // { // // uint $Element; // Offset: 0 Size: 4 // // } // // Resource bind info for g_compactTileGridUav_PunctualShadow // { // // uint $Element; // Offset: 0 Size: 4 // // } // // Resource bind info for g_compactTileGridUav_Area // { // // uint $Element; // Offset: 0 Size: 4 // // } // // Resource bind info for g_compactTileGridUav_AreaShadow // { // // uint $Element; // Offset: 0 Size: 4 // // } // // Resource bind info for g_compactTileGridUav_LocalIBL // { // // uint $Element; // Offset: 0 Size: 4 // // } // // Resource bind info for g_compactTileGridUav_LocalIBLAndPR // { // // uint $Element; // Offset: 0 Size: 4 // // } // // Resource bind info for g_compactTileGridUav_AllLights // { // // uint $Element; // Offset: 0 Size: 4 // // } // // // Resource Bindings: // // Name Type Format Dim Slot Elements // ------------------------------ ---------- ------- ----------- ---- -------- // g_materialIdTileMaskTexture texture uint 2d 0 1 // g_lightCullInput texture struct r/o 1 1 // g_compactTileGridUav_Punctual UAV struct append 0 1 // g_compactTileGridUav_PunctualShadow UAV struct append 1 1 // g_compactTileGridUav_Area UAV struct append 2 1 // g_compactTileGridUav_AreaShadow UAV struct append 3 1 // g_compactTileGridUav_LocalIBL UAV struct append 4 1 // g_compactTileGridUav_LocalIBLAndPR UAV struct append 5 1 // g_compactTileGridUav_AllLights UAV struct append 6 1 // cb0 cbuffer NA NA 0 1 // // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // no Input // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // no Output cs_5_0 dcl_globalFlags refactoringAllowed dcl_constantbuffer cb0[6], immediateIndexed dcl_resource_texture2d (uint,uint,uint,uint) t0 dcl_resource_structured t1, 16 dcl_uav_structured u0, 4 dcl_uav_structured u1, 4 dcl_uav_structured u2, 4 dcl_uav_structured u3, 4 dcl_uav_structured u4, 4 dcl_uav_structured u5, 4 dcl_uav_structured u6, 4 dcl_input vThreadID.xy dcl_temps 3 dcl_thread_group 64, 1, 1 ult r0.x, vThreadID.x, cb0[5].x if_nz r0.x mov r0.xy, vThreadID.xyxx mov r0.zw, l(0,0,0,0) ld_indexable(texture2d)(uint,uint,uint,uint) r0.x, r0.xyzw, t0.xyzw ieq r0.x, r0.x, l(1) ieq r0.y, cb0[5].w, l(0) ieq r0.x, r0.y, r0.x if_nz r0.x imad r0.x, vThreadID.y, cb0[5].x, vThreadID.x ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.xyz, r0.x, l(4), t1.xyzx ushr r1.xyz, r0.xyzx, l(16, 16, 16, 0) and r0.xyz, r0.xyzx, l(0x0000ffff, 0x0000ffff, 0x0000ffff, 0) iadd r1.zw, r1.xxxz, r0.xxxz iadd r0.w, r0.y, r1.z iadd r0.w, r1.y, r0.w ishl r1.z, vThreadID.x, l(16) or r1.z, r1.z, vThreadID.y if_nz r0.w ieq r0.x, r0.w, r0.x if_nz r0.x imm_atomic_alloc r2.x, u0 store_structured u0.x, r2.x, l(0), r1.z else ieq r0.x, r0.w, r1.x if_nz r0.x imm_atomic_alloc r2.x, u1 store_structured u1.x, r2.x, l(0), r1.z else ieq r0.x, r0.w, r0.y if_nz r0.x imm_atomic_alloc r2.x, u2 store_structured u2.x, r2.x, l(0), r1.z else ieq r0.x, r0.w, r1.y if_nz r0.x imm_atomic_alloc r2.x, u3 store_structured u3.x, r2.x, l(0), r1.z else imm_atomic_alloc r2.x, u6 store_structured u6.x, r2.x, l(0), r1.z endif endif endif endif endif if_nz r1.w ieq r0.x, r0.z, r1.w if_nz r0.x imm_atomic_alloc r0.x, u4 store_structured u4.x, r0.x, l(0), r1.z else imm_atomic_alloc r0.x, u5 store_structured u5.x, r0.x, l(0), r1.z endif endif endif endif ret // Approximately 59 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code] Is anyone willing to please tell me how I: - get rid of the compiling issues - stereo this shader?:) Thank you in advance;) Edit: Sorry for Surround images.
Hi guys;)

I've been meedling in different things;) and I finally begin to understand how the magic "StereFlagsDX10" is working. Or at least (from what I've seen) what it affects except the "one eye rendering".

Is related to how Compute shaders are working in stereo as well, hence the one eye WHITE image when things are not stereorized;)

In any case, I am trying to enable "WorldRender.LightTilePathCsEnable 1" in Frostbyte 3 engines;) and managed to find my value for the "StereFlagsDX10" setting.

Basically, this line says: Enable Tile Lighting Deferred Rendering;) The Cs comes from Compute Shader;)
And, yes is using compute shaders (as I found out by 3DMigoto way).

So, first this is how it looks like:
Image
(Notice the black boxes? That is the bounding area in which it calculates the light)

Now same image when left+right eye are at the same parallax (both images fuse to be one, aka screen depth). Notice how the bounding boxes "fit" in both eyes.
Image
Which leads me to believe I need to stereo this compute shader.

HOWEVER, when I dump I am greeted with this:

cbuffer cb0 : register(b0)
{
float4x4 invViewProjectionMatrix : packoffset(c0);
uint2 resolutionMinusOne : packoffset(c4);
float2 invResolutionTimesBlockSize : packoffset(c4.z);
uint tileCountX : packoffset(c5);
uint tileCountY : packoffset(c5.y);
uint maxLightsInLightList : packoffset(c5.z);
uint cullAppendPassMaterialPassType : packoffset(c5.w);
uint lightInfoCount_Punctual : packoffset(c6);
uint lightInfoCount_PunctualShadow : packoffset(c6.y);
uint lightInfoCount_Area : packoffset(c6.z);
uint lightInfoCount_AreaShadow : packoffset(c6.w);
uint lightInfoCount_LocalIBL : packoffset(c7);
uint lightInfoCount_LocalPR : packoffset(c7.y);
uint unused1 : packoffset(c7.z);
uint unused2 : packoffset(c7.w);
uint2 coarseToFineTileShift : packoffset(c8);
uint2 coarseToFineInputTileRes : packoffset(c8.z);
}
Texture2D<uint> g_materialIdTileMaskTexture : register(t0);
StructuredBuffer<g_lightCullInput> g_lightCullInput : register(t1);

Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main()
{
float4 r0,r1,r2;
uint4 bitmask, uiDest;
float4 fDest;

r0.x = (uint)vThreadID.x < tileCountX;
if (r0.x != 0) {
r0.xy = vThreadID.xy;
r0.zw = float2(0,0);
r0.x = g_materialIdTileMaskTexture.Load(r0.xyz).x;
r0.x = (int)r0.x == 1;
r0.y = cullAppendPassMaterialPassType == 0;
r0.x = (int)r0.y == (int)r0.x;
if (r0.x != 0) {
r0.x = mad((int)vThreadID.y, tileCountX, (int)vThreadID.x);
// Known bad code for instruction (needs manual fix):
// ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.xyz, r0.x, l(4), t1.xyzx
r0.x = g_materialIdTileMaskTexture[]..swiz;
r0.y = g_materialIdTileMaskTexture[]..swiz;
r0.z = g_materialIdTileMaskTexture[]..swiz;
r1.xyz = (uint3)r0.xyz >> int3(16,16,16);
r0.xyz = r0.xyz ? 0.000000 : 0;
r1.zw = (int2)r1.xz + (int2)r0.xz;
r0.w = (int)r0.y + (int)r1.z;
r0.w = (int)r1.y + (int)r0.w;
r1.z = (uint)vThreadID.x << 16;
r1.z = (int)r1.z | (int)vThreadID.y;
if (r0.w != 0) {
r0.x = (int)r0.w == (int)r0.x;
if (r0.x != 0) {
// Needs manual fix for instruction:
// imm_atomic_alloc r2.x, u0
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r2.x].0 = u0.x;
} else {
r0.x = (int)r0.w == (int)r1.x;
if (r0.x != 0) {
// Needs manual fix for instruction:
// imm_atomic_alloc r2.x, u1
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r2.x].0 = u1.x;
} else {
r0.x = (int)r0.w == (int)r0.y;
if (r0.x != 0) {
// Needs manual fix for instruction:
// imm_atomic_alloc r2.x, u2
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r2.x].0 = u2.x;
} else {
r0.x = (int)r0.w == (int)r1.y;
if (r0.x != 0) {
// Needs manual fix for instruction:
// imm_atomic_alloc r2.x, u3
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r2.x].0 = u3.x;
} else {
// Needs manual fix for instruction:
// imm_atomic_alloc r2.x, u6
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r2.x].0 = u6.x;
}
}
}
}
}
if (r1.w != 0) {
r0.x = (int)r0.z == (int)r1.w;
if (r0.x != 0) {
// Needs manual fix for instruction:
// imm_atomic_alloc r0.x, u4
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r0.x].0 = u4.x;
} else {
// Needs manual fix for instruction:
// imm_atomic_alloc r0.x, u5
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r0.x].0 = u5.x;
}
}
}
}
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
// using 3Dmigoto v1.2.10 on Wed Nov 25 22:56:18 2015
//
//
// Buffer Definitions:
//
// cbuffer cb0
// {
//
// float4x4 invViewProjectionMatrix; // Offset: 0 Size: 64 [unused]
// uint2 resolutionMinusOne; // Offset: 64 Size: 8 [unused]
// float2 invResolutionTimesBlockSize;// Offset: 72 Size: 8 [unused]
// uint tileCountX; // Offset: 80 Size: 4
// uint tileCountY; // Offset: 84 Size: 4 [unused]
// uint maxLightsInLightList; // Offset: 88 Size: 4 [unused]
// uint cullAppendPassMaterialPassType;// Offset: 92 Size: 4
// uint lightInfoCount_Punctual; // Offset: 96 Size: 4 [unused]
// uint lightInfoCount_PunctualShadow;// Offset: 100 Size: 4 [unused]
// uint lightInfoCount_Area; // Offset: 104 Size: 4 [unused]
// uint lightInfoCount_AreaShadow; // Offset: 108 Size: 4 [unused]
// uint lightInfoCount_LocalIBL; // Offset: 112 Size: 4 [unused]
// uint lightInfoCount_LocalPR; // Offset: 116 Size: 4 [unused]
// uint unused1; // Offset: 120 Size: 4 [unused]
// uint unused2; // Offset: 124 Size: 4 [unused]
// uint2 coarseToFineTileShift; // Offset: 128 Size: 8 [unused]
// uint2 coarseToFineInputTileRes; // Offset: 136 Size: 8 [unused]
//
// }
//
// Resource bind info for g_lightCullInput
// {
//
// uint4 $Element; // Offset: 0 Size: 16
//
// }
//
// Resource bind info for g_compactTileGridUav_Punctual
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
// Resource bind info for g_compactTileGridUav_PunctualShadow
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
// Resource bind info for g_compactTileGridUav_Area
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
// Resource bind info for g_compactTileGridUav_AreaShadow
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
// Resource bind info for g_compactTileGridUav_LocalIBL
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
// Resource bind info for g_compactTileGridUav_LocalIBLAndPR
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
// Resource bind info for g_compactTileGridUav_AllLights
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_materialIdTileMaskTexture texture uint 2d 0 1
// g_lightCullInput texture struct r/o 1 1
// g_compactTileGridUav_Punctual UAV struct append 0 1
// g_compactTileGridUav_PunctualShadow UAV struct append 1 1
// g_compactTileGridUav_Area UAV struct append 2 1
// g_compactTileGridUav_AreaShadow UAV struct append 3 1
// g_compactTileGridUav_LocalIBL UAV struct append 4 1
// g_compactTileGridUav_LocalIBLAndPR UAV struct append 5 1
// g_compactTileGridUav_AllLights UAV struct append 6 1
// cb0 cbuffer NA NA 0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Input
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Output
cs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[6], immediateIndexed
dcl_resource_texture2d (uint,uint,uint,uint) t0
dcl_resource_structured t1, 16
dcl_uav_structured u0, 4
dcl_uav_structured u1, 4
dcl_uav_structured u2, 4
dcl_uav_structured u3, 4
dcl_uav_structured u4, 4
dcl_uav_structured u5, 4
dcl_uav_structured u6, 4
dcl_input vThreadID.xy
dcl_temps 3
dcl_thread_group 64, 1, 1
ult r0.x, vThreadID.x, cb0[5].x
if_nz r0.x
mov r0.xy, vThreadID.xyxx
mov r0.zw, l(0,0,0,0)
ld_indexable(texture2d)(uint,uint,uint,uint) r0.x, r0.xyzw, t0.xyzw
ieq r0.x, r0.x, l(1)
ieq r0.y, cb0[5].w, l(0)
ieq r0.x, r0.y, r0.x
if_nz r0.x
imad r0.x, vThreadID.y, cb0[5].x, vThreadID.x
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.xyz, r0.x, l(4), t1.xyzx
ushr r1.xyz, r0.xyzx, l(16, 16, 16, 0)
and r0.xyz, r0.xyzx, l(0x0000ffff, 0x0000ffff, 0x0000ffff, 0)
iadd r1.zw, r1.xxxz, r0.xxxz
iadd r0.w, r0.y, r1.z
iadd r0.w, r1.y, r0.w
ishl r1.z, vThreadID.x, l(16)
or r1.z, r1.z, vThreadID.y
if_nz r0.w
ieq r0.x, r0.w, r0.x
if_nz r0.x
imm_atomic_alloc r2.x, u0
store_structured u0.x, r2.x, l(0), r1.z
else
ieq r0.x, r0.w, r1.x
if_nz r0.x
imm_atomic_alloc r2.x, u1
store_structured u1.x, r2.x, l(0), r1.z
else
ieq r0.x, r0.w, r0.y
if_nz r0.x
imm_atomic_alloc r2.x, u2
store_structured u2.x, r2.x, l(0), r1.z
else
ieq r0.x, r0.w, r1.y
if_nz r0.x
imm_atomic_alloc r2.x, u3
store_structured u3.x, r2.x, l(0), r1.z
else
imm_atomic_alloc r2.x, u6
store_structured u6.x, r2.x, l(0), r1.z
endif
endif
endif
endif
endif
if_nz r1.w
ieq r0.x, r0.z, r1.w
if_nz r0.x
imm_atomic_alloc r0.x, u4
store_structured u4.x, r0.x, l(0), r1.z
else
imm_atomic_alloc r0.x, u5
store_structured u5.x, r0.x, l(0), r1.z
endif
endif
endif
endif
ret
// Approximately 59 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/


Is anyone willing to please tell me how I:
- get rid of the compiling issues
- stereo this shader?:)

Thank you in advance;)

Edit: Sorry for Surround images.

1x Palit RTX 2080Ti Pro Gaming OC(watercooled and overclocked to hell)
3x 3D Vision Ready Asus VG278HE monitors (5760x1080).
Intel i9 9900K (overclocked to 5.3 and watercooled ofc).
Asus Maximus XI Hero Mobo.
16 GB Team Group T-Force Dark Pro DDR4 @ 3600.
Lots of Disks:
- Raid 0 - 256GB Sandisk Extreme SSD.
- Raid 0 - WD Black - 2TB.
- SanDisk SSD PLUS 480 GB.
- Intel 760p 256GB M.2 PCIe NVMe SSD.
Creative Sound Blaster Z.
Windows 10 x64 Pro.
etc


My website with my fixes and OpenGL to 3D Vision wrapper:
http://3dsurroundgaming.com

(If you like some of the stuff that I've done and want to donate something, you can do it with PayPal at tavyhome@gmail.com)

Posted 11/25/2015 11:56 PM   
The decompiler still needs a fair bit of work to handle instructions unique to compute, domain, hull and geometry shaders properly (looks like it isn't even defining the UAVs / RWStructuredBuffers properly, nor is it using the right syntax to write to them). When we have needed to edit these types shaders so far we have edited the assembly instead which can handle all this stuff (but has it's own set of gotchas, like forgetting to declare the stereo texture or increment dcl_temps working, but destabilising the game increasing the likelihood of a crash down the line, or omitting a parameter in an instruction causing a CTD from the assembler). As for how to stereoise this particular shader... I'm not sure, but I don't think it's possible to do so from within the shader itself (and in fact I don't think this shader needs any adjustments). Looking at the screenshots and examining the code I would bet good money that there is something else external to this shader that decides which tiles to run it on and that is what will need to be fixed - and whatever is making that decision is either only running on the data for the right eye, or it's result is being stored in a mono buffer that we would need to identify and force to stereo. This might be where you need to use frame analysis to study what the game is doing before it runs this shader - start by dumping out the textures for that shader to identify the Texture2D loaded in cs-t0. If you're lucky it will just be a matter of using a [TextureOverride] to force that texture to stereo, but there might be problems earlier in the frame that you need to solve - if you dump out the render targets leading up to the compute shader you might find a matching one. Now, if you are very unlucky this might get even more complicated - I would guess that they are likely using DispatchIndirect() to run the compute shader instead of Dispatch() (no way to confirm this yet, though you could easily add more log messages to 3DMigoto), which takes a buffer to decide how many threads to spawn. If that is the case, that buffer might also need to be stereoised to make this work in 3D (otherwise the left eye might not have enough threads running for the amount of tiles it needs to process). Frame analysis only has limited support for buffers yet (and not the ones we would be looking for), and 3DMigoto currently offers no way to force them to stereo (until the other day I didn't even think they could be, then I discovered the driver does in fact use a stereo buffer internally so now I'm thinking it might be possible to force them, but we need more code to do this). This is something StereoFlagsDX10 might control, but I can't be certain without either documentation or experimental results.
The decompiler still needs a fair bit of work to handle instructions unique to compute, domain, hull and geometry shaders properly (looks like it isn't even defining the UAVs / RWStructuredBuffers properly, nor is it using the right syntax to write to them).

When we have needed to edit these types shaders so far we have edited the assembly instead which can handle all this stuff (but has it's own set of gotchas, like forgetting to declare the stereo texture or increment dcl_temps working, but destabilising the game increasing the likelihood of a crash down the line, or omitting a parameter in an instruction causing a CTD from the assembler).


As for how to stereoise this particular shader... I'm not sure, but I don't think it's possible to do so from within the shader itself (and in fact I don't think this shader needs any adjustments). Looking at the screenshots and examining the code I would bet good money that there is something else external to this shader that decides which tiles to run it on and that is what will need to be fixed - and whatever is making that decision is either only running on the data for the right eye, or it's result is being stored in a mono buffer that we would need to identify and force to stereo.


This might be where you need to use frame analysis to study what the game is doing before it runs this shader - start by dumping out the textures for that shader to identify the Texture2D loaded in cs-t0. If you're lucky it will just be a matter of using a [TextureOverride] to force that texture to stereo, but there might be problems earlier in the frame that you need to solve - if you dump out the render targets leading up to the compute shader you might find a matching one.



Now, if you are very unlucky this might get even more complicated - I would guess that they are likely using DispatchIndirect() to run the compute shader instead of Dispatch() (no way to confirm this yet, though you could easily add more log messages to 3DMigoto), which takes a buffer to decide how many threads to spawn. If that is the case, that buffer might also need to be stereoised to make this work in 3D (otherwise the left eye might not have enough threads running for the amount of tiles it needs to process). Frame analysis only has limited support for buffers yet (and not the ones we would be looking for), and 3DMigoto currently offers no way to force them to stereo (until the other day I didn't even think they could be, then I discovered the driver does in fact use a stereo buffer internally so now I'm thinking it might be possible to force them, but we need more code to do this). This is something StereoFlagsDX10 might control, but I can't be certain without either documentation or experimental results.

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 11/26/2015 10:08 AM   
I am trying to use helixmod to fix a game (How to Survive Third Person). The game uses a Log.txt for logging and helixmod uses the same name for logging which causes an error message when starting the game. Is there a possibility to use a different name for the log in helixmod ?
I am trying to use helixmod to fix a game (How to Survive Third Person). The game uses a Log.txt for logging and helixmod uses the same name for logging which causes an error message when starting the game. Is there a possibility to use a different name for the log in helixmod ?

Posted 11/26/2015 02:16 PM   
If Helix Mod isn't able to open LOG.txt it will try LOG1.txt instead, but it sounds like it must be opening the log file before the game. GetCurDirAtLoad might change where Helix Mod creates the log file, but it probably won't help. Your best bet is probably to hexedit the d3d9.dll and replace the LOG.txt string located at 0x9328C with an alternate filename (looks like there's room for an extra four characters if you wanted).
If Helix Mod isn't able to open LOG.txt it will try LOG1.txt instead, but it sounds like it must be opening the log file before the game. GetCurDirAtLoad might change where Helix Mod creates the log file, but it probably won't help.

Your best bet is probably to hexedit the d3d9.dll and replace the LOG.txt string located at 0x9328C with an alternate filename (looks like there's room for an extra four characters if you wanted).

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 11/26/2015 05:27 PM   
Thanks DarkStarSword, I had to change the one with the '\' before it then it worked, I should have thought of that myself but I know absolutely nothing about dlls, I thought that they were just a library of functions. If I Alt-Tab out of the game is it possible to view that log, I get access denied. I looked at Albedo: Eyes from Outer Space today but it looks far too broken for me to fix. I see on Steam that you also have that game - have you ever looked at it for fixing ? BTW I am now playing Lichdom Battlemage with your fix using all the spells voice activated, it adds a new dimension to the game. I have used a combination of Harry Potter spell names and latin names. Only disadvantage is it takes a bit longer to cast the spell.
Thanks DarkStarSword, I had to change the one with the '\' before it then it worked, I should have thought of that myself but I know absolutely nothing about dlls, I thought that they were just a library of functions. If I Alt-Tab out of the game is it possible to view that log, I get access denied.

I looked at Albedo: Eyes from Outer Space today but it looks far too broken for me to fix. I see on Steam that you also have that game - have you ever looked at it for fixing ?

BTW I am now playing Lichdom Battlemage with your fix using all the spells voice activated, it adds a new dimension to the game. I have used a combination of Harry Potter spell names and latin names.
Only disadvantage is it takes a bit longer to cast the spell.

Posted 11/26/2015 06:22 PM   
[quote="DarkStarSword"]The decompiler still needs a fair bit of work to handle instructions unique to compute, domain, hull and geometry shaders properly (looks like it isn't even defining the UAVs / RWStructuredBuffers properly, nor is it using the right syntax to write to them). When we have needed to edit these types shaders so far we have edited the assembly instead which can handle all this stuff (but has it's own set of gotchas, like forgetting to declare the stereo texture or increment dcl_temps working, but destabilising the game increasing the likelihood of a crash down the line, or omitting a parameter in an instruction causing a CTD from the assembler). As for how to stereoise this particular shader... I'm not sure, but I don't think it's possible to do so from within the shader itself (and in fact I don't think this shader needs any adjustments). Looking at the screenshots and examining the code I would bet good money that there is something else external to this shader that decides which tiles to run it on and that is what will need to be fixed - and whatever is making that decision is either only running on the data for the right eye, or it's result is being stored in a mono buffer that we would need to identify and force to stereo. This might be where you need to use frame analysis to study what the game is doing before it runs this shader - start by dumping out the textures for that shader to identify the Texture2D loaded in cs-t0. If you're lucky it will just be a matter of using a [TextureOverride] to force that texture to stereo, but there might be problems earlier in the frame that you need to solve - if you dump out the render targets leading up to the compute shader you might find a matching one. Now, if you are very unlucky this might get even more complicated - I would guess that they are likely using DispatchIndirect() to run the compute shader instead of Dispatch() (no way to confirm this yet, though you could easily add more log messages to 3DMigoto), which takes a buffer to decide how many threads to spawn. If that is the case, that buffer might also need to be stereoised to make this work in 3D (otherwise the left eye might not have enough threads running for the amount of tiles it needs to process). Frame analysis only has limited support for buffers yet (and not the ones we would be looking for), and 3DMigoto currently offers no way to force them to stereo (until the other day I didn't even think they could be, then I discovered the driver does in fact use a stereo buffer internally so now I'm thinking it might be possible to force them, but we need more code to do this). This is something StereoFlagsDX10 might control, but I can't be certain without either documentation or experimental results.[/quote] Thanks for the info;) Interesting stuff there;) I'll play a bit more from the driver side and see if I can end up with anything;) There are a couple of maps in SW BF that require Compute shaders to render properly unfortunately, as all the lighting is done using them.. SO! I was able to fix all my issues and the tile lighting issue;) And now I am exactly where I want to be. I have a couple of LIGHTING shaders that are Compute Shaders. For example this one: [code] cbuffer cb0 : register(b0) { float4x4 invViewProjectionMatrix : packoffset(c0); uint2 resolutionMinusOne : packoffset(c4); float2 invResolutionTimesBlockSize : packoffset(c4.z); uint tileCountX : packoffset(c5); uint tileCountY : packoffset(c5.y); uint maxLightsInLightList : packoffset(c5.z); uint cullAppendPassMaterialPassType : packoffset(c5.w); uint lightInfoCount_Punctual : packoffset(c6); uint lightInfoCount_PunctualShadow : packoffset(c6.y); uint lightInfoCount_Area : packoffset(c6.z); uint lightInfoCount_AreaShadow : packoffset(c6.w); uint lightInfoCount_LocalIBL : packoffset(c7); uint lightInfoCount_LocalPR : packoffset(c7.y); uint unused1 : packoffset(c7.z); uint unused2 : packoffset(c7.w); uint2 coarseToFineTileShift : packoffset(c8); uint2 coarseToFineInputTileRes : packoffset(c8.z); } Texture2D<uint> g_materialIdTileMaskTexture : register(t0); StructuredBuffer<g_lightCullInput> g_lightCullInput : register(t1); Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main() { float4 r0,r1,r2; uint4 bitmask, uiDest; float4 fDest; r0.x = (uint)vThreadID.x < tileCountX; if (r0.x != 0) { r0.xy = vThreadID.xy; r0.zw = float2(0,0); r0.x = g_materialIdTileMaskTexture.Load(r0.xyz).x; r0.x = (int)r0.x == 1; r0.y = cullAppendPassMaterialPassType == 0; r0.x = (int)r0.y == (int)r0.x; if (r0.x != 0) { r0.x = mad((int)vThreadID.y, tileCountX, (int)vThreadID.x); // Known bad code for instruction (needs manual fix): // ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.xyz, r0.x, l(4), t1.xyzx r0.x = g_materialIdTileMaskTexture[]..swiz; r0.y = g_materialIdTileMaskTexture[]..swiz; r0.z = g_materialIdTileMaskTexture[]..swiz; r1.xyz = (uint3)r0.xyz >> int3(16,16,16); r0.xyz = r0.xyz ? 0.000000 : 0; r1.zw = (int2)r1.xz + (int2)r0.xz; r0.w = (int)r0.y + (int)r1.z; r0.w = (int)r1.y + (int)r0.w; r1.z = (uint)vThreadID.x << 16; r1.z = (int)r1.z | (int)vThreadID.y; if (r0.w != 0) { r0.x = (int)r0.w == (int)r0.x; if (r0.x != 0) { // Needs manual fix for instruction: // imm_atomic_alloc r2.x, u0 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r2.x].0 = u0.x; } else { r0.x = (int)r0.w == (int)r1.x; if (r0.x != 0) { // Needs manual fix for instruction: // imm_atomic_alloc r2.x, u1 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r2.x].0 = u1.x; } else { r0.x = (int)r0.w == (int)r0.y; if (r0.x != 0) { // Needs manual fix for instruction: // imm_atomic_alloc r2.x, u2 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r2.x].0 = u2.x; } else { r0.x = (int)r0.w == (int)r1.y; if (r0.x != 0) { // Needs manual fix for instruction: // imm_atomic_alloc r2.x, u3 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r2.x].0 = u3.x; } else { // Needs manual fix for instruction: // imm_atomic_alloc r2.x, u6 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r2.x].0 = u6.x; } } } } } if (r1.w != 0) { r0.x = (int)r0.z == (int)r1.w; if (r0.x != 0) { // Needs manual fix for instruction: // imm_atomic_alloc r0.x, u4 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r0.x].0 = u4.x; } else { // Needs manual fix for instruction: // imm_atomic_alloc r0.x, u5 InterlockedExchange ?(dest, value, orig_value); g_materialIdTileMaskTexture[r0.x].0 = u5.x; } } } } return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // using 3Dmigoto v1.2.10 on Thu Nov 26 19:52:40 2015 // // // Buffer Definitions: // // cbuffer cb0 // { // // float4x4 invViewProjectionMatrix; // Offset: 0 Size: 64 [unused] // uint2 resolutionMinusOne; // Offset: 64 Size: 8 [unused] // float2 invResolutionTimesBlockSize;// Offset: 72 Size: 8 [unused] // uint tileCountX; // Offset: 80 Size: 4 // uint tileCountY; // Offset: 84 Size: 4 [unused] // uint maxLightsInLightList; // Offset: 88 Size: 4 [unused] // uint cullAppendPassMaterialPassType;// Offset: 92 Size: 4 // uint lightInfoCount_Punctual; // Offset: 96 Size: 4 [unused] // uint lightInfoCount_PunctualShadow;// Offset: 100 Size: 4 [unused] // uint lightInfoCount_Area; // Offset: 104 Size: 4 [unused] // uint lightInfoCount_AreaShadow; // Offset: 108 Size: 4 [unused] // uint lightInfoCount_LocalIBL; // Offset: 112 Size: 4 [unused] // uint lightInfoCount_LocalPR; // Offset: 116 Size: 4 [unused] // uint unused1; // Offset: 120 Size: 4 [unused] // uint unused2; // Offset: 124 Size: 4 [unused] // uint2 coarseToFineTileShift; // Offset: 128 Size: 8 [unused] // uint2 coarseToFineInputTileRes; // Offset: 136 Size: 8 [unused] // // } // // Resource bind info for g_lightCullInput // { // // uint4 $Element; // Offset: 0 Size: 16 // // } // // Resource bind info for g_compactTileGridUav_Punctual // { // // uint $Element; // Offset: 0 Size: 4 // // } // // Resource bind info for g_compactTileGridUav_PunctualShadow // { // // uint $Element; // Offset: 0 Size: 4 // // } // // Resource bind info for g_compactTileGridUav_Area // { // // uint $Element; // Offset: 0 Size: 4 // // } // // Resource bind info for g_compactTileGridUav_AreaShadow // { // // uint $Element; // Offset: 0 Size: 4 // // } // // Resource bind info for g_compactTileGridUav_LocalIBL // { // // uint $Element; // Offset: 0 Size: 4 // // } // // Resource bind info for g_compactTileGridUav_LocalIBLAndPR // { // // uint $Element; // Offset: 0 Size: 4 // // } // // Resource bind info for g_compactTileGridUav_AllLights // { // // uint $Element; // Offset: 0 Size: 4 // // } // // // Resource Bindings: // // Name Type Format Dim Slot Elements // ------------------------------ ---------- ------- ----------- ---- -------- // g_materialIdTileMaskTexture texture uint 2d 0 1 // g_lightCullInput texture struct r/o 1 1 // g_compactTileGridUav_Punctual UAV struct append 0 1 // g_compactTileGridUav_PunctualShadow UAV struct append 1 1 // g_compactTileGridUav_Area UAV struct append 2 1 // g_compactTileGridUav_AreaShadow UAV struct append 3 1 // g_compactTileGridUav_LocalIBL UAV struct append 4 1 // g_compactTileGridUav_LocalIBLAndPR UAV struct append 5 1 // g_compactTileGridUav_AllLights UAV struct append 6 1 // cb0 cbuffer NA NA 0 1 // // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // no Input // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // no Output cs_5_0 dcl_globalFlags refactoringAllowed dcl_constantbuffer cb0[6], immediateIndexed dcl_resource_texture2d (uint,uint,uint,uint) t0 dcl_resource_structured t1, 16 dcl_uav_structured u0, 4 dcl_uav_structured u1, 4 dcl_uav_structured u2, 4 dcl_uav_structured u3, 4 dcl_uav_structured u4, 4 dcl_uav_structured u5, 4 dcl_uav_structured u6, 4 dcl_input vThreadID.xy dcl_temps 3 dcl_thread_group 64, 1, 1 ult r0.x, vThreadID.x, cb0[5].x if_nz r0.x mov r0.xy, vThreadID.xyxx mov r0.zw, l(0,0,0,0) ld_indexable(texture2d)(uint,uint,uint,uint) r0.x, r0.xyzw, t0.xyzw ieq r0.x, r0.x, l(1) ieq r0.y, cb0[5].w, l(0) ieq r0.x, r0.y, r0.x if_nz r0.x imad r0.x, vThreadID.y, cb0[5].x, vThreadID.x ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.xyz, r0.x, l(4), t1.xyzx ushr r1.xyz, r0.xyzx, l(16, 16, 16, 0) and r0.xyz, r0.xyzx, l(0x0000ffff, 0x0000ffff, 0x0000ffff, 0) iadd r1.zw, r1.xxxz, r0.xxxz iadd r0.w, r0.y, r1.z iadd r0.w, r1.y, r0.w ishl r1.z, vThreadID.x, l(16) or r1.z, r1.z, vThreadID.y if_nz r0.w ieq r0.x, r0.w, r0.x if_nz r0.x imm_atomic_alloc r2.x, u0 store_structured u0.x, r2.x, l(0), r1.z else ieq r0.x, r0.w, r1.x if_nz r0.x imm_atomic_alloc r2.x, u1 store_structured u1.x, r2.x, l(0), r1.z else ieq r0.x, r0.w, r0.y if_nz r0.x imm_atomic_alloc r2.x, u2 store_structured u2.x, r2.x, l(0), r1.z else ieq r0.x, r0.w, r1.y if_nz r0.x imm_atomic_alloc r2.x, u3 store_structured u3.x, r2.x, l(0), r1.z else imm_atomic_alloc r2.x, u6 store_structured u6.x, r2.x, l(0), r1.z endif endif endif endif endif if_nz r1.w ieq r0.x, r0.z, r1.w if_nz r0.x imm_atomic_alloc r0.x, u4 store_structured u4.x, r0.x, l(0), r1.z else imm_atomic_alloc r0.x, u5 store_structured u5.x, r0.x, l(0), r1.z endif endif endif endif ret // Approximately 59 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code] Any idea how I can make this one stereo? (It renders in 2D) The ASM is below;) Also, is there a way to find and MARK a shader and dump it in ASM format? I looked in the ini file but I might have missed it... (as I remember doing it before)
DarkStarSword said:The decompiler still needs a fair bit of work to handle instructions unique to compute, domain, hull and geometry shaders properly (looks like it isn't even defining the UAVs / RWStructuredBuffers properly, nor is it using the right syntax to write to them).

When we have needed to edit these types shaders so far we have edited the assembly instead which can handle all this stuff (but has it's own set of gotchas, like forgetting to declare the stereo texture or increment dcl_temps working, but destabilising the game increasing the likelihood of a crash down the line, or omitting a parameter in an instruction causing a CTD from the assembler).


As for how to stereoise this particular shader... I'm not sure, but I don't think it's possible to do so from within the shader itself (and in fact I don't think this shader needs any adjustments). Looking at the screenshots and examining the code I would bet good money that there is something else external to this shader that decides which tiles to run it on and that is what will need to be fixed - and whatever is making that decision is either only running on the data for the right eye, or it's result is being stored in a mono buffer that we would need to identify and force to stereo.


This might be where you need to use frame analysis to study what the game is doing before it runs this shader - start by dumping out the textures for that shader to identify the Texture2D loaded in cs-t0. If you're lucky it will just be a matter of using a [TextureOverride] to force that texture to stereo, but there might be problems earlier in the frame that you need to solve - if you dump out the render targets leading up to the compute shader you might find a matching one.



Now, if you are very unlucky this might get even more complicated - I would guess that they are likely using DispatchIndirect() to run the compute shader instead of Dispatch() (no way to confirm this yet, though you could easily add more log messages to 3DMigoto), which takes a buffer to decide how many threads to spawn. If that is the case, that buffer might also need to be stereoised to make this work in 3D (otherwise the left eye might not have enough threads running for the amount of tiles it needs to process). Frame analysis only has limited support for buffers yet (and not the ones we would be looking for), and 3DMigoto currently offers no way to force them to stereo (until the other day I didn't even think they could be, then I discovered the driver does in fact use a stereo buffer internally so now I'm thinking it might be possible to force them, but we need more code to do this). This is something StereoFlagsDX10 might control, but I can't be certain without either documentation or experimental results.


Thanks for the info;) Interesting stuff there;) I'll play a bit more from the driver side and see if I can end up with anything;) There are a couple of maps in SW BF that require Compute shaders to render properly unfortunately, as all the lighting is done using them..

SO! I was able to fix all my issues and the tile lighting issue;)

And now I am exactly where I want to be. I have a couple of LIGHTING shaders that are Compute Shaders.
For example this one:

cbuffer cb0 : register(b0)
{
float4x4 invViewProjectionMatrix : packoffset(c0);
uint2 resolutionMinusOne : packoffset(c4);
float2 invResolutionTimesBlockSize : packoffset(c4.z);
uint tileCountX : packoffset(c5);
uint tileCountY : packoffset(c5.y);
uint maxLightsInLightList : packoffset(c5.z);
uint cullAppendPassMaterialPassType : packoffset(c5.w);
uint lightInfoCount_Punctual : packoffset(c6);
uint lightInfoCount_PunctualShadow : packoffset(c6.y);
uint lightInfoCount_Area : packoffset(c6.z);
uint lightInfoCount_AreaShadow : packoffset(c6.w);
uint lightInfoCount_LocalIBL : packoffset(c7);
uint lightInfoCount_LocalPR : packoffset(c7.y);
uint unused1 : packoffset(c7.z);
uint unused2 : packoffset(c7.w);
uint2 coarseToFineTileShift : packoffset(c8);
uint2 coarseToFineInputTileRes : packoffset(c8.z);
}
Texture2D<uint> g_materialIdTileMaskTexture : register(t0);
StructuredBuffer<g_lightCullInput> g_lightCullInput : register(t1);

Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main()
{
float4 r0,r1,r2;
uint4 bitmask, uiDest;
float4 fDest;

r0.x = (uint)vThreadID.x < tileCountX;
if (r0.x != 0) {
r0.xy = vThreadID.xy;
r0.zw = float2(0,0);
r0.x = g_materialIdTileMaskTexture.Load(r0.xyz).x;
r0.x = (int)r0.x == 1;
r0.y = cullAppendPassMaterialPassType == 0;
r0.x = (int)r0.y == (int)r0.x;
if (r0.x != 0) {
r0.x = mad((int)vThreadID.y, tileCountX, (int)vThreadID.x);
// Known bad code for instruction (needs manual fix):
// ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.xyz, r0.x, l(4), t1.xyzx
r0.x = g_materialIdTileMaskTexture[]..swiz;
r0.y = g_materialIdTileMaskTexture[]..swiz;
r0.z = g_materialIdTileMaskTexture[]..swiz;
r1.xyz = (uint3)r0.xyz >> int3(16,16,16);
r0.xyz = r0.xyz ? 0.000000 : 0;
r1.zw = (int2)r1.xz + (int2)r0.xz;
r0.w = (int)r0.y + (int)r1.z;
r0.w = (int)r1.y + (int)r0.w;
r1.z = (uint)vThreadID.x << 16;
r1.z = (int)r1.z | (int)vThreadID.y;
if (r0.w != 0) {
r0.x = (int)r0.w == (int)r0.x;
if (r0.x != 0) {
// Needs manual fix for instruction:
// imm_atomic_alloc r2.x, u0
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r2.x].0 = u0.x;
} else {
r0.x = (int)r0.w == (int)r1.x;
if (r0.x != 0) {
// Needs manual fix for instruction:
// imm_atomic_alloc r2.x, u1
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r2.x].0 = u1.x;
} else {
r0.x = (int)r0.w == (int)r0.y;
if (r0.x != 0) {
// Needs manual fix for instruction:
// imm_atomic_alloc r2.x, u2
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r2.x].0 = u2.x;
} else {
r0.x = (int)r0.w == (int)r1.y;
if (r0.x != 0) {
// Needs manual fix for instruction:
// imm_atomic_alloc r2.x, u3
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r2.x].0 = u3.x;
} else {
// Needs manual fix for instruction:
// imm_atomic_alloc r2.x, u6
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r2.x].0 = u6.x;
}
}
}
}
}
if (r1.w != 0) {
r0.x = (int)r0.z == (int)r1.w;
if (r0.x != 0) {
// Needs manual fix for instruction:
// imm_atomic_alloc r0.x, u4
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r0.x].0 = u4.x;
} else {
// Needs manual fix for instruction:
// imm_atomic_alloc r0.x, u5
InterlockedExchange ?(dest, value, orig_value);
g_materialIdTileMaskTexture[r0.x].0 = u5.x;
}
}
}
}
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
// using 3Dmigoto v1.2.10 on Thu Nov 26 19:52:40 2015
//
//
// Buffer Definitions:
//
// cbuffer cb0
// {
//
// float4x4 invViewProjectionMatrix; // Offset: 0 Size: 64 [unused]
// uint2 resolutionMinusOne; // Offset: 64 Size: 8 [unused]
// float2 invResolutionTimesBlockSize;// Offset: 72 Size: 8 [unused]
// uint tileCountX; // Offset: 80 Size: 4
// uint tileCountY; // Offset: 84 Size: 4 [unused]
// uint maxLightsInLightList; // Offset: 88 Size: 4 [unused]
// uint cullAppendPassMaterialPassType;// Offset: 92 Size: 4
// uint lightInfoCount_Punctual; // Offset: 96 Size: 4 [unused]
// uint lightInfoCount_PunctualShadow;// Offset: 100 Size: 4 [unused]
// uint lightInfoCount_Area; // Offset: 104 Size: 4 [unused]
// uint lightInfoCount_AreaShadow; // Offset: 108 Size: 4 [unused]
// uint lightInfoCount_LocalIBL; // Offset: 112 Size: 4 [unused]
// uint lightInfoCount_LocalPR; // Offset: 116 Size: 4 [unused]
// uint unused1; // Offset: 120 Size: 4 [unused]
// uint unused2; // Offset: 124 Size: 4 [unused]
// uint2 coarseToFineTileShift; // Offset: 128 Size: 8 [unused]
// uint2 coarseToFineInputTileRes; // Offset: 136 Size: 8 [unused]
//
// }
//
// Resource bind info for g_lightCullInput
// {
//
// uint4 $Element; // Offset: 0 Size: 16
//
// }
//
// Resource bind info for g_compactTileGridUav_Punctual
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
// Resource bind info for g_compactTileGridUav_PunctualShadow
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
// Resource bind info for g_compactTileGridUav_Area
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
// Resource bind info for g_compactTileGridUav_AreaShadow
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
// Resource bind info for g_compactTileGridUav_LocalIBL
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
// Resource bind info for g_compactTileGridUav_LocalIBLAndPR
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
// Resource bind info for g_compactTileGridUav_AllLights
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_materialIdTileMaskTexture texture uint 2d 0 1
// g_lightCullInput texture struct r/o 1 1
// g_compactTileGridUav_Punctual UAV struct append 0 1
// g_compactTileGridUav_PunctualShadow UAV struct append 1 1
// g_compactTileGridUav_Area UAV struct append 2 1
// g_compactTileGridUav_AreaShadow UAV struct append 3 1
// g_compactTileGridUav_LocalIBL UAV struct append 4 1
// g_compactTileGridUav_LocalIBLAndPR UAV struct append 5 1
// g_compactTileGridUav_AllLights UAV struct append 6 1
// cb0 cbuffer NA NA 0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Input
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Output
cs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[6], immediateIndexed
dcl_resource_texture2d (uint,uint,uint,uint) t0
dcl_resource_structured t1, 16
dcl_uav_structured u0, 4
dcl_uav_structured u1, 4
dcl_uav_structured u2, 4
dcl_uav_structured u3, 4
dcl_uav_structured u4, 4
dcl_uav_structured u5, 4
dcl_uav_structured u6, 4
dcl_input vThreadID.xy
dcl_temps 3
dcl_thread_group 64, 1, 1
ult r0.x, vThreadID.x, cb0[5].x
if_nz r0.x
mov r0.xy, vThreadID.xyxx
mov r0.zw, l(0,0,0,0)
ld_indexable(texture2d)(uint,uint,uint,uint) r0.x, r0.xyzw, t0.xyzw
ieq r0.x, r0.x, l(1)
ieq r0.y, cb0[5].w, l(0)
ieq r0.x, r0.y, r0.x
if_nz r0.x
imad r0.x, vThreadID.y, cb0[5].x, vThreadID.x
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.xyz, r0.x, l(4), t1.xyzx
ushr r1.xyz, r0.xyzx, l(16, 16, 16, 0)
and r0.xyz, r0.xyzx, l(0x0000ffff, 0x0000ffff, 0x0000ffff, 0)
iadd r1.zw, r1.xxxz, r0.xxxz
iadd r0.w, r0.y, r1.z
iadd r0.w, r1.y, r0.w
ishl r1.z, vThreadID.x, l(16)
or r1.z, r1.z, vThreadID.y
if_nz r0.w
ieq r0.x, r0.w, r0.x
if_nz r0.x
imm_atomic_alloc r2.x, u0
store_structured u0.x, r2.x, l(0), r1.z
else
ieq r0.x, r0.w, r1.x
if_nz r0.x
imm_atomic_alloc r2.x, u1
store_structured u1.x, r2.x, l(0), r1.z
else
ieq r0.x, r0.w, r0.y
if_nz r0.x
imm_atomic_alloc r2.x, u2
store_structured u2.x, r2.x, l(0), r1.z
else
ieq r0.x, r0.w, r1.y
if_nz r0.x
imm_atomic_alloc r2.x, u3
store_structured u3.x, r2.x, l(0), r1.z
else
imm_atomic_alloc r2.x, u6
store_structured u6.x, r2.x, l(0), r1.z
endif
endif
endif
endif
endif
if_nz r1.w
ieq r0.x, r0.z, r1.w
if_nz r0.x
imm_atomic_alloc r0.x, u4
store_structured u4.x, r0.x, l(0), r1.z
else
imm_atomic_alloc r0.x, u5
store_structured u5.x, r0.x, l(0), r1.z
endif
endif
endif
endif
ret
// Approximately 59 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/


Any idea how I can make this one stereo? (It renders in 2D)
The ASM is below;)
Also, is there a way to find and MARK a shader and dump it in ASM format? I looked in the ini file but I might have missed it... (as I remember doing it before)

1x Palit RTX 2080Ti Pro Gaming OC(watercooled and overclocked to hell)
3x 3D Vision Ready Asus VG278HE monitors (5760x1080).
Intel i9 9900K (overclocked to 5.3 and watercooled ofc).
Asus Maximus XI Hero Mobo.
16 GB Team Group T-Force Dark Pro DDR4 @ 3600.
Lots of Disks:
- Raid 0 - 256GB Sandisk Extreme SSD.
- Raid 0 - WD Black - 2TB.
- SanDisk SSD PLUS 480 GB.
- Intel 760p 256GB M.2 PCIe NVMe SSD.
Creative Sound Blaster Z.
Windows 10 x64 Pro.
etc


My website with my fixes and OpenGL to 3D Vision wrapper:
http://3dsurroundgaming.com

(If you like some of the stuff that I've done and want to donate something, you can do it with PayPal at tavyhome@gmail.com)

Posted 11/26/2015 06:46 PM   
I also have a BAD pixel shader code here: [code] cbuffer CommonConstants : register(b0) { float4x4 g_invViewProjMatrix : packoffset(c0); float3 g_cameraPos : packoffset(c4); uint g_forceSplitLighting : packoffset(c4.w); float4 g_exposureMultipliers : packoffset(c5); float2 g_invScreenSize : packoffset(c6); float g_distantIblMipmapBias : packoffset(c6.z); uint g_distantIBLArrayLayerCount : packoffset(c6.w); uint g_distantIBLLatLongWidth : packoffset(c7); uint g_distantIBLLatLongHeight : packoffset(c7.y); uint g_distantIBLRenderMode : packoffset(c7.z); uint g_referenceModeComponent : packoffset(c7.w); float g_skipSkyVisibilityAsAO : packoffset(c8); uint g_sssScatteringEnables : packoffset(c8.y); uint g_tileCountX : packoffset(c8.z); float unused : packoffset(c8.w); float4x3 g_normalBasisTransforms[6] : packoffset(c9); uint g_sssTranslucencyEnables : packoffset(c27); uint g_sssAutomaticThicknessEnables : packoffset(c27.y); float g_lightAngularRadiusX : packoffset(c27.z); float g_lightAngularRadiusY : packoffset(c27.w); float4 g_translucencyCoefficients0[8] : packoffset(c28); float4 g_translucencyCoefficients1[8] : packoffset(c36); float3 g_lightIlluminance : packoffset(c44); float g_lightSpecularScale : packoffset(c44.w); float4 g_cloudOffsetAndScale : packoffset(c45); float4 g_cloudCoverageExponent : packoffset(c46); float4 g_cloudFade : packoffset(c47); float3 g_lightDir : packoffset(c48); float g_dynamicAOFactor : packoffset(c48.w); } SamplerState g_preIntegratedDLSampler_s : register(s0); SamplerState g_preIntegratedFGSampler_s : register(s1); SamplerState g_cloudShadowSampler_s : register(s3); Texture2D<float4> g_gbufferTexture0 : register(t0); Texture2D<float4> g_gbufferTexture1 : register(t1); Texture2D<float4> g_gbufferTexture2 : register(t2); Texture2D<float4> g_gbufferTexture3 : register(t3); Texture2D<float> g_depthTexture : register(t6); Texture2D<float4> g_shadowAccumTexture : register(t7); TextureCube<float4> g_distantIBLPreIntegratedSpecularDL : register(t8); TextureCubeArray<float4> g_distantIBLPreIntegratedSpecularDLArray : register(t9); Texture2D<float4> g_preIntegratedFG : register(t10); Texture2D<float> g_diffuseOcclusionTexture : register(t15); Texture2D<float4> g_cloudShadowTexture : register(t18); Texture2D<uint> g_materialIdTileMaskTexture : register(t19); Texture2D<float4> g_LocalIBLsAndPRsTexture : register(t20); StructuredBuffer<g_lightCullInput> g_lightCullInput : register(t21); Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main( float4 v0 : SV_Position0, float2 v1 : TEXCOORD0, out float4 o0 : SV_Target0, out float4 o1 : SV_Target1) { float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15; uint4 bitmask, uiDest; float4 fDest; r0.xy = g_invScreenSize.xy * v0.xy; r1.xy = (int2)v0.xy; r0.x = g_diffuseOcclusionTexture.SampleLevel(g_preIntegratedFGSampler_s, r0.xy, 0).x; r0.yz = trunc(v0.xy); r0.yz = g_invScreenSize.xy * r0.yz; r1.zw = float2(0,0); r2.xyzw = g_gbufferTexture0.Load(r1.xyw).xyzw; r3.xyzw = g_gbufferTexture1.Load(r1.xyw).xyzw; r4.xyzw = g_gbufferTexture2.Load(r1.xyw).xyzw; r5.xyz = g_gbufferTexture3.Load(r1.xyw).xyz; r6.z = g_depthTexture.Load(r1.xyw).x; r0.w = 6 * r3.w; r0.w = round(r0.w); r0.w = (uint)r0.w; r7.xy = r2.xy * float2(2,2) + float2(-1,-1); r2.x = dot(r7.xy, r7.xy); r2.x = min(1, r2.x); r2.x = 1 + -r2.x; r7.z = sqrt(r2.x); r0.w = (int)r0.w * 3; r8.x = dot(r7.xyz, g_normalBasisTransforms[r0.w]._m00_m10_m20); r8.y = dot(r7.xyz, g_normalBasisTransforms[r0.w]._m01_m11_m21); r8.z = dot(r7.xyz, g_normalBasisTransforms[r0.w]._m02_m12_m22); r0.w = 1 + -r2.z; r2.x = 3 * r2.w; r2.x = round(r2.x); r2.x = (int)r2.x; r2.xy = (int2)r2.xx == int2(2,1); r2.x = r2.x ? r4.x : 0; r2.z = 7.96875 * r4.x; r2.w = (int)r2.z; r2.w = min(7, (int)r2.w); r2.w = r2.y ? r2.w : 0; r3.w = r2.y ? 0 : r4.y; r4.x = 1 + -r3.w; r7.xyz = r4.xxx * r3.xyz; r2.x = 1 + -r2.x; r2.x = r4.z * r2.x; r2.x = r2.x * r2.x; r4.z = 0.159999996 * r2.x; r9.xyz = -r2.xxx * float3(0.159999996,0.159999996,0.159999996) + r3.xyz; r9.xyz = r3.www * r9.xyz + r4.zzz; r2.x = dot(r9.xyz, float3(0.330000013,0.330000013,0.330000013)); r2.x = saturate(50 * r2.x); r10.y = r0.w * r0.w; r11.xy = (uint2)r1.xy >> int2(4,4); r11.zw = float2(0,0); r3.w = g_materialIdTileMaskTexture.Load(r11.xyz).x; if (1 == 0) r3.w = 0; else if (1+1 < 32) { r3.w = (int)r3.w << (32-(1 + 1)); r3.w = (uint)r3.w >> (32-1); } else r3.w = (uint)r3.w >> 1; r3.w = (int)r3.w != 0; r4.z = 1 << (int)r2.w; r5.w = (int)r4.z & g_sssScatteringEnables; r5.w = (int)r5.w != 0; r5.w = r2.y ? r5.w : 0; r3.w = r3.w ? r5.w : 0; if (r3.w != 0) { r7.xyz = float3(1,1,1); r3.w = 1; } else { r3.w = g_forceSplitLighting & 1; } r0.yz = r0.yz * float2(2,2) + float2(-1,-1); r6.xy = float2(1,-1) * r0.yz; r6.w = 1; r12.x = dot(r6.xyzw, g_invViewProjMatrix._m00_m10_m20_m30); r12.y = dot(r6.xyzw, g_invViewProjMatrix._m01_m11_m21_m31); r12.z = dot(r6.xyzw, g_invViewProjMatrix._m02_m12_m22_m32); r0.y = dot(r6.xyzw, g_invViewProjMatrix._m03_m13_m23_m33); r0.y = 1 / r0.y; r6.xyz = r12.xzy * r0.yyy; r0.z = dot(-r6.xyz, -r6.xyz); r0.z = rsqrt(r0.z); r12.xzw = -r6.xzy * r0.zzz; r5.w = dot(r8.xyz, r12.xzw); r10.x = saturate(r5.w); r6.w = dot(-r12.xzw, r8.xyz); r6.w = r6.w + r6.w; r12.xzw = r8.xyz * -r6.www + -r12.xzw; r13.xyz = g_preIntegratedFG.SampleLevel(g_preIntegratedFGSampler_s, r10.xy, 0).xyz; r6.w = r13.y * r2.x; r13.xyw = r9.xyz * r13.xxx + r6.www; r6.w = g_distantIBLRenderMode == 1; if (r6.w != 0) { r6.w = -r0.w * r0.w + 1; r7.w = max(0, r6.w); r7.w = sqrt(r7.w); r7.w = r0.w * r0.w + r7.w; r6.w = r7.w * r6.w; r14.xyz = r12.xzw + -r8.xyz; r14.xyz = r6.www * r14.xyz + r8.xyz; r6.w = g_distantIBLArrayLayerCount + -1; r6.w = (uint)r6.w; r6.w = r6.w * r0.w; r14.w = floor(r6.w); r7.w = r0.w * r0.w + 1; r7.w = log2(r7.w); r15.xyz = g_distantIBLPreIntegratedSpecularDLArray.SampleLevel(g_preIntegratedDLSampler_s, r14.xyzw, r7.w).xyz; r15.xyz = r15.xyz * r13.xyw; r14.w = ceil(r6.w); r14.xyz = g_distantIBLPreIntegratedSpecularDLArray.SampleLevel(g_preIntegratedDLSampler_s, r14.xyzw, r7.w).xyz; r6.w = frac(r6.w); r14.xyz = r14.xyz * r13.xyw + -r15.xyz; r14.xyz = r6.www * r14.xyz + r15.xyz; } else { if (g_distantIBLRenderMode == 0) { r6.w = -r0.w * r0.w + 1; r7.w = max(0, r6.w); r7.w = sqrt(r7.w); r7.w = r0.w * r0.w + r7.w; r6.w = r7.w * r6.w; r15.xyz = r12.xzw + -r8.xyz; r15.xyz = r6.www * r15.xyz + r8.xyz; r6.w = r10.y * g_distantIblMipmapBias + 1; r6.w = log2(r6.w); r15.xyz = g_distantIBLPreIntegratedSpecularDL.SampleLevel(g_preIntegratedDLSampler_s, r15.xyz, r6.w).xyz; r13.xyw = r15.xyz * r13.xyw; r4.w = max(g_skipSkyVisibilityAsAO, r4.w); r4.w = min(r4.w, r0.x); r6.w = r10.x + r4.w; r7.w = r10.y * -16 + -1; r7.w = exp2(r7.w); r6.w = log2(r6.w); r6.w = r7.w * r6.w; r6.w = exp2(r6.w); r4.w = r6.w + r4.w; r4.w = saturate(-1 + r4.w); r14.xyz = r13.xyw * r4.www; } else { r14.xyz = float3(0,0,0); } } r10.xzw = g_exposureMultipliers.zzz * r14.xyz; r5.xyz = g_exposureMultipliers.yyy * r5.xyz; r5.xyz = r5.xyz * r13.zzz; r5.xyz = r5.xyz * r7.xyz; r4.w = mad((int)r11.y, g_tileCountX, (int)r11.x); // Known bad code for instruction (needs manual fix): // ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r4.w, r4.w, l(12), t21.xxxx r4.w = g_preIntegratedDLSampler[]..swiz; r6.w = (uint)r4.w >> 16; r4.w = (int)r4.w & 0x0000ffff; r4.w = (int)r6.w + (int)r4.w; if (r4.w != 0) { r11.xyzw = g_LocalIBLsAndPRsTexture.Load(r1.xyw).xyzw; } else { r11.xyzw = float4(0,0,0,1); } r4.w = (int)r4.z & g_sssTranslucencyEnables; r4.w = (int)r4.w != 0; r2.y = r2.y ? r4.w : 0; r1.xy = g_shadowAccumTexture.Load(r1.xyz).xy; r0.y = r12.y * r0.y + g_cameraPos.y; r1.zw = g_lightDir.xz * r0.yy; r1.zw = -r1.zw * g_cloudOffsetAndScale.ww + r6.xy; r1.zw = r1.zw * g_cloudOffsetAndScale.zz + g_cloudOffsetAndScale.xy; r1.z = g_cloudShadowTexture.SampleLevel(g_cloudShadowSampler_s, r1.zw, 0).x; r1.z = saturate(g_cloudCoverageExponent.x + r1.z); r1.z = log2(r1.z); r1.z = g_cloudCoverageExponent.y * r1.z; r1.z = exp2(r1.z); r1.w = dot(r6.xyz, r6.xyz); r1.w = sqrt(r1.w); r1.w = saturate(r1.w * g_cloudFade.y + g_cloudFade.x); r0.y = saturate(r0.y * g_cloudFade.w + g_cloudFade.z); r0.y = max(r1.w, r0.y); r0.y = r0.y * r0.y; r1.w = 1 + -r1.z; r0.y = r0.y * r1.w + r1.z; r0.y = r1.x * r0.y; r1.x = dot(r8.xyz, g_lightDir.xyz); r1.z = saturate(r1.x); r1.w = 0 < r1.z; if (r1.w != 0) { r1.w = max(0.00200000009, r10.y); r4.w = dot(g_lightDir.xyz, r12.xzw); r13.xyz = -r4.www * g_lightDir.xyz + r12.xzw; r4.w = r4.w < g_lightAngularRadiusX; r6.w = dot(r13.xyz, r13.xyz); r6.w = rsqrt(r6.w); r13.xyz = r13.xyz * r6.www; r13.xyz = g_lightAngularRadiusY * r13.xyz; r13.xyz = g_lightAngularRadiusX * g_lightDir.xyz + r13.xyz; r6.w = dot(r13.xyz, r13.xyz); r6.w = rsqrt(r6.w); r13.xyz = r13.xyz * r6.www; r12.xyz = r4.www ? r13.xyz : r12.xzw; r4.w = 9.99999975e-006 + abs(r5.w); r13.xyz = -r6.xzy * r0.zzz + r12.xyz; r5.w = dot(r13.xyz, r13.xyz); r5.w = rsqrt(r5.w); r13.xyz = r13.xyz * r5.www; r6.xyz = -r6.xzy * r0.zzz + g_lightDir.xyz; r0.z = dot(r6.xyz, r6.xyz); r0.z = rsqrt(r0.z); r6.xyz = r6.xyz * r0.zzz; r0.z = saturate(dot(r12.xyz, r13.xyz)); r5.w = saturate(dot(g_lightDir.xyz, r6.xyz)); r6.x = saturate(dot(r8.xyz, r13.xyz)); r6.y = saturate(dot(r8.xyz, r12.xyz)); r0.z = 1 + -r0.z; r6.z = r0.z * r0.z; r6.z = r6.z * r6.z; r0.z = r6.z * r0.z; r8.xyz = r2.xxx + -r9.xyz; r8.xyz = r8.xyz * r0.zzz + r9.xyz; r0.z = r1.w * r1.w; r1.w = -r4.w * r0.z + r4.w; r1.w = r1.w * r4.w + r0.z; r1.w = sqrt(r1.w); r2.x = -r6.y * r0.z + r6.y; r2.x = r2.x * r6.y + r0.z; r2.x = sqrt(r2.x); r2.x = r4.w * r2.x; r1.w = r6.y * r1.w + r2.x; r1.w = 0.5 / r1.w; r2.x = r6.x * r0.z + -r6.x; r2.x = r2.x * r6.x + 1; r2.x = r2.x * r2.x; r0.z = r0.z / r2.x; r0.z = r1.w * r0.z; r6.xyz = r8.xyz * r0.zzz; r0.z = r0.w * -0.337748349 + 1; r1.w = r5.w * r5.w; r1.w = dot(r1.ww, r0.ww); r0.w = r0.w * 0.5 + r1.w; r1.w = 1 + -r1.z; r2.x = r1.w * r1.w; r2.x = r2.x * r2.x; r1.w = r2.x * r1.w; r0.w = -1 + r0.w; r1.w = r0.w * r1.w + 1; r2.x = 1 + -r4.w; r4.w = r2.x * r2.x; r4.w = r4.w * r4.w; r2.x = r4.w * r2.x; r0.w = r0.w * r2.x + 1; r0.w = r1.w * r0.w; r0.z = r0.w * r0.z; r0.w = r1.z * r0.y; r8.xyz = g_lightIlluminance.xyz * r0.www; r9.xyz = r8.xyz * r0.zzz; r6.xyz = r8.xyz * r6.xyz; } else { r9.xyz = float3(0,0,0); r6.xyz = float3(0,0,0); } if (r2.y != 0) { r0.z = frac(r2.z); r0.w = (int)r4.z & g_sssAutomaticThicknessEnables; r2.xyz = g_translucencyCoefficients0[r2.w].xyz * r0.zzz; r0.z = max(9.99999975e-006, r1.y); r0.z = log2(r0.z); r0.z = r4.y + -r0.z; r1.y = g_translucencyCoefficients1[r2.w].x * r4.y; r0.z = r0.w ? r0.z : r1.y; r1.y = saturate(0.100000001 + -r1.x); r0.y = r1.y * r0.y; r1.y = 1 + -r1.z; r1.y = 0.25 * r1.y; r1.x = -0.5 + r1.x; r1.x = saturate(-1.81818175 * r1.x); r1.z = r1.x * -2 + 3; r1.x = r1.x * r1.x; r1.x = r1.z * r1.x; r1.x = r1.y * r1.x; r0.y = r0.w ? r1.x : r0.y; r0.y = g_translucencyCoefficients1[r2.w].y * r0.y; r0.w = saturate(r4.y * -4 + 4); r1.xyz = r2.xyz + r2.xyz; r1.xyz = float3(-0.124999993,-0.124999993,-0.124999993) / r1.xyz; r1.xyz = float3(1.44269502,1.44269502,1.44269502) * r1.xyz; r1.xyz = exp2(r1.xyz); r2.xyz = r3.xyz * r4.xxx + -r1.xyz; r1.xyz = g_translucencyCoefficients0[r2.w].www * r2.xyz + r1.xyz; r1.xyz = max(float3(9.99999975e-006,9.99999975e-006,9.99999975e-006), r1.xyz); r0.z = r0.z * r0.z; r0.z = 8 * r0.z; r1.xyz = log2(r1.xyz); r1.xyz = r1.xyz * r0.zzz; r1.xyz = exp2(r1.xyz); r1.xyz = r1.xyz * r0.yyy; r0.yzw = r1.xyz * r0.www; r9.xyz = g_lightIlluminance.xyz * r0.yzw + r9.xyz; } r0.y = -1 + r0.x; r0.y = g_dynamicAOFactor * r0.y + 1; r0.yzw = r9.xyz * r0.yyy; r1.x = g_lightSpecularScale * g_exposureMultipliers.z; r1.xyz = r6.xyz * r1.xxx; r0.yzw = r7.xyz * r0.yzw; r0.yzw = float3(0.318309873,0.318309873,0.318309873) * r0.yzw; r0.xyz = r5.xyz * r0.xxx + r0.yzw; r2.xyz = g_exposureMultipliers.zzz * r0.xyz; r3.xyz = r11.www * r10.xzw + r11.xyz; r1.xyz = r1.xyz * float3(0.318309873,0.318309873,0.318309873) + r3.xyz; if (r3.w == 0) { r1.xyz = r0.xyz * g_exposureMultipliers.zzz + r1.xyz; r2.xyz = float3(0,0,0); } o1.xyz = r2.xyz; o1.w = 0; o0.xyz = r1.xyz; o0.w = 0; return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // using 3Dmigoto v1.2.10 on Thu Nov 26 20:22:59 2015 // // // Buffer Definitions: // // cbuffer CommonConstants // { // // float4x4 g_invViewProjMatrix; // Offset: 0 Size: 64 // float3 g_cameraPos; // Offset: 64 Size: 12 // uint g_forceSplitLighting; // Offset: 76 Size: 4 // float4 g_exposureMultipliers; // Offset: 80 Size: 16 // float2 g_invScreenSize; // Offset: 96 Size: 8 // float g_distantIblMipmapBias; // Offset: 104 Size: 4 // uint g_distantIBLArrayLayerCount; // Offset: 108 Size: 4 // uint g_distantIBLLatLongWidth; // Offset: 112 Size: 4 [unused] // uint g_distantIBLLatLongHeight; // Offset: 116 Size: 4 [unused] // uint g_distantIBLRenderMode; // Offset: 120 Size: 4 // uint g_referenceModeComponent; // Offset: 124 Size: 4 [unused] // float g_skipSkyVisibilityAsAO; // Offset: 128 Size: 4 // uint g_sssScatteringEnables; // Offset: 132 Size: 4 // uint g_tileCountX; // Offset: 136 Size: 4 // float unused; // Offset: 140 Size: 4 [unused] // float4x3 g_normalBasisTransforms[6];// Offset: 144 Size: 288 // uint g_sssTranslucencyEnables; // Offset: 432 Size: 4 // uint g_sssAutomaticThicknessEnables;// Offset: 436 Size: 4 // float g_lightAngularRadiusX; // Offset: 440 Size: 4 // float g_lightAngularRadiusY; // Offset: 444 Size: 4 // float4 g_translucencyCoefficients0[8];// Offset: 448 Size: 128 // float4 g_translucencyCoefficients1[8];// Offset: 576 Size: 128 // float3 g_lightIlluminance; // Offset: 704 Size: 12 // float g_lightSpecularScale; // Offset: 716 Size: 4 // float4 g_cloudOffsetAndScale; // Offset: 720 Size: 16 // float4 g_cloudCoverageExponent; // Offset: 736 Size: 16 // float4 g_cloudFade; // Offset: 752 Size: 16 // float3 g_lightDir; // Offset: 768 Size: 12 // float g_dynamicAOFactor; // Offset: 780 Size: 4 // // } // // Resource bind info for g_lightCullInput // { // // uint4 $Element; // Offset: 0 Size: 16 // // } // // // Resource Bindings: // // Name Type Format Dim Slot Elements // ------------------------------ ---------- ------- ----------- ---- -------- // g_preIntegratedDLSampler sampler NA NA 0 1 // g_preIntegratedFGSampler sampler NA NA 1 1 // g_cloudShadowSampler sampler NA NA 3 1 // g_gbufferTexture0 texture float4 2d 0 1 // g_gbufferTexture1 texture float4 2d 1 1 // g_gbufferTexture2 texture float4 2d 2 1 // g_gbufferTexture3 texture float4 2d 3 1 // g_depthTexture texture float 2d 6 1 // g_shadowAccumTexture texture float4 2d 7 1 // g_distantIBLPreIntegratedSpecularDL texture float4 cube 8 1 // g_distantIBLPreIntegratedSpecularDLArray texture float4 cubearray 9 1 // g_preIntegratedFG texture float4 2d 10 1 // g_diffuseOcclusionTexture texture float 2d 15 1 // g_cloudShadowTexture texture float4 2d 18 1 // g_materialIdTileMaskTexture texture uint 2d 19 1 // g_LocalIBLsAndPRsTexture texture float4 2d 20 1 // g_lightCullInput texture struct r/o 21 1 // CommonConstants cbuffer NA NA 0 1 // // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Position 0 xyzw 0 POS float xy // TEXCOORD 0 xy 1 NONE float // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Target 0 xyzw 0 TARGET float xyzw // SV_Target 1 xyzw 1 TARGET float xyzw // ps_5_0 dcl_globalFlags refactoringAllowed dcl_constantbuffer cb0[49], dynamicIndexed dcl_sampler s0, mode_default dcl_sampler s1, mode_default dcl_sampler s3, mode_default dcl_resource_texture2d (float,float,float,float) t0 dcl_resource_texture2d (float,float,float,float) t1 dcl_resource_texture2d (float,float,float,float) t2 dcl_resource_texture2d (float,float,float,float) t3 dcl_resource_texture2d (float,float,float,float) t6 dcl_resource_texture2d (float,float,float,float) t7 dcl_resource_texturecube (float,float,float,float) t8 dcl_resource_texturecubearray (float,float,float,float) t9 dcl_resource_texture2d (float,float,float,float) t10 dcl_resource_texture2d (float,float,float,float) t15 dcl_resource_texture2d (float,float,float,float) t18 dcl_resource_texture2d (uint,uint,uint,uint) t19 dcl_resource_texture2d (float,float,float,float) t20 dcl_resource_structured t21, 16 dcl_input_ps_siv linear noperspective v0.xy, position dcl_output o0.xyzw dcl_output o1.xyzw dcl_temps 16 mul r0.xy, v0.xyxx, cb0[6].xyxx ftoi r1.xy, v0.xyxx sample_l_indexable(texture2d)(float,float,float,float) r0.x, r0.xyxx, t15.xyzw, s1, l(0.000000) round_z r0.yz, v0.xxyx mul r0.yz, r0.yyzy, cb0[6].xxyx mov r1.zw, l(0,0,0,0) ld_indexable(texture2d)(float,float,float,float) r2.xyzw, r1.xyww, t0.xyzw ld_indexable(texture2d)(float,float,float,float) r3.xyzw, r1.xyww, t1.xyzw ld_indexable(texture2d)(float,float,float,float) r4.xyzw, r1.xyww, t2.xyzw ld_indexable(texture2d)(float,float,float,float) r5.xyz, r1.xyww, t3.xyzw ld_indexable(texture2d)(float,float,float,float) r6.z, r1.xyww, t6.yzxw mul r0.w, r3.w, l(6.000000) round_ne r0.w, r0.w ftou r0.w, r0.w mad r7.xy, r2.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000) dp2 r2.x, r7.xyxx, r7.xyxx min r2.x, r2.x, l(1.000000) add r2.x, -r2.x, l(1.000000) sqrt r7.z, r2.x imul null, r0.w, r0.w, l(3) dp3 r8.x, r7.xyzx, cb0[r0.w + 9].xyzx dp3 r8.y, r7.xyzx, cb0[r0.w + 10].xyzx dp3 r8.z, r7.xyzx, cb0[r0.w + 11].xyzx add r0.w, -r2.z, l(1.000000) mul r2.x, r2.w, l(3.000000) round_ne r2.x, r2.x ftoi r2.x, r2.x ieq r2.xy, r2.xxxx, l(2, 1, 0, 0) and r2.x, r4.x, r2.x mul r2.z, r4.x, l(7.968750) ftoi r2.w, r2.z imin r2.w, r2.w, l(7) and r2.w, r2.w, r2.y movc r3.w, r2.y, l(0), r4.y add r4.x, -r3.w, l(1.000000) mul r7.xyz, r3.xyzx, r4.xxxx add r2.x, -r2.x, l(1.000000) mul r2.x, r2.x, r4.z mul r2.x, r2.x, r2.x mul r4.z, r2.x, l(0.160000) mad r9.xyz, -r2.xxxx, l(0.160000, 0.160000, 0.160000, 0.000000), r3.xyzx mad r9.xyz, r3.wwww, r9.xyzx, r4.zzzz dp3 r2.x, r9.xyzx, l(0.330000, 0.330000, 0.330000, 0.000000) mul_sat r2.x, r2.x, l(50.000000) mul r10.y, r0.w, r0.w ushr r11.xy, r1.xyxx, l(4, 4, 0, 0) mov r11.zw, l(0,0,0,0) ld_indexable(texture2d)(uint,uint,uint,uint) r3.w, r11.xyzw, t19.yzwx ubfe r3.w, l(1), l(1), r3.w ine r3.w, r3.w, l(0) ishl r4.z, l(1), r2.w and r5.w, r4.z, cb0[8].y ine r5.w, r5.w, l(0) and r5.w, r2.y, r5.w and r3.w, r3.w, r5.w if_nz r3.w mov r7.xyz, l(1.000000,1.000000,1.000000,0) mov r3.w, l(1) else and r3.w, cb0[4].w, l(1) endif mad r0.yz, r0.yyzy, l(0.000000, 2.000000, 2.000000, 0.000000), l(0.000000, -1.000000, -1.000000, 0.000000) mul r6.xy, r0.yzyy, l(1.000000, -1.000000, 0.000000, 0.000000) mov r6.w, l(1.000000) dp4 r12.x, r6.xyzw, cb0[0].xyzw dp4 r12.y, r6.xyzw, cb0[1].xyzw dp4 r12.z, r6.xyzw, cb0[2].xyzw dp4 r0.y, r6.xyzw, cb0[3].xyzw div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y mul r6.xyz, r0.yyyy, r12.xzyx dp3 r0.z, -r6.xyzx, -r6.xyzx rsq r0.z, r0.z mul r12.xzw, r0.zzzz, -r6.xxzy dp3 r5.w, r8.xyzx, r12.xzwx mov_sat r10.x, r5.w dp3 r6.w, -r12.xzwx, r8.xyzx add r6.w, r6.w, r6.w mad r12.xzw, r8.xxyz, -r6.wwww, -r12.xxzw sample_l_indexable(texture2d)(float,float,float,float) r13.xyz, r10.xyxx, t10.xyzw, s1, l(0.000000) mul r6.w, r2.x, r13.y mad r13.xyw, r9.xyxz, r13.xxxx, r6.wwww ieq r6.w, cb0[7].z, l(1) if_nz r6.w mad r6.w, -r0.w, r0.w, l(1.000000) max r7.w, r6.w, l(0.000000) sqrt r7.w, r7.w mad r7.w, r0.w, r0.w, r7.w mul r6.w, r6.w, r7.w add r14.xyz, -r8.xyzx, r12.xzwx mad r14.xyz, r6.wwww, r14.xyzx, r8.xyzx iadd r6.w, cb0[6].w, l(-1) utof r6.w, r6.w mul r6.w, r0.w, r6.w round_ni r14.w, r6.w mad r7.w, r0.w, r0.w, l(1.000000) log r7.w, r7.w sample_l_indexable(texturecubearray)(float,float,float,float) r15.xyz, r14.xyzw, t9.xyzw, s0, r7.w mul r15.xyz, r13.xywx, r15.xyzx round_pi r14.w, r6.w sample_l_indexable(texturecubearray)(float,float,float,float) r14.xyz, r14.xyzw, t9.xyzw, s0, r7.w frc r6.w, r6.w mad r14.xyz, r14.xyzx, r13.xywx, -r15.xyzx mad r14.xyz, r6.wwww, r14.xyzx, r15.xyzx else if_z cb0[7].z mad r6.w, -r0.w, r0.w, l(1.000000) max r7.w, r6.w, l(0.000000) sqrt r7.w, r7.w mad r7.w, r0.w, r0.w, r7.w mul r6.w, r6.w, r7.w add r15.xyz, -r8.xyzx, r12.xzwx mad r15.xyz, r6.wwww, r15.xyzx, r8.xyzx mad r6.w, r10.y, cb0[6].z, l(1.000000) log r6.w, r6.w sample_l_indexable(texturecube)(float,float,float,float) r15.xyz, r15.xyzx, t8.xyzw, s0, r6.w mul r13.xyw, r13.xyxw, r15.xyxz max r4.w, r4.w, cb0[8].x min r4.w, r0.x, r4.w add r6.w, r4.w, r10.x mad r7.w, r10.y, l(-16.000000), l(-1.000000) exp r7.w, r7.w log r6.w, r6.w mul r6.w, r6.w, r7.w exp r6.w, r6.w add r4.w, r4.w, r6.w add_sat r4.w, r4.w, l(-1.000000) mul r14.xyz, r4.wwww, r13.xywx else mov r14.xyz, l(0,0,0,0) endif endif mul r10.xzw, r14.xxyz, cb0[5].zzzz mul r5.xyz, r5.xyzx, cb0[5].yyyy mul r5.xyz, r13.zzzz, r5.xyzx mul r5.xyz, r7.xyzx, r5.xyzx imad r4.w, r11.y, cb0[8].z, r11.x ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r4.w, r4.w, l(12), t21.xxxx ushr r6.w, r4.w, l(16) and r4.w, r4.w, l(0x0000ffff) iadd r4.w, r6.w, r4.w if_nz r4.w ld_indexable(texture2d)(float,float,float,float) r11.xyzw, r1.xyww, t20.xyzw else mov r11.xyzw, l(0,0,0,1.000000) endif and r4.w, r4.z, cb0[27].x ine r4.w, r4.w, l(0) and r2.y, r2.y, r4.w ld_indexable(texture2d)(float,float,float,float) r1.xy, r1.xyzw, t7.xyzw mad r0.y, r12.y, r0.y, cb0[4].y mul r1.zw, r0.yyyy, cb0[48].xxxz mad r1.zw, -r1.zzzw, cb0[45].wwww, r6.xxxy mad r1.zw, r1.zzzw, cb0[45].zzzz, cb0[45].xxxy sample_l_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t18.yzxw, s3, l(0.000000) add_sat r1.z, r1.z, cb0[46].x log r1.z, r1.z mul r1.z, r1.z, cb0[46].y exp r1.z, r1.z dp3 r1.w, r6.xyzx, r6.xyzx sqrt r1.w, r1.w mad_sat r1.w, r1.w, cb0[47].y, cb0[47].x mad_sat r0.y, r0.y, cb0[47].w, cb0[47].z max r0.y, r0.y, r1.w mul r0.y, r0.y, r0.y add r1.w, -r1.z, l(1.000000) mad r0.y, r0.y, r1.w, r1.z mul r0.y, r0.y, r1.x dp3 r1.x, r8.xyzx, cb0[48].xyzx mov_sat r1.z, r1.x lt r1.w, l(0.000000), r1.z if_nz r1.w max r1.w, r10.y, l(0.002000) dp3 r4.w, cb0[48].xyzx, r12.xzwx mad r13.xyz, -r4.wwww, cb0[48].xyzx, r12.xzwx lt r4.w, r4.w, cb0[27].z dp3 r6.w, r13.xyzx, r13.xyzx rsq r6.w, r6.w mul r13.xyz, r6.wwww, r13.xyzx mul r13.xyz, r13.xyzx, cb0[27].wwww mad r13.xyz, cb0[27].zzzz, cb0[48].xyzx, r13.xyzx dp3 r6.w, r13.xyzx, r13.xyzx rsq r6.w, r6.w mul r13.xyz, r6.wwww, r13.xyzx movc r12.xyz, r4.wwww, r13.xyzx, r12.xzwx add r4.w, |r5.w|, l(0.000010) mad r13.xyz, -r6.xzyx, r0.zzzz, r12.xyzx dp3 r5.w, r13.xyzx, r13.xyzx rsq r5.w, r5.w mul r13.xyz, r5.wwww, r13.xyzx mad r6.xyz, -r6.xzyx, r0.zzzz, cb0[48].xyzx dp3 r0.z, r6.xyzx, r6.xyzx rsq r0.z, r0.z mul r6.xyz, r0.zzzz, r6.xyzx dp3_sat r0.z, r12.xyzx, r13.xyzx dp3_sat r5.w, cb0[48].xyzx, r6.xyzx dp3_sat r6.x, r8.xyzx, r13.xyzx dp3_sat r6.y, r8.xyzx, r12.xyzx add r0.z, -r0.z, l(1.000000) mul r6.z, r0.z, r0.z mul r6.z, r6.z, r6.z mul r0.z, r0.z, r6.z add r8.xyz, -r9.xyzx, r2.xxxx mad r8.xyz, r8.xyzx, r0.zzzz, r9.xyzx mul r0.z, r1.w, r1.w mad r1.w, -r4.w, r0.z, r4.w mad r1.w, r1.w, r4.w, r0.z sqrt r1.w, r1.w mad r2.x, -r6.y, r0.z, r6.y mad r2.x, r2.x, r6.y, r0.z sqrt r2.x, r2.x mul r2.x, r2.x, r4.w mad r1.w, r6.y, r1.w, r2.x div r1.w, l(0.500000), r1.w mad r2.x, r6.x, r0.z, -r6.x mad r2.x, r2.x, r6.x, l(1.000000) mul r2.x, r2.x, r2.x div r0.z, r0.z, r2.x mul r0.z, r0.z, r1.w mul r6.xyz, r0.zzzz, r8.xyzx mad r0.z, r0.w, l(-0.337748349), l(1.000000) mul r1.w, r5.w, r5.w dp2 r1.w, r1.wwww, r0.wwww mad r0.w, r0.w, l(0.500000), r1.w add r1.w, -r1.z, l(1.000000) mul r2.x, r1.w, r1.w mul r2.x, r2.x, r2.x mul r1.w, r1.w, r2.x add r0.w, r0.w, l(-1.000000) mad r1.w, r0.w, r1.w, l(1.000000) add r2.x, -r4.w, l(1.000000) mul r4.w, r2.x, r2.x mul r4.w, r4.w, r4.w mul r2.x, r2.x, r4.w mad r0.w, r0.w, r2.x, l(1.000000) mul r0.w, r0.w, r1.w mul r0.z, r0.z, r0.w mul r0.w, r0.y, r1.z mul r8.xyz, r0.wwww, cb0[44].xyzx mul r9.xyz, r0.zzzz, r8.xyzx mul r6.xyz, r6.xyzx, r8.xyzx else mov r9.xyz, l(0,0,0,0) mov r6.xyz, l(0,0,0,0) endif if_nz r2.y frc r0.z, r2.z and r0.w, r4.z, cb0[27].y mul r2.xyz, r0.zzzz, cb0[r2.w + 28].xyzx max r0.z, r1.y, l(0.000010) log r0.z, r0.z add r0.z, -r0.z, r4.y mul r1.y, r4.y, cb0[r2.w + 36].x movc r0.z, r0.w, r0.z, r1.y add_sat r1.y, -r1.x, l(0.100000) mul r0.y, r0.y, r1.y add r1.y, -r1.z, l(1.000000) mul r1.y, r1.y, l(0.250000) add r1.x, r1.x, l(-0.500000) mul_sat r1.x, r1.x, l(-1.81818175) mad r1.z, r1.x, l(-2.000000), l(3.000000) mul r1.x, r1.x, r1.x mul r1.x, r1.x, r1.z mul r1.x, r1.x, r1.y movc r0.y, r0.w, r1.x, r0.y mul r0.y, r0.y, cb0[r2.w + 36].y mad_sat r0.w, r4.y, l(-4.000000), l(4.000000) add r1.xyz, r2.xyzx, r2.xyzx div r1.xyz, l(-0.124999993, -0.124999993, -0.124999993, 0.000000), r1.xyzx mul r1.xyz, r1.xyzx, l(1.442695, 1.442695, 1.442695, 0.000000) exp r1.xyz, r1.xyzx mad r2.xyz, r3.xyzx, r4.xxxx, -r1.xyzx mad r1.xyz, cb0[r2.w + 28].wwww, r2.xyzx, r1.xyzx max r1.xyz, r1.xyzx, l(0.000010, 0.000010, 0.000010, 0.000000) mul r0.z, r0.z, r0.z mul r0.z, r0.z, l(8.000000) log r1.xyz, r1.xyzx mul r1.xyz, r0.zzzz, r1.xyzx exp r1.xyz, r1.xyzx mul r1.xyz, r0.yyyy, r1.xyzx mul r0.yzw, r0.wwww, r1.xxyz mad r9.xyz, cb0[44].xyzx, r0.yzwy, r9.xyzx endif add r0.y, r0.x, l(-1.000000) mad r0.y, cb0[48].w, r0.y, l(1.000000) mul r0.yzw, r0.yyyy, r9.xxyz mul r1.x, cb0[5].z, cb0[44].w mul r1.xyz, r1.xxxx, r6.xyzx mul r0.yzw, r0.yyzw, r7.xxyz mul r0.yzw, r0.yyzw, l(0.000000, 0.318309873, 0.318309873, 0.318309873) mad r0.xyz, r5.xyzx, r0.xxxx, r0.yzwy mul r2.xyz, r0.xyzx, cb0[5].zzzz mad r3.xyz, r11.wwww, r10.xzwx, r11.xyzx mad r1.xyz, r1.xyzx, l(0.318309873, 0.318309873, 0.318309873, 0.000000), r3.xyzx if_z r3.w mad r1.xyz, r0.xyzx, cb0[5].zzzz, r1.xyzx mov r2.xyz, l(0,0,0,0) endif mov o1.xyz, r2.xyzx mov o1.w, l(0) mov o0.xyz, r1.xyzx mov o0.w, l(0) ret // Approximately 302 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code] How can I fix the "bad code" segment? ^_^
I also have a BAD pixel shader code here:

cbuffer CommonConstants : register(b0)
{
float4x4 g_invViewProjMatrix : packoffset(c0);
float3 g_cameraPos : packoffset(c4);
uint g_forceSplitLighting : packoffset(c4.w);
float4 g_exposureMultipliers : packoffset(c5);
float2 g_invScreenSize : packoffset(c6);
float g_distantIblMipmapBias : packoffset(c6.z);
uint g_distantIBLArrayLayerCount : packoffset(c6.w);
uint g_distantIBLLatLongWidth : packoffset(c7);
uint g_distantIBLLatLongHeight : packoffset(c7.y);
uint g_distantIBLRenderMode : packoffset(c7.z);
uint g_referenceModeComponent : packoffset(c7.w);
float g_skipSkyVisibilityAsAO : packoffset(c8);
uint g_sssScatteringEnables : packoffset(c8.y);
uint g_tileCountX : packoffset(c8.z);
float unused : packoffset(c8.w);
float4x3 g_normalBasisTransforms[6] : packoffset(c9);
uint g_sssTranslucencyEnables : packoffset(c27);
uint g_sssAutomaticThicknessEnables : packoffset(c27.y);
float g_lightAngularRadiusX : packoffset(c27.z);
float g_lightAngularRadiusY : packoffset(c27.w);
float4 g_translucencyCoefficients0[8] : packoffset(c28);
float4 g_translucencyCoefficients1[8] : packoffset(c36);
float3 g_lightIlluminance : packoffset(c44);
float g_lightSpecularScale : packoffset(c44.w);
float4 g_cloudOffsetAndScale : packoffset(c45);
float4 g_cloudCoverageExponent : packoffset(c46);
float4 g_cloudFade : packoffset(c47);
float3 g_lightDir : packoffset(c48);
float g_dynamicAOFactor : packoffset(c48.w);
}
SamplerState g_preIntegratedDLSampler_s : register(s0);
SamplerState g_preIntegratedFGSampler_s : register(s1);
SamplerState g_cloudShadowSampler_s : register(s3);
Texture2D<float4> g_gbufferTexture0 : register(t0);
Texture2D<float4> g_gbufferTexture1 : register(t1);
Texture2D<float4> g_gbufferTexture2 : register(t2);
Texture2D<float4> g_gbufferTexture3 : register(t3);
Texture2D<float> g_depthTexture : register(t6);
Texture2D<float4> g_shadowAccumTexture : register(t7);
TextureCube<float4> g_distantIBLPreIntegratedSpecularDL : register(t8);
TextureCubeArray<float4> g_distantIBLPreIntegratedSpecularDLArray : register(t9);
Texture2D<float4> g_preIntegratedFG : register(t10);
Texture2D<float> g_diffuseOcclusionTexture : register(t15);
Texture2D<float4> g_cloudShadowTexture : register(t18);
Texture2D<uint> g_materialIdTileMaskTexture : register(t19);
Texture2D<float4> g_LocalIBLsAndPRsTexture : register(t20);
StructuredBuffer<g_lightCullInput> g_lightCullInput : register(t21);

Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main(
float4 v0 : SV_Position0,
float2 v1 : TEXCOORD0,
out float4 o0 : SV_Target0,
out float4 o1 : SV_Target1)
{
float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15;
uint4 bitmask, uiDest;
float4 fDest;

r0.xy = g_invScreenSize.xy * v0.xy;
r1.xy = (int2)v0.xy;
r0.x = g_diffuseOcclusionTexture.SampleLevel(g_preIntegratedFGSampler_s, r0.xy, 0).x;
r0.yz = trunc(v0.xy);
r0.yz = g_invScreenSize.xy * r0.yz;
r1.zw = float2(0,0);
r2.xyzw = g_gbufferTexture0.Load(r1.xyw).xyzw;
r3.xyzw = g_gbufferTexture1.Load(r1.xyw).xyzw;
r4.xyzw = g_gbufferTexture2.Load(r1.xyw).xyzw;
r5.xyz = g_gbufferTexture3.Load(r1.xyw).xyz;
r6.z = g_depthTexture.Load(r1.xyw).x;
r0.w = 6 * r3.w;
r0.w = round(r0.w);
r0.w = (uint)r0.w;
r7.xy = r2.xy * float2(2,2) + float2(-1,-1);
r2.x = dot(r7.xy, r7.xy);
r2.x = min(1, r2.x);
r2.x = 1 + -r2.x;
r7.z = sqrt(r2.x);
r0.w = (int)r0.w * 3;
r8.x = dot(r7.xyz, g_normalBasisTransforms[r0.w]._m00_m10_m20);
r8.y = dot(r7.xyz, g_normalBasisTransforms[r0.w]._m01_m11_m21);
r8.z = dot(r7.xyz, g_normalBasisTransforms[r0.w]._m02_m12_m22);
r0.w = 1 + -r2.z;
r2.x = 3 * r2.w;
r2.x = round(r2.x);
r2.x = (int)r2.x;
r2.xy = (int2)r2.xx == int2(2,1);
r2.x = r2.x ? r4.x : 0;
r2.z = 7.96875 * r4.x;
r2.w = (int)r2.z;
r2.w = min(7, (int)r2.w);
r2.w = r2.y ? r2.w : 0;
r3.w = r2.y ? 0 : r4.y;
r4.x = 1 + -r3.w;
r7.xyz = r4.xxx * r3.xyz;
r2.x = 1 + -r2.x;
r2.x = r4.z * r2.x;
r2.x = r2.x * r2.x;
r4.z = 0.159999996 * r2.x;
r9.xyz = -r2.xxx * float3(0.159999996,0.159999996,0.159999996) + r3.xyz;
r9.xyz = r3.www * r9.xyz + r4.zzz;
r2.x = dot(r9.xyz, float3(0.330000013,0.330000013,0.330000013));
r2.x = saturate(50 * r2.x);
r10.y = r0.w * r0.w;
r11.xy = (uint2)r1.xy >> int2(4,4);
r11.zw = float2(0,0);
r3.w = g_materialIdTileMaskTexture.Load(r11.xyz).x;
if (1 == 0) r3.w = 0; else if (1+1 < 32) { r3.w = (int)r3.w << (32-(1 + 1)); r3.w = (uint)r3.w >> (32-1); } else r3.w = (uint)r3.w >> 1;
r3.w = (int)r3.w != 0;
r4.z = 1 << (int)r2.w;
r5.w = (int)r4.z & g_sssScatteringEnables;
r5.w = (int)r5.w != 0;
r5.w = r2.y ? r5.w : 0;
r3.w = r3.w ? r5.w : 0;
if (r3.w != 0) {
r7.xyz = float3(1,1,1);
r3.w = 1;
} else {
r3.w = g_forceSplitLighting & 1;
}
r0.yz = r0.yz * float2(2,2) + float2(-1,-1);
r6.xy = float2(1,-1) * r0.yz;
r6.w = 1;
r12.x = dot(r6.xyzw, g_invViewProjMatrix._m00_m10_m20_m30);
r12.y = dot(r6.xyzw, g_invViewProjMatrix._m01_m11_m21_m31);
r12.z = dot(r6.xyzw, g_invViewProjMatrix._m02_m12_m22_m32);
r0.y = dot(r6.xyzw, g_invViewProjMatrix._m03_m13_m23_m33);
r0.y = 1 / r0.y;
r6.xyz = r12.xzy * r0.yyy;
r0.z = dot(-r6.xyz, -r6.xyz);
r0.z = rsqrt(r0.z);
r12.xzw = -r6.xzy * r0.zzz;
r5.w = dot(r8.xyz, r12.xzw);
r10.x = saturate(r5.w);
r6.w = dot(-r12.xzw, r8.xyz);
r6.w = r6.w + r6.w;
r12.xzw = r8.xyz * -r6.www + -r12.xzw;
r13.xyz = g_preIntegratedFG.SampleLevel(g_preIntegratedFGSampler_s, r10.xy, 0).xyz;
r6.w = r13.y * r2.x;
r13.xyw = r9.xyz * r13.xxx + r6.www;
r6.w = g_distantIBLRenderMode == 1;
if (r6.w != 0) {
r6.w = -r0.w * r0.w + 1;
r7.w = max(0, r6.w);
r7.w = sqrt(r7.w);
r7.w = r0.w * r0.w + r7.w;
r6.w = r7.w * r6.w;
r14.xyz = r12.xzw + -r8.xyz;
r14.xyz = r6.www * r14.xyz + r8.xyz;
r6.w = g_distantIBLArrayLayerCount + -1;
r6.w = (uint)r6.w;
r6.w = r6.w * r0.w;
r14.w = floor(r6.w);
r7.w = r0.w * r0.w + 1;
r7.w = log2(r7.w);
r15.xyz = g_distantIBLPreIntegratedSpecularDLArray.SampleLevel(g_preIntegratedDLSampler_s, r14.xyzw, r7.w).xyz;
r15.xyz = r15.xyz * r13.xyw;
r14.w = ceil(r6.w);
r14.xyz = g_distantIBLPreIntegratedSpecularDLArray.SampleLevel(g_preIntegratedDLSampler_s, r14.xyzw, r7.w).xyz;
r6.w = frac(r6.w);
r14.xyz = r14.xyz * r13.xyw + -r15.xyz;
r14.xyz = r6.www * r14.xyz + r15.xyz;
} else {
if (g_distantIBLRenderMode == 0) {
r6.w = -r0.w * r0.w + 1;
r7.w = max(0, r6.w);
r7.w = sqrt(r7.w);
r7.w = r0.w * r0.w + r7.w;
r6.w = r7.w * r6.w;
r15.xyz = r12.xzw + -r8.xyz;
r15.xyz = r6.www * r15.xyz + r8.xyz;
r6.w = r10.y * g_distantIblMipmapBias + 1;
r6.w = log2(r6.w);
r15.xyz = g_distantIBLPreIntegratedSpecularDL.SampleLevel(g_preIntegratedDLSampler_s, r15.xyz, r6.w).xyz;
r13.xyw = r15.xyz * r13.xyw;
r4.w = max(g_skipSkyVisibilityAsAO, r4.w);
r4.w = min(r4.w, r0.x);
r6.w = r10.x + r4.w;
r7.w = r10.y * -16 + -1;
r7.w = exp2(r7.w);
r6.w = log2(r6.w);
r6.w = r7.w * r6.w;
r6.w = exp2(r6.w);
r4.w = r6.w + r4.w;
r4.w = saturate(-1 + r4.w);
r14.xyz = r13.xyw * r4.www;
} else {
r14.xyz = float3(0,0,0);
}
}
r10.xzw = g_exposureMultipliers.zzz * r14.xyz;
r5.xyz = g_exposureMultipliers.yyy * r5.xyz;
r5.xyz = r5.xyz * r13.zzz;
r5.xyz = r5.xyz * r7.xyz;
r4.w = mad((int)r11.y, g_tileCountX, (int)r11.x);
// Known bad code for instruction (needs manual fix):
// ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r4.w, r4.w, l(12), t21.xxxx
r4.w = g_preIntegratedDLSampler[]..swiz;
r6.w = (uint)r4.w >> 16;
r4.w = (int)r4.w & 0x0000ffff;
r4.w = (int)r6.w + (int)r4.w;
if (r4.w != 0) {
r11.xyzw = g_LocalIBLsAndPRsTexture.Load(r1.xyw).xyzw;
} else {
r11.xyzw = float4(0,0,0,1);
}
r4.w = (int)r4.z & g_sssTranslucencyEnables;
r4.w = (int)r4.w != 0;
r2.y = r2.y ? r4.w : 0;
r1.xy = g_shadowAccumTexture.Load(r1.xyz).xy;
r0.y = r12.y * r0.y + g_cameraPos.y;
r1.zw = g_lightDir.xz * r0.yy;
r1.zw = -r1.zw * g_cloudOffsetAndScale.ww + r6.xy;
r1.zw = r1.zw * g_cloudOffsetAndScale.zz + g_cloudOffsetAndScale.xy;
r1.z = g_cloudShadowTexture.SampleLevel(g_cloudShadowSampler_s, r1.zw, 0).x;
r1.z = saturate(g_cloudCoverageExponent.x + r1.z);
r1.z = log2(r1.z);
r1.z = g_cloudCoverageExponent.y * r1.z;
r1.z = exp2(r1.z);
r1.w = dot(r6.xyz, r6.xyz);
r1.w = sqrt(r1.w);
r1.w = saturate(r1.w * g_cloudFade.y + g_cloudFade.x);
r0.y = saturate(r0.y * g_cloudFade.w + g_cloudFade.z);
r0.y = max(r1.w, r0.y);
r0.y = r0.y * r0.y;
r1.w = 1 + -r1.z;
r0.y = r0.y * r1.w + r1.z;
r0.y = r1.x * r0.y;
r1.x = dot(r8.xyz, g_lightDir.xyz);
r1.z = saturate(r1.x);
r1.w = 0 < r1.z;
if (r1.w != 0) {
r1.w = max(0.00200000009, r10.y);
r4.w = dot(g_lightDir.xyz, r12.xzw);
r13.xyz = -r4.www * g_lightDir.xyz + r12.xzw;
r4.w = r4.w < g_lightAngularRadiusX;
r6.w = dot(r13.xyz, r13.xyz);
r6.w = rsqrt(r6.w);
r13.xyz = r13.xyz * r6.www;
r13.xyz = g_lightAngularRadiusY * r13.xyz;
r13.xyz = g_lightAngularRadiusX * g_lightDir.xyz + r13.xyz;
r6.w = dot(r13.xyz, r13.xyz);
r6.w = rsqrt(r6.w);
r13.xyz = r13.xyz * r6.www;
r12.xyz = r4.www ? r13.xyz : r12.xzw;
r4.w = 9.99999975e-006 + abs(r5.w);
r13.xyz = -r6.xzy * r0.zzz + r12.xyz;
r5.w = dot(r13.xyz, r13.xyz);
r5.w = rsqrt(r5.w);
r13.xyz = r13.xyz * r5.www;
r6.xyz = -r6.xzy * r0.zzz + g_lightDir.xyz;
r0.z = dot(r6.xyz, r6.xyz);
r0.z = rsqrt(r0.z);
r6.xyz = r6.xyz * r0.zzz;
r0.z = saturate(dot(r12.xyz, r13.xyz));
r5.w = saturate(dot(g_lightDir.xyz, r6.xyz));
r6.x = saturate(dot(r8.xyz, r13.xyz));
r6.y = saturate(dot(r8.xyz, r12.xyz));
r0.z = 1 + -r0.z;
r6.z = r0.z * r0.z;
r6.z = r6.z * r6.z;
r0.z = r6.z * r0.z;
r8.xyz = r2.xxx + -r9.xyz;
r8.xyz = r8.xyz * r0.zzz + r9.xyz;
r0.z = r1.w * r1.w;
r1.w = -r4.w * r0.z + r4.w;
r1.w = r1.w * r4.w + r0.z;
r1.w = sqrt(r1.w);
r2.x = -r6.y * r0.z + r6.y;
r2.x = r2.x * r6.y + r0.z;
r2.x = sqrt(r2.x);
r2.x = r4.w * r2.x;
r1.w = r6.y * r1.w + r2.x;
r1.w = 0.5 / r1.w;
r2.x = r6.x * r0.z + -r6.x;
r2.x = r2.x * r6.x + 1;
r2.x = r2.x * r2.x;
r0.z = r0.z / r2.x;
r0.z = r1.w * r0.z;
r6.xyz = r8.xyz * r0.zzz;
r0.z = r0.w * -0.337748349 + 1;
r1.w = r5.w * r5.w;
r1.w = dot(r1.ww, r0.ww);
r0.w = r0.w * 0.5 + r1.w;
r1.w = 1 + -r1.z;
r2.x = r1.w * r1.w;
r2.x = r2.x * r2.x;
r1.w = r2.x * r1.w;
r0.w = -1 + r0.w;
r1.w = r0.w * r1.w + 1;
r2.x = 1 + -r4.w;
r4.w = r2.x * r2.x;
r4.w = r4.w * r4.w;
r2.x = r4.w * r2.x;
r0.w = r0.w * r2.x + 1;
r0.w = r1.w * r0.w;
r0.z = r0.w * r0.z;
r0.w = r1.z * r0.y;
r8.xyz = g_lightIlluminance.xyz * r0.www;
r9.xyz = r8.xyz * r0.zzz;
r6.xyz = r8.xyz * r6.xyz;
} else {
r9.xyz = float3(0,0,0);
r6.xyz = float3(0,0,0);
}
if (r2.y != 0) {
r0.z = frac(r2.z);
r0.w = (int)r4.z & g_sssAutomaticThicknessEnables;
r2.xyz = g_translucencyCoefficients0[r2.w].xyz * r0.zzz;
r0.z = max(9.99999975e-006, r1.y);
r0.z = log2(r0.z);
r0.z = r4.y + -r0.z;
r1.y = g_translucencyCoefficients1[r2.w].x * r4.y;
r0.z = r0.w ? r0.z : r1.y;
r1.y = saturate(0.100000001 + -r1.x);
r0.y = r1.y * r0.y;
r1.y = 1 + -r1.z;
r1.y = 0.25 * r1.y;
r1.x = -0.5 + r1.x;
r1.x = saturate(-1.81818175 * r1.x);
r1.z = r1.x * -2 + 3;
r1.x = r1.x * r1.x;
r1.x = r1.z * r1.x;
r1.x = r1.y * r1.x;
r0.y = r0.w ? r1.x : r0.y;
r0.y = g_translucencyCoefficients1[r2.w].y * r0.y;
r0.w = saturate(r4.y * -4 + 4);
r1.xyz = r2.xyz + r2.xyz;
r1.xyz = float3(-0.124999993,-0.124999993,-0.124999993) / r1.xyz;
r1.xyz = float3(1.44269502,1.44269502,1.44269502) * r1.xyz;
r1.xyz = exp2(r1.xyz);
r2.xyz = r3.xyz * r4.xxx + -r1.xyz;
r1.xyz = g_translucencyCoefficients0[r2.w].www * r2.xyz + r1.xyz;
r1.xyz = max(float3(9.99999975e-006,9.99999975e-006,9.99999975e-006), r1.xyz);
r0.z = r0.z * r0.z;
r0.z = 8 * r0.z;
r1.xyz = log2(r1.xyz);
r1.xyz = r1.xyz * r0.zzz;
r1.xyz = exp2(r1.xyz);
r1.xyz = r1.xyz * r0.yyy;
r0.yzw = r1.xyz * r0.www;
r9.xyz = g_lightIlluminance.xyz * r0.yzw + r9.xyz;
}
r0.y = -1 + r0.x;
r0.y = g_dynamicAOFactor * r0.y + 1;
r0.yzw = r9.xyz * r0.yyy;
r1.x = g_lightSpecularScale * g_exposureMultipliers.z;
r1.xyz = r6.xyz * r1.xxx;
r0.yzw = r7.xyz * r0.yzw;
r0.yzw = float3(0.318309873,0.318309873,0.318309873) * r0.yzw;
r0.xyz = r5.xyz * r0.xxx + r0.yzw;
r2.xyz = g_exposureMultipliers.zzz * r0.xyz;
r3.xyz = r11.www * r10.xzw + r11.xyz;
r1.xyz = r1.xyz * float3(0.318309873,0.318309873,0.318309873) + r3.xyz;
if (r3.w == 0) {
r1.xyz = r0.xyz * g_exposureMultipliers.zzz + r1.xyz;
r2.xyz = float3(0,0,0);
}
o1.xyz = r2.xyz;
o1.w = 0;
o0.xyz = r1.xyz;
o0.w = 0;
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
// using 3Dmigoto v1.2.10 on Thu Nov 26 20:22:59 2015
//
//
// Buffer Definitions:
//
// cbuffer CommonConstants
// {
//
// float4x4 g_invViewProjMatrix; // Offset: 0 Size: 64
// float3 g_cameraPos; // Offset: 64 Size: 12
// uint g_forceSplitLighting; // Offset: 76 Size: 4
// float4 g_exposureMultipliers; // Offset: 80 Size: 16
// float2 g_invScreenSize; // Offset: 96 Size: 8
// float g_distantIblMipmapBias; // Offset: 104 Size: 4
// uint g_distantIBLArrayLayerCount; // Offset: 108 Size: 4
// uint g_distantIBLLatLongWidth; // Offset: 112 Size: 4 [unused]
// uint g_distantIBLLatLongHeight; // Offset: 116 Size: 4 [unused]
// uint g_distantIBLRenderMode; // Offset: 120 Size: 4
// uint g_referenceModeComponent; // Offset: 124 Size: 4 [unused]
// float g_skipSkyVisibilityAsAO; // Offset: 128 Size: 4
// uint g_sssScatteringEnables; // Offset: 132 Size: 4
// uint g_tileCountX; // Offset: 136 Size: 4
// float unused; // Offset: 140 Size: 4 [unused]
// float4x3 g_normalBasisTransforms[6];// Offset: 144 Size: 288
// uint g_sssTranslucencyEnables; // Offset: 432 Size: 4
// uint g_sssAutomaticThicknessEnables;// Offset: 436 Size: 4
// float g_lightAngularRadiusX; // Offset: 440 Size: 4
// float g_lightAngularRadiusY; // Offset: 444 Size: 4
// float4 g_translucencyCoefficients0[8];// Offset: 448 Size: 128
// float4 g_translucencyCoefficients1[8];// Offset: 576 Size: 128
// float3 g_lightIlluminance; // Offset: 704 Size: 12
// float g_lightSpecularScale; // Offset: 716 Size: 4
// float4 g_cloudOffsetAndScale; // Offset: 720 Size: 16
// float4 g_cloudCoverageExponent; // Offset: 736 Size: 16
// float4 g_cloudFade; // Offset: 752 Size: 16
// float3 g_lightDir; // Offset: 768 Size: 12
// float g_dynamicAOFactor; // Offset: 780 Size: 4
//
// }
//
// Resource bind info for g_lightCullInput
// {
//
// uint4 $Element; // Offset: 0 Size: 16
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_preIntegratedDLSampler sampler NA NA 0 1
// g_preIntegratedFGSampler sampler NA NA 1 1
// g_cloudShadowSampler sampler NA NA 3 1
// g_gbufferTexture0 texture float4 2d 0 1
// g_gbufferTexture1 texture float4 2d 1 1
// g_gbufferTexture2 texture float4 2d 2 1
// g_gbufferTexture3 texture float4 2d 3 1
// g_depthTexture texture float 2d 6 1
// g_shadowAccumTexture texture float4 2d 7 1
// g_distantIBLPreIntegratedSpecularDL texture float4 cube 8 1
// g_distantIBLPreIntegratedSpecularDLArray texture float4 cubearray 9 1
// g_preIntegratedFG texture float4 2d 10 1
// g_diffuseOcclusionTexture texture float 2d 15 1
// g_cloudShadowTexture texture float4 2d 18 1
// g_materialIdTileMaskTexture texture uint 2d 19 1
// g_LocalIBLsAndPRsTexture texture float4 2d 20 1
// g_lightCullInput texture struct r/o 21 1
// CommonConstants cbuffer NA NA 0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position 0 xyzw 0 POS float xy
// TEXCOORD 0 xy 1 NONE float
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target 0 xyzw 0 TARGET float xyzw
// SV_Target 1 xyzw 1 TARGET float xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[49], dynamicIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s3, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t6
dcl_resource_texture2d (float,float,float,float) t7
dcl_resource_texturecube (float,float,float,float) t8
dcl_resource_texturecubearray (float,float,float,float) t9
dcl_resource_texture2d (float,float,float,float) t10
dcl_resource_texture2d (float,float,float,float) t15
dcl_resource_texture2d (float,float,float,float) t18
dcl_resource_texture2d (uint,uint,uint,uint) t19
dcl_resource_texture2d (float,float,float,float) t20
dcl_resource_structured t21, 16
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_temps 16
mul r0.xy, v0.xyxx, cb0[6].xyxx
ftoi r1.xy, v0.xyxx
sample_l_indexable(texture2d)(float,float,float,float) r0.x, r0.xyxx, t15.xyzw, s1, l(0.000000)
round_z r0.yz, v0.xxyx
mul r0.yz, r0.yyzy, cb0[6].xxyx
mov r1.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r2.xyzw, r1.xyww, t0.xyzw
ld_indexable(texture2d)(float,float,float,float) r3.xyzw, r1.xyww, t1.xyzw
ld_indexable(texture2d)(float,float,float,float) r4.xyzw, r1.xyww, t2.xyzw
ld_indexable(texture2d)(float,float,float,float) r5.xyz, r1.xyww, t3.xyzw
ld_indexable(texture2d)(float,float,float,float) r6.z, r1.xyww, t6.yzxw
mul r0.w, r3.w, l(6.000000)
round_ne r0.w, r0.w
ftou r0.w, r0.w
mad r7.xy, r2.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r2.x, r7.xyxx, r7.xyxx
min r2.x, r2.x, l(1.000000)
add r2.x, -r2.x, l(1.000000)
sqrt r7.z, r2.x
imul null, r0.w, r0.w, l(3)
dp3 r8.x, r7.xyzx, cb0[r0.w + 9].xyzx
dp3 r8.y, r7.xyzx, cb0[r0.w + 10].xyzx
dp3 r8.z, r7.xyzx, cb0[r0.w + 11].xyzx
add r0.w, -r2.z, l(1.000000)
mul r2.x, r2.w, l(3.000000)
round_ne r2.x, r2.x
ftoi r2.x, r2.x
ieq r2.xy, r2.xxxx, l(2, 1, 0, 0)
and r2.x, r4.x, r2.x
mul r2.z, r4.x, l(7.968750)
ftoi r2.w, r2.z
imin r2.w, r2.w, l(7)
and r2.w, r2.w, r2.y
movc r3.w, r2.y, l(0), r4.y
add r4.x, -r3.w, l(1.000000)
mul r7.xyz, r3.xyzx, r4.xxxx
add r2.x, -r2.x, l(1.000000)
mul r2.x, r2.x, r4.z
mul r2.x, r2.x, r2.x
mul r4.z, r2.x, l(0.160000)
mad r9.xyz, -r2.xxxx, l(0.160000, 0.160000, 0.160000, 0.000000), r3.xyzx
mad r9.xyz, r3.wwww, r9.xyzx, r4.zzzz
dp3 r2.x, r9.xyzx, l(0.330000, 0.330000, 0.330000, 0.000000)
mul_sat r2.x, r2.x, l(50.000000)
mul r10.y, r0.w, r0.w
ushr r11.xy, r1.xyxx, l(4, 4, 0, 0)
mov r11.zw, l(0,0,0,0)
ld_indexable(texture2d)(uint,uint,uint,uint) r3.w, r11.xyzw, t19.yzwx
ubfe r3.w, l(1), l(1), r3.w
ine r3.w, r3.w, l(0)
ishl r4.z, l(1), r2.w
and r5.w, r4.z, cb0[8].y
ine r5.w, r5.w, l(0)
and r5.w, r2.y, r5.w
and r3.w, r3.w, r5.w
if_nz r3.w
mov r7.xyz, l(1.000000,1.000000,1.000000,0)
mov r3.w, l(1)
else
and r3.w, cb0[4].w, l(1)
endif
mad r0.yz, r0.yyzy, l(0.000000, 2.000000, 2.000000, 0.000000), l(0.000000, -1.000000, -1.000000, 0.000000)
mul r6.xy, r0.yzyy, l(1.000000, -1.000000, 0.000000, 0.000000)
mov r6.w, l(1.000000)
dp4 r12.x, r6.xyzw, cb0[0].xyzw
dp4 r12.y, r6.xyzw, cb0[1].xyzw
dp4 r12.z, r6.xyzw, cb0[2].xyzw
dp4 r0.y, r6.xyzw, cb0[3].xyzw
div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
mul r6.xyz, r0.yyyy, r12.xzyx
dp3 r0.z, -r6.xyzx, -r6.xyzx
rsq r0.z, r0.z
mul r12.xzw, r0.zzzz, -r6.xxzy
dp3 r5.w, r8.xyzx, r12.xzwx
mov_sat r10.x, r5.w
dp3 r6.w, -r12.xzwx, r8.xyzx
add r6.w, r6.w, r6.w
mad r12.xzw, r8.xxyz, -r6.wwww, -r12.xxzw
sample_l_indexable(texture2d)(float,float,float,float) r13.xyz, r10.xyxx, t10.xyzw, s1, l(0.000000)
mul r6.w, r2.x, r13.y
mad r13.xyw, r9.xyxz, r13.xxxx, r6.wwww
ieq r6.w, cb0[7].z, l(1)
if_nz r6.w
mad r6.w, -r0.w, r0.w, l(1.000000)
max r7.w, r6.w, l(0.000000)
sqrt r7.w, r7.w
mad r7.w, r0.w, r0.w, r7.w
mul r6.w, r6.w, r7.w
add r14.xyz, -r8.xyzx, r12.xzwx
mad r14.xyz, r6.wwww, r14.xyzx, r8.xyzx
iadd r6.w, cb0[6].w, l(-1)
utof r6.w, r6.w
mul r6.w, r0.w, r6.w
round_ni r14.w, r6.w
mad r7.w, r0.w, r0.w, l(1.000000)
log r7.w, r7.w
sample_l_indexable(texturecubearray)(float,float,float,float) r15.xyz, r14.xyzw, t9.xyzw, s0, r7.w
mul r15.xyz, r13.xywx, r15.xyzx
round_pi r14.w, r6.w
sample_l_indexable(texturecubearray)(float,float,float,float) r14.xyz, r14.xyzw, t9.xyzw, s0, r7.w
frc r6.w, r6.w
mad r14.xyz, r14.xyzx, r13.xywx, -r15.xyzx
mad r14.xyz, r6.wwww, r14.xyzx, r15.xyzx
else
if_z cb0[7].z
mad r6.w, -r0.w, r0.w, l(1.000000)
max r7.w, r6.w, l(0.000000)
sqrt r7.w, r7.w
mad r7.w, r0.w, r0.w, r7.w
mul r6.w, r6.w, r7.w
add r15.xyz, -r8.xyzx, r12.xzwx
mad r15.xyz, r6.wwww, r15.xyzx, r8.xyzx
mad r6.w, r10.y, cb0[6].z, l(1.000000)
log r6.w, r6.w
sample_l_indexable(texturecube)(float,float,float,float) r15.xyz, r15.xyzx, t8.xyzw, s0, r6.w
mul r13.xyw, r13.xyxw, r15.xyxz
max r4.w, r4.w, cb0[8].x
min r4.w, r0.x, r4.w
add r6.w, r4.w, r10.x
mad r7.w, r10.y, l(-16.000000), l(-1.000000)
exp r7.w, r7.w
log r6.w, r6.w
mul r6.w, r6.w, r7.w
exp r6.w, r6.w
add r4.w, r4.w, r6.w
add_sat r4.w, r4.w, l(-1.000000)
mul r14.xyz, r4.wwww, r13.xywx
else
mov r14.xyz, l(0,0,0,0)
endif
endif
mul r10.xzw, r14.xxyz, cb0[5].zzzz
mul r5.xyz, r5.xyzx, cb0[5].yyyy
mul r5.xyz, r13.zzzz, r5.xyzx
mul r5.xyz, r7.xyzx, r5.xyzx
imad r4.w, r11.y, cb0[8].z, r11.x
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r4.w, r4.w, l(12), t21.xxxx
ushr r6.w, r4.w, l(16)
and r4.w, r4.w, l(0x0000ffff)
iadd r4.w, r6.w, r4.w
if_nz r4.w
ld_indexable(texture2d)(float,float,float,float) r11.xyzw, r1.xyww, t20.xyzw
else
mov r11.xyzw, l(0,0,0,1.000000)
endif
and r4.w, r4.z, cb0[27].x
ine r4.w, r4.w, l(0)
and r2.y, r2.y, r4.w
ld_indexable(texture2d)(float,float,float,float) r1.xy, r1.xyzw, t7.xyzw
mad r0.y, r12.y, r0.y, cb0[4].y
mul r1.zw, r0.yyyy, cb0[48].xxxz
mad r1.zw, -r1.zzzw, cb0[45].wwww, r6.xxxy
mad r1.zw, r1.zzzw, cb0[45].zzzz, cb0[45].xxxy
sample_l_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t18.yzxw, s3, l(0.000000)
add_sat r1.z, r1.z, cb0[46].x
log r1.z, r1.z
mul r1.z, r1.z, cb0[46].y
exp r1.z, r1.z
dp3 r1.w, r6.xyzx, r6.xyzx
sqrt r1.w, r1.w
mad_sat r1.w, r1.w, cb0[47].y, cb0[47].x
mad_sat r0.y, r0.y, cb0[47].w, cb0[47].z
max r0.y, r0.y, r1.w
mul r0.y, r0.y, r0.y
add r1.w, -r1.z, l(1.000000)
mad r0.y, r0.y, r1.w, r1.z
mul r0.y, r0.y, r1.x
dp3 r1.x, r8.xyzx, cb0[48].xyzx
mov_sat r1.z, r1.x
lt r1.w, l(0.000000), r1.z
if_nz r1.w
max r1.w, r10.y, l(0.002000)
dp3 r4.w, cb0[48].xyzx, r12.xzwx
mad r13.xyz, -r4.wwww, cb0[48].xyzx, r12.xzwx
lt r4.w, r4.w, cb0[27].z
dp3 r6.w, r13.xyzx, r13.xyzx
rsq r6.w, r6.w
mul r13.xyz, r6.wwww, r13.xyzx
mul r13.xyz, r13.xyzx, cb0[27].wwww
mad r13.xyz, cb0[27].zzzz, cb0[48].xyzx, r13.xyzx
dp3 r6.w, r13.xyzx, r13.xyzx
rsq r6.w, r6.w
mul r13.xyz, r6.wwww, r13.xyzx
movc r12.xyz, r4.wwww, r13.xyzx, r12.xzwx
add r4.w, |r5.w|, l(0.000010)
mad r13.xyz, -r6.xzyx, r0.zzzz, r12.xyzx
dp3 r5.w, r13.xyzx, r13.xyzx
rsq r5.w, r5.w
mul r13.xyz, r5.wwww, r13.xyzx
mad r6.xyz, -r6.xzyx, r0.zzzz, cb0[48].xyzx
dp3 r0.z, r6.xyzx, r6.xyzx
rsq r0.z, r0.z
mul r6.xyz, r0.zzzz, r6.xyzx
dp3_sat r0.z, r12.xyzx, r13.xyzx
dp3_sat r5.w, cb0[48].xyzx, r6.xyzx
dp3_sat r6.x, r8.xyzx, r13.xyzx
dp3_sat r6.y, r8.xyzx, r12.xyzx
add r0.z, -r0.z, l(1.000000)
mul r6.z, r0.z, r0.z
mul r6.z, r6.z, r6.z
mul r0.z, r0.z, r6.z
add r8.xyz, -r9.xyzx, r2.xxxx
mad r8.xyz, r8.xyzx, r0.zzzz, r9.xyzx
mul r0.z, r1.w, r1.w
mad r1.w, -r4.w, r0.z, r4.w
mad r1.w, r1.w, r4.w, r0.z
sqrt r1.w, r1.w
mad r2.x, -r6.y, r0.z, r6.y
mad r2.x, r2.x, r6.y, r0.z
sqrt r2.x, r2.x
mul r2.x, r2.x, r4.w
mad r1.w, r6.y, r1.w, r2.x
div r1.w, l(0.500000), r1.w
mad r2.x, r6.x, r0.z, -r6.x
mad r2.x, r2.x, r6.x, l(1.000000)
mul r2.x, r2.x, r2.x
div r0.z, r0.z, r2.x
mul r0.z, r0.z, r1.w
mul r6.xyz, r0.zzzz, r8.xyzx
mad r0.z, r0.w, l(-0.337748349), l(1.000000)
mul r1.w, r5.w, r5.w
dp2 r1.w, r1.wwww, r0.wwww
mad r0.w, r0.w, l(0.500000), r1.w
add r1.w, -r1.z, l(1.000000)
mul r2.x, r1.w, r1.w
mul r2.x, r2.x, r2.x
mul r1.w, r1.w, r2.x
add r0.w, r0.w, l(-1.000000)
mad r1.w, r0.w, r1.w, l(1.000000)
add r2.x, -r4.w, l(1.000000)
mul r4.w, r2.x, r2.x
mul r4.w, r4.w, r4.w
mul r2.x, r2.x, r4.w
mad r0.w, r0.w, r2.x, l(1.000000)
mul r0.w, r0.w, r1.w
mul r0.z, r0.z, r0.w
mul r0.w, r0.y, r1.z
mul r8.xyz, r0.wwww, cb0[44].xyzx
mul r9.xyz, r0.zzzz, r8.xyzx
mul r6.xyz, r6.xyzx, r8.xyzx
else
mov r9.xyz, l(0,0,0,0)
mov r6.xyz, l(0,0,0,0)
endif
if_nz r2.y
frc r0.z, r2.z
and r0.w, r4.z, cb0[27].y
mul r2.xyz, r0.zzzz, cb0[r2.w + 28].xyzx
max r0.z, r1.y, l(0.000010)
log r0.z, r0.z
add r0.z, -r0.z, r4.y
mul r1.y, r4.y, cb0[r2.w + 36].x
movc r0.z, r0.w, r0.z, r1.y
add_sat r1.y, -r1.x, l(0.100000)
mul r0.y, r0.y, r1.y
add r1.y, -r1.z, l(1.000000)
mul r1.y, r1.y, l(0.250000)
add r1.x, r1.x, l(-0.500000)
mul_sat r1.x, r1.x, l(-1.81818175)
mad r1.z, r1.x, l(-2.000000), l(3.000000)
mul r1.x, r1.x, r1.x
mul r1.x, r1.x, r1.z
mul r1.x, r1.x, r1.y
movc r0.y, r0.w, r1.x, r0.y
mul r0.y, r0.y, cb0[r2.w + 36].y
mad_sat r0.w, r4.y, l(-4.000000), l(4.000000)
add r1.xyz, r2.xyzx, r2.xyzx
div r1.xyz, l(-0.124999993, -0.124999993, -0.124999993, 0.000000), r1.xyzx
mul r1.xyz, r1.xyzx, l(1.442695, 1.442695, 1.442695, 0.000000)
exp r1.xyz, r1.xyzx
mad r2.xyz, r3.xyzx, r4.xxxx, -r1.xyzx
mad r1.xyz, cb0[r2.w + 28].wwww, r2.xyzx, r1.xyzx
max r1.xyz, r1.xyzx, l(0.000010, 0.000010, 0.000010, 0.000000)
mul r0.z, r0.z, r0.z
mul r0.z, r0.z, l(8.000000)
log r1.xyz, r1.xyzx
mul r1.xyz, r0.zzzz, r1.xyzx
exp r1.xyz, r1.xyzx
mul r1.xyz, r0.yyyy, r1.xyzx
mul r0.yzw, r0.wwww, r1.xxyz
mad r9.xyz, cb0[44].xyzx, r0.yzwy, r9.xyzx
endif
add r0.y, r0.x, l(-1.000000)
mad r0.y, cb0[48].w, r0.y, l(1.000000)
mul r0.yzw, r0.yyyy, r9.xxyz
mul r1.x, cb0[5].z, cb0[44].w
mul r1.xyz, r1.xxxx, r6.xyzx
mul r0.yzw, r0.yyzw, r7.xxyz
mul r0.yzw, r0.yyzw, l(0.000000, 0.318309873, 0.318309873, 0.318309873)
mad r0.xyz, r5.xyzx, r0.xxxx, r0.yzwy
mul r2.xyz, r0.xyzx, cb0[5].zzzz
mad r3.xyz, r11.wwww, r10.xzwx, r11.xyzx
mad r1.xyz, r1.xyzx, l(0.318309873, 0.318309873, 0.318309873, 0.000000), r3.xyzx
if_z r3.w
mad r1.xyz, r0.xyzx, cb0[5].zzzz, r1.xyzx
mov r2.xyz, l(0,0,0,0)
endif
mov o1.xyz, r2.xyzx
mov o1.w, l(0)
mov o0.xyz, r1.xyzx
mov o0.w, l(0)
ret
// Approximately 302 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/


How can I fix the "bad code" segment? ^_^

1x Palit RTX 2080Ti Pro Gaming OC(watercooled and overclocked to hell)
3x 3D Vision Ready Asus VG278HE monitors (5760x1080).
Intel i9 9900K (overclocked to 5.3 and watercooled ofc).
Asus Maximus XI Hero Mobo.
16 GB Team Group T-Force Dark Pro DDR4 @ 3600.
Lots of Disks:
- Raid 0 - 256GB Sandisk Extreme SSD.
- Raid 0 - WD Black - 2TB.
- SanDisk SSD PLUS 480 GB.
- Intel 760p 256GB M.2 PCIe NVMe SSD.
Creative Sound Blaster Z.
Windows 10 x64 Pro.
etc


My website with my fixes and OpenGL to 3D Vision wrapper:
http://3dsurroundgaming.com

(If you like some of the stuff that I've done and want to donate something, you can do it with PayPal at tavyhome@gmail.com)

Posted 11/26/2015 08:27 PM   
  44 / 88    
Scroll To Top