Anecoz / AneRend

Prototyping Vulkan engine
16 stars 1 forks source link

Put HiZ samplers/images into descriptor arrays #38

Closed Anecoz closed 11 months ago

Anecoz commented 11 months ago

They are currently all individually named in some shaders, resulting in code such as this:

float sampleHiZ(vec2 coords, uint level)
{
  float ret = 1.0;

  if (level == 0) {
    ret = texture(hiZ64, coords).r;
  }
  else if (level == 1) {
    ret = texture(hiZ32, coords).r;
  }
   else if (level == 2) {
    ret = texture(hiZ16, coords).r;
  }
  else if (level == 3) {
    ret = texture(hiZ8, coords).r;
  }
  else if (level == 4) {
    ret = texture(hiZ4, coords).r;
  }
  else if (level == 5 || level == 6) {
    ret = texture(hiZ2, coords).r;
  }

  return ret;
}

Since we now have support for descriptor arrays, they should live in arrays.