@@ -32,8 +32,8 @@ uint nbl_glsl_unpackMaxMipInVT(in uvec2 texData)
32
32
}
33
33
vec3 nbl_glsl_unpackVirtualUV(in uvec2 texData)
34
34
{
35
- // assert that PAGE_SZ_LOG2 <8 , or change the line to uvec3(texData.yy<<uvec2(PAGE_SZ_LOG2,PAGE_SZ_LOG2 -8u),texData.y>>16u)
36
- uvec3 unnormCoords = uvec3 (texData.y << PAGE_SZ_LOG2 , texData.yy >> uvec2 (8u - PAGE_SZ_LOG2 , 16u))& uvec3 (uvec2 (0xffu) << PAGE_SZ_LOG2 , 0xffu);
35
+ // assert that _NBL_VT_IMPL_PAGE_SZ_LOG2 <8 , or change the line to uvec3(texData.yy<<uvec2(_NBL_VT_IMPL_PAGE_SZ_LOG2,_NBL_VT_IMPL_PAGE_SZ_LOG2 -8u),texData.y>>16u)
36
+ uvec3 unnormCoords = uvec3 (texData.y<< _NBL_VT_IMPL_PAGE_SZ_LOG2 , texData.yy >> uvec2 (8u- _NBL_VT_IMPL_PAGE_SZ_LOG2 , 16u))& uvec3 (uvec2 (0xffu)<< _NBL_VT_IMPL_PAGE_SZ_LOG2 , 0xffu);
37
37
return vec3 (unnormCoords);
38
38
}
39
39
vec2 nbl_glsl_unpackSize(in uvec2 texData)
@@ -70,12 +70,12 @@ vec3 nbl_glsl_vTexture_helper(in uint formatID, in vec3 virtualUV, in int clippe
70
70
71
71
vec2 tileCoordinate = uintBitsToFloat(floatBitsToUint(virtualUV.xy)+ thisLevelTableSize);
72
72
tileCoordinate = fract (tileCoordinate); // optimize this fract at some point
73
- tileCoordinate = uintBitsToFloat(floatBitsToUint(tileCoordinate)+ uint ((PAGE_SZ_LOG2 - levelInTail)<< 23 ));
73
+ tileCoordinate = uintBitsToFloat(floatBitsToUint(tileCoordinate)+ uint ((_NBL_VT_IMPL_PAGE_SZ_LOG2 - levelInTail)<< 23 ));
74
74
tileCoordinate += packingOffsets[levelInTail];
75
75
tileCoordinate *= phys_pg_tex_sz_rcp;
76
76
77
77
vec3 physicalUV = nbl_glsl_unpackPageID(levelInTail!= 0 ? pageID.y: pageID.x);
78
- physicalUV.xy *= vec2 (PAGE_SZ + 2 * TILE_PADDING )* phys_pg_tex_sz_rcp;
78
+ physicalUV.xy *= vec2 (_NBL_VT_IMPL_PAGE_SZ + 2 * _NBL_VT_IMPL_TILE_PADDING )* phys_pg_tex_sz_rcp;
79
79
80
80
// add the in-tile coordinate
81
81
physicalUV.xy += tileCoordinate;
@@ -90,7 +90,7 @@ vec4 nbl_glsl_vTextureGrad_impl(in uint formatID, in vec3 virtualUV, in mat2 dOr
90
90
{
91
91
// returns what would have been `textureGrad(originalTexture,gOriginalUV[0],gOriginalUV[1])
92
92
// https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap15.html#textures-normalized-operations
93
- const float kMaxAnisotropy = float (2u* TILE_PADDING );
93
+ const float kMaxAnisotropy = float (2u* _NBL_VT_IMPL_TILE_PADDING );
94
94
// you can use an approx `log2` if you know one
95
95
#ifdef _NBL_APPROXIMATE_TEXEL_FOOTPRINT_FROM_DERIVATIVE_CACL_
96
96
// bounded by sqrt(2)
@@ -123,8 +123,8 @@ vec4 nbl_glsl_vTextureGrad_impl(in uint formatID, in vec3 virtualUV, in mat2 dOr
123
123
// if minification is being performaed then get tail position
124
124
int levelInTail = LoD_high- clippedLoD;
125
125
// have to do trilinear only if doing minification AND larger than 1x1 footprint
126
- bool haveToDoTrilinear = levelInTail< int (PAGE_SZ_LOG2 ) && positiveLoD;
127
- levelInTail = haveToDoTrilinear ? levelInTail: (positiveLoD ? int (PAGE_SZ_LOG2 ): 0 );
126
+ bool haveToDoTrilinear = levelInTail< int (_NBL_VT_IMPL_PAGE_SZ_LOG2 ) && positiveLoD;
127
+ levelInTail = haveToDoTrilinear ? levelInTail: (positiveLoD ? int (_NBL_VT_IMPL_PAGE_SZ_LOG2 ): 0 );
128
128
129
129
// get the higher resolution mip-map level
130
130
vec3 hiPhysCoord = nbl_glsl_vTexture_helper(formatID,virtualUV,clippedLoD,levelInTail);
0 commit comments