WIP shader work - not complete!

This commit is contained in:
Tim Barnes 2018-11-02 09:08:45 +10:00
parent 14e3be8855
commit b91126c08c
52 changed files with 1315 additions and 589 deletions

View file

@ -24,11 +24,26 @@
#define _TORQUE_SHADERMODEL_AUTOGEN_
#include "shadergen:/autogenConditioners.h"
#include "./shaderModel.hlsl"
// Portability helpers for autogenConditioners
#if TORQUE_SM >= 40
#define TORQUE_DEFERRED_UNCONDITION(tex, coords) deferredUncondition(tex, texture_##tex, coords)
#endif
//todo deprecate this function
#define TORQUE_DEFERRED_UNCONDITION(tex, coords) deferredUncondition(tex, texture_##tex, coords)
inline float4 UnpackDepthNormal(TORQUE_SAMPLER2D(tex), float2 screenUVVar)
{
// Sampler g-buffer
float4 bufferSample = TORQUE_TEX2DLOD(tex,float4(screenUVVar,0,0));
// g-buffer unconditioner: float4(normal.X, normal.Y, depth Hi, depth Lo)
float2 _inpXY = bufferSample.xy;
float _xySQ = dot(_inpXY, _inpXY);
float4 _gbUnconditionedInput = float4( sqrt(half(1.0 - (_xySQ / 4.0))) * _inpXY, -1.0 + (_xySQ / 2.0), bufferSample.a).xzyw;
// Decode depth
_gbUnconditionedInput.w = dot( bufferSample.zw, float2(1.0, 1.0/65535.0));
return _gbUnconditionedInput;
}
#endif //_TORQUE_SHADERMODEL_AUTOGEN_