//HDR, exposure, gamma.
// ---- Created with 3Dmigoto v1.3.12 on Fri Dec 14 21:54:31 2018

cbuffer _Globals : register(b0)
{
  float4 _sp_system_hdr_param_half : packoffset(c0);
  float _sp_exposure : packoffset(c1);
  float _sp_gamma : packoffset(c1.y);
  float2 _boundary_params : packoffset(c1.z);
}

SamplerState _samp_samplerstate_s : register(s0);
Texture2D<float4> _samp : register(t0);


// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main(
  float4 v0 : SV_Position0,
  float2 v1 : TEXCOORD0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = 1 + _sp_system_hdr_param_half.w;
  r0.x = _sp_system_hdr_param_half.w / r0.x;
  r1.xyzw = _samp.Sample(_samp_samplerstate_s, v1.xy).xyzw;
  r0.yzw = r1.xyz / r1.www;
  r1.xyz = r0.yzw * r0.xxx;
  o0.w = dot(r0.yzw, float3(0.212500006,0.715399981,0.0720999986));
  r0.x = dot(r1.xyz, float3(0.212500006,0.715399981,0.0720999986));
  r0.y = -_boundary_params.x + r0.x;
  r0.z = r0.y * _boundary_params.y + _boundary_params.x;
  r0.y = cmp(0 < r0.y);
  r0.x = r0.z / r0.x;
  r0.x = r0.y ? r0.x : 1;
  r0.xyz = r0.xxx * r1.xyz;
  r0.xyz = log2(abs(r0.xyz));
  r0.xyz = _sp_gamma * r0.xyz;
  o0.xyz = exp2(r0.xyz);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20789
//
//   using 3Dmigoto v1.3.12 on Fri Dec 14 21:54:31 2018
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float4 _sp_system_hdr_param_half;  // Offset:    0 Size:    16
//   float _sp_exposure;                // Offset:   16 Size:     4 [unused]
//   float _sp_gamma;                   // Offset:   20 Size:     4
//   float2 _boundary_params;           // Offset:   24 Size:     8
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// _samp_samplerstate                sampler      NA          NA    0        1
// _samp                             texture  float4          2d    0        1
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float
// TEXCOORD                 0   xy          1     NONE   float   xy
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[2], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v1.xy
dcl_output o0.xyzw
dcl_temps 2
add r0.x, cb0[0].w, l(1.000000)
div r0.x, cb0[0].w, r0.x
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, v1.xyxx, t0.xyzw, s0
div r0.yzw, r1.xxyz, r1.wwww
mul r1.xyz, r0.xxxx, r0.yzwy
dp3 o0.w, r0.yzwy, l(0.212500, 0.715400, 0.072100, 0.000000)
dp3 r0.x, r1.xyzx, l(0.212500, 0.715400, 0.072100, 0.000000)
add r0.y, r0.x, -cb0[1].z
mad r0.z, r0.y, cb0[1].w, cb0[1].z
lt r0.y, l(0.000000), r0.y
div r0.x, r0.z, r0.x
movc r0.x, r0.y, r0.x, l(1.000000)
mul r0.xyz, r1.xyzx, r0.xxxx
log r0.xyz, |r0.xyzx|
mul r0.xyz, r0.xyzx, cb0[1].yyyy
exp o0.xyz, r0.xyzx
ret
// Approximately 17 instruction slots used

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