Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of VkTrimCommandPoolKHR #2316

Merged
merged 2 commits into from
Oct 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions gapis/api/vulkan/api/bitfields.api
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type VkFlags VkInstanceCreateFlags

/// Format capability flags
@unused
@analyze_usage
bitfield VkFormatFeatureFlagBits {
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, /// Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, /// Format can be used for storage images (STORAGE_IMAGE descriptor type)
Expand All @@ -56,9 +57,11 @@ bitfield VkFormatFeatureFlagBits {
VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, /// Format can be used as the destination image of blits with vkCommandBlitImage
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000,
VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = 0x00004000,
VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = 0x00008000,
// Vulkan 1.1 core
VK_FORMAT_FEATURE_TRANSFER_SRC_BIT = 0x00004000,
VK_FORMAT_FEATURE_TRANSFER_DST_BIT = 0x00008000,
VK_FORMAT_FEATURE_TRANSFER_SRC_BIT = 0x00004000, // VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR
VK_FORMAT_FEATURE_TRANSFER_DST_BIT = 0x00008000, // VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR
VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT = 0x00020000,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT = 0x00040000,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT = 0x00080000,
Expand Down Expand Up @@ -510,7 +513,7 @@ type VkFlags VkExternalSemaphoreHandleTypeFlags
@unused
@analyze_usage
bitfield VkFenceImportFlagBits {
VK_FENCE_IMPORT_TEMPORARY_BIT = 0x00000001,
VK_FENCE_IMPORT_TEMPORARY_BIT = 0x000000001,
VK_FENCE_IMPORT_TEMPORARY_BIT_KHR = 0x000000001, // VK_FENCE_IMPORT_TEMPORARY_BIT,
}
type VkFlags VkFenceImportFlags
Expand Down
24 changes: 24 additions & 0 deletions gapis/api/vulkan/api/command_buffer_control.api
Original file line number Diff line number Diff line change
Expand Up @@ -423,3 +423,27 @@ cmd void vkCmdExecuteCommands(

AddCommand(commandBuffer, cmd_vkCmdExecuteCommands, mapPos)
}

// ----------------------------------------------------------------------------
// Vulkan 1.1 Commands
// ----------------------------------------------------------------------------

//////////////////
// Command pool //
//////////////////

sub void TrimCommandPool(
VkDevice device,
VkCommandPool commandPool,
VkCommandPoolTrimFlags flags) {
if !(device in Devices) { vkErrorInvalidDevice(device) }
if !(commandPool in CommandPools) { vkErrorInvalidCommandPool(commandPool) }
}

@indirect("VkDevice")
cmd void vkTrimCommandPool(
VkDevice device,
VkCommandPool commandPool,
VkCommandPoolTrimFlags flags) {
TrimCommandPool(device, commandPool, flags)
}
3 changes: 2 additions & 1 deletion gapis/api/vulkan/api/copy_clear_commands.api
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ sub void dovkCmdCopyImage(ref!vkCmdCopyImageArgs args) {
dstElementAndTexelBlockSize := getElementAndTexelBlockSize(dstFormat)
dstDepthElementSize := getDepthElementSize(dstFormat, false)
for r in (0 .. len(args.Regions)) {
// TODO: (qining) Handle the apsect mask
// TODO: Support KHR_maintenance1 extension, support copying from a 2D array
// image to slices of a 3D image and vice versa.
region := args.Regions[as!u32(r)]
srcBaseLayer := region.srcSubresource.baseArrayLayer
dstBaseLayer := region.srcSubresource.baseArrayLayer
Expand Down
57 changes: 57 additions & 0 deletions gapis/api/vulkan/extensions/khr_maintenance1.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright (C) 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Based off of the original vulkan.h header file which has the following
// license.

// Copyright (c) 2015 The Khronos Group Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and/or associated documentation files (the
// "Materials"), to deal in the Materials without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Materials, and to
// permit persons to whom the Materials are furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Materials.
//
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.


///////////////
// Bitfields //
///////////////

// Updated in api/bitfields.api

//////////////
// Commands //
//////////////

@extension("VK_KHR_maintenance1")
@indirect("VkDevice")
cmd void vkTrimCommandPoolKHR(
VkDevice device,
VkCommandPool commandPool,
VkCommandPoolTrimFlags flags) {
TrimCommandPool(device, commandPool, flags)
}
2 changes: 2 additions & 0 deletions gapis/api/vulkan/footprint_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2800,6 +2800,8 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context,
// TODO: ResetCommandPool should overwrite all the command buffers in this
// pool.
*VkResetCommandPool,
*VkTrimCommandPool,
*VkTrimCommandPoolKHR,
*VkDestroyCommandPool:
bh.Alive = true
case *VkGetPhysicalDeviceXlibPresentationSupportKHR,
Expand Down
1 change: 1 addition & 0 deletions gapis/api/vulkan/vulkan.api
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import "extensions/khr_display_swapchain.api"
import "extensions/khr_get_memory_requirements2.api"
import "extensions/khr_get_physical_device_properties2.api"
import "extensions/khr_get_surface_capabilities2.api"
import "extensions/khr_maintenance1.api"
import "extensions/khr_surface.api"
import "extensions/khr_swapchain.api"
import "extensions/nv_dedicated_allocation.api"
Expand Down