vk/formats: Fix incorrect depth formats
authorChad Versace <chad.versace@intel.com>
Fri, 26 Jun 2015 02:29:59 +0000 (19:29 -0700)
committerChad Versace <chad.versace@intel.com>
Fri, 26 Jun 2015 03:10:16 +0000 (20:10 -0700)
commitebe1e768b8f0c3a7e2958c6e82182016a1c9bb5c
tree7893f1fb55a4bf2b4e03d68993190e4fcf337004
parent45b804a049c9c28be9e6c4b3ac92464cffee4997
vk/formats: Fix incorrect depth formats

anv_format::surface_format was incorrect for Vulkan depth formats.
For example, the format table mapped

    VK_FORMAT_D24_UNORM -> .surface_format = D24_UNORM_X8_UINT
    VK_FORMAT_D32_FLOAT -> .surface_format = D32_FLOAT

but should have mapped

    VK_FORMAT_D24_UNORM -> .surface_format = R24_UNORM_X8_TYPELESS
    VK_FORMAT_D32_FLOAT -> .surface_format = R32_FLOAT

The Crucible test func.depthstencil.basic passed despite the bug, but
only because it did not attempt to texture from the depth surface.

The core problem is that RENDER_SURFACE_STATE.SurfaceFormat and
3DSTATE_DEPTH_BUFFER.SurfaceFormat are distinct types. Considering them
as enum spaces, the two enum spaces have incompatible collisions.

Fix this by adding a new field 'depth_format' to struct anv_format.

Refer to brw_surface_formats.c:translate_tex_format() for precedent.
src/vulkan/formats.c
src/vulkan/image.c
src/vulkan/private.h