d3d: Bug in handling of depth-stencil surfaces, and potential patch