diff --git a/examples/common/glslPtexCommon.glsl b/examples/common/glslPtexCommon.glsl index 561ca449..08cbf4a9 100644 --- a/examples/common/glslPtexCommon.glsl +++ b/examples/common/glslPtexCommon.glsl @@ -114,7 +114,7 @@ vec4 PtexLookupNearest(vec4 patchCoord, sampler2DArray data, isamplerBuffer packings) { - vec2 uv = patchCoord.xy; + vec2 uv = clamp(patchCoord.xy, vec2(0), vec2(1)); int faceID = int(patchCoord.w); PtexPacking ppack = getPtexPacking(packings, faceID); vec2 coords = vec2(uv.x * ppack.width + ppack.uOffset, @@ -127,7 +127,7 @@ vec4 PtexLookupNearest(vec4 patchCoord, sampler2DArray data, isamplerBuffer packings) { - vec2 uv = patchCoord.xy; + vec2 uv = clamp(patchCoord.xy, vec2(0), vec2(1)); int faceID = int(patchCoord.w); PtexPacking ppack = getPtexPacking(packings, faceID, level); vec2 coords = vec2(uv.x * ppack.width + ppack.uOffset, @@ -139,7 +139,7 @@ vec4 PtexLookupFast(vec4 patchCoord, sampler2DArray data, isamplerBuffer packings) { - vec2 uv = patchCoord.xy; + vec2 uv = clamp(patchCoord.xy, vec2(0), vec2(1)); int faceID = int(patchCoord.w); PtexPacking ppack = getPtexPacking(packings, faceID); @@ -154,7 +154,7 @@ vec4 PtexLookupFast(vec4 patchCoord, sampler2DArray data, isamplerBuffer packings) { - vec2 uv = patchCoord.xy; + vec2 uv = clamp(patchCoord.xy, vec2(0), vec2(1)); int faceID = int(patchCoord.w); PtexPacking ppack = getPtexPacking(packings, faceID, level); @@ -169,7 +169,7 @@ vec4 PtexLookup(vec4 patchCoord, sampler2DArray data, isamplerBuffer packings) { - vec2 uv = patchCoord.xy; + vec2 uv = clamp(patchCoord.xy, vec2(0), vec2(1)); int faceID = int(patchCoord.w); PtexPacking ppack = getPtexPacking(packings, faceID, level); @@ -203,7 +203,7 @@ vec4 PtexLookupQuadratic(out vec4 du, sampler2DArray data, isamplerBuffer packings) { - vec2 uv = patchCoord.xy; + vec2 uv = clamp(patchCoord.xy, vec2(0), vec2(1)); int faceID = int(patchCoord.w); PtexPacking ppack = getPtexPacking(packings, faceID, level); diff --git a/examples/common/hlslPtexCommon.hlsl b/examples/common/hlslPtexCommon.hlsl index f72c828d..022a7a21 100644 --- a/examples/common/hlslPtexCommon.hlsl +++ b/examples/common/hlslPtexCommon.hlsl @@ -114,7 +114,7 @@ float4 PtexLookupNearest(float4 patchCoord, Texture2DArray data, Buffer packings) { - float2 uv = patchCoord.xy; + float2 uv = clamp(patchCoord.xy, float2(0,0), float2(1,1)); int faceID = int(patchCoord.w); PtexPacking ppack = getPtexPacking(packings, faceID); float2 coords = float2(uv.x * ppack.width + ppack.uOffset, @@ -127,7 +127,7 @@ float4 PtexLookupNearest(float4 patchCoord, Texture2DArray data, Buffer packings) { - float2 uv = patchCoord.xy; + float2 uv = clamp(patchCoord.xy, float2(0,0), float2(1,1)); int faceID = int(patchCoord.w); PtexPacking ppack = getPtexPacking(packings, faceID, level); float2 coords = float2(uv.x * ppack.width + ppack.uOffset, @@ -140,7 +140,7 @@ float4 PtexLookup(float4 patchCoord, Texture2DArray data, Buffer packings) { - float2 uv = patchCoord.xy; + float2 uv = clamp(patchCoord.xy, float2(0,0), float2(1,1)); int faceID = int(patchCoord.w); PtexPacking ppack = getPtexPacking(packings, faceID, level); @@ -174,7 +174,7 @@ float4 PtexLookupQuadratic(out float4 du, Texture2DArray data, Buffer packings) { - float2 uv = patchCoord.xy; + float2 uv = clamp(patchCoord.xy, float2(0,0), float2(1,1)); int faceID = int(patchCoord.w); PtexPacking ppack = getPtexPacking(packings, faceID, level);