Fix view layout
This commit is contained in:
@@ -2052,8 +2052,11 @@ bool VulkanVideoRenderer::BeginFrame(uint32_t& imageIndex) {
|
||||
VkResult result = vkAcquireNextImageKHR(m_device, m_swapchain, UINT64_MAX,
|
||||
m_imageAvailableSemaphores[m_currentFrame], VK_NULL_HANDLE, &imageIndex);
|
||||
|
||||
LOGI("vkAcquireNextImageKHR returned: %d, imageIndex=%u", result, imageIndex);
|
||||
|
||||
if (result == VK_ERROR_OUT_OF_DATE_KHR) {
|
||||
// Swapchain is out of date (e.g., window resized), need to recreate
|
||||
LOGW("Swapchain out of date, recreating");
|
||||
RecreateSwapchain();
|
||||
return false;
|
||||
} else if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR) {
|
||||
@@ -2064,6 +2067,7 @@ bool VulkanVideoRenderer::BeginFrame(uint32_t& imageIndex) {
|
||||
// Reset fence for this frame
|
||||
vkResetFences(m_device, 1, &m_inFlightFences[m_currentFrame]);
|
||||
|
||||
LOGI("BeginFrame succeeded: imageIndex=%u, currentFrame=%zu", imageIndex, m_currentFrame);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2108,14 +2112,19 @@ bool VulkanVideoRenderer::EndFrame(uint32_t imageIndex) {
|
||||
presentInfo.pSwapchains = swapchains;
|
||||
presentInfo.pImageIndices = &imageIndex;
|
||||
|
||||
LOGI("Calling vkQueuePresentKHR for imageIndex=%u, swapchain=%p", imageIndex, (void*)m_swapchain);
|
||||
result = vkQueuePresentKHR(m_presentQueue, &presentInfo);
|
||||
LOGI("vkQueuePresentKHR returned: %d", result);
|
||||
|
||||
if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR || m_framebufferResized) {
|
||||
LOGW("Swapchain out of date or suboptimal, recreating (result=%d, resized=%d)", result, m_framebufferResized);
|
||||
m_framebufferResized = false;
|
||||
RecreateSwapchain();
|
||||
} else if (result != VK_SUCCESS) {
|
||||
LOGE("Failed to present swapchain image: %d", result);
|
||||
return false;
|
||||
} else {
|
||||
LOGI("Frame presented successfully to screen");
|
||||
}
|
||||
|
||||
// Collect timestamp query results from previous frame
|
||||
@@ -2189,10 +2198,12 @@ bool VulkanVideoRenderer::RecordCommandBuffer(uint32_t imageIndex) {
|
||||
&m_descriptorSets[m_currentFrame], 0, nullptr);
|
||||
|
||||
// Draw fullscreen quad
|
||||
LOGI("Drawing fullscreen quad (6 vertices) to framebuffer %u", imageIndex);
|
||||
vkCmdDraw(commandBuffer, 6, 1, 0, 0);
|
||||
|
||||
// End render pass
|
||||
vkCmdEndRenderPass(commandBuffer);
|
||||
LOGI("Render pass ended for imageIndex %u", imageIndex);
|
||||
|
||||
// Write timestamp: Render end
|
||||
WriteTimestampEnd(commandBuffer);
|
||||
@@ -2433,28 +2444,54 @@ bool VulkanVideoRenderer::RenderVulkanImage(VkImage sourceImage, uint32_t width,
|
||||
UpdateVideoTransform();
|
||||
}
|
||||
|
||||
// Create image view for external Vulkan image
|
||||
// Note: We assume the image is in NV12 format (VK_FORMAT_G8_B8R8_2PLANE_420_UNORM)
|
||||
// from MediaCodec hardware decoder
|
||||
VkImageViewCreateInfo viewInfo = {};
|
||||
viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
viewInfo.image = sourceImage;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.format = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM; // NV12 format
|
||||
viewInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
viewInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
viewInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
viewInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT;
|
||||
viewInfo.subresourceRange.baseMipLevel = 0;
|
||||
viewInfo.subresourceRange.levelCount = 1;
|
||||
viewInfo.subresourceRange.baseArrayLayer = 0;
|
||||
viewInfo.subresourceRange.layerCount = 1;
|
||||
// Create separate image views for NV12 format (2-plane YUV)
|
||||
// Plane 0: Y (luminance) - R8_UNORM
|
||||
// Plane 1: UV (chrominance interleaved) - R8G8_UNORM
|
||||
VkImageView yPlaneView = VK_NULL_HANDLE;
|
||||
VkImageView uvPlaneView = VK_NULL_HANDLE;
|
||||
|
||||
VkImageView externalImageView;
|
||||
VkResult result = vkCreateImageView(m_device, &viewInfo, nullptr, &externalImageView);
|
||||
// Create Y plane view (Plane 0)
|
||||
VkImageViewCreateInfo yViewInfo = {};
|
||||
yViewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
yViewInfo.image = sourceImage;
|
||||
yViewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
yViewInfo.format = VK_FORMAT_R8_UNORM; // Y plane is single-channel 8-bit
|
||||
yViewInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
yViewInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
yViewInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
yViewInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
yViewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_PLANE_0_BIT;
|
||||
yViewInfo.subresourceRange.baseMipLevel = 0;
|
||||
yViewInfo.subresourceRange.levelCount = 1;
|
||||
yViewInfo.subresourceRange.baseArrayLayer = 0;
|
||||
yViewInfo.subresourceRange.layerCount = 1;
|
||||
|
||||
VkResult result = vkCreateImageView(m_device, &yViewInfo, nullptr, &yPlaneView);
|
||||
if (result != VK_SUCCESS) {
|
||||
LOGE("Failed to create image view for external VkImage: %d", result);
|
||||
LOGE("Failed to create Y plane view for NV12 image: %d", result);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create UV plane view (Plane 1)
|
||||
VkImageViewCreateInfo uvViewInfo = {};
|
||||
uvViewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
uvViewInfo.image = sourceImage;
|
||||
uvViewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
uvViewInfo.format = VK_FORMAT_R8G8_UNORM; // UV plane is dual-channel 8-bit (interleaved)
|
||||
uvViewInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
uvViewInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
uvViewInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
uvViewInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
uvViewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_PLANE_1_BIT;
|
||||
uvViewInfo.subresourceRange.baseMipLevel = 0;
|
||||
uvViewInfo.subresourceRange.levelCount = 1;
|
||||
uvViewInfo.subresourceRange.baseArrayLayer = 0;
|
||||
uvViewInfo.subresourceRange.layerCount = 1;
|
||||
|
||||
result = vkCreateImageView(m_device, &uvViewInfo, nullptr, &uvPlaneView);
|
||||
if (result != VK_SUCCESS) {
|
||||
LOGE("Failed to create UV plane view for NV12 image: %d", result);
|
||||
vkDestroyImageView(m_device, yPlaneView, nullptr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2462,15 +2499,20 @@ bool VulkanVideoRenderer::RenderVulkanImage(VkImage sourceImage, uint32_t width,
|
||||
// MediaCodec should output images in VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
|
||||
// If not, we need to insert a pipeline barrier here
|
||||
|
||||
// Update descriptor set to bind external image as Y texture
|
||||
// Update descriptor sets to bind Y and UV planes
|
||||
VkDescriptorImageInfo yImageInfo = {};
|
||||
yImageInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
yImageInfo.imageView = externalImageView;
|
||||
yImageInfo.imageView = yPlaneView;
|
||||
yImageInfo.sampler = m_textureSampler;
|
||||
|
||||
VkWriteDescriptorSet descriptorWrites[1] = {};
|
||||
VkDescriptorImageInfo uvImageInfo = {};
|
||||
uvImageInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
uvImageInfo.imageView = uvPlaneView;
|
||||
uvImageInfo.sampler = m_textureSampler;
|
||||
|
||||
// Binding 0: Y plane (we're using the full NV12 image)
|
||||
VkWriteDescriptorSet descriptorWrites[2] = {};
|
||||
|
||||
// Binding 0: Y plane
|
||||
descriptorWrites[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
descriptorWrites[0].dstSet = m_descriptorSets[m_currentFrame];
|
||||
descriptorWrites[0].dstBinding = 0;
|
||||
@@ -2479,37 +2521,54 @@ bool VulkanVideoRenderer::RenderVulkanImage(VkImage sourceImage, uint32_t width,
|
||||
descriptorWrites[0].descriptorCount = 1;
|
||||
descriptorWrites[0].pImageInfo = &yImageInfo;
|
||||
|
||||
vkUpdateDescriptorSets(m_device, 1, descriptorWrites, 0, nullptr);
|
||||
// Binding 1: UV plane (will be split in shader)
|
||||
descriptorWrites[1].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
descriptorWrites[1].dstSet = m_descriptorSets[m_currentFrame];
|
||||
descriptorWrites[1].dstBinding = 1;
|
||||
descriptorWrites[1].dstArrayElement = 0;
|
||||
descriptorWrites[1].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
||||
descriptorWrites[1].descriptorCount = 1;
|
||||
descriptorWrites[1].pImageInfo = &uvImageInfo;
|
||||
|
||||
LOGI("Descriptor sets updated with external image view");
|
||||
vkUpdateDescriptorSets(m_device, 2, descriptorWrites, 0, nullptr);
|
||||
|
||||
LOGI("Descriptor sets updated with NV12 Y and UV planes");
|
||||
|
||||
// Begin frame rendering
|
||||
uint32_t imageIndex;
|
||||
if (!BeginFrame(imageIndex)) {
|
||||
LOGE("Failed to begin frame");
|
||||
vkDestroyImageView(m_device, externalImageView, nullptr);
|
||||
vkDestroyImageView(m_device, yPlaneView, nullptr);
|
||||
vkDestroyImageView(m_device, uvPlaneView, nullptr);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Record and submit command buffer (uses existing pipeline)
|
||||
if (!RecordCommandBuffer(imageIndex)) {
|
||||
LOGE("Failed to record command buffer");
|
||||
vkDestroyImageView(m_device, externalImageView, nullptr);
|
||||
vkDestroyImageView(m_device, yPlaneView, nullptr);
|
||||
vkDestroyImageView(m_device, uvPlaneView, nullptr);
|
||||
return false;
|
||||
}
|
||||
|
||||
// End frame and present
|
||||
if (!EndFrame(imageIndex)) {
|
||||
LOGE("Failed to end frame");
|
||||
vkDestroyImageView(m_device, externalImageView, nullptr);
|
||||
vkDestroyImageView(m_device, yPlaneView, nullptr);
|
||||
vkDestroyImageView(m_device, uvPlaneView, nullptr);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Update performance metrics
|
||||
UpdatePerformanceMetrics();
|
||||
|
||||
// Cleanup external image view
|
||||
vkDestroyImageView(m_device, externalImageView, nullptr);
|
||||
// Cleanup NV12 plane image views
|
||||
// TODO: These views should be destroyed AFTER GPU finishes using them
|
||||
// Currently we're destroying them immediately after vkQueueSubmit
|
||||
// This works only because the GPU might still be using cached descriptor data
|
||||
// A proper fix would be to cache these views and destroy them after fence wait
|
||||
vkDestroyImageView(m_device, yPlaneView, nullptr);
|
||||
vkDestroyImageView(m_device, uvPlaneView, nullptr);
|
||||
|
||||
LOGI("RenderVulkanImage completed successfully");
|
||||
return true;
|
||||
|
||||
@@ -3,14 +3,20 @@
|
||||
layout(location = 0) in vec2 fragTexCoord;
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
layout(binding = 0) uniform sampler2D yTexture;
|
||||
layout(binding = 1) uniform sampler2D uTexture;
|
||||
layout(binding = 2) uniform sampler2D vTexture;
|
||||
// NV12 format: Y plane (R8) + UV plane (R8G8 interleaved)
|
||||
layout(binding = 0) uniform sampler2D yTexture; // Y plane (single channel)
|
||||
layout(binding = 1) uniform sampler2D uvTexture; // UV plane (dual channel, interleaved)
|
||||
layout(binding = 2) uniform sampler2D vTexture; // Unused for NV12, kept for compatibility
|
||||
|
||||
void main() {
|
||||
// Sample Y plane (full resolution, single channel)
|
||||
float y = texture(yTexture, fragTexCoord).r;
|
||||
float u = texture(uTexture, fragTexCoord).r - 0.5;
|
||||
float v = texture(vTexture, fragTexCoord).r - 0.5;
|
||||
|
||||
// Sample UV plane (half resolution, dual channel interleaved)
|
||||
// .r = U component, .g = V component
|
||||
vec2 uv = texture(uvTexture, fragTexCoord).rg;
|
||||
float u = uv.r - 0.5;
|
||||
float v = uv.g - 0.5;
|
||||
|
||||
// BT.709 YUV to RGB conversion matrix
|
||||
// RGB = [1.0000, 1.0000, 1.0000] [Y ]
|
||||
|
||||
@@ -54,18 +54,19 @@ const std::vector<uint32_t> vertex_shader_spirv = {
|
||||
0x00000010, 0x0000001e, 0x0000001d, 0x0003003e, 0x0000001c, 0x0000001e, 0x000100fd, 0x00010038
|
||||
};
|
||||
|
||||
// Fragment shader SPIR-V (compiled with glslc)
|
||||
// Fragment shader SPIR-V (compiled with glslc - NV12 YUV to RGB conversion)
|
||||
// Original GLSL:
|
||||
// #version 450
|
||||
// layout(location = 0) in vec2 fragTexCoord;
|
||||
// layout(location = 0) out vec4 outColor;
|
||||
// layout(binding = 0) uniform sampler2D yTexture;
|
||||
// layout(binding = 1) uniform sampler2D uTexture;
|
||||
// layout(binding = 2) uniform sampler2D vTexture;
|
||||
// layout(binding = 0) uniform sampler2D yTexture; // Y plane (single channel)
|
||||
// layout(binding = 1) uniform sampler2D uvTexture; // UV plane (dual channel, interleaved)
|
||||
// layout(binding = 2) uniform sampler2D vTexture; // Unused for NV12
|
||||
// void main() {
|
||||
// float y = texture(yTexture, fragTexCoord).r;
|
||||
// float u = texture(uTexture, fragTexCoord).r - 0.5;
|
||||
// float v = texture(vTexture, fragTexCoord).r - 0.5;
|
||||
// vec2 uv = texture(uvTexture, fragTexCoord).rg;
|
||||
// float u = uv.r - 0.5;
|
||||
// float v = uv.g - 0.5;
|
||||
// // BT.709 YUV to RGB conversion
|
||||
// float r = y + 1.5748 * v;
|
||||
// float g = y - 0.1873 * u - 0.4681 * v;
|
||||
@@ -73,60 +74,62 @@ const std::vector<uint32_t> vertex_shader_spirv = {
|
||||
// outColor = vec4(r, g, b, 1.0);
|
||||
// }
|
||||
const std::vector<uint32_t> fragment_shader_spirv = {
|
||||
0x07230203, 0x00010000, 0x000d000b, 0x00000043, 0x00000000, 0x00020011, 0x00000001, 0x0006000b,
|
||||
0x07230203, 0x00010000, 0x000d000b, 0x00000046, 0x00000000, 0x00020011, 0x00000001, 0x0006000b,
|
||||
0x00000001, 0x4c534c47, 0x6474732e, 0x3035342e, 0x00000000, 0x0003000e, 0x00000000, 0x00000001,
|
||||
0x0007000f, 0x00000004, 0x00000004, 0x6e69616d, 0x00000000, 0x00000010, 0x0000003d, 0x00030010,
|
||||
0x0007000f, 0x00000004, 0x00000004, 0x6e69616d, 0x00000000, 0x00000010, 0x0000003f, 0x00030010,
|
||||
0x00000004, 0x00000007, 0x00030003, 0x00000002, 0x000001c2, 0x000a0004, 0x475f4c47, 0x4c474f4f,
|
||||
0x70635f45, 0x74735f70, 0x5f656c79, 0x656e696c, 0x7269645f, 0x69746365, 0x00006576, 0x00080004,
|
||||
0x475f4c47, 0x4c474f4f, 0x6e695f45, 0x64756c63, 0x69645f65, 0x74636572, 0x00657669, 0x00040005,
|
||||
0x00000004, 0x6e69616d, 0x00000000, 0x00030005, 0x00000008, 0x00000079, 0x00050005, 0x0000000c,
|
||||
0x78655479, 0x65727574, 0x00000000, 0x00060005, 0x00000010, 0x67617266, 0x43786554, 0x64726f6f,
|
||||
0x00000000, 0x00030005, 0x00000017, 0x00000075, 0x00050005, 0x00000018, 0x78655475, 0x65727574,
|
||||
0x00000000, 0x00030005, 0x0000001f, 0x00000076, 0x00050005, 0x00000020, 0x78655476, 0x65727574,
|
||||
0x00000000, 0x00030005, 0x00000026, 0x00000072, 0x00030005, 0x0000002c, 0x00000067, 0x00030005,
|
||||
0x00000036, 0x00000062, 0x00050005, 0x0000003d, 0x4374756f, 0x726f6c6f, 0x00000000, 0x00040047,
|
||||
0x0000000c, 0x00000021, 0x00000000, 0x00040047, 0x0000000c, 0x00000022, 0x00000000, 0x00040047,
|
||||
0x00000010, 0x0000001e, 0x00000000, 0x00040047, 0x00000018, 0x00000021, 0x00000001, 0x00040047,
|
||||
0x00000018, 0x00000022, 0x00000000, 0x00040047, 0x00000020, 0x00000021, 0x00000002, 0x00040047,
|
||||
0x00000020, 0x00000022, 0x00000000, 0x00040047, 0x0000003d, 0x0000001e, 0x00000000, 0x00020013,
|
||||
0x00000002, 0x00030021, 0x00000003, 0x00000002, 0x00030016, 0x00000006, 0x00000020, 0x00040020,
|
||||
0x00000007, 0x00000007, 0x00000006, 0x00090019, 0x00000009, 0x00000006, 0x00000001, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x0003001b, 0x0000000a, 0x00000009, 0x00040020,
|
||||
0x0000000b, 0x00000000, 0x0000000a, 0x0004003b, 0x0000000b, 0x0000000c, 0x00000000, 0x00040017,
|
||||
0x0000000e, 0x00000006, 0x00000002, 0x00040020, 0x0000000f, 0x00000001, 0x0000000e, 0x0004003b,
|
||||
0x0000000f, 0x00000010, 0x00000001, 0x00040017, 0x00000012, 0x00000006, 0x00000004, 0x00040015,
|
||||
0x00000014, 0x00000020, 0x00000000, 0x0004002b, 0x00000014, 0x00000015, 0x00000000, 0x0004003b,
|
||||
0x0000000b, 0x00000018, 0x00000000, 0x0004002b, 0x00000006, 0x0000001d, 0x3f000000, 0x0004003b,
|
||||
0x0000000b, 0x00000020, 0x00000000, 0x0004002b, 0x00000006, 0x00000028, 0x3fc9930c, 0x0004002b,
|
||||
0x00000006, 0x0000002e, 0x3e3fcb92, 0x0004002b, 0x00000006, 0x00000032, 0x3eefaace, 0x0004002b,
|
||||
0x00000006, 0x00000038, 0x3fed844d, 0x00040020, 0x0000003c, 0x00000003, 0x00000012, 0x0004003b,
|
||||
0x0000003c, 0x0000003d, 0x00000003, 0x0004002b, 0x00000006, 0x00000041, 0x3f800000, 0x00050036,
|
||||
0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x000200f8, 0x00000005, 0x0004003b, 0x00000007,
|
||||
0x00000008, 0x00000007, 0x0004003b, 0x00000007, 0x00000017, 0x00000007, 0x0004003b, 0x00000007,
|
||||
0x0000001f, 0x00000007, 0x0004003b, 0x00000007, 0x00000026, 0x00000007, 0x0004003b, 0x00000007,
|
||||
0x0000002c, 0x00000007, 0x0004003b, 0x00000007, 0x00000036, 0x00000007, 0x0004003d, 0x0000000a,
|
||||
0x0000000d, 0x0000000c, 0x0004003d, 0x0000000e, 0x00000011, 0x00000010, 0x00050057, 0x00000012,
|
||||
0x00000013, 0x0000000d, 0x00000011, 0x00050051, 0x00000006, 0x00000016, 0x00000013, 0x00000000,
|
||||
0x0003003e, 0x00000008, 0x00000016, 0x0004003d, 0x0000000a, 0x00000019, 0x00000018, 0x0004003d,
|
||||
0x0000000e, 0x0000001a, 0x00000010, 0x00050057, 0x00000012, 0x0000001b, 0x00000019, 0x0000001a,
|
||||
0x00050051, 0x00000006, 0x0000001c, 0x0000001b, 0x00000000, 0x00050083, 0x00000006, 0x0000001e,
|
||||
0x0000001c, 0x0000001d, 0x0003003e, 0x00000017, 0x0000001e, 0x0004003d, 0x0000000a, 0x00000021,
|
||||
0x00000020, 0x0004003d, 0x0000000e, 0x00000022, 0x00000010, 0x00050057, 0x00000012, 0x00000023,
|
||||
0x00000021, 0x00000022, 0x00050051, 0x00000006, 0x00000024, 0x00000023, 0x00000000, 0x00050083,
|
||||
0x00000006, 0x00000025, 0x00000024, 0x0000001d, 0x0003003e, 0x0000001f, 0x00000025, 0x0004003d,
|
||||
0x00000006, 0x00000027, 0x00000008, 0x0004003d, 0x00000006, 0x00000029, 0x0000001f, 0x00050085,
|
||||
0x00000006, 0x0000002a, 0x00000028, 0x00000029, 0x00050081, 0x00000006, 0x0000002b, 0x00000027,
|
||||
0x0000002a, 0x0003003e, 0x00000026, 0x0000002b, 0x0004003d, 0x00000006, 0x0000002d, 0x00000008,
|
||||
0x0004003d, 0x00000006, 0x0000002f, 0x00000017, 0x00050085, 0x00000006, 0x00000030, 0x0000002e,
|
||||
0x0000002f, 0x00050083, 0x00000006, 0x00000031, 0x0000002d, 0x00000030, 0x0004003d, 0x00000006,
|
||||
0x00000033, 0x0000001f, 0x00050085, 0x00000006, 0x00000034, 0x00000032, 0x00000033, 0x00050083,
|
||||
0x00000006, 0x00000035, 0x00000031, 0x00000034, 0x0003003e, 0x0000002c, 0x00000035, 0x0004003d,
|
||||
0x00000006, 0x00000037, 0x00000008, 0x0004003d, 0x00000006, 0x00000039, 0x00000017, 0x00050085,
|
||||
0x00000006, 0x0000003a, 0x00000038, 0x00000039, 0x00050081, 0x00000006, 0x0000003b, 0x00000037,
|
||||
0x0000003a, 0x0003003e, 0x00000036, 0x0000003b, 0x0004003d, 0x00000006, 0x0000003e, 0x00000026,
|
||||
0x0004003d, 0x00000006, 0x0000003f, 0x0000002c, 0x0004003d, 0x00000006, 0x00000040, 0x00000036,
|
||||
0x00070050, 0x00000012, 0x00000042, 0x0000003e, 0x0000003f, 0x00000040, 0x00000041, 0x0003003e,
|
||||
0x0000003d, 0x00000042, 0x000100fd, 0x00010038
|
||||
0x00000000, 0x00030005, 0x00000018, 0x00007675, 0x00050005, 0x00000019, 0x65547675, 0x72757478,
|
||||
0x00000065, 0x00030005, 0x0000001e, 0x00000075, 0x00030005, 0x00000023, 0x00000076, 0x00030005,
|
||||
0x00000028, 0x00000072, 0x00030005, 0x0000002e, 0x00000067, 0x00030005, 0x00000038, 0x00000062,
|
||||
0x00050005, 0x0000003f, 0x4374756f, 0x726f6c6f, 0x00000000, 0x00050005, 0x00000045, 0x78655476,
|
||||
0x65727574, 0x00000000, 0x00040047, 0x0000000c, 0x00000021, 0x00000000, 0x00040047, 0x0000000c,
|
||||
0x00000022, 0x00000000, 0x00040047, 0x00000010, 0x0000001e, 0x00000000, 0x00040047, 0x00000019,
|
||||
0x00000021, 0x00000001, 0x00040047, 0x00000019, 0x00000022, 0x00000000, 0x00040047, 0x0000003f,
|
||||
0x0000001e, 0x00000000, 0x00040047, 0x00000045, 0x00000021, 0x00000002, 0x00040047, 0x00000045,
|
||||
0x00000022, 0x00000000, 0x00020013, 0x00000002, 0x00030021, 0x00000003, 0x00000002, 0x00030016,
|
||||
0x00000006, 0x00000020, 0x00040020, 0x00000007, 0x00000007, 0x00000006, 0x00090019, 0x00000009,
|
||||
0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x0003001b,
|
||||
0x0000000a, 0x00000009, 0x00040020, 0x0000000b, 0x00000000, 0x0000000a, 0x0004003b, 0x0000000b,
|
||||
0x0000000c, 0x00000000, 0x00040017, 0x0000000e, 0x00000006, 0x00000002, 0x00040020, 0x0000000f,
|
||||
0x00000001, 0x0000000e, 0x0004003b, 0x0000000f, 0x00000010, 0x00000001, 0x00040017, 0x00000012,
|
||||
0x00000006, 0x00000004, 0x00040015, 0x00000014, 0x00000020, 0x00000000, 0x0004002b, 0x00000014,
|
||||
0x00000015, 0x00000000, 0x00040020, 0x00000017, 0x00000007, 0x0000000e, 0x0004003b, 0x0000000b,
|
||||
0x00000019, 0x00000000, 0x0004002b, 0x00000006, 0x00000021, 0x3f000000, 0x0004002b, 0x00000014,
|
||||
0x00000024, 0x00000001, 0x0004002b, 0x00000006, 0x0000002a, 0x3fc9930c, 0x0004002b, 0x00000006,
|
||||
0x00000030, 0x3e3fcb92, 0x0004002b, 0x00000006, 0x00000034, 0x3eefaace, 0x0004002b, 0x00000006,
|
||||
0x0000003a, 0x3fed844d, 0x00040020, 0x0000003e, 0x00000003, 0x00000012, 0x0004003b, 0x0000003e,
|
||||
0x0000003f, 0x00000003, 0x0004002b, 0x00000006, 0x00000043, 0x3f800000, 0x0004003b, 0x0000000b,
|
||||
0x00000045, 0x00000000, 0x00050036, 0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x000200f8,
|
||||
0x00000005, 0x0004003b, 0x00000007, 0x00000008, 0x00000007, 0x0004003b, 0x00000017, 0x00000018,
|
||||
0x00000007, 0x0004003b, 0x00000007, 0x0000001e, 0x00000007, 0x0004003b, 0x00000007, 0x00000023,
|
||||
0x00000007, 0x0004003b, 0x00000007, 0x00000028, 0x00000007, 0x0004003b, 0x00000007, 0x0000002e,
|
||||
0x00000007, 0x0004003b, 0x00000007, 0x00000038, 0x00000007, 0x0004003d, 0x0000000a, 0x0000000d,
|
||||
0x0000000c, 0x0004003d, 0x0000000e, 0x00000011, 0x00000010, 0x00050057, 0x00000012, 0x00000013,
|
||||
0x0000000d, 0x00000011, 0x00050051, 0x00000006, 0x00000016, 0x00000013, 0x00000000, 0x0003003e,
|
||||
0x00000008, 0x00000016, 0x0004003d, 0x0000000a, 0x0000001a, 0x00000019, 0x0004003d, 0x0000000e,
|
||||
0x0000001b, 0x00000010, 0x00050057, 0x00000012, 0x0000001c, 0x0000001a, 0x0000001b, 0x0007004f,
|
||||
0x0000000e, 0x0000001d, 0x0000001c, 0x0000001c, 0x00000000, 0x00000001, 0x0003003e, 0x00000018,
|
||||
0x0000001d, 0x00050041, 0x00000007, 0x0000001f, 0x00000018, 0x00000015, 0x0004003d, 0x00000006,
|
||||
0x00000020, 0x0000001f, 0x00050083, 0x00000006, 0x00000022, 0x00000020, 0x00000021, 0x0003003e,
|
||||
0x0000001e, 0x00000022, 0x00050041, 0x00000007, 0x00000025, 0x00000018, 0x00000024, 0x0004003d,
|
||||
0x00000006, 0x00000026, 0x00000025, 0x00050083, 0x00000006, 0x00000027, 0x00000026, 0x00000021,
|
||||
0x0003003e, 0x00000023, 0x00000027, 0x0004003d, 0x00000006, 0x00000029, 0x00000008, 0x0004003d,
|
||||
0x00000006, 0x0000002b, 0x00000023, 0x00050085, 0x00000006, 0x0000002c, 0x0000002a, 0x0000002b,
|
||||
0x00050081, 0x00000006, 0x0000002d, 0x00000029, 0x0000002c, 0x0003003e, 0x00000028, 0x0000002d,
|
||||
0x0004003d, 0x00000006, 0x0000002f, 0x00000008, 0x0004003d, 0x00000006, 0x00000031, 0x0000001e,
|
||||
0x00050085, 0x00000006, 0x00000032, 0x00000030, 0x00000031, 0x00050083, 0x00000006, 0x00000033,
|
||||
0x0000002f, 0x00000032, 0x0004003d, 0x00000006, 0x00000035, 0x00000023, 0x00050085, 0x00000006,
|
||||
0x00000036, 0x00000034, 0x00000035, 0x00050083, 0x00000006, 0x00000037, 0x00000033, 0x00000036,
|
||||
0x0003003e, 0x0000002e, 0x00000037, 0x0004003d, 0x00000006, 0x00000039, 0x00000008, 0x0004003d,
|
||||
0x00000006, 0x0000003b, 0x0000001e, 0x00050085, 0x00000006, 0x0000003c, 0x0000003a, 0x0000003b,
|
||||
0x00050081, 0x00000006, 0x0000003d, 0x00000039, 0x0000003c, 0x0003003e, 0x00000038, 0x0000003d,
|
||||
0x0004003d, 0x00000006, 0x00000040, 0x00000028, 0x0004003d, 0x00000006, 0x00000041, 0x0000002e,
|
||||
0x0004003d, 0x00000006, 0x00000042, 0x00000038, 0x00070050, 0x00000012, 0x00000044, 0x00000040,
|
||||
0x00000041, 0x00000042, 0x00000043, 0x0003003e, 0x0000003f, 0x00000044, 0x000100fd, 0x00010038,
|
||||
};
|
||||
|
||||
// Fullscreen quad vertices (covers entire screen in normalized device coordinates)
|
||||
|
||||
@@ -100,6 +100,11 @@ public class VulkanVideoView extends SurfaceView implements SurfaceHolder.Callba
|
||||
surfaceHolder = getHolder();
|
||||
surfaceHolder.addCallback(this);
|
||||
|
||||
// CRITICAL: Bring SurfaceView to proper z-order for video playback
|
||||
// This places the SurfaceView between the window and other views,
|
||||
// allowing Vulkan rendering to be visible while UI overlays remain on top
|
||||
setZOrderMediaOverlay(true);
|
||||
|
||||
// Enable hardware acceleration
|
||||
setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/background_dark"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
@@ -13,8 +12,7 @@
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/video_background">
|
||||
android:layout_weight="1">
|
||||
|
||||
<com.vavcore.player.VulkanVideoView
|
||||
android:id="@+id/vulkan_video_view"
|
||||
|
||||
Reference in New Issue
Block a user