uint32_t l)
{
struct dzn_device *device = container_of(cmdbuf->vk.base.device, struct dzn_device, vk);
+ struct dzn_physical_device *pdev = container_of(device->vk.physical, struct dzn_physical_device, vk);
VK_FROM_HANDLE(dzn_image, src, info->srcImage);
VK_FROM_HANDLE(dzn_image, dst, info->dstImage);
}
tmp_desc->Format =
- dzn_image_get_placed_footprint_format(src->vk.format, aspect);
+ dzn_image_get_placed_footprint_format(pdev, src->vk.format, aspect);
tmp_desc->Width = region.extent.width;
tmp_desc->Height = region.extent.height;
}
tmp_desc->Format =
- dzn_image_get_placed_footprint_format(dst->vk.format, aspect);
+ dzn_image_get_placed_footprint_format(pdev, dst->vk.format, aspect);
if (src_blkw != dst_blkw)
tmp_desc->Width = DIV_ROUND_UP(region.extent.width, src_blkw) * dst_blkw;
if (src_blkh != dst_blkh)
VkFilter filter, bool resolve)
{
struct dzn_device *device = container_of(cmdbuf->vk.base.device, struct dzn_device, vk);
+ struct dzn_physical_device *pdev = container_of(device->vk.physical, struct dzn_physical_device, vk);
enum pipe_format pfmt = vk_format_to_pipe_format(dst->vk.format);
VkImageUsageFlags usage =
vk_format_is_depth_or_stencil(dst->vk.format) ?
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT :
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
struct dzn_meta_blit_key ctx_key = {
- .out_format = dzn_image_get_dxgi_format(dst->vk.format, usage, aspect),
+ .out_format = dzn_image_get_dxgi_format(pdev, dst->vk.format, usage, aspect),
.samples = (uint32_t)src->vk.samples,
.loc = (uint32_t)(aspect == VK_IMAGE_ASPECT_DEPTH_BIT ?
FRAG_RESULT_DEPTH :
{
VK_FROM_HANDLE(dzn_cmd_buffer, cmdbuf, commandBuffer);
struct dzn_device *device = container_of(cmdbuf->vk.base.device, struct dzn_device, vk);
+ struct dzn_physical_device *pdev = container_of(device->vk.physical, struct dzn_physical_device, vk);
VK_FROM_HANDLE(dzn_image, src, info->srcImage);
VK_FROM_HANDLE(dzn_image, dst, info->dstImage);
uint64_t region_size = 0;
tmp_desc.Format =
- dzn_image_get_dxgi_format(src->vk.format,
+ dzn_image_get_dxgi_format(pdev, src->vk.format,
VK_IMAGE_USAGE_TRANSFER_DST_BIT,
aspect);
tmp_desc.Width = region->extent.width;
bool block_compressed = util_format_is_compressed(pfmt);
if (block_compressed &&
!(create_flags & VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT))
- return dzn_image_get_dxgi_format(format, 0, 0);
+ return dzn_image_get_dxgi_format(NULL, format, 0, 0);
unsigned blksz = util_format_get_blocksize(pfmt);
switch (blksz) {
case 1: return DXGI_FORMAT_R8_UNORM;
aspects = VK_IMAGE_ASPECT_STENCIL_BIT;
D3D12_FEATURE_DATA_FORMAT_SUPPORT dfmt_info = {
- .Format = dzn_image_get_dxgi_format(format, usage, aspects),
+ .Format = dzn_image_get_dxgi_format(pdev, format, usage, aspects),
};
/* KHR_maintenance2: If an image is created with the extended usage flag
*/
dzn_foreach_aspect(aspect, aspects) {
D3D12_FEATURE_DATA_FORMAT_SUPPORT dfmt_info2 = {
- .Format = dzn_image_get_dxgi_format(format, 0, aspect),
+ .Format = dzn_image_get_dxgi_format(pdev, format, 0, aspect),
};
hres = ID3D12Device1_CheckFeatureSupport(dev, D3D12_FEATURE_FORMAT_SUPPORT,
VkImageAspectFlagBits aspect,
uint32_t layer)
{
+ struct dzn_physical_device *pdev =
+ container_of(buf->base.device->physical, struct dzn_physical_device, vk);
const uint32_t buffer_row_length =
region->bufferRowLength ? region->bufferRowLength : region->imageExtent.width;
.PlacedFootprint = {
.Footprint = {
.Format =
- dzn_image_get_placed_footprint_format(format, aspect),
+ dzn_image_get_placed_footprint_format(pdev, format, aspect),
.Width = region->imageExtent.width,
.Height = region->imageExtent.height,
.Depth = region->imageExtent.depth,
image->castable_format_count = 0;
for (uint32_t i = 0; i < compat_format_count; i++) {
castable_formats[image->castable_format_count] =
- dzn_image_get_dxgi_format(compat_formats[i], usage, 0);
+ dzn_image_get_dxgi_format(pdev, compat_formats[i], usage, 0);
if (castable_formats[image->castable_format_count] != DXGI_FORMAT_UNKNOWN)
image->castable_format_count++;
.DepthOrArraySize = 1,
.MipLevels = 1,
.Format =
- dzn_image_get_dxgi_format(pCreateInfo->format, usage, 0),
+ dzn_image_get_dxgi_format(pdev, pCreateInfo->format, usage, 0),
.SampleDesc = { .Count = 1, .Quality = 0 },
.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN,
.Flags = D3D12_RESOURCE_FLAG_NONE
image->castable_format_count = 0;
} else {
image->desc.Format =
- dzn_image_get_dxgi_format(pCreateInfo->format,
+ dzn_image_get_dxgi_format(pdev, pCreateInfo->format,
usage & ~VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
0),
image->desc.Dimension = (D3D12_RESOURCE_DIMENSION)(D3D12_RESOURCE_DIMENSION_TEXTURE1D + pCreateInfo->imageType);
}
DXGI_FORMAT
-dzn_image_get_dxgi_format(VkFormat format,
+dzn_image_get_dxgi_format(const struct dzn_physical_device *pdev,
+ VkFormat format,
VkImageUsageFlags usage,
VkImageAspectFlags aspects)
{
}
DXGI_FORMAT
-dzn_image_get_placed_footprint_format(VkFormat format,
+dzn_image_get_placed_footprint_format(const struct dzn_physical_device *pdev,
+ VkFormat format,
VkImageAspectFlags aspect)
{
DXGI_FORMAT out =
- dzn_image_get_dxgi_format(format,
+ dzn_image_get_dxgi_format(pdev, format,
VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
VK_IMAGE_USAGE_TRANSFER_DST_BIT,
aspect);
VkImageAspectFlagBits aspect,
uint32_t layer)
{
+ struct dzn_physical_device *pdev =
+ container_of(image->vk.base.device->physical, struct dzn_physical_device, vk);
D3D12_TEXTURE_COPY_LOCATION loc = {
.pResource = image->res,
};
loc.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
loc.PlacedFootprint.Offset = 0;
loc.PlacedFootprint.Footprint.Format =
- dzn_image_get_placed_footprint_format(image->vk.format, aspect);
+ dzn_image_get_placed_footprint_format(pdev, image->vk.format, aspect);
loc.PlacedFootprint.Footprint.Width = image->vk.extent.width;
loc.PlacedFootprint.Footprint.Height = image->vk.extent.height;
loc.PlacedFootprint.Footprint.Depth = image->vk.extent.depth;
const VkImageSubresourceRange *range,
uint32_t level)
{
+ struct dzn_physical_device *pdev =
+ container_of(image->vk.base.device->physical, struct dzn_physical_device, vk);
uint32_t layer_count = dzn_get_layer_count(image, range);
D3D12_DEPTH_STENCIL_VIEW_DESC dsv_desc = {
.Format =
- dzn_image_get_dxgi_format(image->vk.format,
+ dzn_image_get_dxgi_format(pdev, image->vk.format,
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
range->aspectMask),
};
const VkImageSubresourceRange *range,
uint32_t level)
{
+ struct dzn_physical_device *pdev =
+ container_of(image->vk.base.device->physical, struct dzn_physical_device, vk);
uint32_t layer_count = dzn_get_layer_count(image, range);
D3D12_RENDER_TARGET_VIEW_DESC rtv_desc = {
.Format =
- dzn_image_get_dxgi_format(image->vk.format,
+ dzn_image_get_dxgi_format(pdev, image->vk.format,
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
VK_IMAGE_ASPECT_COLOR_BIT),
};
{
const struct dzn_physical_device *pdev =
container_of(device->vk.physical, struct dzn_physical_device, vk);
- DXGI_FORMAT orig_dxgi = dzn_image_get_dxgi_format(orig_fmt, usage, aspect);
- DXGI_FORMAT new_dxgi = dzn_image_get_dxgi_format(new_fmt, usage, aspect);
+ DXGI_FORMAT orig_dxgi = dzn_image_get_dxgi_format(pdev, orig_fmt, usage, aspect);
+ DXGI_FORMAT new_dxgi = dzn_image_get_dxgi_format(pdev, new_fmt, usage, aspect);
if (orig_dxgi == new_dxgi)
return true;
static void
dzn_image_view_prepare_srv_desc(struct dzn_image_view *iview)
{
+ struct dzn_physical_device *pdev =
+ container_of(iview->vk.base.device->physical, struct dzn_physical_device, vk);
uint32_t plane_slice = (iview->vk.aspects & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) ==
VK_IMAGE_ASPECT_STENCIL_BIT ? 1 : 0;
bool ms = iview->vk.image->samples > 1;
iview->srv_desc = (D3D12_SHADER_RESOURCE_VIEW_DESC) {
.Format =
- dzn_image_get_dxgi_format(iview->vk.format,
+ dzn_image_get_dxgi_format(pdev, iview->vk.format,
iview->vk.usage & ~VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
iview->vk.aspects),
};
static void
dzn_image_view_prepare_uav_desc(struct dzn_image_view *iview)
{
+ struct dzn_physical_device *pdev =
+ container_of(iview->vk.base.device->physical, struct dzn_physical_device, vk);
bool use_array = iview->vk.base_array_layer > 0 || iview->vk.layer_count > 1;
assert(iview->vk.image->samples == 1);
iview->uav_desc = (D3D12_UNORDERED_ACCESS_VIEW_DESC) {
.Format =
- dzn_image_get_dxgi_format(iview->vk.format,
+ dzn_image_get_dxgi_format(pdev, iview->vk.format,
VK_IMAGE_USAGE_STORAGE_BIT,
iview->vk.aspects),
};
static void
dzn_image_view_prepare_rtv_desc(struct dzn_image_view *iview)
{
+ struct dzn_physical_device *pdev =
+ container_of(iview->vk.base.device->physical, struct dzn_physical_device, vk);
bool use_array = iview->vk.base_array_layer > 0 || iview->vk.layer_count > 1;
bool from_3d_image = iview->vk.image->image_type == VK_IMAGE_TYPE_3D;
bool ms = iview->vk.image->samples > 1;
iview->rtv_desc = (D3D12_RENDER_TARGET_VIEW_DESC) {
.Format =
- dzn_image_get_dxgi_format(iview->vk.format,
+ dzn_image_get_dxgi_format(pdev, iview->vk.format,
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
iview->vk.aspects),
};
static void
dzn_image_view_prepare_dsv_desc(struct dzn_image_view *iview)
{
+ struct dzn_physical_device *pdev =
+ container_of(iview->vk.base.device->physical, struct dzn_physical_device, vk);
bool use_array = iview->vk.base_array_layer > 0 || iview->vk.layer_count > 1;
bool ms = iview->vk.image->samples > 1;
iview->dsv_desc = (D3D12_DEPTH_STENCIL_VIEW_DESC) {
.Format =
- dzn_image_get_dxgi_format(iview->vk.format,
+ dzn_image_get_dxgi_format(pdev, iview->vk.format,
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
iview->vk.aspects),
};