Skip to content

Commit

Permalink
DX9 Workaround
Browse files Browse the repository at this point in the history
Workaround for compiling under DX9.
  • Loading branch information
BlueSkyDefender committed Nov 30, 2024
1 parent 44364cd commit 89ba1a4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 22 deletions.
10 changes: 5 additions & 5 deletions Shaders/Overwatch.fxh
Original file line number Diff line number Diff line change
Expand Up @@ -29491,11 +29491,11 @@ static const int Not_Compatible_Warning_D = 0; //Not Compatible Warning
#define DA_W 0 // Set Linerzation
//#define DB_X 1 // Flip
#define DA_X 0.025 // ZPD
#define DF_Y 0.025 // Seperation
#define DA_Y 25.0 // Near Plane Adjustment
//#define DF_Y 0.025 // Seperation
#define DA_Y 22.5 // Near Plane Adjustment
//#define DA_Z -.500 // Linerzation Offset
#define DS_Y 0 // Linerzation Offset Effects only distance if true
#define DB_Z 0.040 // Auto Depth Protection
#define DB_Z 0.025 // Auto Depth Protection
#define DE_X 4 // ZPD Boundary
#define DE_Y 0.750 // Set ZPD Boundary Level Zero
#define DE_Z 0.375 // Speed that Boundary is Enforced
Expand All @@ -29522,9 +29522,9 @@ static const int Not_Compatible_Warning_D = 0; //Not Compatible Warning

//Smooth Mode
//#define SMS 1 //SM Separation Limit - Do Not use any more
#define DL_X 0.75 //SM Tune Limit
#define DL_X 0.625 //SM Tune Limit
//#define DL_W 0.5 //SM Perspective Limit - Do Not use any more
#define DM_X 7 //SM HQ Tune Power - Will be made global
#define DM_X 6 //SM HQ Tune Power - Will be made global
//#define DM_Y 1 //SM HQ VRS Limit
//#define HQT 1 //SM HQ Trigger
//#define FMM 1 //Filter Mode - Need to add this back in the new shader.
Expand Down
28 changes: 19 additions & 9 deletions Shaders/SuperDepth3D.fx
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,19 @@ namespace SuperDepth3D
#endif

#if __RESHADE__ >= 50000
#define Compatibility_DD 1
#define Compatibility_00 1
#else
#define Compatibility_DD 0
#define Compatibility_00 0
#endif

#if __RENDERER__ == 0x9000
#if __RESHADE__ <= 60303
#define Compatibility_01 1
#else
#define Compatibility_01 0
#endif
#endif

//FreePie Compatibility
#if __RESHADE__ >= 40600
#if __RESHADE__ > 40700
Expand Down Expand Up @@ -737,7 +746,7 @@ uniform int SuperDepth3D <
"Default and starts at 0 and is Off. With a max offset of 5 pixels Wide.";
ui_category = "Scaling Corrections";
> = 0;

#if !Compatibility_01
uniform uint2 Starting_Resolution <
#if Compatibility
ui_type = "drag";
Expand All @@ -751,7 +760,7 @@ uniform int SuperDepth3D <
"Default is 0 and it is Off.";
ui_category = "Scaling Corrections";
> = uint2(0,0);

#endif
#if !DX9_Toggle
uniform int Auto_Scaler_Adjust <
ui_type = "combo";
Expand Down Expand Up @@ -1481,7 +1490,7 @@ uniform int Extra_Information <

static const float Auto_Balance_Clamp = 0.5; //This Clamps Auto Balance's max Distance.

#if Compatibility_DD
#if Compatibility_00
uniform bool DepthCheck < source = "bufready_depth"; >;
#endif

Expand Down Expand Up @@ -2663,7 +2672,8 @@ uniform int Extra_Information <
}

