Skip to content

Commit

Permalink
Merge pull request #121 from tumblr/sergio/fix_metal_identify_filter
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioEstevao authored Aug 21, 2021
2 parents 7b03e71 + 2716a12 commit 75acbd2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Resources/MetalShaders/shaders.metal
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ kernel void kernelIdentity(texture2d<float, access::read> inTexture [[ texture(0
texture2d<float, access::write> outTexture [[ texture(1) ]],
uint2 gid [[ thread_position_in_grid ]])
{
uint inWidth = inTexture.get_width();
uint outWidth = outTexture.get_width();
int inWidth = inTexture.get_width();
int outWidth = outTexture.get_width();

uint offset = (inWidth - outWidth) > 0 ? (inWidth - outWidth) / 2 : 0;
int offset = (inWidth - outWidth) > 0 ? (inWidth - outWidth) / 2 : 0;
uint2 adjusted = uint2(gid.x + offset, gid.y);
float4 outColor = inTexture.read(adjusted);
outTexture.write(outColor, gid);
Expand Down

0 comments on commit 75acbd2

Please sign in to comment.