MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / RecordEncodeVideo

Method RecordEncodeVideo

layers/sync/sync_command_buffer.cpp:1929–1975  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1927}
1928
1929void CommandBufferSubState::RecordEncodeVideo(vvl::VideoSession& vs_state, const VkVideoEncodeInfoKHR& encode_info,
1930 const Location& loc) {
1931 const auto tag = access_context.NextCommandTag(loc.function);
1932 AccessContext& context = access_context.GetCurrentAccessContext();
1933
1934 if (auto src_buffer = base.dev_data.Get<vvl::Buffer>(encode_info.dstBuffer)) {
1935 const AccessRange src_range = MakeRange(*src_buffer, encode_info.dstBufferOffset, encode_info.dstBufferRange);
1936 const ResourceUsageTagEx src_tag_ex = access_context.AddCommandHandle(tag, src_buffer->Handle());
1937 context.UpdateAccessState(*src_buffer, SYNC_VIDEO_ENCODE_VIDEO_ENCODE_WRITE, src_range, src_tag_ex);
1938 }
1939
1940 const auto* device_state = access_context.GetSyncState().device_state;
1941 auto src_resource = vvl::VideoPictureResource(*device_state, encode_info.srcPictureResource);
1942 if (src_resource) {
1943 UpdateVideoAccessState(context, vs_state, src_resource, SYNC_VIDEO_ENCODE_VIDEO_ENCODE_READ, tag);
1944 }
1945
1946 if (encode_info.pSetupReferenceSlot != nullptr && encode_info.pSetupReferenceSlot->pPictureResource != nullptr) {
1947 auto setup_resource = vvl::VideoPictureResource(*device_state, *encode_info.pSetupReferenceSlot->pPictureResource);
1948 if (setup_resource) {
1949 UpdateVideoAccessState(context, vs_state, setup_resource, SYNC_VIDEO_ENCODE_VIDEO_ENCODE_WRITE, tag);
1950 }
1951 }
1952
1953 for (uint32_t i = 0; i < encode_info.referenceSlotCount; ++i) {
1954 if (encode_info.pReferenceSlots[i].pPictureResource != nullptr) {
1955 auto reference_resource = vvl::VideoPictureResource(*device_state, *encode_info.pReferenceSlots[i].pPictureResource);
1956 if (reference_resource) {
1957 UpdateVideoAccessState(context, vs_state, reference_resource, SYNC_VIDEO_ENCODE_VIDEO_ENCODE_READ, tag);
1958 }
1959 }
1960 }
1961
1962 if (encode_info.flags & (VK_VIDEO_ENCODE_WITH_QUANTIZATION_DELTA_MAP_BIT_KHR | VK_VIDEO_ENCODE_WITH_EMPHASIS_MAP_BIT_KHR)) {
1963 auto quantization_map_info = vku::FindStructInPNextChain<VkVideoEncodeQuantizationMapInfoKHR>(encode_info.pNext);
1964 if (quantization_map_info) {
1965 auto image_view_state = base.dev_data.Get<vvl::ImageView>(quantization_map_info->quantizationMap);
1966 if (image_view_state) {
1967 VkOffset3D offset = {0, 0, 0};
1968 VkExtent3D extent = {quantization_map_info->quantizationMapExtent.width,
1969 quantization_map_info->quantizationMapExtent.height, 1};
1970 ImageRangeGen range_gen(MakeImageRangeGen(*image_view_state, offset, extent));
1971 context.UpdateAccessState(range_gen, SYNC_VIDEO_ENCODE_VIDEO_ENCODE_READ, ResourceUsageTagEx{tag});
1972 }
1973 }
1974 }
1975}
1976
1977void CommandBufferSubState::RecordCopyQueryPoolResults(vvl::QueryPool& pool_state, vvl::Buffer& dst_buffer_state,
1978 uint32_t first_query, uint32_t query_count, VkDeviceSize dst_offset,

Callers

nothing calls this directly

Calls 8

UpdateVideoAccessStateFunction · 0.85
MakeImageRangeGenFunction · 0.85
NextCommandTagMethod · 0.80
AddCommandHandleMethod · 0.80
UpdateAccessStateMethod · 0.80
MakeRangeFunction · 0.70
HandleMethod · 0.45

Tested by

no test coverage detected