 uniform sampler2D 		primaryRendering;
 uniform sampler2D 		depthTexture;
 uniform sampler2D 		normTexture;
-uniform sampler2D 		textureIDTexture;
+uniform sampler2D 		primitiveIDTexture;
+uniform sampler2D		vertexTextureIDTexture;
+uniform sampler2D		primitiveUVZWTexture;
+uniform sampler2D		primitivenXnYnZTexture;
 uniform sampler2DArray 	rgbaTiles;
+uniform sampler2D		layerAccumulator;
 uniform usamplerBuffer 	rootBuffer; 	//Global memory, as a set of uint vec4s.
-uniform sampler2DMS		depthQueueTexture;
+//uniform sampler2DMS		depthQueueTexture;
 uniform vec3 			fogColor;
 uniform uint 			screenWidth;
 uniform uint 			screenHeight;

 vec4 intrinsicCodeTexel(float warpedFog,uint textureID,vec3 norm,vec2 uv, vec3 illuminatedFog){
 // TOC
 if(textureID==0u)return vec4(0,1,0,1);//Green means textureID=zero
 if(textureID==100024u)return vec4(1,1,0,1);//Yellow means 0xDEADBEEF (unwritten) reverse[4022250974][3735928559u]
 uvec4 	tocHeader 	= texelFetch(rootBuffer,int(textureID+TOC_OFFSET_VEC4_HEADER));
 if(tocHeader[TOC_HEADER_OFFSET_QUADS_MAGIC]!=1337u)return vec4(1,0,1,1);//Magenta means invalid texture.
 vec2	tDims		= vec2(float(tocHeader[TOC_HEADER_OFFSET_QUADS_WIDTH]),float(tocHeader[TOC_HEADER_OFFSET_QUADS_HEIGHT]));

void main(){
float 	depth 		= texture(depthTexture,screenLoc)[0];
gl_FragDepth 		= depth;
float 	warpedFog 	= warpFog(depth);
uint	primitiveID = uint(texture(primitiveIDTexture,screenLoc)[0u]*65536);
vec3	color;
vec3	illuminatedFog
					= fogColor*sunColor;

// S O L I D   B A C K D R O P
 {
 vec2 pq = getPQuad(primitiveID);
 vec4 _uvzw	= textureLod(primitiveUVZWTexture,pq,0);
 _uvzw.xyz /= _uvzw.w;
 color = vec3(primitiveLayer(pq, warpedFog, illuminatedFog, vec4(_uvzw.xyz,getTextureID(primitiveID)) ));
 }

vec4	fsq			= texture(layerAccumulator,screenLoc);

uint relevantSize=0u/*depthOfFloatShiftQueue(fsq)*/;
vec4 vUVZI[DEPTH_QUEUE_SIZE]; // U,V, depth, texture ID
vec2 pQuads[DEPTH_QUEUE_SIZE];
int ordering[DEPTH_QUEUE_SIZE];

// D E P T H   P O P U L A T E
for(int i=0; i<DEPTH_QUEUE_SIZE; i++){
 vec2 pQuad = pQuads[i]= getPQuad(primitiveID = getPrimitiveIDFromQueue(fsq,i));
 vec4 _uvzw	= textureLod(primitiveUVZWTexture,pQuad,0);
 _uvzw.xyz /= _uvzw.w;
 vUVZI[i]   = vec4(_uvzw.xyz,getTextureID(primitiveID));
 ordering[i]=i;
 if(primitiveID<=0u)
  {break;}
 relevantSize++;
 }//end for(DEPTH_QUEUE_SIZE)
 
 // D E P T H   S O R T
 if(relevantSize>0u){
 float alphaAccumulator=0;
 //Perform the not-so-quick sort
 int intermediary;
 for(uint i=0u; i<relevantSize-1u; i++){
  for(uint j=i+1u; j<relevantSize; j++){
   if(vUVZI[ordering[j]].z>vUVZI[ordering[i]].z){//Found new deepest
    //Trade
    intermediary = ordering[i];
    ordering[i] = ordering[j];
