diff options
author | Christoph Bumiller <[email protected]> | 2011-10-13 14:40:44 +0200 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2011-10-21 23:00:37 +0200 |
commit | c463dfe4e4999a0d745c31bce9a2a2bbe6a05899 (patch) | |
tree | 7d4c3a160c408ca0a204c2b09172bb44772535f8 /src/gallium/state_trackers/d3d1x | |
parent | c43b2f6a30dc9d42cb3b19c9396002b6c18a493e (diff) |
d3d1x: implement array textures
Diffstat (limited to 'src/gallium/state_trackers/d3d1x')
3 files changed, 70 insertions, 18 deletions
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index 2cda1ad6423..bbeeb8c3c95 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -1667,7 +1667,8 @@ changed: pipe->bind_stream_output_state(pipe, 0); if(pipe->render_condition) pipe->render_condition(pipe, 0, 0); - util_gen_mipmap(gen_mipmap, view->object, 0, 0, view->object->texture->last_level, PIPE_TEX_FILTER_LINEAR); + for(unsigned layer = view->object->u.tex.first_layer; layer <= view->object->u.tex.last_layer; ++layer) + util_gen_mipmap(gen_mipmap, view->object, layer, view->object->u.tex.first_level, view->object->u.tex.last_level, PIPE_TEX_FILTER_LINEAR); restore_gallium_state_blit_only(); } diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 33cea8380cd..74ad24cf4c3 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -689,15 +689,17 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen if(target != PIPE_TEXTURE_2D) return E_INVALIDARG; target = PIPE_TEXTURE_CUBE; - - if(array_size != 6) - return E_NOTIMPL; + if(array_size % 6) + return E_INVALIDARG; } - else + else if(array_size > 1) { - if(array_size > 1) - return E_NOTIMPL; - array_size = 1; + switch (target) { + case PIPE_TEXTURE_1D: target = PIPE_TEXTURE_1D_ARRAY; break; + case PIPE_TEXTURE_2D: target = PIPE_TEXTURE_2D_ARRAY; break; + default: + return E_INVALIDARG; + } } /* TODO: msaa */ struct pipe_resource templat; @@ -706,6 +708,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen templat.width0 = width; templat.height0 = height; templat.depth0 = depth; + templat.array_size = array_size; if(mip_levels) templat.last_level = mip_levels - 1; else @@ -956,17 +959,35 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen def_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE1D; def_desc.Texture1D.MipLevels = resource->last_level + 1; break; + case PIPE_TEXTURE_1D_ARRAY: + def_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE1DARRAY; + def_desc.Texture1DArray.MipLevels = resource->last_level + 1; + def_desc.Texture1DArray.ArraySize = resource->array_size; + break; case PIPE_TEXTURE_2D: case PIPE_TEXTURE_RECT: def_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; def_desc.Texture2D.MipLevels = resource->last_level + 1; break; + case PIPE_TEXTURE_2D_ARRAY: + def_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; + def_desc.Texture2DArray.MipLevels = resource->last_level + 1; + def_desc.Texture2DArray.ArraySize = resource->array_size; + break; case PIPE_TEXTURE_3D: def_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D; def_desc.Texture3D.MipLevels = resource->last_level + 1; break; case PIPE_TEXTURE_CUBE: - def_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE; + if(resource->array_size > 6) + { + def_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBEARRAY; + def_desc.TextureCubeArray.NumCubes = resource->array_size / 6; + } + else + { + def_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE; + } def_desc.TextureCube.MipLevels = resource->last_level + 1; break; default: @@ -990,12 +1011,21 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen templat.texture = ((GalliumD3D11Resource<>*)iresource)->resource; switch(desc->ViewDimension) { + case D3D11_SRV_DIMENSION_TEXTURE1DARRAY: + case D3D11_SRV_DIMENSION_TEXTURE2DARRAY: + case D3D11_SRV_DIMENSION_TEXTURECUBEARRAY: + templat.u.tex.first_layer = desc->Texture1DArray.FirstArraySlice; + templat.u.tex.last_layer = desc->Texture1DArray.FirstArraySlice + desc->Texture1DArray.ArraySize - 1; + if (desc->ViewDimension == D3D11_SRV_DIMENSION_TEXTURECUBEARRAY) { + templat.u.tex.first_layer *= 6; + templat.u.tex.last_layer *= 6; + } + // fall through case D3D11_SRV_DIMENSION_TEXTURE1D: case D3D11_SRV_DIMENSION_TEXTURE2D: case D3D11_SRV_DIMENSION_TEXTURE3D: - case D3D11_SRV_DIMENSION_TEXTURE1DARRAY: - case D3D11_SRV_DIMENSION_TEXTURE2DARRAY: - /* yes, this works for all of these types (but TODO: texture arrays) */ + case D3D11_SRV_DIMENSION_TEXTURECUBE: + // yes, this works for all of these types templat.u.tex.first_level = desc->Texture1D.MostDetailedMip; templat.u.tex.last_level = templat.u.tex.first_level + desc->Texture1D.MipLevels - 1; break; @@ -1054,10 +1084,18 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen case PIPE_TEXTURE_1D: def_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE1D; break; + case PIPE_TEXTURE_1D_ARRAY: + def_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE1DARRAY; + def_desc.Texture1DArray.ArraySize = resource->array_size; + break; case PIPE_TEXTURE_2D: case PIPE_TEXTURE_RECT: def_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; break; + case PIPE_TEXTURE_2D_ARRAY: + def_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; + def_desc.Texture2DArray.ArraySize = resource->array_size; + break; case PIPE_TEXTURE_3D: def_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D; def_desc.Texture3D.WSize = resource->depth0; @@ -1091,15 +1129,13 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen case D3D11_RTV_DIMENSION_TEXTURE3D: templat.u.tex.level = desc->Texture3D.MipSlice; templat.u.tex.first_layer = desc->Texture3D.FirstWSlice; - /* XXX FIXME */ - templat.u.tex.last_layer = desc->Texture3D.FirstWSlice; + templat.u.tex.last_layer = desc->Texture3D.FirstWSlice + desc->Texture3D.WSize - 1; break; case D3D11_RTV_DIMENSION_TEXTURE1DARRAY: case D3D11_RTV_DIMENSION_TEXTURE2DARRAY: templat.u.tex.level = desc->Texture1DArray.MipSlice; templat.u.tex.first_layer = desc->Texture1DArray.FirstArraySlice; - /* XXX FIXME */ - templat.u.tex.last_layer = desc->Texture1DArray.FirstArraySlice; + templat.u.tex.last_layer = desc->Texture1DArray.FirstArraySlice + desc->Texture1DArray.ArraySize - 1; break; case D3D11_RTV_DIMENSION_BUFFER: case D3D11_RTV_DIMENSION_TEXTURE2DMS: @@ -1138,10 +1174,18 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen case PIPE_TEXTURE_1D: def_desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE1D; break; + case PIPE_TEXTURE_1D_ARRAY: + def_desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE1DARRAY; + def_desc.Texture1DArray.ArraySize = resource->array_size; + break; case PIPE_TEXTURE_2D: case PIPE_TEXTURE_RECT: def_desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; break; + case PIPE_TEXTURE_2D_ARRAY: + def_desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY; + def_desc.Texture2DArray.ArraySize = resource->array_size; + break; case PIPE_TEXTURE_CUBE: def_desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY; def_desc.Texture2DArray.ArraySize = 6; @@ -1172,8 +1216,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen case D3D11_DSV_DIMENSION_TEXTURE2DARRAY: templat.u.tex.level = desc->Texture1DArray.MipSlice; templat.u.tex.first_layer = desc->Texture1DArray.FirstArraySlice; - /* XXX FIXME */ - templat.u.tex.last_layer = desc->Texture1DArray.FirstArraySlice; + templat.u.tex.last_layer = desc->Texture1DArray.FirstArraySlice + desc->Texture1DArray.ArraySize - 1; break; case D3D11_DSV_DIMENSION_TEXTURE2DMS: case D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY: diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp index fd54a673248..b541d922cd4 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp @@ -720,10 +720,18 @@ next:; targets[idx].first = TGSI_TEXTURE_1D; targets[idx].second = TGSI_TEXTURE_SHADOW1D; break; + case SM4_TARGET_TEXTURE1DARRAY: + targets[idx].first = TGSI_TEXTURE_1D_ARRAY; + targets[idx].second = TGSI_TEXTURE_SHADOW1D_ARRAY; + break; case SM4_TARGET_TEXTURE2D: targets[idx].first = TGSI_TEXTURE_2D; targets[idx].second = TGSI_TEXTURE_SHADOW2D; break; + case SM4_TARGET_TEXTURE2DARRAY: + targets[idx].first = TGSI_TEXTURE_2D_ARRAY; + targets[idx].second = TGSI_TEXTURE_SHADOW2D_ARRAY; + break; case SM4_TARGET_TEXTURE3D: targets[idx].first = TGSI_TEXTURE_3D; targets[idx].second = 0; |