  return uint(logn(fsq.x,16));
 }
 
-vec2 getPQuad(uint primitiveID){
- uint	row			= primitiveID/PRIMS_PER_ROW;
- uint	col			= primitiveID%PRIMS_PER_ROW;
- vec2	pQuadBL		= PRIM_QUAD_BL;
- pQuadBL.x			+=float(col*2u)*PRIM_TEX_WIDTH_SCALAR;// x2 because each quad is 2 texels wide.
- pQuadBL.y			+=float(row*2u)*PRIM_TEX_HEIGHT_SCALAR;
- return				pQuadBL+vec2(PRIM_TEX_WIDTH_SCALAR,PRIM_TEX_HEIGHT_SCALAR)*screenLoc.xy;
+vec3 getPQuad(uint primitiveID){
+ vec2	corner		= vec2(primitiveID%PRIMS_PER_ROW,primitiveID/PRIMS_PER_ROW);
+ return				vec3(corner + halfScreenLocOffset,PQUAD_DENOM);
 }
 
 float getTextureID(uint primitiveID){
  uint vertexID = primitiveID * 3u;
- return texelFetch(vertexTextureIDTexture,ivec2(vertexID%VTX_TEXTURE_USABLE_WIDTH,vertexID/VTX_TEXTURE_USABLE_WIDTH),0).x*65536*PAGE_SIZE_VEC4;
+ return texelFetch(
+  vertexTextureIDTexture,
+  ivec2(vertexID%VTX_TEXTURE_USABLE_WIDTH,
+  vertexID/VTX_TEXTURE_USABLE_WIDTH),0).x
+   *(65536u*PAGE_SIZE_VEC4);
 }
 
 ////////// STRUCT LAYOUT DOCUMENTATION ///////////////

const float PRIM_TEX_WIDTH_SCALAR	= 1/float(PRIM_TEXTURE_WIDTH);
const uint PRIMS_PER_ROW			= PRIM_TEXTURE_WIDTH/PQUAD_SIDE_WIDTH;
const uint OVERSAMPLING				= 4u;

const  vec2 PRIM_QUAD_BL 			= vec2(PRIM_TEX_WIDTH_SCALAR,PRIM_TEX_HEIGHT_SCALAR)/(2*float(OVERSAMPLING));

float warpFog(float z){
const float ZNEAR = 6554 * 32;

 	vec2	subTexUVsub	= codeXY*CODE_PAGE_TEXEL_SIZE_UV;
 	vec2	codePgXY	= vec2(codeIdx % CODE_PAGE_SIDE_WIDTH_CODES,(codeIdx / CODE_PAGE_SIDE_WIDTH_CODES)%CODE_PAGE_SIDE_WIDTH_CODES)*4+codeXY+sub;
 	cTexel				= textureLod(rgbaTiles,vec3(codePgXY*CODE_PAGE_TEXEL_SIZE_UV,codeBkPgNum),0);
 	vec4 illumination;
 	if(dot(norm.xyz,norm.xyz)>.01)illumination.rgb
 								=((clamp(-dot(sunVector,norm),0,1)*sunColor)+ambientLight);
 	return cTexel * illumination;
    }else{subTexV4Addr = uvec4(stv4a);}
   uvec4	subTexXY_A	= iuv4A%SUBTEXTURE_SIDE_WIDTH_TEXELS;
   uvec4	subTexXY_B  = iuv4B%SUBTEXTURE_SIDE_WIDTH_TEXELS;
