diff options
author | Christoph Bumiller <[email protected]> | 2011-10-17 20:49:56 +0200 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2011-10-21 23:00:37 +0200 |
commit | c0e03c7694aa53c0dfb0513c57728c3582d8da7d (patch) | |
tree | 8d7a20dfcaeead316a6042c543c7dcf9701e68ad /src | |
parent | 77574bf0f46716490be741d8095a8d184eff6076 (diff) |
d3d1x: improve CheckFormatSupport
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h | 66 |
1 files changed, 48 insertions, 18 deletions
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index cf8c564d889..fdfaacc88b9 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -303,6 +303,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen SYNCHRONIZED; /* TODO: MSAA, advanced features */ + pipe_format format = dxgi_to_pipe_format[dxgi_format]; if(!format) return E_INVALIDARG; @@ -311,32 +312,61 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen if(support < 0) { support = 0; - unsigned buffer = D3D11_FORMAT_SUPPORT_BUFFER | D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER | D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER; - unsigned sampler_view = D3D11_FORMAT_SUPPORT_SHADER_SAMPLE | D3D11_FORMAT_SUPPORT_MIP | D3D11_FORMAT_SUPPORT_MIP_AUTOGEN; - if(util_format_is_depth_or_stencil(format)) - sampler_view |= D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON; - - /* TODO: do this properly when Gallium drivers actually support index/vertex format queries */ - if(screen->is_format_supported(screen, format, PIPE_BUFFER, 0, PIPE_BIND_VERTEX_BUFFER) - || (screen->is_format_supported(screen, format, PIPE_BUFFER, 0, PIPE_BIND_INDEX_BUFFER) - || format == PIPE_FORMAT_R8_UNORM)) - support |= buffer; + + if(dxgi_format == DXGI_FORMAT_R8_UINT || + dxgi_format == DXGI_FORMAT_R16_UINT || + dxgi_format == DXGI_FORMAT_R32_UINT) + support |= D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER; + + if(screen->is_format_supported(screen, format, PIPE_BUFFER, 0, PIPE_BIND_VERTEX_BUFFER)) + support |= D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER; + if(screen->is_format_supported(screen, format, PIPE_BUFFER, 0, PIPE_BIND_STREAM_OUTPUT)) - support |= buffer | D3D11_FORMAT_SUPPORT_SO_BUFFER; + support |= D3D11_FORMAT_SUPPORT_SO_BUFFER; + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_1D, 0, PIPE_BIND_SAMPLER_VIEW)) - support |= D3D11_FORMAT_SUPPORT_TEXTURE1D | sampler_view; + support |= D3D11_FORMAT_SUPPORT_TEXTURE1D; if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW)) - support |= D3D11_FORMAT_SUPPORT_TEXTURE2D | sampler_view; + support |= D3D11_FORMAT_SUPPORT_TEXTURE2D; if(screen->is_format_supported(screen, format, PIPE_TEXTURE_CUBE, 0, PIPE_BIND_SAMPLER_VIEW)) - support |= D3D11_FORMAT_SUPPORT_TEXTURE2D | sampler_view; + support |= D3D11_FORMAT_SUPPORT_TEXTURECUBE; if(screen->is_format_supported(screen, format, PIPE_TEXTURE_3D, 0, PIPE_BIND_SAMPLER_VIEW)) - support |= D3D11_FORMAT_SUPPORT_TEXTURE3D | sampler_view; - if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET)) + support |= D3D11_FORMAT_SUPPORT_TEXTURE3D; + + if(support & (D3D11_FORMAT_SUPPORT_TEXTURE1D | D3D11_FORMAT_SUPPORT_TEXTURE2D | + D3D11_FORMAT_SUPPORT_TEXTURE3D | D3D11_FORMAT_SUPPORT_TEXTURECUBE)) + { + support |= + D3D11_FORMAT_SUPPORT_SHADER_LOAD | + D3D11_FORMAT_SUPPORT_SHADER_SAMPLE | + D3D11_FORMAT_SUPPORT_MIP | + D3D11_FORMAT_SUPPORT_MIP_AUTOGEN; + if(util_format_is_depth_or_stencil(format)) + support |= D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON; + } + + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET | PIPE_BIND_BLENDABLE)) support |= D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_BLENDABLE; - if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL)) + else + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET)) + support |= D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_RENDER_TARGET; + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL)) support |= D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_DEPTH_STENCIL; - if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_DISPLAY_TARGET)) + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_DISPLAY_TARGET)) support |= D3D11_FORMAT_SUPPORT_DISPLAY; + + unsigned ms; + for(ms = 2; ms <= 8; ++ms) + { + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, ms, PIPE_BIND_RENDER_TARGET)) + { + support |= D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET | D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE; + break; + } + } + if(ms <= 8 && screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, ms, PIPE_BIND_SAMPLER_VIEW)) + support |= D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD; + format_support[format] = support; } *out_format_support = support; |