Skip to content

Commit

Permalink
Reworked BOTTOM_UP_TEXTURE_COORDINATES functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewRichards-Code committed Dec 12, 2024
1 parent 423d811 commit dce1e04
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
26 changes: 20 additions & 6 deletions CrossPlatform/Shaders/common.sl
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,29 @@
#define sample_3d_lod(tex,sampler,texc,lod) tex.SampleLevel(sampler,texc,lod)

#ifndef __cplusplus
vec2 ReverseYTextureCoordinates(vec2 texc)

#ifndef BOTTOM_UP_TEXTURE_COORDINATES
#define BOTTOM_UP_TEXTURE_COORDINATES 0
#endif

#if BOTTOM_UP_TEXTURE_COORDINATES
vec2 BottomUpTextureCoordinates(vec2 texc)
{
return vec2(texc.x, 1.0 - texc.y);
}

#ifndef BOTTOM_UP_TEXTURE_COORDINATES_DEFINED
#define BottomUpTextureCoordinates(original_texc) original_texc
#define BottomUpTextureCoordinates4(original_texc) original_texc
#define BOTTOM_UP_TEXTURE_COORDINATES_DEFINED 1
vec4 BottomUpTextureCoordinates4(vec4 texc)
{
return vec4(texc.x, 1.0 - texc.y, texc.z, 1.0 - texc.w);
}
#else
vec2 BottomUpTextureCoordinates(vec2 texc)
{
return texc;
}
vec4 BottomUpTextureCoordinates4(vec4 texc)
{
return texc;
}
#endif

#define ALIGN_16
Expand Down
7 changes: 4 additions & 3 deletions DirectX11/Sfx/shader_platform.sl
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@
#define layout(a)
#define SIMUL_RENDERTARGET_OUTPUT_DSB_INDEX_0(n) : SV_TARGET0
#define SIMUL_RENDERTARGET_OUTPUT_DSB_INDEX_1(n) : SV_TARGET1
#define BottomUpTextureCoordinates4(texc) vec4(texc.x,1.0-texc.y,texc.z,1.0-texc.w)
#define BottomUpTextureCoordinates(texc) vec2(texc.x,1.0-texc.y)

#ifndef BOTTOM_UP_TEXTURE_COORDINATES
#define BOTTOM_UP_TEXTURE_COORDINATES 1
#endif
#endif

#define BOTTOM_UP_TEXTURE_COORDINATES_DEFINED 1

#endif
15 changes: 4 additions & 11 deletions DirectX12/Sfx/shader_platform.sl
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,10 @@
#define SIMUL_RENDERTARGET_OUTPUT_DSB_INDEX_0(n) : SV_TARGET0
#define SIMUL_RENDERTARGET_OUTPUT_DSB_INDEX_1(n) : SV_TARGET1

#ifndef BOTTOM_UP_TEXTURE_COORDINATES_DEFINED
vec2 BottomUpTextureCoordinates(vec2 texc)
{
return vec2(texc.x,1.0-texc.y);
}
vec4 BottomUpTextureCoordinates4(vec4 texc)
{
return vec4(texc.x,1.0-texc.y,texc.z,1.0-texc.w);
}
#define BOTTOM_UP_TEXTURE_COORDINATES_DEFINED 1
#endif
#ifndef BOTTOM_UP_TEXTURE_COORDINATES
#define BOTTOM_UP_TEXTURE_COORDINATES 1
#endif

#endif

#endif
12 changes: 2 additions & 10 deletions Vulkan/Sfx/shader_platform.sl
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,8 @@

#ifndef __cplusplus

#ifdef XBOTTOM_UP_TEXTURE_COORDINATES_DEFINED
vec2 BottomUpTextureCoordinates(vec2 texc)
{
return vec2(texc.x,1.0-texc.y);
}
vec4 BottomUpTextureCoordinates4(vec4 texc)
{
return vec4(texc.x,1.0-texc.y,texc.z,1.0-texc.w);
}
#define BOTTOM_UP_TEXTURE_COORDINATES_DEFINED 1
#ifndef BOTTOM_UP_TEXTURE_COORDINATES
#define BOTTOM_UP_TEXTURE_COORDINATES 1
#endif

#define USE_D3D_REF_MODE 0
Expand Down

0 comments on commit dce1e04

Please sign in to comment.