float Depth(float2 texcoord)
{ //May have to move this around. But, it seems good in it's current location.
{ //May have to move this around. But, it seems good in it's current location.
#if !Compatibility_01
float2 Current_Size = tex2Dsize(DepthBuffer);
float2 Adjust_Size_XY = ScaleSize(Starting_Resolution, Current_Size);

Expand All @@ -2672,7 +2682,7 @@ uniform int Extra_Information <

if(Adjust_Size_XY.x != 0 && Starting_Resolution.x != 0)
texcoord.x = texcoord.x / Adjust_Size_XY.x;

#endif
// Retrieve depth from the buffer
float zBuffer = tex2Dlod(DepthBuffer, float4(texcoord, 0, 0)).x;

Expand Down Expand Up @@ -3546,7 +3556,7 @@ uniform int Extra_Information <
float UI_Detection_Mask = 0.0625;
#endif
DM = lerp(lerp(EdgeMask( DM, texcoord, 0.955 ),DM, Edge_Adj), DM, saturate(1-DM.y) );
#if Compatibility_DD
#if Compatibility_00
if (Depth_Detection == 1)
{
if (!DepthCheck)
Expand Down Expand Up @@ -5248,7 +5258,7 @@ uniform int Extra_Information <
//toggle = Text_Info_Key;
hidden = true;
enabled = true;
#if Compatibility_DD
#if Compatibility_00
timeout = 1;
#else
timeout = 1000;
Expand Down
26 changes: 18 additions & 8 deletions Shaders/SuperDepth3D_VR+.fx
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,19 @@ namespace SuperDepth3DVR
#endif

#if __RESHADE__ >= 40300
#define Compatibility_DD 1
#define Compatibility_00 1
#else
#define Compatibility_DD 0
#define Compatibility_00 0
#endif

#if __RENDERER__ == 0x9000
#if __RESHADE__ <= 60303
#define Compatibility_01 1
#else
#define Compatibility_01 0
#endif
#endif

//DX9 0x9000 and OpenGL
#if __RENDERER__ == 0x9000 || __RENDERER__ >= 0x10000
#define RenderLimitations 1
Expand Down Expand Up @@ -744,7 +753,7 @@ namespace SuperDepth3DVR
"Default and starts at 0 and is Off. With a max offset of 5 pixels Wide.";
ui_category = "Scaling Corrections";
> = 0;

#if !Compatibility_01
uniform uint2 Starting_Resolution <
#if Compatibility
ui_type = "drag";
Expand All @@ -758,7 +767,7 @@ namespace SuperDepth3DVR
"Default is 0 and it is Off.";
ui_category = "Scaling Corrections";
> = uint2(0,0);

#endif
#if !DX9_Toggle
uniform int Auto_Scaler_Adjust <
ui_type = "combo";
Expand Down Expand Up @@ -1293,7 +1302,7 @@ uniform int Extra_Information <

static const float Auto_Balance_Clamp = 0.5; //This Clamps Auto Balance's max Distance.

#if Compatibility_DD
#if Compatibility_00
uniform bool DepthCheck < source = "bufready_depth"; >;
#endif

Expand Down Expand Up @@ -1603,7 +1612,7 @@ uniform int Extra_Information <
#define RGBA RGBA8
#endif

#if Compatibility_DD
#if Compatibility_00
#define RGBAC RGB10A2
#else
#define RGBAC RGBA8
Expand Down Expand Up @@ -2471,7 +2480,8 @@ uniform int Extra_Information <
}

float Depth(float2 texcoord)
{ //May have to move this around. But, it seems good in it's current location.
{ //May have to move this around. But, it seems good in it's current location.
#if !Compatibility_01
float2 Current_Size = tex2Dsize(DepthBuffer);
float2 Adjust_Size_XY = ScaleSize(Starting_Resolution, Current_Size);

Expand All @@ -2480,7 +2490,7 @@ uniform int Extra_Information <

if(Adjust_Size_XY.x != 0 && Starting_Resolution.x != 0)
texcoord.x = texcoord.x / Adjust_Size_XY.x;

#endif
// Retrieve depth from the buffer
float zBuffer = tex2Dlod(DepthBuffer, float4(texcoord, 0, 0)).x;

Expand Down

0 comments on commit 89ba1a4

Please sign in to comment.