external/vulkancts/modules/vulkan/draw/vktDrawSimpleTest.cpp \
external/vulkancts/modules/vulkan/draw/vktDrawTests.cpp \
external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateBaseClass.cpp \
- external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateBufferObjectUtil.cpp \
external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateCBTests.cpp \
- external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateCreateInfoUtil.cpp \
external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateDSTests.cpp \
external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateGeneralTests.cpp \
- external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateImageObjectUtil.cpp \
external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateRSTests.cpp \
external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateTests.cpp \
external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateVPTests.cpp \
external/vulkancts/modules/vulkan/pipeline/vktPipelineTimestampTests.cpp \
external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexInputTests.cpp \
external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexUtil.cpp \
- external/vulkancts/modules/vulkan/query_pool/vktQueryPoolBufferObjectUtil.cpp \
- external/vulkancts/modules/vulkan/query_pool/vktQueryPoolCreateInfoUtil.cpp \
- external/vulkancts/modules/vulkan/query_pool/vktQueryPoolImageObjectUtil.cpp \
external/vulkancts/modules/vulkan/query_pool/vktQueryPoolOcclusionTests.cpp \
external/vulkancts/modules/vulkan/query_pool/vktQueryPoolTests.cpp \
external/vulkancts/modules/vulkan/rasterization/vktRasterizationTests.cpp \
const vk::VkDeviceSize size = depthPitch * depth;
- const deUint8* srcRow = reinterpret_cast<const deUint8*>(srcBuffer);
- const deUint8* srcStart;
+ const deUint8 *srcRow = reinterpret_cast<const deUint8 *>(srcBuffer);
+ const deUint8 *srcStart;
srcStart = srcRow;
- deUint8* dstRow = reinterpret_cast<deUint8 *>(destBuffer);
- deUint8* dstStart;
+ deUint8 *dstRow = reinterpret_cast<deUint8 *>(destBuffer);
+ deUint8 *dstStart;
dstStart = dstRow;
if (rowPitch == static_cast<vk::VkDeviceSize>(width * pixelSize) &&
const vk::VkDeviceSize size = depthPitch * depth;
- const deUint8* srcRow = reinterpret_cast<const deUint8*>(srcBuffer);
- const deUint8* srcStart;
+ const deUint8 *srcRow = reinterpret_cast<const deUint8 *>(srcBuffer);
+ const deUint8 *srcStart;
srcStart = srcRow;
- deUint8* dstRow = reinterpret_cast<deUint8*>(destBuffer);
- deUint8* dstStart;
+ deUint8 *dstRow = reinterpret_cast<deUint8 *>(destBuffer);
+ deUint8 *dstStart;
dstStart = dstRow;
if (rowPitch == static_cast<vk::VkDeviceSize>(width * pixelSize) &&
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
(const vk::VkPipelineStageFlags*)DE_NULL,
- 1, // deUint32 commandBufferCount;
+ 1, // deUint32 commandBufferCount;
©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
+ 0, // deUint32 signalSemaphoreCount;
DE_NULL // const VkSemaphore* pSignalSemaphores;
};
m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
vk::VkImageSubresource imageSubResource = { (vk::VkImageAspectFlags)aspect, mipLevel, arrayElement };
vk::VkSubresourceLayout imageLayout;
-
deMemset(&imageLayout, 0, sizeof(imageLayout));
+
m_vk.getImageSubresourceLayout(m_device, object(), &imageSubResource, &imageLayout);
const deUint8* srcPtr = reinterpret_cast<const deUint8*>(getBoundMemory().getHostPtr());
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
(const vk::VkPipelineStageFlags*)DE_NULL,
- 1, // deUint32 commandBufferCount;
+ 1, // deUint32 commandBufferCount;
©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
+ 0, // deUint32 signalSemaphoreCount;
DE_NULL // const VkSemaphore* pSignalSemaphores;
};
m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
void Image::uploadVolume(const tcu::ConstPixelBufferAccess& access,
vk::VkQueue queue,
- vk::Allocator& allocator,
+ vk::Allocator& allocator,
vk::VkImageLayout layout,
vk::VkOffset3D offset,
vk::VkImageAspectFlagBits aspect,
void Image::uploadSurface (const tcu::ConstPixelBufferAccess& access,
vk::VkQueue queue,
- vk::Allocator& allocator,
+ vk::Allocator& allocator,
vk::VkImageLayout layout,
vk::VkOffset3D offset,
vk::VkImageAspectFlagBits aspect,
void Image::uploadSurface1D (const tcu::ConstPixelBufferAccess& access,
vk::VkQueue queue,
- vk::Allocator& allocator,
+ vk::Allocator& allocator,
vk::VkImageLayout layout,
vk::VkOffset3D offset,
vk::VkImageAspectFlagBits aspect,
}
void Image::upload (vk::VkQueue queue,
- vk::Allocator& allocator,
+ vk::Allocator& allocator,
vk::VkImageLayout layout,
vk::VkOffset3D offset,
int width,
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
(const vk::VkPipelineStageFlags*)DE_NULL,
- 1, // deUint32 commandBufferCount;
+ 1, // deUint32 commandBufferCount;
©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
+ 0, // deUint32 signalSemaphoreCount;
DE_NULL // const VkSemaphore* pSignalSemaphores;
};
m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
}
void Image::uploadUsingBuffer (vk::VkQueue queue,
- vk::Allocator& allocator,
+ vk::Allocator& allocator,
vk::VkImageLayout layout,
vk::VkOffset3D offset,
int width,
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
(const vk::VkPipelineStageFlags*)DE_NULL,
- 1, // deUint32 commandBufferCount;
+ 1, // deUint32 commandBufferCount;
©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
+ 0, // deUint32 signalSemaphoreCount;
DE_NULL // const VkSemaphore* pSignalSemaphores;
};
m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
de::SharedPtr<Image> Image::createAndAlloc(const vk::DeviceInterface& vk,
vk::VkDevice device,
const vk::VkImageCreateInfo& createInfo,
- vk::Allocator& allocator,
+ vk::Allocator& allocator,
vk::MemoryRequirement memoryRequirement)
{
de::SharedPtr<Image> ret = create(vk, device, createInfo);
}
void transition2DImage (const vk::DeviceInterface& vk,
- vk::VkCommandBuffer cmdBuffer,
+ vk::VkCommandBuffer cmdBuffer,
vk::VkImage image,
vk::VkImageAspectFlags aspectMask,
vk::VkImageLayout oldLayout,
- vk::VkImageLayout newLayout)
+ vk::VkImageLayout newLayout,
+ vk::VkAccessFlags srcAccessMask,
+ vk::VkAccessFlags dstAccessMask)
{
vk::VkImageMemoryBarrier barrier;
barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
barrier.pNext = DE_NULL;
- barrier.srcAccessMask = 0;
- barrier.dstAccessMask = 0;
+ barrier.srcAccessMask = srcAccessMask;
+ barrier.dstAccessMask = dstAccessMask;
barrier.oldLayout = oldLayout;
barrier.newLayout = newLayout;
barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
transition2DImage(vk, cmdBuffer, image, vk::VK_IMAGE_ASPECT_STENCIL_BIT, vk::VK_IMAGE_LAYOUT_UNDEFINED, layout);
}
-void initialTransitionDepthStencil2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout)
+void initialTransitionDepthStencil2DImage (const vk::DeviceInterface& vk,
+ vk::VkCommandBuffer cmdBuffer,
+ vk::VkImage image,
+ vk::VkImageLayout layout,
+ vk::VkAccessFlags srcAccessMask,
+ vk::VkAccessFlags dstAccessMask)
{
- transition2DImage(vk, cmdBuffer, image, vk::VK_IMAGE_ASPECT_DEPTH_BIT | vk::VK_IMAGE_ASPECT_STENCIL_BIT, vk::VK_IMAGE_LAYOUT_UNDEFINED, layout);
+ transition2DImage(vk, cmdBuffer, image, vk::VK_IMAGE_ASPECT_DEPTH_BIT | vk::VK_IMAGE_ASPECT_STENCIL_BIT, vk::VK_IMAGE_LAYOUT_UNDEFINED, layout, srcAccessMask, dstAccessMask);
}
} // Draw
* \brief Image Object Util
*//*--------------------------------------------------------------------*/
+#include "vkDefs.hpp"
#include "vkMemUtil.hpp"
#include "vkRefUtil.hpp"
vk::VkDevice m_device;
};
-void transition2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageAspectFlags aspectMask, vk::VkImageLayout oldLayout, vk::VkImageLayout newLayout);
+void transition2DImage (const vk::DeviceInterface& vk,
+ vk::VkCommandBuffer cmdBuffer,
+ vk::VkImage image,
+ vk::VkImageAspectFlags aspectMask,
+ vk::VkImageLayout oldLayout,
+ vk::VkImageLayout newLayout,
+ vk::VkAccessFlags srcAccessMask = 0,
+ vk::VkAccessFlags dstAccessMask = 0);
void initialTransitionColor2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
void initialTransitionStencil2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-void initialTransitionDepthStencil2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
+void initialTransitionDepthStencil2DImage (const vk::DeviceInterface& vk,
+ vk::VkCommandBuffer cmdBuffer,
+ vk::VkImage image,
+ vk::VkImageLayout layout,
+ vk::VkAccessFlags srcAccessMask = 0,
+ vk::VkAccessFlags dstAccessMask = 0);
} // Draw
} // vkt
-include_directories(..)
+include_directories(
+ ..
+ ../draw
+ )
set(DEQP_VK_DYNAMIC_STATE_SRCS
vktDynamicStateTestCaseUtil.hpp
vktDynamicStateTests.hpp
vktDynamicStateVPTests.cpp
vktDynamicStateVPTests.hpp
- vktDynamicStateCreateInfoUtil.hpp
- vktDynamicStateCreateInfoUtil.cpp
- vktDynamicStateBufferObjectUtil.hpp
- vktDynamicStateBufferObjectUtil.cpp
- vktDynamicStateImageObjectUtil.hpp
- vktDynamicStateImageObjectUtil.cpp
)
set(DEQP_VK_DYNAMIC_STATE_LIBS
deqp-vk-common
+ deqp-vk-draw
tcutil
vkutil
)
namespace DynamicState
{
+using namespace Draw;
+
DynamicStateBaseClass::DynamicStateBaseClass (Context& context, const char* vertexShaderName, const char* fragmentShaderName)
: TestInstance (context)
, m_colorAttachmentFormat (vk::VK_FORMAT_R8G8B8A8_UNORM)
#include "vktTestCase.hpp"
#include "vktDynamicStateTestCaseUtil.hpp"
-#include "vktDynamicStateImageObjectUtil.hpp"
-#include "vktDynamicStateBufferObjectUtil.hpp"
-#include "vktDynamicStateCreateInfoUtil.hpp"
+#include "vktDrawImageObjectUtil.hpp"
+#include "vktDrawBufferObjectUtil.hpp"
+#include "vktDrawCreateInfoUtil.hpp"
namespace vkt
{
vk::Move<vk::VkPipeline> m_pipeline;
vk::Move<vk::VkPipelineLayout> m_pipelineLayout;
- de::SharedPtr<Image> m_colorTargetImage;
+ de::SharedPtr<Draw::Image> m_colorTargetImage;
vk::Move<vk::VkImageView> m_colorTargetView;
- PipelineCreateInfo::VertexInputState m_vertexInputState;
- de::SharedPtr<Buffer> m_vertexBuffer;
+ Draw::PipelineCreateInfo::VertexInputState m_vertexInputState;
+ de::SharedPtr<Draw::Buffer> m_vertexBuffer;
vk::Move<vk::VkCommandPool> m_cmdPool;
vk::Move<vk::VkCommandBuffer> m_cmdBuffer;
+++ /dev/null
-/*------------------------------------------------------------------------
- * Vulkan Conformance Tests
- * ------------------------
- *
- * Copyright (c) 2015 The Khronos Group Inc.
- * Copyright (c) 2015 Intel Corporation
- *
- * 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.
- *
- *//*!
- * \file
- * \brief Buffer Object Util
- *//*--------------------------------------------------------------------*/
-
-#include "vktDynamicStateBufferObjectUtil.hpp"
-
-#include "vkQueryUtil.hpp"
-
-namespace vkt
-{
-namespace DynamicState
-{
-
-Buffer::Buffer (const vk::DeviceInterface& vk, vk::VkDevice device, vk::Move<vk::VkBuffer> object_)
- : m_allocation (DE_NULL)
- , m_object (object_)
- , m_vk (vk)
- , m_device (device)
-{
-}
-
-void Buffer::bindMemory (de::MovePtr<vk::Allocation> allocation)
-{
- DE_ASSERT(allocation);
- VK_CHECK(m_vk.bindBufferMemory(m_device, *m_object, allocation->getMemory(), allocation->getOffset()));
-
- DE_ASSERT(!m_allocation);
- m_allocation = allocation;
-}
-
-de::SharedPtr<Buffer> Buffer::createAndAlloc (const vk::DeviceInterface& vk,
- vk::VkDevice device,
- const vk::VkBufferCreateInfo &createInfo,
- vk::Allocator &allocator,
- vk::MemoryRequirement memoryRequirement)
-{
- de::SharedPtr<Buffer> ret = create(vk, device, createInfo);
-
- vk::VkMemoryRequirements bufferRequirements = vk::getBufferMemoryRequirements(vk, device, ret->object());
- ret->bindMemory(allocator.allocate(bufferRequirements, memoryRequirement));
- return ret;
-}
-
-de::SharedPtr<Buffer> Buffer::create (const vk::DeviceInterface& vk,
- vk::VkDevice device,
- const vk::VkBufferCreateInfo& createInfo)
-{
- return de::SharedPtr<Buffer>(new Buffer(vk, device, vk::createBuffer(vk, device, &createInfo)));
-}
-
-} // DynamicState
-} // vkt
+++ /dev/null
-#ifndef _VKTDYNAMICSTATEBUFFEROBJECTUTIL_HPP
-#define _VKTDYNAMICSTATEBUFFEROBJECTUTIL_HPP
-/*------------------------------------------------------------------------
- * Vulkan Conformance Tests
- * ------------------------
- *
- * Copyright (c) 2015 The Khronos Group Inc.
- * Copyright (c) 2015 Intel Corporation
- *
- * 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.
- *
- *//*!
- * \file
- * \brief Buffer Object Util
- *//*--------------------------------------------------------------------*/
-
-#include "vkDefs.hpp"
-#include "vkMemUtil.hpp"
-#include "vkRefUtil.hpp"
-
-#include "deSharedPtr.hpp"
-
-namespace vkt
-{
-namespace DynamicState
-{
-
-class Buffer
-{
-public:
-
- static de::SharedPtr<Buffer> create (const vk::DeviceInterface& vk, vk::VkDevice device, const vk::VkBufferCreateInfo &createInfo);
-
- static de::SharedPtr<Buffer> createAndAlloc (const vk::DeviceInterface& vk,
- vk::VkDevice device,
- const vk::VkBufferCreateInfo& createInfo,
- vk::Allocator& allocator,
- vk::MemoryRequirement allocationMemoryProperties = vk::MemoryRequirement::Any);
-
- Buffer (const vk::DeviceInterface &vk, vk::VkDevice device, vk::Move<vk::VkBuffer> object);
-
- void bindMemory (de::MovePtr<vk::Allocation> allocation);
-
- vk::VkBuffer object (void) const { return *m_object; }
- vk::Allocation getBoundMemory (void) const { return *m_allocation; }
-
-private:
-
- Buffer (const Buffer& other); // Not allowed!
- Buffer& operator= (const Buffer& other); // Not allowed!
-
- de::MovePtr<vk::Allocation> m_allocation;
- vk::Unique<vk::VkBuffer> m_object;
-
- const vk::DeviceInterface& m_vk;
- vk::VkDevice m_device;
-};
-
-} // DynamicState
-} // vkt
-
-#endif // _VKTDYNAMICSTATEBUFFEROBJECTUTIL_HPP
{
namespace DynamicState
{
+
+using namespace Draw;
+
namespace
{
+++ /dev/null
-/*------------------------------------------------------------------------
- * Vulkan Conformance Tests
- * ------------------------
- *
- * Copyright (c) 2015 The Khronos Group Inc.
- * Copyright (c) 2015 Intel Corporation
- *
- * 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.
- *
- *//*!
- * \file
- * \brief CreateInfo utilities
- *//*--------------------------------------------------------------------*/
-
-#include "vktDynamicStateCreateInfoUtil.hpp"
-
-#include "vkImageUtil.hpp"
-
-namespace vkt
-{
-namespace DynamicState
-{
-
-ImageSubresourceRange::ImageSubresourceRange (vk::VkImageAspectFlags _aspectMask,
- deUint32 _baseMipLevel,
- deUint32 _levelCount,
- deUint32 _baseArrayLayer,
- deUint32 _layerCount)
-{
- aspectMask = _aspectMask;
- baseMipLevel = _baseMipLevel;
- levelCount = _levelCount;
- baseArrayLayer = _baseArrayLayer;
- layerCount = _layerCount;
-}
-
-ComponentMapping::ComponentMapping (vk::VkComponentSwizzle _r,
- vk::VkComponentSwizzle _g,
- vk::VkComponentSwizzle _b,
- vk::VkComponentSwizzle _a)
-{
- r = _r;
- g = _g;
- b = _b;
- a = _a;
-}
-
-ImageViewCreateInfo::ImageViewCreateInfo (vk::VkImage _image,
- vk::VkImageViewType _viewType,
- vk::VkFormat _format,
- const vk::VkImageSubresourceRange& _subresourceRange,
- const vk::VkComponentMapping& _components,
- vk::VkImageViewCreateFlags _flags)
-{
- sType = vk::VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- image = _image;
- viewType = _viewType;
- format = _format;
- components.r = _components.r;
- components.g = _components.g;
- components.b = _components.b;
- components.a = _components.a;
- subresourceRange = _subresourceRange;
- flags = _flags;
-}
-
-ImageViewCreateInfo::ImageViewCreateInfo (vk::VkImage _image,
- vk::VkImageViewType _viewType,
- vk::VkFormat _format,
- const vk::VkComponentMapping& _components,
- vk::VkImageViewCreateFlags _flags)
-{
- sType = vk::VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- image = _image;
- viewType = _viewType;
- format = _format;
- components.r = _components.r;
- components.g = _components.g;
- components.b = _components.b;
- components.a = _components.a;
-
- vk::VkImageAspectFlags aspectFlags;
- const tcu::TextureFormat tcuFormat = vk::mapVkFormat(_format);
-
- switch (tcuFormat.order)
- {
- case tcu::TextureFormat::D:
- aspectFlags = vk::VK_IMAGE_ASPECT_DEPTH_BIT;
- break;
- case tcu::TextureFormat::S:
- aspectFlags = vk::VK_IMAGE_ASPECT_STENCIL_BIT;
- break;
- case tcu::TextureFormat::DS:
- aspectFlags = vk::VK_IMAGE_ASPECT_STENCIL_BIT | vk::VK_IMAGE_ASPECT_DEPTH_BIT;
- break;
- default:
- aspectFlags = vk::VK_IMAGE_ASPECT_COLOR_BIT;
- break;
- }
-
- subresourceRange = ImageSubresourceRange(aspectFlags);;
- flags = _flags;
-}
-
-BufferViewCreateInfo::BufferViewCreateInfo (vk::VkBuffer _buffer,
- vk::VkFormat _format,
- vk::VkDeviceSize _offset,
- vk::VkDeviceSize _range)
-{
- sType = vk::VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO;
- pNext = DE_NULL;
-
- flags = 0u;
- buffer = _buffer;
- format = _format;
- offset = _offset;
- range = _range;
-}
-
-BufferCreateInfo::BufferCreateInfo (vk::VkDeviceSize _size,
- vk::VkBufferUsageFlags _usage,
- vk::VkSharingMode _sharingMode,
- deUint32 _queueFamilyIndexCount,
- const deUint32* _pQueueFamilyIndices,
- vk::VkBufferCreateFlags _flags)
-{
- sType = vk::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
- pNext = DE_NULL;
- size = _size;
- usage = _usage;
- flags = _flags;
- sharingMode = _sharingMode;
- queueFamilyIndexCount = _queueFamilyIndexCount;
-
- if (_queueFamilyIndexCount)
- {
- m_queueFamilyIndices = std::vector<deUint32>(
- _pQueueFamilyIndices, _pQueueFamilyIndices + _queueFamilyIndexCount);
- pQueueFamilyIndices = &m_queueFamilyIndices[0];
- }
- else
- {
- pQueueFamilyIndices = _pQueueFamilyIndices;
- }
-}
-
-BufferCreateInfo::BufferCreateInfo (const BufferCreateInfo &other)
-{
- sType = other.sType;
- pNext = other.pNext;
- size = other.size;
- usage = other.usage;
- flags = other.flags;
- sharingMode = other.sharingMode;
- queueFamilyIndexCount = other.queueFamilyIndexCount;
-
- m_queueFamilyIndices = other.m_queueFamilyIndices;
- DE_ASSERT(m_queueFamilyIndices.size() == queueFamilyIndexCount);
-
- if (m_queueFamilyIndices.size())
- {
- pQueueFamilyIndices = &m_queueFamilyIndices[0];
- }
- else
- {
- pQueueFamilyIndices = DE_NULL;
- }
-}
-
-BufferCreateInfo & BufferCreateInfo::operator= (const BufferCreateInfo &other)
-{
- sType = other.sType;
- pNext = other.pNext;
- size = other.size;
- usage = other.usage;
- flags = other.flags;
- sharingMode = other.sharingMode;
- queueFamilyIndexCount = other.queueFamilyIndexCount;
-
- m_queueFamilyIndices = other.m_queueFamilyIndices;
-
- DE_ASSERT(m_queueFamilyIndices.size() == queueFamilyIndexCount);
-
- if (m_queueFamilyIndices.size())
- {
- pQueueFamilyIndices = &m_queueFamilyIndices[0];
- }
- else
- {
- pQueueFamilyIndices = DE_NULL;
- }
-
- return *this;
-}
-
-ImageCreateInfo::ImageCreateInfo (vk::VkImageType _imageType,
- vk::VkFormat _format,
- vk::VkExtent3D _extent,
- deUint32 _mipLevels,
- deUint32 _arrayLayers,
- vk::VkSampleCountFlagBits _samples,
- vk::VkImageTiling _tiling,
- vk::VkImageUsageFlags _usage,
- vk::VkSharingMode _sharingMode,
- deUint32 _queueFamilyIndexCount,
- const deUint32* _pQueueFamilyIndices,
- vk::VkImageCreateFlags _flags,
- vk::VkImageLayout _initialLayout)
-{
- if (_queueFamilyIndexCount)
- {
- m_queueFamilyIndices = std::vector<deUint32>(_pQueueFamilyIndices, _pQueueFamilyIndices + _queueFamilyIndexCount);
- }
-
- sType = vk::VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
- pNext = DE_NULL;
- flags = _flags;
- imageType = _imageType;
- format = _format;
- extent = _extent;
- mipLevels = _mipLevels;
- arrayLayers = _arrayLayers;
- samples = _samples;
- tiling = _tiling;
- usage = _usage;
- sharingMode = _sharingMode;
- queueFamilyIndexCount = _queueFamilyIndexCount;
-
- if (m_queueFamilyIndices.size())
- {
- pQueueFamilyIndices = &m_queueFamilyIndices[0];
- }
- else
- {
- pQueueFamilyIndices = DE_NULL;
- }
- initialLayout = _initialLayout;
-}
-
-FramebufferCreateInfo::FramebufferCreateInfo (vk::VkRenderPass _renderPass,
- const std::vector<vk::VkImageView>& atachments,
- deUint32 _width,
- deUint32 _height,
- deUint32 _layers)
-{
- sType = vk::VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
-
- renderPass = _renderPass;
- attachmentCount = static_cast<deUint32>(atachments.size());
-
- if (attachmentCount)
- {
- pAttachments = const_cast<vk::VkImageView *>(&atachments[0]);
- }
-
- width = _width;
- height = _height;
- layers = _layers;
-}
-
-RenderPassCreateInfo::RenderPassCreateInfo (const std::vector<vk::VkAttachmentDescription>& attachments,
- const std::vector<vk::VkSubpassDescription>& subpasses,
- const std::vector<vk::VkSubpassDependency>& dependiences)
-
- : m_attachments (attachments.begin(), attachments.end())
- , m_subpasses (subpasses.begin(), subpasses.end())
- , m_dependiences (dependiences.begin(), dependiences.end())
- , m_attachmentsStructs (m_attachments.begin(), m_attachments.end())
- , m_subpassesStructs (m_subpasses.begin(), m_subpasses.end())
- , m_dependiencesStructs (m_dependiences.begin(), m_dependiences.end())
-{
- sType = vk::VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0;
-
- attachmentCount = static_cast<deUint32>(m_attachments.size());
- pAttachments = &m_attachmentsStructs[0];
- subpassCount = static_cast<deUint32>(m_subpasses.size());
- pSubpasses = &m_subpassesStructs[0];
- dependencyCount = static_cast<deUint32>(m_dependiences.size());
- pDependencies = &m_dependiencesStructs[0];
-}
-
-RenderPassCreateInfo::RenderPassCreateInfo (deUint32 _attachmentCount,
- const vk::VkAttachmentDescription* _pAttachments,
- deUint32 _subpassCount,
- const vk::VkSubpassDescription* _pSubpasses,
- deUint32 _dependencyCount,
- const vk::VkSubpassDependency* _pDependiences)
-{
-
- m_attachments = std::vector<AttachmentDescription>(_pAttachments, _pAttachments + _attachmentCount);
- m_subpasses = std::vector<SubpassDescription>(_pSubpasses, _pSubpasses + _subpassCount);
- m_dependiences = std::vector<SubpassDependency>(_pDependiences, _pDependiences + _dependencyCount);
-
- m_attachmentsStructs = std::vector<vk::VkAttachmentDescription> (m_attachments.begin(), m_attachments.end());
- m_subpassesStructs = std::vector<vk::VkSubpassDescription> (m_subpasses.begin(), m_subpasses.end());
- m_dependiencesStructs = std::vector<vk::VkSubpassDependency> (m_dependiences.begin(), m_dependiences.end());
-
- sType = vk::VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0;
-
- attachmentCount = static_cast<deUint32>(m_attachments.size());
-
- if (attachmentCount) {
- pAttachments = &m_attachmentsStructs[0];
- }
- else
- {
- pAttachments = DE_NULL;
- }
-
- subpassCount = static_cast<deUint32>(m_subpasses.size());
-
- if (subpassCount) {
- pSubpasses = &m_subpassesStructs[0];
- }
- else
- {
- pSubpasses = DE_NULL;
- }
-
- dependencyCount = static_cast<deUint32>(m_dependiences.size());
-
- if (dependencyCount) {
- pDependencies = &m_dependiencesStructs[0];
- }
- else
- {
- pDependencies = DE_NULL;
- }
-}
-
-void
-RenderPassCreateInfo::addAttachment (vk::VkAttachmentDescription attachment)
-{
-
- m_attachments.push_back(attachment);
- m_attachmentsStructs = std::vector<vk::VkAttachmentDescription>(m_attachments.begin(), m_attachments.end());
- attachmentCount = static_cast<deUint32>(m_attachments.size());
- pAttachments = &m_attachmentsStructs[0];
-}
-
-void
-RenderPassCreateInfo::addSubpass (vk::VkSubpassDescription subpass)
-{
-
- m_subpasses.push_back(subpass);
- m_subpassesStructs = std::vector<vk::VkSubpassDescription>(m_subpasses.begin(), m_subpasses.end());
- subpassCount = static_cast<deUint32>(m_subpasses.size());
- pSubpasses = &m_subpassesStructs[0];
-}
-
-void
-RenderPassCreateInfo::addDependency (vk::VkSubpassDependency dependency)
-{
-
- m_dependiences.push_back(dependency);
- m_dependiencesStructs = std::vector<vk::VkSubpassDependency>(m_dependiences.begin(), m_dependiences.end());
-
- dependencyCount = static_cast<deUint32>(m_dependiences.size());
- pDependencies = &m_dependiencesStructs[0];
-}
-
-RenderPassBeginInfo::RenderPassBeginInfo (vk::VkRenderPass _renderPass,
- vk::VkFramebuffer _framebuffer,
- vk::VkRect2D _renderArea,
- const std::vector<vk::VkClearValue>& _clearValues)
-{
-
- m_clearValues = _clearValues;
-
- sType = vk::VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
- pNext = DE_NULL;
- renderPass = _renderPass;
- framebuffer = _framebuffer;
- renderArea = _renderArea;
- clearValueCount = static_cast<deUint32>(m_clearValues.size());
- pClearValues = m_clearValues.size() ? &m_clearValues[0] : DE_NULL;
-}
-
-CmdPoolCreateInfo::CmdPoolCreateInfo (deUint32 _queueFamilyIndex, unsigned int _flags)
-{
- sType = vk::VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
- pNext = DE_NULL;
-
- queueFamilyIndex = _queueFamilyIndex;
- flags = _flags;
-}
-
-AttachmentDescription::AttachmentDescription (vk::VkFormat _format,
- vk::VkSampleCountFlagBits _samples,
- vk::VkAttachmentLoadOp _loadOp,
- vk::VkAttachmentStoreOp _storeOp,
- vk::VkAttachmentLoadOp _stencilLoadOp,
- vk::VkAttachmentStoreOp _stencilStoreOp,
- vk::VkImageLayout _initialLayout,
- vk::VkImageLayout _finalLayout)
-{
- flags = 0;
- format = _format;
- samples = _samples;
- loadOp = _loadOp;
- storeOp = _storeOp;
- stencilLoadOp = _stencilLoadOp;
- stencilStoreOp = _stencilStoreOp;
- initialLayout = _initialLayout;
- finalLayout = _finalLayout;
-}
-
-AttachmentDescription::AttachmentDescription (const vk::VkAttachmentDescription& rhs)
-{
- flags = rhs.flags;
- format = rhs.format;
- samples = rhs.samples;
- loadOp = rhs.loadOp;
- storeOp = rhs.storeOp;
- stencilLoadOp = rhs.stencilLoadOp;
- stencilStoreOp = rhs.stencilStoreOp;
- initialLayout = rhs.initialLayout;
- finalLayout = rhs.finalLayout;
-}
-
-AttachmentReference::AttachmentReference (deUint32 _attachment, vk::VkImageLayout _layout)
-{
- attachment = _attachment;
- layout = _layout;
-}
-
-AttachmentReference::AttachmentReference (void)
-{
- attachment = VK_ATTACHMENT_UNUSED;
- layout = vk::VK_IMAGE_LAYOUT_UNDEFINED;
-}
-
-SubpassDescription::SubpassDescription (vk::VkPipelineBindPoint _pipelineBindPoint,
- vk::VkSubpassDescriptionFlags _flags,
- deUint32 _inputAttachmentCount,
- const vk::VkAttachmentReference* _inputAttachments,
- deUint32 _colorAttachmentCount,
- const vk::VkAttachmentReference* _colorAttachments,
- const vk::VkAttachmentReference* _resolveAttachments,
- vk::VkAttachmentReference depthStencilAttachment,
- deUint32 _preserveAttachmentCount,
- const deUint32* _preserveAttachments)
-{
- m_inputAttachments = std::vector<vk::VkAttachmentReference>(_inputAttachments, _inputAttachments + _inputAttachmentCount);
- m_colorAttachments = std::vector<vk::VkAttachmentReference>(_colorAttachments, _colorAttachments + _colorAttachmentCount);
-
- if (_resolveAttachments)
- m_resolveAttachments = std::vector<vk::VkAttachmentReference>(_resolveAttachments, _resolveAttachments + _colorAttachmentCount);
-
- m_preserveAttachments = std::vector<deUint32>(_preserveAttachments, _preserveAttachments + _preserveAttachmentCount);
-
- m_depthStencilAttachment = depthStencilAttachment;
-
- flags = _flags;
- pipelineBindPoint = _pipelineBindPoint;
- inputAttachmentCount = _inputAttachmentCount;
- pInputAttachments = DE_NULL;
- colorAttachmentCount = _colorAttachmentCount;
- pColorAttachments = DE_NULL;
- pResolveAttachments = DE_NULL;
- pDepthStencilAttachment = &m_depthStencilAttachment;
- pPreserveAttachments = DE_NULL;
- preserveAttachmentCount = _preserveAttachmentCount;
-
- if (!m_inputAttachments.empty())
- pInputAttachments = &m_inputAttachments[0];
-
- if (!m_colorAttachments.empty())
- pColorAttachments = &m_colorAttachments[0];
-
- if (!m_resolveAttachments.empty())
- pResolveAttachments = &m_resolveAttachments[0];
-
- if (!m_preserveAttachments.empty())
- pPreserveAttachments = &m_preserveAttachments[0];
-}
-
-SubpassDescription::SubpassDescription (const vk::VkSubpassDescription& rhs)
-{
- *static_cast<vk::VkSubpassDescription*>(this) = rhs;
-
- m_inputAttachments = std::vector<vk::VkAttachmentReference>(
- rhs.pInputAttachments, rhs.pInputAttachments + rhs.inputAttachmentCount);
-
- m_colorAttachments = std::vector<vk::VkAttachmentReference>(
- rhs.pColorAttachments, rhs.pColorAttachments + rhs.colorAttachmentCount);
-
- if (rhs.pResolveAttachments)
- m_resolveAttachments = std::vector<vk::VkAttachmentReference>(
- rhs.pResolveAttachments, rhs.pResolveAttachments + rhs.colorAttachmentCount);
-
- m_preserveAttachments = std::vector<deUint32>(
- rhs.pPreserveAttachments, rhs.pPreserveAttachments + rhs.preserveAttachmentCount);
-
- if (rhs.pDepthStencilAttachment)
- m_depthStencilAttachment = *rhs.pDepthStencilAttachment;
-
- if (!m_inputAttachments.empty())
- pInputAttachments = &m_inputAttachments[0];
-
- if (!m_colorAttachments.empty())
- pColorAttachments = &m_colorAttachments[0];
-
- if (!m_resolveAttachments.empty())
- pResolveAttachments = &m_resolveAttachments[0];
-
- pDepthStencilAttachment = &m_depthStencilAttachment;
-
- if (!m_preserveAttachments.empty())
- pPreserveAttachments = &m_preserveAttachments[0];
-}
-
-SubpassDescription::SubpassDescription (const SubpassDescription& rhs) {
- *this = rhs;
-}
-
-SubpassDescription& SubpassDescription::operator= (const SubpassDescription& rhs)
-{
- *static_cast<vk::VkSubpassDescription*>(this) = rhs;
-
- m_inputAttachments = rhs.m_inputAttachments;
- m_colorAttachments = rhs.m_colorAttachments;
- m_resolveAttachments = rhs.m_resolveAttachments;
- m_preserveAttachments = rhs.m_preserveAttachments;
- m_depthStencilAttachment = rhs.m_depthStencilAttachment;
-
- if (!m_inputAttachments.empty())
- pInputAttachments = &m_inputAttachments[0];
-
- if (!m_colorAttachments.empty())
- pColorAttachments = &m_colorAttachments[0];
-
- if (!m_resolveAttachments.empty())
- pResolveAttachments = &m_resolveAttachments[0];
-
- pDepthStencilAttachment = &m_depthStencilAttachment;
-
- if (!m_preserveAttachments.empty())
- pPreserveAttachments = &m_preserveAttachments[0];
-
- return *this;
-}
-
-SubpassDependency::SubpassDependency (deUint32 _srcSubpass,
- deUint32 _dstSubpass,
- vk::VkPipelineStageFlags _srcStageMask,
- vk::VkPipelineStageFlags _dstStageMask,
- vk::VkAccessFlags _srcAccessMask,
- vk::VkAccessFlags _dstAccessMask,
- vk::VkDependencyFlags _dependencyFlags)
-{
- srcSubpass = _srcSubpass;
- dstSubpass = _dstSubpass;
- srcStageMask = _srcStageMask;
- dstStageMask = _dstStageMask;
- srcAccessMask = _srcAccessMask;
- dstAccessMask = _dstAccessMask;
- dependencyFlags = _dependencyFlags;
-}
-
-SubpassDependency::SubpassDependency (const vk::VkSubpassDependency& rhs)
-{
- srcSubpass = rhs.srcSubpass;
- dstSubpass = rhs.dstSubpass;
- srcStageMask = rhs.srcStageMask;
- dstStageMask = rhs.dstStageMask;
- srcAccessMask = rhs.srcAccessMask;
- dstAccessMask = rhs.dstAccessMask;
- dependencyFlags = rhs.dependencyFlags;
-}
-
-CmdBufferBeginInfo::CmdBufferBeginInfo (vk::VkCommandBufferUsageFlags _flags)
-{
- sType = vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- pNext = DE_NULL;
- flags = _flags;
- pInheritanceInfo = DE_NULL;
-}
-
-DescriptorPoolCreateInfo::DescriptorPoolCreateInfo (const std::vector<vk::VkDescriptorPoolSize>& poolSizeCounts,
- vk::VkDescriptorPoolCreateFlags _flags,
- deUint32 _maxSets)
- : m_poolSizeCounts(poolSizeCounts)
-{
- sType = vk::VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
- pNext = DE_NULL;
- flags = _flags;
- maxSets = _maxSets;
- poolSizeCount = static_cast<deUint32>(m_poolSizeCounts.size());
- pPoolSizes = &m_poolSizeCounts[0];
-}
-
-DescriptorPoolCreateInfo& DescriptorPoolCreateInfo::addDescriptors (vk::VkDescriptorType type, deUint32 count)
-{
- vk::VkDescriptorPoolSize descriptorTypeCount = { type, count };
- m_poolSizeCounts.push_back(descriptorTypeCount);
-
- poolSizeCount = static_cast<deUint32>(m_poolSizeCounts.size());
- pPoolSizes = &m_poolSizeCounts[0];
-
- return *this;
-}
-
-DescriptorSetLayoutCreateInfo::DescriptorSetLayoutCreateInfo (deUint32 _bindingCount, const vk::VkDescriptorSetLayoutBinding* _pBindings)
-{
- sType = vk::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0;
- bindingCount = _bindingCount;
- pBindings = _pBindings;
-}
-
-PipelineLayoutCreateInfo::PipelineLayoutCreateInfo (deUint32 _descriptorSetCount,
- const vk::VkDescriptorSetLayout* _pSetLayouts,
- deUint32 _pushConstantRangeCount,
- const vk::VkPushConstantRange* _pPushConstantRanges)
- : m_pushConstantRanges(_pPushConstantRanges, _pPushConstantRanges + _pushConstantRangeCount)
-{
- for (unsigned int i = 0; i < _descriptorSetCount; i++)
- {
- m_setLayouts.push_back(_pSetLayouts[i]);
- }
-
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
- pNext = DE_NULL;
- setLayoutCount = static_cast<deUint32>(m_setLayouts.size());
- pSetLayouts = setLayoutCount > 0 ? &m_setLayouts[0] : DE_NULL;
- pushConstantRangeCount = static_cast<deUint32>(m_pushConstantRanges.size());
-
- if (m_pushConstantRanges.size()) {
- pPushConstantRanges = &m_pushConstantRanges[0];
- }
- else
- {
- pPushConstantRanges = DE_NULL;
- }
-}
-
-PipelineLayoutCreateInfo::PipelineLayoutCreateInfo (const std::vector<vk::VkDescriptorSetLayout>& setLayouts,
- deUint32 _pushConstantRangeCount,
- const vk::VkPushConstantRange* _pPushConstantRanges)
- : m_setLayouts (setLayouts)
- , m_pushConstantRanges (_pPushConstantRanges, _pPushConstantRanges + _pushConstantRangeCount)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
- pNext = DE_NULL;
-
- flags = 0u;
- setLayoutCount = static_cast<deUint32>(m_setLayouts.size());
-
- if (setLayoutCount)
- {
- pSetLayouts = &m_setLayouts[0];
- }
- else
- {
- pSetLayouts = DE_NULL;
- }
-
- pushConstantRangeCount = static_cast<deUint32>(m_pushConstantRanges.size());
- if (pushConstantRangeCount) {
- pPushConstantRanges = &m_pushConstantRanges[0];
- }
- else
- {
- pPushConstantRanges = DE_NULL;
- }
-}
-
-PipelineCreateInfo::PipelineShaderStage::PipelineShaderStage (vk::VkShaderModule _module, const char* _pName, vk::VkShaderStageFlagBits _stage)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- stage = _stage;
- module = _module;
- pName = _pName;
- pSpecializationInfo = DE_NULL;
-}
-
-PipelineCreateInfo::VertexInputState::VertexInputState (deUint32 _vertexBindingDescriptionCount,
- const vk::VkVertexInputBindingDescription* _pVertexBindingDescriptions,
- deUint32 _vertexAttributeDescriptionCount,
- const vk::VkVertexInputAttributeDescription* _pVertexAttributeDescriptions)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- vertexBindingDescriptionCount = _vertexBindingDescriptionCount;
- pVertexBindingDescriptions = _pVertexBindingDescriptions;
- vertexAttributeDescriptionCount = _vertexAttributeDescriptionCount;
- pVertexAttributeDescriptions = _pVertexAttributeDescriptions;
-}
-
-PipelineCreateInfo::InputAssemblerState::InputAssemblerState (vk::VkPrimitiveTopology _topology,
- vk::VkBool32 _primitiveRestartEnable)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- topology = _topology;
- primitiveRestartEnable = _primitiveRestartEnable;
-}
-
-PipelineCreateInfo::TessellationState::TessellationState (deUint32 _patchControlPoints)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- patchControlPoints = _patchControlPoints;
-}
-
-PipelineCreateInfo::ViewportState::ViewportState (deUint32 _viewportCount,
- std::vector<vk::VkViewport> _viewports,
- std::vector<vk::VkRect2D> _scissors)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- viewportCount = _viewportCount;
- scissorCount = _viewportCount;
-
- if (!_viewports.size())
- {
- m_viewports.resize(viewportCount);
- deMemset(&m_viewports[0], 0, sizeof(m_viewports[0]) * m_viewports.size());
- }
- else
- {
- m_viewports = _viewports;
- }
-
- if (!_scissors.size())
- {
- m_scissors.resize(scissorCount);
- deMemset(&m_scissors[0], 0, sizeof(m_scissors[0]) * m_scissors.size());
- }
- else
- {
- m_scissors = _scissors;
- }
-
- pViewports = &m_viewports[0];
- pScissors = &m_scissors[0];
-}
-
-PipelineCreateInfo::ViewportState::ViewportState (const ViewportState& other)
-{
- sType = other.sType;
- pNext = other.pNext;
- flags = other.flags;
- viewportCount = other.viewportCount;
- scissorCount = other.scissorCount;
-
- m_viewports = std::vector<vk::VkViewport>(other.pViewports, other.pViewports + viewportCount);
- m_scissors = std::vector<vk::VkRect2D>(other.pScissors, other.pScissors + scissorCount);
-
- pViewports = &m_viewports[0];
- pScissors = &m_scissors[0];
-}
-
-PipelineCreateInfo::ViewportState& PipelineCreateInfo::ViewportState::operator= (const ViewportState& other)
-{
- sType = other.sType;
- pNext = other.pNext;
- flags = other.flags;
- viewportCount = other.viewportCount;
- scissorCount = other.scissorCount;
-
- m_viewports = std::vector<vk::VkViewport>(other.pViewports, other.pViewports + scissorCount);
- m_scissors = std::vector<vk::VkRect2D>(other.pScissors, other.pScissors + scissorCount);
-
- pViewports = &m_viewports[0];
- pScissors = &m_scissors[0];
- return *this;
-}
-
-PipelineCreateInfo::RasterizerState::RasterizerState (vk::VkBool32 _depthClampEnable,
- vk::VkBool32 _rasterizerDiscardEnable,
- vk::VkPolygonMode _polygonMode,
- vk::VkCullModeFlags _cullMode,
- vk::VkFrontFace _frontFace,
- vk::VkBool32 _depthBiasEnable,
- float _depthBiasConstantFactor,
- float _depthBiasClamp,
- float _depthBiasSlopeFactor,
- float _lineWidth)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- depthClampEnable = _depthClampEnable;
- rasterizerDiscardEnable = _rasterizerDiscardEnable;
- polygonMode = _polygonMode;
- cullMode = _cullMode;
- frontFace = _frontFace;
-
- depthBiasEnable = _depthBiasEnable;
- depthBiasConstantFactor = _depthBiasConstantFactor;
- depthBiasClamp = _depthBiasClamp;
- depthBiasSlopeFactor = _depthBiasSlopeFactor;
- lineWidth = _lineWidth;
-}
-
-PipelineCreateInfo::MultiSampleState::MultiSampleState (vk::VkSampleCountFlagBits _rasterizationSamples,
- vk::VkBool32 _sampleShadingEnable,
- float _minSampleShading,
- const std::vector<vk::VkSampleMask>& _sampleMask,
- bool _alphaToCoverageEnable,
- bool _alphaToOneEnable)
- : m_sampleMask(_sampleMask)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- rasterizationSamples = _rasterizationSamples;
- sampleShadingEnable = _sampleShadingEnable;
- minSampleShading = _minSampleShading;
- pSampleMask = &m_sampleMask[0];
- alphaToCoverageEnable = _alphaToCoverageEnable;
- alphaToOneEnable = _alphaToOneEnable;
-}
-
-PipelineCreateInfo::MultiSampleState::MultiSampleState (const MultiSampleState& other)
-{
- sType = other.sType;
- pNext = other.pNext;
- flags = other.flags;
- rasterizationSamples = other.rasterizationSamples;
- sampleShadingEnable = other.sampleShadingEnable;
- minSampleShading = other.minSampleShading;
-
- const size_t sampleMaskArrayLen = (sizeof(vk::VkSampleMask) * 8 + other.rasterizationSamples) / (sizeof(vk::VkSampleMask) * 8);
-
- m_sampleMask = std::vector<vk::VkSampleMask>(other.pSampleMask, other.pSampleMask + sampleMaskArrayLen);
- pSampleMask = &m_sampleMask[0];
-}
-
-PipelineCreateInfo::MultiSampleState& PipelineCreateInfo::MultiSampleState::operator= (const MultiSampleState& other)
-{
- sType = other.sType;
- pNext = other.pNext;
- flags = other.flags;
- rasterizationSamples = other.rasterizationSamples;
- sampleShadingEnable = other.sampleShadingEnable;
- minSampleShading = other.minSampleShading;
-
- const size_t sampleMaskArrayLen = (sizeof(vk::VkSampleMask) * 8 + other.rasterizationSamples) / (sizeof(vk::VkSampleMask) * 8);
-
- m_sampleMask = std::vector<vk::VkSampleMask>(other.pSampleMask, other.pSampleMask + sampleMaskArrayLen);
- pSampleMask = &m_sampleMask[0];
-
- return *this;
-}
-
-PipelineCreateInfo::ColorBlendState::ColorBlendState (const std::vector<vk::VkPipelineColorBlendAttachmentState>& _attachments,
- vk::VkBool32 _logicOpEnable,
- vk::VkLogicOp _logicOp)
- : m_attachments(_attachments)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- logicOpEnable = _logicOpEnable;
- logicOp = _logicOp;
- attachmentCount = static_cast<deUint32>(m_attachments.size());
- pAttachments = &m_attachments[0];
-}
-
-PipelineCreateInfo::ColorBlendState::ColorBlendState (deUint32 _attachmentCount,
- const vk::VkPipelineColorBlendAttachmentState* _attachments,
- vk::VkBool32 _logicOpEnable,
- vk::VkLogicOp _logicOp)
- : m_attachments(_attachments, _attachments + _attachmentCount)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- logicOpEnable = _logicOpEnable;
- logicOp = _logicOp;
- attachmentCount = static_cast<deUint32>(m_attachments.size());
- pAttachments = &m_attachments[0];
-}
-
-PipelineCreateInfo::ColorBlendState::ColorBlendState (const vk::VkPipelineColorBlendStateCreateInfo& createInfo)
- : m_attachments (createInfo.pAttachments, createInfo.pAttachments + createInfo.attachmentCount)
-{
- sType = createInfo.sType;
- pNext = createInfo.pNext;
- flags = createInfo.flags;
- logicOpEnable = createInfo.logicOpEnable;
- logicOp = createInfo.logicOp;
- attachmentCount = static_cast<deUint32>(m_attachments.size());
- pAttachments = &m_attachments[0];
-}
-
-PipelineCreateInfo::ColorBlendState::ColorBlendState (const ColorBlendState& createInfo, std::vector<float> _blendConstants)
- : m_attachments (createInfo.pAttachments, createInfo.pAttachments + createInfo.attachmentCount)
-{
- sType = createInfo.sType;
- pNext = createInfo.pNext;
- flags = createInfo.flags;
- logicOpEnable = createInfo.logicOpEnable;
- logicOp = createInfo.logicOp;
- attachmentCount = static_cast<deUint32>(m_attachments.size());
- pAttachments = &m_attachments[0];
- deMemcpy(blendConstants, &_blendConstants[0], 4 * sizeof(float));
-}
-
-PipelineCreateInfo::ColorBlendState::Attachment::Attachment (vk::VkBool32 _blendEnable,
- vk::VkBlendFactor _srcColorBlendFactor,
- vk::VkBlendFactor _dstColorBlendFactor,
- vk::VkBlendOp _colorBlendOp,
- vk::VkBlendFactor _srcAlphaBlendFactor,
- vk::VkBlendFactor _dstAlphaBlendFactor,
- vk::VkBlendOp _alphaBlendOp,
- deUint8 _colorWriteMask)
-{
- blendEnable = _blendEnable;
- srcColorBlendFactor = _srcColorBlendFactor;
- dstColorBlendFactor = _dstColorBlendFactor;
- colorBlendOp = _colorBlendOp;
- srcAlphaBlendFactor = _srcAlphaBlendFactor;
- dstAlphaBlendFactor = _dstAlphaBlendFactor;
- alphaBlendOp = _alphaBlendOp;
- colorWriteMask = _colorWriteMask;
-}
-
-PipelineCreateInfo::DepthStencilState::StencilOpState::StencilOpState (vk::VkStencilOp _failOp,
- vk::VkStencilOp _passOp,
- vk::VkStencilOp _depthFailOp,
- vk::VkCompareOp _compareOp,
- deUint32 _compareMask,
- deUint32 _writeMask,
- deUint32 _reference)
-{
- failOp = _failOp;
- passOp = _passOp;
- depthFailOp = _depthFailOp;
- compareOp = _compareOp;
-
- compareMask = _compareMask;
- writeMask = _writeMask;
- reference = _reference;
-}
-
-PipelineCreateInfo::DepthStencilState::DepthStencilState (vk::VkBool32 _depthTestEnable,
- vk::VkBool32 _depthWriteEnable,
- vk::VkCompareOp _depthCompareOp,
- vk::VkBool32 _depthBoundsTestEnable,
- vk::VkBool32 _stencilTestEnable,
- StencilOpState _front,
- StencilOpState _back,
- float _minDepthBounds,
- float _maxDepthBounds)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- depthTestEnable = _depthTestEnable;
- depthWriteEnable = _depthWriteEnable;
- depthCompareOp = _depthCompareOp;
- depthBoundsTestEnable = _depthBoundsTestEnable;
- stencilTestEnable = _stencilTestEnable;
- front = _front;
- back = _back;
-
- minDepthBounds = _minDepthBounds;
- maxDepthBounds = _maxDepthBounds;
-}
-
-PipelineCreateInfo::DynamicState::DynamicState (const std::vector<vk::VkDynamicState>& _dynamicStates)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
-
- if (!_dynamicStates.size())
- {
- for (size_t i = 0; i < vk::VK_DYNAMIC_STATE_LAST; ++i)
- {
- m_dynamicStates.push_back(static_cast<vk::VkDynamicState>(i));
- }
- }
- else
- m_dynamicStates = _dynamicStates;
-
- dynamicStateCount = static_cast<deUint32>(m_dynamicStates.size());
- pDynamicStates = &m_dynamicStates[0];
-}
-
-PipelineCreateInfo::DynamicState::DynamicState (const DynamicState &other)
-{
- sType = other.sType;
- pNext = other.pNext;
- flags = other.flags;
-
- dynamicStateCount = other.dynamicStateCount;
-
- m_dynamicStates = std::vector<vk::VkDynamicState>(other.pDynamicStates, other.pDynamicStates + dynamicStateCount);
- pDynamicStates = &m_dynamicStates[0];
-}
-
-PipelineCreateInfo::DynamicState& PipelineCreateInfo::DynamicState::operator= (const DynamicState& other)
-{
- sType = other.sType;
- pNext = other.pNext;
- flags = other.flags;
-
- dynamicStateCount = other.dynamicStateCount;
-
- m_dynamicStates = std::vector<vk::VkDynamicState>(other.pDynamicStates, other.pDynamicStates + dynamicStateCount);
- pDynamicStates = &m_dynamicStates[0];
-
- return *this;
-}
-
-PipelineCreateInfo::PipelineCreateInfo (vk::VkPipelineLayout _layout,
- vk::VkRenderPass _renderPass,
- int _subpass,
- vk::VkPipelineCreateFlags _flags)
-{
- deMemset(static_cast<vk::VkGraphicsPipelineCreateInfo *>(this), 0,
- sizeof(vk::VkGraphicsPipelineCreateInfo));
-
- sType = vk::VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
- pNext = DE_NULL;
- flags = _flags;
- renderPass = _renderPass;
- subpass = _subpass;
- layout = _layout;
- basePipelineHandle = DE_NULL;
- basePipelineIndex = 0;
- pDynamicState = DE_NULL;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addShader (const vk::VkPipelineShaderStageCreateInfo& shader)
-{
- m_shaders.push_back(shader);
-
- stageCount = static_cast<deUint32>(m_shaders.size());
- pStages = &m_shaders[0];
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineVertexInputStateCreateInfo& state)
-{
- m_vertexInputState = state;
- pVertexInputState = &m_vertexInputState;
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineInputAssemblyStateCreateInfo& state)
-{
- m_inputAssemblyState = state;
- pInputAssemblyState = &m_inputAssemblyState;
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineColorBlendStateCreateInfo& state)
-{
- m_colorBlendStateAttachments = std::vector<vk::VkPipelineColorBlendAttachmentState>(state.pAttachments, state.pAttachments + state.attachmentCount);
- m_colorBlendState = state;
- m_colorBlendState.pAttachments = &m_colorBlendStateAttachments[0];
- pColorBlendState = &m_colorBlendState;
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineViewportStateCreateInfo& state)
-{
- m_viewports = std::vector<vk::VkViewport>(state.pViewports, state.pViewports + state.viewportCount);
- m_scissors = std::vector<vk::VkRect2D>(state.pScissors, state.pScissors + state.scissorCount);
- m_viewportState = state;
- m_viewportState.pViewports = &m_viewports[0];
- m_viewportState.pScissors = &m_scissors[0];
- pViewportState = &m_viewportState;
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineDepthStencilStateCreateInfo& state)
-{
- m_dynamicDepthStencilState = state;
- pDepthStencilState = &m_dynamicDepthStencilState;
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineTessellationStateCreateInfo& state)
-{
- m_tessState = state;
- pTessellationState = &m_tessState;
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineRasterizationStateCreateInfo& state)
-{
- m_rasterState = state;
- pRasterizationState = &m_rasterState;
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineMultisampleStateCreateInfo& state)
-{
-
- const size_t sampleMaskArrayLen = (sizeof(vk::VkSampleMask) * 8 + state.rasterizationSamples) / ( sizeof(vk::VkSampleMask) * 8 );
- m_multisampleStateSampleMask = std::vector<vk::VkSampleMask>(state.pSampleMask, state.pSampleMask + sampleMaskArrayLen);
- m_multisampleState = state;
- m_multisampleState.pSampleMask = &m_multisampleStateSampleMask[0];
- pMultisampleState = &m_multisampleState;
-
- return *this;
-}
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineDynamicStateCreateInfo& state)
-{
- m_dynamicStates = std::vector<vk::VkDynamicState>(state.pDynamicStates, state.pDynamicStates + state.dynamicStateCount);
- m_dynamicState = state;
- m_dynamicState.pDynamicStates = &m_dynamicStates[0];
- pDynamicState = &m_dynamicState;
-
- return *this;
-}
-
-SamplerCreateInfo::SamplerCreateInfo (vk::VkFilter _magFilter,
- vk::VkFilter _minFilter,
- vk::VkSamplerMipmapMode _mipmapMode,
- vk::VkSamplerAddressMode _addressModeU,
- vk::VkSamplerAddressMode _addressModeV,
- vk::VkSamplerAddressMode _addressModeW,
- float _mipLodBias,
- vk::VkBool32 _anisotropyEnable,
- float _maxAnisotropy,
- vk::VkBool32 _compareEnable,
- vk::VkCompareOp _compareOp,
- float _minLod,
- float _maxLod,
- vk::VkBorderColor _borderColor,
- vk::VkBool32 _unnormalizedCoordinates)
-{
- sType = vk::VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- magFilter = _magFilter;
- minFilter = _minFilter;
- mipmapMode = _mipmapMode;
- addressModeU = _addressModeU;
- addressModeV = _addressModeV;
- addressModeW = _addressModeW;
- mipLodBias = _mipLodBias;
- anisotropyEnable = _anisotropyEnable;
- maxAnisotropy = _maxAnisotropy;
- compareEnable = _compareEnable;
- compareOp = _compareOp;
- minLod = _minLod;
- maxLod = _maxLod;
- borderColor = _borderColor;
- unnormalizedCoordinates = _unnormalizedCoordinates;
-}
-} // DynamicState
-} // vkt
+++ /dev/null
-#ifndef _VKTDYNAMICSTATECREATEINFOUTIL_HPP
-#define _VKTDYNAMICSTATECREATEINFOUTIL_HPP
-/*------------------------------------------------------------------------
- * Vulkan Conformance Tests
- * ------------------------
- *
- * Copyright (c) 2015 The Khronos Group Inc.
- * Copyright (c) 2015 Intel Corporation
- *
- * 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.
- *
- *//*!
- * \file
- * \brief CreateInfo utilities
- *//*--------------------------------------------------------------------*/
-
-#include "vkDefs.hpp"
-#include "tcuVector.hpp"
-
-#include "deSharedPtr.hpp"
-
-#include <vector>
-
-namespace vkt
-{
-namespace DynamicState
-{
-
-class ImageSubresourceRange : public vk::VkImageSubresourceRange
-{
-public:
- ImageSubresourceRange (vk::VkImageAspectFlags aspectMask,
- deUint32 baseMipLevel = 0,
- deUint32 levelCount = 1,
- deUint32 baseArrayLayer = 0,
- deUint32 layerCount = 1);
-};
-
-class ComponentMapping : public vk::VkComponentMapping
-{
-public:
- ComponentMapping (vk::VkComponentSwizzle r = vk::VK_COMPONENT_SWIZZLE_R,
- vk::VkComponentSwizzle g = vk::VK_COMPONENT_SWIZZLE_G,
- vk::VkComponentSwizzle b = vk::VK_COMPONENT_SWIZZLE_B,
- vk::VkComponentSwizzle a = vk::VK_COMPONENT_SWIZZLE_A);
-};
-
-class ImageViewCreateInfo : public vk::VkImageViewCreateInfo
-{
-public:
- ImageViewCreateInfo (vk::VkImage image,
- vk::VkImageViewType viewType,
- vk::VkFormat format,
- const vk::VkImageSubresourceRange& subresourceRange,
- const vk::VkComponentMapping& components = ComponentMapping(),
- vk::VkImageViewCreateFlags flags = 0);
-
- ImageViewCreateInfo (vk::VkImage image,
- vk::VkImageViewType viewType,
- vk::VkFormat format,
- const vk::VkComponentMapping& components = ComponentMapping(),
- vk::VkImageViewCreateFlags flags = 0);
-};
-
-class BufferViewCreateInfo : public vk::VkBufferViewCreateInfo
-{
-public:
- BufferViewCreateInfo (vk::VkBuffer buffer,
- vk::VkFormat format,
- vk::VkDeviceSize offset,
- vk::VkDeviceSize range);
-};
-
-class BufferCreateInfo : public vk::VkBufferCreateInfo
-{
-public:
- BufferCreateInfo (vk::VkDeviceSize size,
- vk::VkBufferCreateFlags usage,
- vk::VkSharingMode sharingMode = vk::VK_SHARING_MODE_EXCLUSIVE,
- deUint32 queueFamilyIndexCount = 0,
- const deUint32* pQueueFamilyIndices = DE_NULL,
- vk::VkBufferCreateFlags flags = 0);
-
- BufferCreateInfo (const BufferCreateInfo& other);
- BufferCreateInfo& operator= (const BufferCreateInfo& other);
-
-private:
- std::vector<deUint32> m_queueFamilyIndices;
-};
-
-class ImageCreateInfo : public vk::VkImageCreateInfo
-{
-public:
- ImageCreateInfo (vk::VkImageType imageType,
- vk::VkFormat format,
- vk::VkExtent3D extent,
- deUint32 mipLevels,
- deUint32 arrayLayers,
- vk::VkSampleCountFlagBits samples,
- vk::VkImageTiling tiling,
- vk::VkImageUsageFlags usage,
- vk::VkSharingMode sharingMode = vk::VK_SHARING_MODE_EXCLUSIVE,
- deUint32 queueFamilyIndexCount = 0,
- const deUint32* pQueueFamilyIndices = DE_NULL,
- vk::VkImageCreateFlags flags = 0,
- vk::VkImageLayout initialLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED);
-
-private:
- ImageCreateInfo (const ImageCreateInfo& other);
- ImageCreateInfo& operator= (const ImageCreateInfo& other);
-
- std::vector<deUint32> m_queueFamilyIndices;
-};
-
-class FramebufferCreateInfo : public vk::VkFramebufferCreateInfo
-{
-public:
- FramebufferCreateInfo (vk::VkRenderPass renderPass,
- const std::vector<vk::VkImageView>& attachments,
- deUint32 width,
- deUint32 height,
- deUint32 layers);
-};
-
-class AttachmentDescription : public vk::VkAttachmentDescription
-{
-public:
- AttachmentDescription (vk::VkFormat format,
- vk::VkSampleCountFlagBits samples,
- vk::VkAttachmentLoadOp loadOp,
- vk::VkAttachmentStoreOp storeOp,
- vk::VkAttachmentLoadOp stencilLoadOp,
- vk::VkAttachmentStoreOp stencilStoreOp,
- vk::VkImageLayout initialLayout,
- vk::VkImageLayout finalLayout);
-
- AttachmentDescription (const vk::VkAttachmentDescription &);
-};
-
-class AttachmentReference : public vk::VkAttachmentReference
-{
-public:
- AttachmentReference (deUint32 attachment, vk::VkImageLayout layout);
- AttachmentReference (void);
-};
-
-class SubpassDescription : public vk::VkSubpassDescription
-{
-public:
- SubpassDescription (vk::VkPipelineBindPoint pipelineBindPoint,
- vk::VkSubpassDescriptionFlags flags,
- deUint32 inputAttachmentCount,
- const vk::VkAttachmentReference* inputAttachments,
- deUint32 colorAttachmentCount,
- const vk::VkAttachmentReference* colorAttachments,
- const vk::VkAttachmentReference* resolveAttachments,
- vk::VkAttachmentReference depthStencilAttachment,
- deUint32 preserveAttachmentCount,
- const deUint32* preserveAttachments);
-
- SubpassDescription (const vk::VkSubpassDescription& other);
- SubpassDescription (const SubpassDescription& other);
- SubpassDescription& operator= (const SubpassDescription& other);
-
-private:
- std::vector<vk::VkAttachmentReference> m_inputAttachments;
- std::vector<vk::VkAttachmentReference> m_colorAttachments;
- std::vector<vk::VkAttachmentReference> m_resolveAttachments;
- std::vector<deUint32> m_preserveAttachments;
-
- vk::VkAttachmentReference m_depthStencilAttachment;
-};
-
-class SubpassDependency : public vk::VkSubpassDependency
-{
-public:
- SubpassDependency ( deUint32 srcSubpass,
- deUint32 dstSubpass,
- vk::VkPipelineStageFlags srcStageMask,
- vk::VkPipelineStageFlags dstStageMask,
- vk::VkAccessFlags srcAccessMask,
- vk::VkAccessFlags dstAccessMask,
- vk::VkDependencyFlags dependencyFlags);
-
- SubpassDependency (const vk::VkSubpassDependency& other);
-};
-
-class RenderPassCreateInfo : public vk::VkRenderPassCreateInfo
-{
-public:
- RenderPassCreateInfo (const std::vector<vk::VkAttachmentDescription>& attachments,
- const std::vector<vk::VkSubpassDescription>& subpasses,
- const std::vector<vk::VkSubpassDependency>& dependiences = std::vector<vk::VkSubpassDependency>());
-
- RenderPassCreateInfo (deUint32 attachmentCount = 0,
- const vk::VkAttachmentDescription* pAttachments = DE_NULL,
- deUint32 subpassCount = 0,
- const vk::VkSubpassDescription* pSubpasses = DE_NULL,
- deUint32 dependencyCount = 0,
- const vk::VkSubpassDependency* pDependiences = DE_NULL);
-
- void addAttachment (vk::VkAttachmentDescription attachment);
- void addSubpass (vk::VkSubpassDescription subpass);
- void addDependency (vk::VkSubpassDependency dependency);
-
-private:
- std::vector<AttachmentDescription> m_attachments;
- std::vector<SubpassDescription> m_subpasses;
- std::vector<SubpassDependency> m_dependiences;
-
- std::vector<vk::VkAttachmentDescription> m_attachmentsStructs;
- std::vector<vk::VkSubpassDescription> m_subpassesStructs;
- std::vector<vk::VkSubpassDependency> m_dependiencesStructs;
-
- RenderPassCreateInfo (const RenderPassCreateInfo &other); //Not allowed!
- RenderPassCreateInfo& operator= (const RenderPassCreateInfo &other); //Not allowed!
-};
-
-class RenderPassBeginInfo : public vk::VkRenderPassBeginInfo
-{
-public:
- RenderPassBeginInfo (vk::VkRenderPass renderPass,
- vk::VkFramebuffer framebuffer,
- vk::VkRect2D renderArea,
- const std::vector<vk::VkClearValue>& clearValues = std::vector<vk::VkClearValue>());
-
-private:
- std::vector<vk::VkClearValue> m_clearValues;
-
- RenderPassBeginInfo (const RenderPassBeginInfo& other); //Not allowed!
- RenderPassBeginInfo& operator= (const RenderPassBeginInfo& other); //Not allowed!
-};
-
-class CmdPoolCreateInfo : public vk::VkCommandPoolCreateInfo
-{
-public:
- CmdPoolCreateInfo (deUint32 queueFamilyIndex,
- vk::VkCommandPoolCreateFlags flags = vk::VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT);
-};
-
-class CmdBufferBeginInfo : public vk::VkCommandBufferBeginInfo
-{
-public:
- CmdBufferBeginInfo (vk::VkCommandBufferUsageFlags flags = 0);
-};
-
-class DescriptorPoolSize : public vk::VkDescriptorPoolSize
-{
-public:
- DescriptorPoolSize (vk::VkDescriptorType _type, deUint32 _descriptorCount)
- {
- type = _type;
- descriptorCount = _descriptorCount;
- }
-};
-
-class DescriptorPoolCreateInfo : public vk::VkDescriptorPoolCreateInfo
-{
-public:
- DescriptorPoolCreateInfo (const std::vector<vk::VkDescriptorPoolSize>& poolSizeCounts,
- vk::VkDescriptorPoolCreateFlags flags,
- deUint32 maxSets);
-
- DescriptorPoolCreateInfo& addDescriptors (vk::VkDescriptorType type, deUint32 count);
-
-private:
- std::vector<vk::VkDescriptorPoolSize> m_poolSizeCounts;
-};
-
-class DescriptorSetLayoutCreateInfo : public vk::VkDescriptorSetLayoutCreateInfo
-{
-public:
- DescriptorSetLayoutCreateInfo (deUint32 bindingCount, const vk::VkDescriptorSetLayoutBinding* pBindings);
-};
-
-class PipelineLayoutCreateInfo : public vk::VkPipelineLayoutCreateInfo
-{
-public:
- PipelineLayoutCreateInfo (deUint32 descriptorSetCount,
- const vk::VkDescriptorSetLayout* pSetLayouts,
- deUint32 pushConstantRangeCount = 0,
- const vk::VkPushConstantRange* pPushConstantRanges = DE_NULL);
-
- PipelineLayoutCreateInfo (const std::vector<vk::VkDescriptorSetLayout>& setLayouts = std::vector<vk::VkDescriptorSetLayout>(),
- deUint32 pushConstantRangeCount = 0,
- const vk::VkPushConstantRange* pPushConstantRanges = DE_NULL);
-
-private:
- std::vector<vk::VkDescriptorSetLayout> m_setLayouts;
- std::vector<vk::VkPushConstantRange> m_pushConstantRanges;
-};
-
-class PipelineCreateInfo : public vk::VkGraphicsPipelineCreateInfo
-{
-public:
- class VertexInputState : public vk::VkPipelineVertexInputStateCreateInfo
- {
- public:
- VertexInputState (deUint32 vertexBindingDescriptionCount = 0,
- const vk::VkVertexInputBindingDescription* pVertexBindingDescriptions = NULL,
- deUint32 vertexAttributeDescriptionCount = 0,
- const vk::VkVertexInputAttributeDescription* pVertexAttributeDescriptions = NULL);
- };
-
- class InputAssemblerState : public vk::VkPipelineInputAssemblyStateCreateInfo
- {
- public:
- InputAssemblerState (vk::VkPrimitiveTopology topology, vk::VkBool32 primitiveRestartEnable = false);
- };
-
- class TessellationState : public vk::VkPipelineTessellationStateCreateInfo
- {
- public:
- TessellationState (deUint32 patchControlPoints = 0);
- };
-
- class ViewportState : public vk::VkPipelineViewportStateCreateInfo
- {
- public:
- ViewportState (deUint32 viewportCount,
- std::vector<vk::VkViewport> viewports = std::vector<vk::VkViewport>(0),
- std::vector<vk::VkRect2D> scissors = std::vector<vk::VkRect2D>(0));
-
- ViewportState (const ViewportState& other);
- ViewportState& operator= (const ViewportState& other);
-
- std::vector<vk::VkViewport> m_viewports;
- std::vector<vk::VkRect2D> m_scissors;
- };
-
- class RasterizerState : public vk::VkPipelineRasterizationStateCreateInfo
- {
- public:
- RasterizerState (vk::VkBool32 depthClampEnable = false,
- vk::VkBool32 rasterizerDiscardEnable = false,
- vk::VkPolygonMode polygonMode = vk::VK_POLYGON_MODE_FILL,
- vk::VkCullModeFlags cullMode = vk::VK_CULL_MODE_NONE,
- vk::VkFrontFace frontFace = vk::VK_FRONT_FACE_CLOCKWISE,
- vk::VkBool32 depthBiasEnable = true,
- float depthBiasConstantFactor = 0.0f,
- float depthBiasClamp = 0.0f,
- float depthBiasSlopeFactor = 0.0f,
- float lineWidth = 1.0f);
- };
-
- class MultiSampleState : public vk::VkPipelineMultisampleStateCreateInfo
- {
- public:
- MultiSampleState (vk::VkSampleCountFlagBits rasterizationSamples = vk::VK_SAMPLE_COUNT_1_BIT,
- vk::VkBool32 sampleShadingEnable = false,
- float minSampleShading = 0.0f,
- const std::vector<vk::VkSampleMask>& sampleMask = std::vector<vk::VkSampleMask>(1, 0xffffffff),
- bool alphaToCoverageEnable = false,
- bool alphaToOneEnable = false);
-
- MultiSampleState (const MultiSampleState& other);
- MultiSampleState& operator= (const MultiSampleState& other);
-
- private:
- std::vector<vk::VkSampleMask> m_sampleMask;
- };
-
- class ColorBlendState : public vk::VkPipelineColorBlendStateCreateInfo
- {
- public:
- class Attachment : public vk::VkPipelineColorBlendAttachmentState
- {
- public:
- Attachment (vk::VkBool32 blendEnable = false,
- vk::VkBlendFactor srcColorBlendFactor = vk::VK_BLEND_FACTOR_SRC_COLOR,
- vk::VkBlendFactor dstColorBlendFactor = vk::VK_BLEND_FACTOR_DST_COLOR,
- vk::VkBlendOp colorBlendOp = vk::VK_BLEND_OP_ADD,
- vk::VkBlendFactor srcAlphaBlendFactor = vk::VK_BLEND_FACTOR_SRC_COLOR,
- vk::VkBlendFactor dstAlphaBlendFactor = vk::VK_BLEND_FACTOR_DST_COLOR,
- vk::VkBlendOp alphaBlendOp = vk::VK_BLEND_OP_ADD,
- deUint8 colorWriteMask = 0xff);
- };
-
- ColorBlendState (const std::vector<vk::VkPipelineColorBlendAttachmentState>& attachments,
- vk::VkBool32 alphaToCoverageEnable = false,
- vk::VkLogicOp logicOp = vk::VK_LOGIC_OP_COPY);
-
- ColorBlendState (deUint32 attachmentCount,
- const vk::VkPipelineColorBlendAttachmentState* attachments,
- vk::VkBool32 logicOpEnable = false,
- vk::VkLogicOp logicOp = vk::VK_LOGIC_OP_COPY);
-
- ColorBlendState (const vk::VkPipelineColorBlendStateCreateInfo& createInfo);
- ColorBlendState (const ColorBlendState& createInfo,
- std::vector<float> blendConstants = std::vector<float>(4));
-
- private:
- std::vector<vk::VkPipelineColorBlendAttachmentState> m_attachments;
- };
-
- class DepthStencilState : public vk::VkPipelineDepthStencilStateCreateInfo
- {
- public:
- class StencilOpState : public vk::VkStencilOpState
- {
- public:
- StencilOpState (vk::VkStencilOp failOp = vk::VK_STENCIL_OP_REPLACE,
- vk::VkStencilOp passOp = vk::VK_STENCIL_OP_REPLACE,
- vk::VkStencilOp depthFailOp = vk::VK_STENCIL_OP_REPLACE,
- vk::VkCompareOp compareOp = vk::VK_COMPARE_OP_ALWAYS,
- deUint32 compareMask = 0xffffffffu,
- deUint32 writeMask = 0xffffffffu,
- deUint32 reference = 0);
- };
-
- DepthStencilState (vk::VkBool32 depthTestEnable = false,
- vk::VkBool32 depthWriteEnable = false,
- vk::VkCompareOp depthCompareOp = vk::VK_COMPARE_OP_ALWAYS,
- vk::VkBool32 depthBoundsTestEnable = false,
- vk::VkBool32 stencilTestEnable = false,
- StencilOpState front = StencilOpState(),
- StencilOpState back = StencilOpState(),
- float minDepthBounds = -1.0f,
- float maxDepthBounds = 1.0f);
- };
-
- class PipelineShaderStage : public vk::VkPipelineShaderStageCreateInfo
- {
- public:
- PipelineShaderStage (vk::VkShaderModule shaderModule, const char* pName, vk::VkShaderStageFlagBits stage);
- };
-
- class DynamicState : public vk::VkPipelineDynamicStateCreateInfo
- {
- public:
- DynamicState (const std::vector<vk::VkDynamicState>& dynamicStates = std::vector<vk::VkDynamicState>(0));
-
- DynamicState (const DynamicState& other);
- DynamicState& operator= (const DynamicState& other);
-
- std::vector<vk::VkDynamicState> m_dynamicStates;
- };
-
- PipelineCreateInfo (vk::VkPipelineLayout layout,
- vk::VkRenderPass renderPass,
- int subpass,
- vk::VkPipelineCreateFlags flags);
-
- PipelineCreateInfo& addShader (const vk::VkPipelineShaderStageCreateInfo& shader);
-
- PipelineCreateInfo& addState (const vk::VkPipelineVertexInputStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineInputAssemblyStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineColorBlendStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineViewportStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineDepthStencilStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineTessellationStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineRasterizationStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineMultisampleStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineDynamicStateCreateInfo& state);
-
-private:
- std::vector<vk::VkPipelineShaderStageCreateInfo> m_shaders;
-
- vk::VkPipelineVertexInputStateCreateInfo m_vertexInputState;
- vk::VkPipelineInputAssemblyStateCreateInfo m_inputAssemblyState;
- std::vector<vk::VkPipelineColorBlendAttachmentState> m_colorBlendStateAttachments;
- vk::VkPipelineColorBlendStateCreateInfo m_colorBlendState;
- vk::VkPipelineViewportStateCreateInfo m_viewportState;
- vk::VkPipelineDepthStencilStateCreateInfo m_dynamicDepthStencilState;
- vk::VkPipelineTessellationStateCreateInfo m_tessState;
- vk::VkPipelineRasterizationStateCreateInfo m_rasterState;
- vk::VkPipelineMultisampleStateCreateInfo m_multisampleState;
- vk::VkPipelineDynamicStateCreateInfo m_dynamicState;
-
- std::vector<vk::VkDynamicState> m_dynamicStates;
-
- std::vector<vk::VkViewport> m_viewports;
- std::vector<vk::VkRect2D> m_scissors;
-
- std::vector<vk::VkSampleMask> m_multisampleStateSampleMask;
-};
-
-class SamplerCreateInfo : public vk::VkSamplerCreateInfo
-{
-public:
- SamplerCreateInfo (vk::VkFilter magFilter = vk::VK_FILTER_NEAREST,
- vk::VkFilter minFilter = vk::VK_FILTER_NEAREST,
- vk::VkSamplerMipmapMode mipmapMode = vk::VK_SAMPLER_MIPMAP_MODE_NEAREST,
- vk::VkSamplerAddressMode addressU = vk::VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
- vk::VkSamplerAddressMode addressV = vk::VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
- vk::VkSamplerAddressMode addressW = vk::VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
- float mipLodBias = 0.0f,
- vk::VkBool32 anisotropyEnable = VK_FALSE,
- float maxAnisotropy = 1.0f,
- vk::VkBool32 compareEnable = false,
- vk::VkCompareOp compareOp = vk::VK_COMPARE_OP_ALWAYS,
- float minLod = 0.0f,
- float maxLod = 16.0f,
- vk::VkBorderColor borderColor = vk::VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE,
- vk::VkBool32 unnormalizedCoordinates = false);
-};
-
-} // DynamicState
-} // vkt
-
-#endif // _VKTDYNAMICSTATECREATEINFOUTIL_HPP
#include "vkRefUtil.hpp"
#include "vkImageUtil.hpp"
-#include "vktDynamicStateCreateInfoUtil.hpp"
-#include "vktDynamicStateImageObjectUtil.hpp"
-#include "vktDynamicStateBufferObjectUtil.hpp"
+#include "vktDrawCreateInfoUtil.hpp"
+#include "vktDrawImageObjectUtil.hpp"
+#include "vktDrawBufferObjectUtil.hpp"
#include "vkPrograms.hpp"
namespace vkt
namespace DynamicState
{
+using namespace Draw;
+
namespace
{
#include "vktTestCaseUtil.hpp"
#include "vktDynamicStateTestCaseUtil.hpp"
#include "vktDynamicStateBaseClass.hpp"
-#include "vktDynamicStateCreateInfoUtil.hpp"
-#include "vktDynamicStateImageObjectUtil.hpp"
-#include "vktDynamicStateBufferObjectUtil.hpp"
+#include "vktDrawCreateInfoUtil.hpp"
+#include "vktDrawImageObjectUtil.hpp"
+#include "vktDrawBufferObjectUtil.hpp"
#include "vkImageUtil.hpp"
{
namespace DynamicState
{
+
+using namespace Draw;
+
namespace
{
+++ /dev/null
-/*------------------------------------------------------------------------
- * Vulkan Conformance Tests
- * ------------------------
- *
- * Copyright (c) 2015 The Khronos Group Inc.
- * Copyright (c) 2015 Intel Corporation
- *
- * 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.
- *
- *//*!
- * \file
- * \brief Image Object Util
- *//*--------------------------------------------------------------------*/
-
-#include "vktDynamicStateImageObjectUtil.hpp"
-
-#include "tcuSurface.hpp"
-#include "tcuVectorUtil.hpp"
-
-#include "vkRefUtil.hpp"
-#include "vkQueryUtil.hpp"
-#include "vkImageUtil.hpp"
-#include "vktDynamicStateCreateInfoUtil.hpp"
-#include "vktDynamicStateBufferObjectUtil.hpp"
-
-#include "tcuTextureUtil.hpp"
-
-namespace vkt
-{
-namespace DynamicState
-{
-
-void MemoryOp::pack (int pixelSize,
- int width,
- int height,
- int depth,
- vk::VkDeviceSize rowPitchOrZero,
- vk::VkDeviceSize depthPitchOrZero,
- const void * srcBuffer,
- void * destBuffer)
-{
- vk::VkDeviceSize rowPitch = rowPitchOrZero;
- vk::VkDeviceSize depthPitch = depthPitchOrZero;
-
- if (rowPitch == 0)
- rowPitch = width * pixelSize;
-
- if (depthPitch == 0)
- depthPitch = rowPitch * height;
-
- const vk::VkDeviceSize size = depthPitch * depth;
-
- const char *srcRow = reinterpret_cast<const char *>(srcBuffer);
- const char *srcStart;
- srcStart = srcRow;
- char *dstRow = reinterpret_cast<char *>(destBuffer);
- char *dstStart;
- dstStart = dstRow;
-
- if (rowPitch == static_cast<vk::VkDeviceSize>(width * pixelSize) &&
- depthPitch == static_cast<vk::VkDeviceSize>(rowPitch * height))
- {
- // fast path
- deMemcpy(dstRow, srcRow, static_cast<size_t>(size));
- }
- else
- {
- // slower, per row path
- for (int d = 0; d < depth; d++)
- {
- vk::VkDeviceSize offsetDepthDst = d * depthPitch;
- vk::VkDeviceSize offsetDepthSrc = d * (pixelSize * width * height);
- srcRow = srcStart + offsetDepthSrc;
- dstRow = dstStart + offsetDepthDst;
- for (int r = 0; r < height; ++r)
- {
- deMemcpy(dstRow, srcRow, static_cast<size_t>(rowPitch));
- srcRow += pixelSize * width;
- dstRow += rowPitch;
- }
- }
- }
-}
-
-void MemoryOp::unpack (int pixelSize,
- int width,
- int height,
- int depth,
- vk::VkDeviceSize rowPitchOrZero,
- vk::VkDeviceSize depthPitchOrZero,
- const void * srcBuffer,
- void * destBuffer)
-{
- vk::VkDeviceSize rowPitch = rowPitchOrZero;
- vk::VkDeviceSize depthPitch = depthPitchOrZero;
-
- if (rowPitch == 0)
- rowPitch = width * pixelSize;
-
- if (depthPitch == 0)
- depthPitch = rowPitch * height;
-
- const vk::VkDeviceSize size = depthPitch * depth;
-
- const char *srcRow = reinterpret_cast<const char *>(srcBuffer);
- const char *srcStart;
- srcStart = srcRow;
- char *dstRow = reinterpret_cast<char *>(destBuffer);
- char *dstStart;
- dstStart = dstRow;
-
- if (rowPitch == static_cast<vk::VkDeviceSize>(width * pixelSize) &&
- depthPitch == static_cast<vk::VkDeviceSize>(rowPitch * height))
- {
- // fast path
- deMemcpy(dstRow, srcRow, static_cast<size_t>(size));
- }
- else {
- // slower, per row path
- for (size_t d = 0; d < (size_t)depth; d++)
- {
- vk::VkDeviceSize offsetDepthDst = d * (pixelSize * width * height);
- vk::VkDeviceSize offsetDepthSrc = d * depthPitch;
- srcRow = srcStart + offsetDepthSrc;
- dstRow = dstStart + offsetDepthDst;
- for (int r = 0; r < height; ++r)
- {
- deMemcpy(dstRow, srcRow, static_cast<size_t>(pixelSize * width));
- srcRow += rowPitch;
- dstRow += pixelSize * width;
- }
- }
- }
-}
-
-Image::Image (const vk::DeviceInterface& vk,
- vk::VkDevice device,
- vk::VkFormat format,
- const vk::VkExtent3D& extend,
- deUint32 levelCount,
- deUint32 layerCount,
- vk::Move<vk::VkImage> object_)
- : m_allocation (DE_NULL)
- , m_object (object_)
- , m_format (format)
- , m_extent (extend)
- , m_levelCount (levelCount)
- , m_layerCount (layerCount)
- , m_vk(vk)
- , m_device(device)
-{
-}
-
-tcu::ConstPixelBufferAccess Image::readSurface (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- m_pixelAccessData.resize(width * height * vk::mapVkFormat(m_format).getPixelSize());
- deMemset(m_pixelAccessData.data(), 0, m_pixelAccessData.size());
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR_BIT)
- {
- read(queue, allocator, layout, offset, width, height, 1, mipLevel, arrayElement, aspect, vk::VK_IMAGE_TYPE_2D,
- m_pixelAccessData.data());
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT || aspect == vk::VK_IMAGE_ASPECT_STENCIL_BIT)
- {
- readUsingBuffer(queue, allocator, layout, offset, width, height, 1, mipLevel, arrayElement, aspect, m_pixelAccessData.data());
- }
- return tcu::ConstPixelBufferAccess(vk::mapVkFormat(m_format), width, height, 1, m_pixelAccessData.data());
-}
-
-tcu::ConstPixelBufferAccess Image::readVolume (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- m_pixelAccessData.resize(width * height * depth * vk::mapVkFormat(m_format).getPixelSize());
- deMemset(m_pixelAccessData.data(), 0, m_pixelAccessData.size());
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR_BIT)
- {
- read(queue, allocator, layout, offset, width, height, depth, mipLevel, arrayElement, aspect, vk::VK_IMAGE_TYPE_3D,
- m_pixelAccessData.data());
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT || aspect == vk::VK_IMAGE_ASPECT_STENCIL_BIT)
- {
- readUsingBuffer(queue, allocator, layout, offset, width, height, depth, mipLevel, arrayElement, aspect, m_pixelAccessData.data());
- }
- return tcu::ConstPixelBufferAccess(vk::mapVkFormat(m_format), width, height, depth, m_pixelAccessData.data());
-}
-
-tcu::ConstPixelBufferAccess Image::readSurface1D(vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- m_pixelAccessData.resize(width * vk::mapVkFormat(m_format).getPixelSize());
- deMemset(m_pixelAccessData.data(), 0, m_pixelAccessData.size());
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR_BIT)
- {
- read(queue, allocator, layout, offset, width, 1, 1, mipLevel, arrayElement, aspect, vk::VK_IMAGE_TYPE_1D,
- m_pixelAccessData.data());
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT || aspect == vk::VK_IMAGE_ASPECT_STENCIL_BIT)
- {
- readUsingBuffer(queue, allocator, layout, offset, width, 1, 1, mipLevel, arrayElement, aspect,
- m_pixelAccessData.data());
- }
- return tcu::ConstPixelBufferAccess(vk::mapVkFormat(m_format), width, 1, 1, m_pixelAccessData.data());
-}
-
-void Image::read (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- vk::VkImageType type,
- void * data)
-{
- DE_ASSERT(layout == vk::VK_IMAGE_LAYOUT_GENERAL || layout == vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
-
- de::SharedPtr<Image> stagingResource = copyToLinearImage(queue, allocator, layout, offset, width,
- height, depth, mipLevel, arrayElement, aspect, type);
- const vk::VkOffset3D zeroOffset = {0, 0, 0};
- stagingResource->readLinear(zeroOffset, width, height, depth, 0, 0, aspect, data);
-}
-
-void Image::readUsingBuffer (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- void * data)
-{
- DE_ASSERT(layout == vk::VK_IMAGE_LAYOUT_GENERAL || layout == vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);;
-
- de::SharedPtr<Buffer> stagingResource;
-
- bool isCombinedType = isCombinedDepthStencilType(vk::mapVkFormat(m_format).type);
- vk::VkDeviceSize bufferSize = 0;
-
- if (!isCombinedType)
- bufferSize = vk::mapVkFormat(m_format).getPixelSize() * width * height * depth;
-
- if (isCombinedType)
- {
- int pixelSize = 0;
- switch (m_format)
- {
- case vk::VK_FORMAT_D16_UNORM_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 2 : 1;
- break;
- case vk::VK_FORMAT_D32_SFLOAT_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 4 : 1;
- break;
- case vk::VK_FORMAT_X8_D24_UNORM_PACK32:
- case vk::VK_FORMAT_D24_UNORM_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 3 : 1;
- break;
-
- default:
- DE_FATAL("Not implemented");
- }
- bufferSize = pixelSize*width*height*depth;
- }
-
- BufferCreateInfo stagingBufferResourceCreateInfo(bufferSize, vk::VK_BUFFER_USAGE_TRANSFER_DST_BIT | vk::VK_BUFFER_USAGE_TRANSFER_SRC_BIT);
- stagingResource = Buffer::createAndAlloc(m_vk, m_device, stagingBufferResourceCreateInfo, allocator, vk::MemoryRequirement::HostVisible);
-
- {
- //todo [scygan] get proper queueFamilyIndex
- CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
- vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
-
- const vk::VkCommandBufferAllocateInfo cmdBufferAllocateInfo =
- {
- vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- *copyCmdPool, // VkCommandPool commandPool;
- vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCommandBufferLevel level;
- 1u, // deUint32 bufferCount;
- };
- vk::Unique<vk::VkCommandBuffer> copyCmdBuffer(vk::allocateCommandBuffer(m_vk, m_device, &cmdBufferAllocateInfo));
-
- CmdBufferBeginInfo beginInfo;
- VK_CHECK(m_vk.beginCommandBuffer(*copyCmdBuffer, &beginInfo));
-
- if (layout == vk::VK_IMAGE_LAYOUT_UNDEFINED)
- {
- layout = vk::VK_IMAGE_LAYOUT_GENERAL;
-
- vk::VkImageMemoryBarrier barrier;
- barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- barrier.pNext = DE_NULL;
- barrier.srcAccessMask = 0;
- barrier.dstAccessMask = 0;
- barrier.oldLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED;
- barrier.newLayout = vk::VK_IMAGE_LAYOUT_GENERAL;
- barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.image = object();
-
- barrier.subresourceRange.aspectMask = aspect;
- barrier.subresourceRange.baseMipLevel = 0;
- barrier.subresourceRange.levelCount = m_levelCount;
- barrier.subresourceRange.baseArrayLayer = 0;
- barrier.subresourceRange.layerCount = m_layerCount;
-
- m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, (vk::VkDependencyFlags)0,
- 0, (const vk::VkMemoryBarrier*)DE_NULL,
- 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
- 1, &barrier);
- }
-
- vk::VkBufferImageCopy region =
- {
- 0, 0, 0,
- { (vk::VkImageAspectFlags)aspect, mipLevel, arrayElement, 1 },
- offset,
- { (deUint32)width, (deUint32)height, (deUint32)depth }
- };
-
- m_vk.cmdCopyImageToBuffer(*copyCmdBuffer, object(), layout, stagingResource->object(), 1, ®ion);
- VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
-
- vk::VkSubmitInfo submitInfo =
- {
- vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- (const vk::VkPipelineStageFlags*)DE_NULL,
- 1, // deUint32 commandBufferCount;
- ©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
- DE_NULL // const VkSemaphore* pSignalSemaphores;
- };
- m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-
- // TODO: make this less intrusive
- VK_CHECK(m_vk.queueWaitIdle(queue));
- }
-
- char* destPtr = reinterpret_cast<char*>(stagingResource->getBoundMemory().getHostPtr());
- deMemcpy(data, destPtr, static_cast<size_t>(bufferSize));
-}
-
-tcu::ConstPixelBufferAccess Image::readSurfaceLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- m_pixelAccessData.resize(width * height * vk::mapVkFormat(m_format).getPixelSize());
- readLinear(offset, width, height, depth, mipLevel, arrayElement, aspect, m_pixelAccessData.data());
- return tcu::ConstPixelBufferAccess(vk::mapVkFormat(m_format), width, height, 1, m_pixelAccessData.data());
-}
-
-void Image::readLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- void * data)
-{
- vk::VkImageSubresource imageSubResource = { (vk::VkImageAspectFlags)aspect, mipLevel, arrayElement };
-
- vk::VkSubresourceLayout imageLayout;
- deMemset(&imageLayout, 0, sizeof(imageLayout));
-
- m_vk.getImageSubresourceLayout(m_device, object(), &imageSubResource, &imageLayout);
-
- const char* srcPtr = reinterpret_cast<const char*>(getBoundMemory().getHostPtr());
- srcPtr += imageLayout.offset + getPixelOffset(offset, imageLayout.rowPitch, imageLayout.depthPitch, mipLevel, arrayElement);
-
- MemoryOp::unpack(vk::mapVkFormat(m_format).getPixelSize(), width, height, depth,
- imageLayout.rowPitch, imageLayout.depthPitch, srcPtr, data);
-}
-
-de::SharedPtr<Image> Image::copyToLinearImage (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- vk::VkImageType type)
-{
- de::SharedPtr<Image> stagingResource;
- {
- vk::VkExtent3D stagingExtent = {(deUint32)width, (deUint32)height, (deUint32)depth};
- ImageCreateInfo stagingResourceCreateInfo(type, m_format, stagingExtent, 1, 1, vk::VK_SAMPLE_COUNT_1_BIT,
- vk::VK_IMAGE_TILING_LINEAR, vk::VK_IMAGE_USAGE_TRANSFER_DST_BIT);
-
- stagingResource = Image::createAndAlloc(m_vk, m_device, stagingResourceCreateInfo, allocator,
- vk::MemoryRequirement::HostVisible);
-
- //todo [scygan] get proper queueFamilyIndex
- CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
- vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
-
- const vk::VkCommandBufferAllocateInfo cmdBufferAllocateInfo =
- {
- vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- *copyCmdPool, // VkCommandPool commandPool;
- vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCommandBufferLevel level;
- 1u, // deUint32 bufferCount;
- };
- vk::Unique<vk::VkCommandBuffer> copyCmdBuffer(vk::allocateCommandBuffer(m_vk, m_device, &cmdBufferAllocateInfo));
-
- CmdBufferBeginInfo beginInfo;
- VK_CHECK(m_vk.beginCommandBuffer(*copyCmdBuffer, &beginInfo));
-
- transition2DImage(m_vk, *copyCmdBuffer, stagingResource->object(), aspect, vk::VK_IMAGE_LAYOUT_UNDEFINED, vk::VK_IMAGE_LAYOUT_GENERAL);
-
- const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
- vk::VkImageCopy region = { {(vk::VkImageAspectFlags)aspect, mipLevel, arrayElement, 1}, offset, {(vk::VkImageAspectFlags)aspect, 0, 0, 1}, zeroOffset, {(deUint32)width, (deUint32)height, (deUint32)depth} };
-
- m_vk.cmdCopyImage(*copyCmdBuffer, object(), layout, stagingResource->object(), vk::VK_IMAGE_LAYOUT_GENERAL, 1, ®ion);
- VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
-
- vk::VkSubmitInfo submitInfo =
- {
- vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- (const vk::VkPipelineStageFlags*)DE_NULL,
- 1, // deUint32 commandBufferCount;
- ©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
- DE_NULL // const VkSemaphore* pSignalSemaphores;
- };
- m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-
- // TODO: make this less intrusive
- VK_CHECK(m_vk.queueWaitIdle(queue));
- }
- return stagingResource;
-}
-
-void Image::uploadVolume(const tcu::ConstPixelBufferAccess& access,
- vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR_BIT)
- {
- upload(queue, allocator, layout, offset, access.getWidth(),
- access.getHeight(), access.getDepth(), mipLevel, arrayElement, aspect, vk::VK_IMAGE_TYPE_3D,
- access.getDataPtr());
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT || aspect == vk::VK_IMAGE_ASPECT_STENCIL_BIT)
- {
- uploadUsingBuffer(queue, allocator, layout, offset, access.getWidth(),
- access.getHeight(), access.getDepth(), mipLevel, arrayElement, aspect, access.getDataPtr());
- }
-}
-
-void Image::uploadSurface (const tcu::ConstPixelBufferAccess& access,
- vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR_BIT)
- {
- upload(queue, allocator, layout, offset, access.getWidth(),
- access.getHeight(), access.getDepth(), mipLevel, arrayElement, aspect, vk::VK_IMAGE_TYPE_2D,
- access.getDataPtr());
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT || aspect == vk::VK_IMAGE_ASPECT_STENCIL_BIT)
- {
- uploadUsingBuffer(queue, allocator, layout, offset, access.getWidth(),
- access.getHeight(), access.getDepth(), mipLevel, arrayElement, aspect, access.getDataPtr());
- }
-}
-
-void Image::uploadSurface1D (const tcu::ConstPixelBufferAccess& access,
- vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR_BIT)
- {
- upload(queue, allocator, layout, offset, access.getWidth(),
- access.getHeight(), access.getDepth(), mipLevel, arrayElement, aspect, vk::VK_IMAGE_TYPE_1D,
- access.getDataPtr());
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT || aspect == vk::VK_IMAGE_ASPECT_STENCIL_BIT)
- {
- uploadUsingBuffer(queue, allocator, layout, offset, access.getWidth(),
- access.getHeight(), access.getDepth(), mipLevel, arrayElement, aspect, access.getDataPtr());
- }
-}
-
-void Image::uploadSurfaceLinear (const tcu::ConstPixelBufferAccess& access,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- uploadLinear(offset, width, height, depth, mipLevel, arrayElement, aspect, access.getDataPtr());
-}
-
-void Image::upload (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- vk::VkImageType type,
- const void * data)
-{
- DE_ASSERT(layout == vk::VK_IMAGE_LAYOUT_GENERAL || layout == vk::VK_IMAGE_LAYOUT_UNDEFINED || layout == vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
-
- de::SharedPtr<Image> stagingResource;
- vk::VkExtent3D extent = {(deUint32)width, (deUint32)height, (deUint32)depth};
- ImageCreateInfo stagingResourceCreateInfo(
- type, m_format, extent, 1, 1, vk::VK_SAMPLE_COUNT_1_BIT,
- vk::VK_IMAGE_TILING_LINEAR, vk::VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
-
- stagingResource = Image::createAndAlloc(m_vk, m_device, stagingResourceCreateInfo, allocator,
- vk::MemoryRequirement::HostVisible);
-
- const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
- stagingResource->uploadLinear(zeroOffset, width, height, depth, 0, 0, aspect, data);
-
- {
- //todo [scygan] get proper queueFamilyIndex
- CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
- vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
-
- const vk::VkCommandBufferAllocateInfo cmdBufferAllocateInfo =
- {
- vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- *copyCmdPool, // VkCommandPool commandPool;
- vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCommandBufferLevel level;
- 1u, // deUint32 bufferCount;
- };
-
- vk::Unique<vk::VkCommandBuffer> copyCmdBuffer(vk::allocateCommandBuffer(m_vk, m_device, &cmdBufferAllocateInfo));
-
- CmdBufferBeginInfo beginInfo;
- VK_CHECK(m_vk.beginCommandBuffer(*copyCmdBuffer, &beginInfo));
-
- if (layout == vk::VK_IMAGE_LAYOUT_UNDEFINED)
- {
- layout = vk::VK_IMAGE_LAYOUT_GENERAL;
-
- vk::VkImageMemoryBarrier barrier;
- barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- barrier.pNext = DE_NULL;
- barrier.srcAccessMask = 0;
- barrier.dstAccessMask = 0;
- barrier.oldLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED;
- barrier.newLayout = vk::VK_IMAGE_LAYOUT_GENERAL;
- barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.image = object();
-
- barrier.subresourceRange.aspectMask = aspect;
- barrier.subresourceRange.baseMipLevel = 0;
- barrier.subresourceRange.levelCount = m_levelCount;
- barrier.subresourceRange.baseArrayLayer = 0;
- barrier.subresourceRange.layerCount = m_layerCount;
-
- m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, (vk::VkDependencyFlags)0,
- 0, (const vk::VkMemoryBarrier*)DE_NULL,
- 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
- 1, &barrier);
- }
-
- transition2DImage(m_vk, *copyCmdBuffer, stagingResource->object(), aspect, vk::VK_IMAGE_LAYOUT_UNDEFINED, vk::VK_IMAGE_LAYOUT_GENERAL);
-
- vk::VkImageCopy region = {{(vk::VkImageAspectFlags)aspect, 0, 0, 1},
- zeroOffset,
- {(vk::VkImageAspectFlags)aspect, mipLevel, arrayElement, 1},
- offset,
- {(deUint32)width, (deUint32)height, (deUint32)depth}};
-
- m_vk.cmdCopyImage(*copyCmdBuffer, stagingResource->object(),
- vk::VK_IMAGE_LAYOUT_GENERAL, object(), layout, 1, ®ion);
- VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
-
- vk::VkSubmitInfo submitInfo =
- {
- vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- (const vk::VkPipelineStageFlags*)DE_NULL,
- 1, // deUint32 commandBufferCount;
- ©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
- DE_NULL // const VkSemaphore* pSignalSemaphores;
- };
- m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-
- // TODO: make this less intrusive
- VK_CHECK(m_vk.queueWaitIdle(queue));
- }
-}
-
-void Image::uploadUsingBuffer (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- const void * data)
-{
- DE_ASSERT(layout == vk::VK_IMAGE_LAYOUT_GENERAL || layout == vk::VK_IMAGE_LAYOUT_UNDEFINED || layout == vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
-
- de::SharedPtr<Buffer> stagingResource;
- bool isCombinedType = isCombinedDepthStencilType(vk::mapVkFormat(m_format).type);
- vk::VkDeviceSize bufferSize = 0;
- if (!isCombinedType)
- bufferSize = vk::mapVkFormat(m_format).getPixelSize() *width*height*depth;
- if (isCombinedType)
- {
- int pixelSize = 0;
- switch (m_format)
- {
- case vk::VK_FORMAT_D16_UNORM_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 2 : 1;
- break;
- case vk::VK_FORMAT_D32_SFLOAT_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 4 : 1;
- break;
- case vk::VK_FORMAT_X8_D24_UNORM_PACK32:
- case vk::VK_FORMAT_D24_UNORM_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 3 : 1;
- break;
-
- default:
- DE_FATAL("Not implemented");
- }
- bufferSize = pixelSize*width*height*depth;
- }
- BufferCreateInfo stagingBufferResourceCreateInfo(bufferSize, vk::VK_BUFFER_USAGE_TRANSFER_DST_BIT | vk::VK_BUFFER_USAGE_TRANSFER_SRC_BIT);
- stagingResource = Buffer::createAndAlloc(m_vk, m_device, stagingBufferResourceCreateInfo, allocator, vk::MemoryRequirement::HostVisible);
- char* destPtr = reinterpret_cast<char*>(stagingResource->getBoundMemory().getHostPtr());
- deMemcpy(destPtr, data, static_cast<size_t>(bufferSize));
- vk::flushMappedMemoryRange(m_vk, m_device, stagingResource->getBoundMemory().getMemory(), stagingResource->getBoundMemory().getOffset(), bufferSize);
- {
- //todo [scygan] get proper queueFamilyIndex
- CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
- vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
-
- const vk::VkCommandBufferAllocateInfo cmdBufferAllocateInfo =
- {
- vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- *copyCmdPool, // VkCommandPool commandPool;
- vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCommandBufferLevel level;
- 1u, // deUint32 bufferCount;
- };
- vk::Unique<vk::VkCommandBuffer> copyCmdBuffer(vk::allocateCommandBuffer(m_vk, m_device, &cmdBufferAllocateInfo));
-
- CmdBufferBeginInfo beginInfo;
- VK_CHECK(m_vk.beginCommandBuffer(*copyCmdBuffer, &beginInfo));
-
- if (layout == vk::VK_IMAGE_LAYOUT_UNDEFINED)
- {
- layout = vk::VK_IMAGE_LAYOUT_GENERAL;
-
- vk::VkImageMemoryBarrier barrier;
- barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- barrier.pNext = DE_NULL;
- barrier.srcAccessMask = 0;
- barrier.dstAccessMask = 0;
- barrier.oldLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED;
- barrier.newLayout = vk::VK_IMAGE_LAYOUT_GENERAL;
- barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.image = object();
-
- barrier.subresourceRange.aspectMask = aspect;
- barrier.subresourceRange.baseMipLevel = 0;
- barrier.subresourceRange.levelCount = m_levelCount;
- barrier.subresourceRange.baseArrayLayer = 0;
- barrier.subresourceRange.layerCount = m_layerCount;
-
- m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, (vk::VkDependencyFlags)0,
- 0, (const vk::VkMemoryBarrier*)DE_NULL,
- 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
- 1, &barrier);
- }
-
- vk::VkBufferImageCopy region = {
- 0, 0, 0,
- { (vk::VkImageAspectFlags)aspect, mipLevel, arrayElement, 1 },
- offset,
- { (deUint32)width, (deUint32)height, (deUint32)depth }
- };
-
- m_vk.cmdCopyBufferToImage(*copyCmdBuffer, stagingResource->object(),
- object(), layout, 1, ®ion);
- VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
-
- vk::VkSubmitInfo submitInfo =
- {
- vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- (const vk::VkPipelineStageFlags*)DE_NULL,
- 1, // deUint32 commandBufferCount;
- ©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
- DE_NULL // const VkSemaphore* pSignalSemaphores;
- };
- m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-
- // TODO: make this less intrusive
- VK_CHECK(m_vk.queueWaitIdle(queue));
- }
-}
-
-void Image::uploadLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- const void * data)
-{
- vk::VkSubresourceLayout imageLayout;
-
- vk::VkImageSubresource imageSubResource = {(vk::VkImageAspectFlags)aspect, mipLevel, arrayElement};
-
- m_vk.getImageSubresourceLayout(m_device, object(), &imageSubResource,
- &imageLayout);
-
- char* destPtr = reinterpret_cast<char*>(getBoundMemory().getHostPtr());
-
- destPtr += imageLayout.offset + getPixelOffset(offset, imageLayout.rowPitch, imageLayout.depthPitch, mipLevel, arrayElement);
-
- MemoryOp::pack(vk::mapVkFormat(m_format).getPixelSize(), width, height, depth,
- imageLayout.rowPitch, imageLayout.depthPitch, data, destPtr);
-}
-
-vk::VkDeviceSize Image::getPixelOffset (vk::VkOffset3D offset,
- vk::VkDeviceSize rowPitch,
- vk::VkDeviceSize depthPitch,
- unsigned int level,
- unsigned int layer)
-{
- DE_ASSERT(level < m_levelCount);
- DE_ASSERT(layer < m_layerCount);
-
- vk::VkDeviceSize mipLevelSizes[32];
- vk::VkDeviceSize mipLevelRectSizes[32];
- tcu::IVec3 mipExtend
- = tcu::IVec3(m_extent.width, m_extent.height, m_extent.depth);
-
- vk::VkDeviceSize arrayElemSize = 0;
- for (unsigned int i = 0; i < m_levelCount && (mipExtend[0] > 1 || mipExtend[1] > 1 || mipExtend[2] > 1); ++i)
- {
- // Rect size is just a 3D image size;
- mipLevelSizes[i] = mipExtend[2] * depthPitch;
-
- arrayElemSize += mipLevelSizes[0];
-
- mipExtend = tcu::max(mipExtend / 2, tcu::IVec3(1));
- }
-
- vk::VkDeviceSize pixelOffset = layer * arrayElemSize;
- for (size_t i = 0; i < level; ++i) {
- pixelOffset += mipLevelSizes[i];
- }
- pixelOffset += offset.z * mipLevelRectSizes[level];
- pixelOffset += offset.y * rowPitch;
- pixelOffset += offset.x;
-
- return pixelOffset;
-}
-
-void Image::bindMemory (de::MovePtr<vk::Allocation> allocation)
-{
- DE_ASSERT(allocation);
- VK_CHECK(m_vk.bindImageMemory(m_device, *m_object, allocation->getMemory(), allocation->getOffset()));
-
- DE_ASSERT(!m_allocation);
- m_allocation = allocation;
-}
-
-de::SharedPtr<Image> Image::createAndAlloc(const vk::DeviceInterface& vk,
- vk::VkDevice device,
- const vk::VkImageCreateInfo& createInfo,
- vk::Allocator& allocator,
- vk::MemoryRequirement memoryRequirement)
-{
- de::SharedPtr<Image> ret = create(vk, device, createInfo);
-
- vk::VkMemoryRequirements imageRequirements = vk::getImageMemoryRequirements(vk, device, ret->object());
- ret->bindMemory(allocator.allocate(imageRequirements, memoryRequirement));
- return ret;
-}
-
-de::SharedPtr<Image> Image::create(const vk::DeviceInterface& vk,
- vk::VkDevice device,
- const vk::VkImageCreateInfo &createInfo)
-{
- return de::SharedPtr<Image>(new Image(vk, device, createInfo.format, createInfo.extent,
- createInfo.mipLevels, createInfo.arrayLayers,
- vk::createImage(vk, device, &createInfo)));
-}
-
-void transition2DImage (const vk::DeviceInterface& vk,
- vk::VkCommandBuffer cmdBuffer,
- vk::VkImage image,
- vk::VkImageAspectFlags aspectMask,
- vk::VkImageLayout oldLayout,
- vk::VkImageLayout newLayout,
- vk::VkAccessFlags srcAccessMask,
- vk::VkAccessFlags dstAccessMask)
-{
- vk::VkImageMemoryBarrier barrier;
- barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- barrier.pNext = DE_NULL;
- barrier.srcAccessMask = srcAccessMask;
- barrier.dstAccessMask = dstAccessMask;
- barrier.oldLayout = oldLayout;
- barrier.newLayout = newLayout;
- barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.image = image;
- barrier.subresourceRange.aspectMask = aspectMask;
- barrier.subresourceRange.baseMipLevel = 0;
- barrier.subresourceRange.levelCount = 1;
- barrier.subresourceRange.baseArrayLayer = 0;
- barrier.subresourceRange.layerCount = 1;
-
- vk.cmdPipelineBarrier(cmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, (vk::VkDependencyFlags)0,
- 0, (const vk::VkMemoryBarrier*)DE_NULL,
- 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
- 1, &barrier);
-}
-
-void initialTransitionColor2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout)
-{
- transition2DImage(vk, cmdBuffer, image, vk::VK_IMAGE_ASPECT_COLOR_BIT, vk::VK_IMAGE_LAYOUT_UNDEFINED, layout);
-}
-
-void initialTransitionDepth2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout)
-{
- transition2DImage(vk, cmdBuffer, image, vk::VK_IMAGE_ASPECT_DEPTH_BIT, vk::VK_IMAGE_LAYOUT_UNDEFINED, layout);
-}
-
-void initialTransitionStencil2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout)
-{
- transition2DImage(vk, cmdBuffer, image, vk::VK_IMAGE_ASPECT_STENCIL_BIT, vk::VK_IMAGE_LAYOUT_UNDEFINED, layout);
-}
-
-void initialTransitionDepthStencil2DImage (const vk::DeviceInterface& vk,
- vk::VkCommandBuffer cmdBuffer,
- vk::VkImage image,
- vk::VkImageLayout layout,
- vk::VkAccessFlags srcAccessMask,
- vk::VkAccessFlags dstAccessMask)
-{
- transition2DImage(vk, cmdBuffer, image, vk::VK_IMAGE_ASPECT_DEPTH_BIT | vk::VK_IMAGE_ASPECT_STENCIL_BIT, vk::VK_IMAGE_LAYOUT_UNDEFINED, layout, srcAccessMask, dstAccessMask);
-}
-
-} // DynamicState
-} // vkt
+++ /dev/null
-#ifndef _VKTDYNAMICSTATEIMAGEOBJECTUTIL_HPP
-#define _VKTDYNAMICSTATEIMAGEOBJECTUTIL_HPP
-/*------------------------------------------------------------------------
- * Vulkan Conformance Tests
- * ------------------------
- *
- * Copyright (c) 2015 The Khronos Group Inc.
- * Copyright (c) 2015 Intel Corporation
- *
- * 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.
- *
- *//*!
- * \file
- * \brief Image Object Util
- *//*--------------------------------------------------------------------*/
-
-#include "vkDefs.hpp"
-#include "vkMemUtil.hpp"
-#include "vkRefUtil.hpp"
-
-#include "deSharedPtr.hpp"
-
-#include "tcuTexture.hpp"
-
-namespace vkt
-{
-namespace DynamicState
-{
-
-class MemoryOp
-{
-public:
- static void pack (int pixelSize,
- int width,
- int height,
- int depth,
- vk::VkDeviceSize rowPitchOrZero,
- vk::VkDeviceSize depthPitchOrZero,
- const void * srcBuffer,
- void * destBuffer);
-
- static void unpack (int pixelSize,
- int width,
- int height,
- int depth,
- vk::VkDeviceSize rowPitchOrZero,
- vk::VkDeviceSize depthPitchOrZero,
- const void * srcBuffer,
- void * destBuffer);
-};
-
-class Image
-{
-public:
- static de::SharedPtr<Image> create (const vk::DeviceInterface& vk, vk::VkDevice device, const vk::VkImageCreateInfo& createInfo);
-
- static de::SharedPtr<Image> createAndAlloc (const vk::DeviceInterface& vk,
- vk::VkDevice device,
- const vk::VkImageCreateInfo& createInfo,
- vk::Allocator& allocator,
- vk::MemoryRequirement memoryRequirement = vk::MemoryRequirement::Any);
-
- tcu::ConstPixelBufferAccess readSurface (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- tcu::ConstPixelBufferAccess readSurface1D (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- tcu::ConstPixelBufferAccess readVolume (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- tcu::ConstPixelBufferAccess readSurfaceLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- void read (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- vk::VkImageType type,
- void * data);
-
- void readUsingBuffer (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- void * data);
-
- void readLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- void * data);
-
- void uploadVolume (const tcu::ConstPixelBufferAccess& access,
- vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- void uploadSurface (const tcu::ConstPixelBufferAccess& access,
- vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- void uploadSurface1D (const tcu::ConstPixelBufferAccess& access,
- vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- void uploadSurfaceLinear (const tcu::ConstPixelBufferAccess& access,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- void upload (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- vk::VkImageType type,
- const void * data);
-
- void uploadUsingBuffer (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- const void * data);
-
- void uploadLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- const void * data);
-
- de::SharedPtr<Image> copyToLinearImage (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- vk::VkImageType type);
-
- const vk::VkFormat& getFormat (void) const { return m_format; }
- vk::VkImage object (void) const { return *m_object; }
- void bindMemory (de::MovePtr<vk::Allocation> allocation);
- vk::Allocation getBoundMemory (void) const { return *m_allocation; }
-
-private:
- vk::VkDeviceSize getPixelOffset (vk::VkOffset3D offset,
- vk::VkDeviceSize rowPitch,
- vk::VkDeviceSize depthPitch,
- unsigned int mipLevel,
- unsigned int arrayElement);
-
- Image (const vk::DeviceInterface& vk,
- vk::VkDevice device,
- vk::VkFormat format,
- const vk::VkExtent3D& extend,
- deUint32 levelCount,
- deUint32 layerCount,
- vk::Move<vk::VkImage> object);
-
- Image (const Image& other); // Not allowed!
- Image& operator= (const Image& other); // Not allowed!
-
- de::MovePtr<vk::Allocation> m_allocation;
- vk::Unique<vk::VkImage> m_object;
-
- vk::VkFormat m_format;
- vk::VkExtent3D m_extent;
- deUint32 m_levelCount;
- deUint32 m_layerCount;
-
- std::vector<deUint8> m_pixelAccessData;
-
- const vk::DeviceInterface& m_vk;
- vk::VkDevice m_device;
-};
-
-void transition2DImage (const vk::DeviceInterface& vk,
- vk::VkCommandBuffer cmdBuffer,
- vk::VkImage image,
- vk::VkImageAspectFlags aspectMask,
- vk::VkImageLayout oldLayout,
- vk::VkImageLayout newLayout,
- vk::VkAccessFlags srcAccessMask = 0,
- vk::VkAccessFlags dstAccessMask = 0);
-
-void initialTransitionColor2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-
-void initialTransitionDepth2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-
-void initialTransitionStencil2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-
-void initialTransitionDepthStencil2DImage (const vk::DeviceInterface& vk,
- vk::VkCommandBuffer cmdBuffer,
- vk::VkImage image,
- vk::VkImageLayout layout,
- vk::VkAccessFlags srcAccessMask = 0,
- vk::VkAccessFlags dstAccessMask = 0);
-
-} // DynamicState
-} // vkt
-
-#endif // _VKTDYNAMICSTATEIMAGEOBJECTUTIL_HPP
{
namespace DynamicState
{
+
+using namespace Draw;
+
namespace
{
{
namespace DynamicState
{
+
+using namespace Draw;
+
namespace
{
-include_directories(..)
+include_directories(
+ ..
+ ../draw
+ )
set(DEQP_VK_QUERY_POOL_SRCS
vktQueryPoolTests.hpp
vktQueryPoolTests.cpp
vktQueryPoolOcclusionTests.hpp
vktQueryPoolOcclusionTests.cpp
- vktQueryPoolCreateInfoUtil.hpp
- vktQueryPoolCreateInfoUtil.cpp
- vktQueryPoolBufferObjectUtil.hpp
- vktQueryPoolBufferObjectUtil.cpp
- vktQueryPoolImageObjectUtil.hpp
- vktQueryPoolImageObjectUtil.cpp
)
set(DEQP_VK_QUERY_POOL_LIBS
deqp-vk-common
+ deqp-vk-draw
tcutil
vkutil
)
+++ /dev/null
-/*------------------------------------------------------------------------
- * Vulkan Conformance Tests
- * ------------------------
- *
- * Copyright (c) 2015 The Khronos Group Inc.
- * Copyright (c) 2015 Intel Corporation
- *
- * 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.
- *
- *//*!
- * \file
- * \brief Buffer Object Util
- *//*--------------------------------------------------------------------*/
-
-#include "vktQueryPoolBufferObjectUtil.hpp"
-
-#include "vkQueryUtil.hpp"
-
-namespace vkt
-{
-namespace QueryPool
-{
-
-Buffer::Buffer (const vk::DeviceInterface& vk, vk::VkDevice device, vk::Move<vk::VkBuffer> object_)
- : m_allocation (DE_NULL)
- , m_object (object_)
- , m_vk (vk)
- , m_device (device)
-{
-}
-
-void Buffer::bindMemory (de::MovePtr<vk::Allocation> allocation)
-{
- DE_ASSERT(allocation);
- VK_CHECK(m_vk.bindBufferMemory(m_device, *m_object, allocation->getMemory(), allocation->getOffset()));
-
- DE_ASSERT(!m_allocation);
- m_allocation = allocation;
-}
-
-de::SharedPtr<Buffer> Buffer::createAndAlloc (const vk::DeviceInterface& vk,
- vk::VkDevice device,
- const vk::VkBufferCreateInfo &createInfo,
- vk::Allocator &allocator,
- vk::MemoryRequirement memoryRequirement)
-{
- de::SharedPtr<Buffer> ret = create(vk, device, createInfo);
-
- vk::VkMemoryRequirements bufferRequirements = vk::getBufferMemoryRequirements(vk, device, ret->object());
- ret->bindMemory(allocator.allocate(bufferRequirements, memoryRequirement));
- return ret;
-}
-
-de::SharedPtr<Buffer> Buffer::create (const vk::DeviceInterface& vk,
- vk::VkDevice device,
- const vk::VkBufferCreateInfo& createInfo)
-{
- return de::SharedPtr<Buffer>(new Buffer(vk, device, vk::createBuffer(vk, device, &createInfo)));
-}
-
-} // QueryPool
-} // vkt
+++ /dev/null
-#ifndef _VKTQUERYPOOLBUFFEROBJECTUTIL_HPP
-#define _VKTQUERYPOOLBUFFEROBJECTUTIL_HPP
-/*------------------------------------------------------------------------
- * Vulkan Conformance Tests
- * ------------------------
- *
- * Copyright (c) 2015 The Khronos Group Inc.
- * Copyright (c) 2015 Intel Corporation
- *
- * 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.
- *
- *//*!
- * \file
- * \brief Buffer Object Util
- *//*--------------------------------------------------------------------*/
-
-#include "vkMemUtil.hpp"
-#include "vkRefUtil.hpp"
-
-#include "deSharedPtr.hpp"
-
-namespace vkt
-{
-namespace QueryPool
-{
-
-class Buffer
-{
-public:
-
- static de::SharedPtr<Buffer> create (const vk::DeviceInterface& vk, vk::VkDevice device, const vk::VkBufferCreateInfo &createInfo);
-
- static de::SharedPtr<Buffer> createAndAlloc (const vk::DeviceInterface& vk,
- vk::VkDevice device,
- const vk::VkBufferCreateInfo& createInfo,
- vk::Allocator& allocator,
- vk::MemoryRequirement allocationMemoryProperties = vk::MemoryRequirement::Any);
-
- Buffer (const vk::DeviceInterface &vk, vk::VkDevice device, vk::Move<vk::VkBuffer> object);
-
- void bindMemory (de::MovePtr<vk::Allocation> allocation);
-
- vk::VkBuffer object (void) const { return *m_object; }
- vk::Allocation getBoundMemory (void) const { return *m_allocation; }
-
-private:
-
- Buffer (const Buffer& other); // Not allowed!
- Buffer& operator= (const Buffer& other); // Not allowed!
-
- de::MovePtr<vk::Allocation> m_allocation;
- vk::Unique<vk::VkBuffer> m_object;
-
- const vk::DeviceInterface& m_vk;
- vk::VkDevice m_device;
-};
-
-} //DynamicState
-} //vkt
-
-#endif // _VKTQUERYPOOLBUFFEROBJECTUTIL_HPP
+++ /dev/null
-/*------------------------------------------------------------------------
- * Vulkan Conformance Tests
- * ------------------------
- *
- * Copyright (c) 2015 The Khronos Group Inc.
- * Copyright (c) 2015 Intel Corporation
- *
- * 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.
- *
- *//*!
- * \file
- * \brief CreateInfo utilities
- *//*--------------------------------------------------------------------*/
-
-#include "vktQueryPoolCreateInfoUtil.hpp"
-
-#include "vkImageUtil.hpp"
-
-namespace vkt
-{
-namespace QueryPool
-{
-
-ImageSubresourceRange::ImageSubresourceRange (vk::VkImageAspectFlags _aspectMask,
- deUint32 _baseMipLevel,
- deUint32 _levelCount,
- deUint32 _baseArrayLayer,
- deUint32 _layerCount)
-{
- aspectMask = _aspectMask;
- baseMipLevel = _baseMipLevel;
- levelCount = _levelCount;
- baseArrayLayer = _baseArrayLayer;
- layerCount = _layerCount;
-}
-
-ComponentMapping::ComponentMapping (vk::VkComponentSwizzle _r,
- vk::VkComponentSwizzle _g,
- vk::VkComponentSwizzle _b,
- vk::VkComponentSwizzle _a)
-{
- r = _r;
- g = _g;
- b = _b;
- a = _a;
-}
-
-ImageViewCreateInfo::ImageViewCreateInfo (vk::VkImage _image,
- vk::VkImageViewType _viewType,
- vk::VkFormat _format,
- const vk::VkImageSubresourceRange& _subresourceRange,
- const vk::VkComponentMapping& _components,
- vk::VkImageViewCreateFlags _flags)
-{
- sType = vk::VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- image = _image;
- viewType = _viewType;
- format = _format;
- components.r = _components.r;
- components.g = _components.g;
- components.b = _components.b;
- components.a = _components.a;
- subresourceRange = _subresourceRange;
- flags = _flags;
-}
-
-ImageViewCreateInfo::ImageViewCreateInfo (vk::VkImage _image,
- vk::VkImageViewType _viewType,
- vk::VkFormat _format,
- const vk::VkComponentMapping& _components,
- vk::VkImageViewCreateFlags _flags)
-{
- sType = vk::VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- image = _image;
- viewType = _viewType;
- format = _format;
- components.r = _components.r;
- components.g = _components.g;
- components.b = _components.b;
- components.a = _components.a;
-
- vk::VkImageAspectFlags aspectFlags;
- const tcu::TextureFormat tcuFormat = vk::mapVkFormat(_format);
-
- switch (tcuFormat.order)
- {
- case tcu::TextureFormat::D:
- aspectFlags = vk::VK_IMAGE_ASPECT_DEPTH_BIT;
- break;
- case tcu::TextureFormat::S:
- aspectFlags = vk::VK_IMAGE_ASPECT_STENCIL_BIT;
- break;
- case tcu::TextureFormat::DS:
- aspectFlags = vk::VK_IMAGE_ASPECT_STENCIL_BIT | vk::VK_IMAGE_ASPECT_DEPTH_BIT;
- break;
- default:
- aspectFlags = vk::VK_IMAGE_ASPECT_COLOR_BIT;
- break;
- }
-
- subresourceRange = ImageSubresourceRange(aspectFlags);;
- flags = _flags;
-}
-
-BufferViewCreateInfo::BufferViewCreateInfo (vk::VkBuffer _buffer,
- vk::VkFormat _format,
- vk::VkDeviceSize _offset,
- vk::VkDeviceSize _range)
-{
- sType = vk::VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO;
- pNext = DE_NULL;
-
- flags = 0u;
- buffer = _buffer;
- format = _format;
- offset = _offset;
- range = _range;
-}
-
-BufferCreateInfo::BufferCreateInfo (vk::VkDeviceSize _size,
- vk::VkBufferUsageFlags _usage,
- vk::VkSharingMode _sharingMode,
- deUint32 _queueFamilyIndexCount,
- const deUint32* _pQueueFamilyIndices,
- vk::VkBufferCreateFlags _flags)
-{
- sType = vk::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
- pNext = DE_NULL;
- size = _size;
- usage = _usage;
- flags = _flags;
- sharingMode = _sharingMode;
- queueFamilyIndexCount = _queueFamilyIndexCount;
-
- if (_queueFamilyIndexCount)
- {
- m_queueFamilyIndices = std::vector<deUint32>(
- _pQueueFamilyIndices, _pQueueFamilyIndices + _queueFamilyIndexCount);
- pQueueFamilyIndices = &m_queueFamilyIndices[0];
- }
- else
- {
- pQueueFamilyIndices = _pQueueFamilyIndices;
- }
-}
-
-BufferCreateInfo::BufferCreateInfo (const BufferCreateInfo &other)
-{
- sType = other.sType;
- pNext = other.pNext;
- size = other.size;
- usage = other.usage;
- flags = other.flags;
- sharingMode = other.sharingMode;
- queueFamilyIndexCount = other.queueFamilyIndexCount;
-
- m_queueFamilyIndices = other.m_queueFamilyIndices;
- DE_ASSERT(m_queueFamilyIndices.size() == queueFamilyIndexCount);
-
- if (m_queueFamilyIndices.size())
- {
- pQueueFamilyIndices = &m_queueFamilyIndices[0];
- }
- else
- {
- pQueueFamilyIndices = DE_NULL;
- }
-}
-
-BufferCreateInfo & BufferCreateInfo::operator= (const BufferCreateInfo &other)
-{
- sType = other.sType;
- pNext = other.pNext;
- size = other.size;
- usage = other.usage;
- flags = other.flags;
- sharingMode = other.sharingMode;
- queueFamilyIndexCount = other.queueFamilyIndexCount;
-
- m_queueFamilyIndices = other.m_queueFamilyIndices;
-
- DE_ASSERT(m_queueFamilyIndices.size() == queueFamilyIndexCount);
-
- if (m_queueFamilyIndices.size())
- {
- pQueueFamilyIndices = &m_queueFamilyIndices[0];
- }
- else
- {
- pQueueFamilyIndices = DE_NULL;
- }
-
- return *this;
-}
-
-ImageCreateInfo::ImageCreateInfo (vk::VkImageType _imageType,
- vk::VkFormat _format,
- vk::VkExtent3D _extent,
- deUint32 _mipLevels,
- deUint32 _arrayLayers,
- vk::VkSampleCountFlagBits _samples,
- vk::VkImageTiling _tiling,
- vk::VkImageUsageFlags _usage,
- vk::VkSharingMode _sharingMode,
- deUint32 _queueFamilyIndexCount,
- const deUint32* _pQueueFamilyIndices,
- vk::VkImageCreateFlags _flags,
- vk::VkImageLayout _initialLayout)
-{
- if (_queueFamilyIndexCount)
- {
- m_queueFamilyIndices = std::vector<deUint32>(_pQueueFamilyIndices, _pQueueFamilyIndices + _queueFamilyIndexCount);
- }
-
- sType = vk::VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
- pNext = DE_NULL;
- flags = _flags;
- imageType = _imageType;
- format = _format;
- extent = _extent;
- mipLevels = _mipLevels;
- arrayLayers = _arrayLayers;
- samples = _samples;
- tiling = _tiling;
- usage = _usage;
- sharingMode = _sharingMode;
- queueFamilyIndexCount = _queueFamilyIndexCount;
-
- if (m_queueFamilyIndices.size())
- {
- pQueueFamilyIndices = &m_queueFamilyIndices[0];
- }
- else
- {
- pQueueFamilyIndices = DE_NULL;
- }
- initialLayout = _initialLayout;
-}
-
-FramebufferCreateInfo::FramebufferCreateInfo (vk::VkRenderPass _renderPass,
- const std::vector<vk::VkImageView>& atachments,
- deUint32 _width,
- deUint32 _height,
- deUint32 _layers)
-{
- sType = vk::VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
-
- renderPass = _renderPass;
- attachmentCount = static_cast<deUint32>(atachments.size());
-
- if (attachmentCount)
- {
- pAttachments = const_cast<vk::VkImageView *>(&atachments[0]);
- }
-
- width = _width;
- height = _height;
- layers = _layers;
-}
-
-RenderPassCreateInfo::RenderPassCreateInfo (const std::vector<vk::VkAttachmentDescription>& attachments,
- const std::vector<vk::VkSubpassDescription>& subpasses,
- const std::vector<vk::VkSubpassDependency>& dependiences)
-
- : m_attachments (attachments.begin(), attachments.end())
- , m_subpasses (subpasses.begin(), subpasses.end())
- , m_dependiences (dependiences.begin(), dependiences.end())
- , m_attachmentsStructs (m_attachments.begin(), m_attachments.end())
- , m_subpassesStructs (m_subpasses.begin(), m_subpasses.end())
- , m_dependiencesStructs (m_dependiences.begin(), m_dependiences.end())
-{
- sType = vk::VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0;
-
- attachmentCount = static_cast<deUint32>(m_attachments.size());
- pAttachments = &m_attachmentsStructs[0];
- subpassCount = static_cast<deUint32>(m_subpasses.size());
- pSubpasses = &m_subpassesStructs[0];
- dependencyCount = static_cast<deUint32>(m_dependiences.size());
- pDependencies = &m_dependiencesStructs[0];
-}
-
-RenderPassCreateInfo::RenderPassCreateInfo (deUint32 _attachmentCount,
- const vk::VkAttachmentDescription* _pAttachments,
- deUint32 _subpassCount,
- const vk::VkSubpassDescription* _pSubpasses,
- deUint32 _dependencyCount,
- const vk::VkSubpassDependency* _pDependiences)
-{
-
- m_attachments = std::vector<AttachmentDescription>(_pAttachments, _pAttachments + _attachmentCount);
- m_subpasses = std::vector<SubpassDescription>(_pSubpasses, _pSubpasses + _subpassCount);
- m_dependiences = std::vector<SubpassDependency>(_pDependiences, _pDependiences + _dependencyCount);
-
- m_attachmentsStructs = std::vector<vk::VkAttachmentDescription> (m_attachments.begin(), m_attachments.end());
- m_subpassesStructs = std::vector<vk::VkSubpassDescription> (m_subpasses.begin(), m_subpasses.end());
- m_dependiencesStructs = std::vector<vk::VkSubpassDependency> (m_dependiences.begin(), m_dependiences.end());
-
- sType = vk::VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0;
-
- attachmentCount = static_cast<deUint32>(m_attachments.size());
-
- if (attachmentCount)
- {
- pAttachments = &m_attachmentsStructs[0];
- }
- else
- {
- pAttachments = DE_NULL;
- }
-
- subpassCount = static_cast<deUint32>(m_subpasses.size());
-
- if (subpassCount)
- {
- pSubpasses = &m_subpassesStructs[0];
- }
- else
- {
- pSubpasses = DE_NULL;
- }
-
- dependencyCount = static_cast<deUint32>(m_dependiences.size());
-
- if (dependencyCount)
- {
- pDependencies = &m_dependiencesStructs[0];
- }
- else
- {
- pDependencies = DE_NULL;
- }
-}
-
-void
-RenderPassCreateInfo::addAttachment (vk::VkAttachmentDescription attachment)
-{
-
- m_attachments.push_back(attachment);
- m_attachmentsStructs = std::vector<vk::VkAttachmentDescription>(m_attachments.begin(), m_attachments.end());
- attachmentCount = static_cast<deUint32>(m_attachments.size());
- pAttachments = &m_attachmentsStructs[0];
-}
-
-void
-RenderPassCreateInfo::addSubpass (vk::VkSubpassDescription subpass)
-{
-
- m_subpasses.push_back(subpass);
- m_subpassesStructs = std::vector<vk::VkSubpassDescription>(m_subpasses.begin(), m_subpasses.end());
- subpassCount = static_cast<deUint32>(m_subpasses.size());
- pSubpasses = &m_subpassesStructs[0];
-}
-
-void
-RenderPassCreateInfo::addDependency (vk::VkSubpassDependency dependency)
-{
-
- m_dependiences.push_back(dependency);
- m_dependiencesStructs = std::vector<vk::VkSubpassDependency>(m_dependiences.begin(), m_dependiences.end());
-
- dependencyCount = static_cast<deUint32>(m_dependiences.size());
- pDependencies = &m_dependiencesStructs[0];
-}
-
-RenderPassBeginInfo::RenderPassBeginInfo (vk::VkRenderPass _renderPass,
- vk::VkFramebuffer _framebuffer,
- vk::VkRect2D _renderArea,
- const std::vector<vk::VkClearValue>& _clearValues)
-{
-
- m_clearValues = _clearValues;
-
- sType = vk::VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
- pNext = DE_NULL;
- renderPass = _renderPass;
- framebuffer = _framebuffer;
- renderArea = _renderArea;
- clearValueCount = static_cast<deUint32>(m_clearValues.size());
- pClearValues = m_clearValues.size() ? &m_clearValues[0] : DE_NULL;
-}
-
-CmdPoolCreateInfo::CmdPoolCreateInfo (deUint32 _queueFamilyIndex, unsigned int _flags)
-{
- sType = vk::VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
- pNext = DE_NULL;
-
- queueFamilyIndex = _queueFamilyIndex;
- flags = _flags;
-}
-
-AttachmentDescription::AttachmentDescription (vk::VkFormat _format,
- vk::VkSampleCountFlagBits _samples,
- vk::VkAttachmentLoadOp _loadOp,
- vk::VkAttachmentStoreOp _storeOp,
- vk::VkAttachmentLoadOp _stencilLoadOp,
- vk::VkAttachmentStoreOp _stencilStoreOp,
- vk::VkImageLayout _initialLayout,
- vk::VkImageLayout _finalLayout)
-{
- flags = 0;
- format = _format;
- samples = _samples;
- loadOp = _loadOp;
- storeOp = _storeOp;
- stencilLoadOp = _stencilLoadOp;
- stencilStoreOp = _stencilStoreOp;
- initialLayout = _initialLayout;
- finalLayout = _finalLayout;
-}
-
-AttachmentDescription::AttachmentDescription (const vk::VkAttachmentDescription& rhs)
-{
- flags = rhs.flags;
- format = rhs.format;
- samples = rhs.samples;
- loadOp = rhs.loadOp;
- storeOp = rhs.storeOp;
- stencilLoadOp = rhs.stencilLoadOp;
- stencilStoreOp = rhs.stencilStoreOp;
- initialLayout = rhs.initialLayout;
- finalLayout = rhs.finalLayout;
-}
-
-AttachmentReference::AttachmentReference (deUint32 _attachment, vk::VkImageLayout _layout)
-{
- attachment = _attachment;
- layout = _layout;
-}
-
-AttachmentReference::AttachmentReference (void)
-{
- attachment = VK_ATTACHMENT_UNUSED;
- layout = vk::VK_IMAGE_LAYOUT_UNDEFINED;
-}
-
-SubpassDescription::SubpassDescription (vk::VkPipelineBindPoint _pipelineBindPoint,
- vk::VkSubpassDescriptionFlags _flags,
- deUint32 _inputAttachmentCount,
- const vk::VkAttachmentReference* _inputAttachments,
- deUint32 _colorAttachmentCount,
- const vk::VkAttachmentReference* _colorAttachments,
- const vk::VkAttachmentReference* _resolveAttachments,
- vk::VkAttachmentReference depthStencilAttachment,
- deUint32 _preserveAttachmentCount,
- const deUint32* _preserveAttachments)
-{
- m_inputAttachments = std::vector<vk::VkAttachmentReference>(_inputAttachments, _inputAttachments + _inputAttachmentCount);
- m_colorAttachments = std::vector<vk::VkAttachmentReference>(_colorAttachments, _colorAttachments + _colorAttachmentCount);
-
- if (_resolveAttachments)
- m_resolveAttachments = std::vector<vk::VkAttachmentReference>(_resolveAttachments, _resolveAttachments + _colorAttachmentCount);
-
- m_preserveAttachments = std::vector<deUint32>(_preserveAttachments, _preserveAttachments + _preserveAttachmentCount);
-
- m_depthStencilAttachment = depthStencilAttachment;
-
- flags = _flags;
- pipelineBindPoint = _pipelineBindPoint;
- inputAttachmentCount = _inputAttachmentCount;
- pInputAttachments = DE_NULL;
- colorAttachmentCount = _colorAttachmentCount;
- pColorAttachments = DE_NULL;
- pResolveAttachments = DE_NULL;
- pDepthStencilAttachment = &m_depthStencilAttachment;
- pPreserveAttachments = DE_NULL;
- preserveAttachmentCount = _preserveAttachmentCount;
-
- if (!m_inputAttachments.empty())
- pInputAttachments = &m_inputAttachments[0];
-
- if (!m_colorAttachments.empty())
- pColorAttachments = &m_colorAttachments[0];
-
- if (!m_resolveAttachments.empty())
- pResolveAttachments = &m_resolveAttachments[0];
-
- if (!m_preserveAttachments.empty())
- pPreserveAttachments = &m_preserveAttachments[0];
-}
-
-SubpassDescription::SubpassDescription (const vk::VkSubpassDescription& rhs)
-{
- *static_cast<vk::VkSubpassDescription*>(this) = rhs;
-
- m_inputAttachments = std::vector<vk::VkAttachmentReference>(
- rhs.pInputAttachments, rhs.pInputAttachments + rhs.inputAttachmentCount);
-
- m_colorAttachments = std::vector<vk::VkAttachmentReference>(
- rhs.pColorAttachments, rhs.pColorAttachments + rhs.colorAttachmentCount);
-
- if (rhs.pResolveAttachments)
- m_resolveAttachments = std::vector<vk::VkAttachmentReference>(
- rhs.pResolveAttachments, rhs.pResolveAttachments + rhs.colorAttachmentCount);
-
- m_preserveAttachments = std::vector<deUint32>(
- rhs.pPreserveAttachments, rhs.pPreserveAttachments + rhs.preserveAttachmentCount);
-
- if (rhs.pDepthStencilAttachment)
- m_depthStencilAttachment = *rhs.pDepthStencilAttachment;
-
- if (!m_inputAttachments.empty())
- pInputAttachments = &m_inputAttachments[0];
-
- if (!m_colorAttachments.empty())
- pColorAttachments = &m_colorAttachments[0];
-
- if (!m_resolveAttachments.empty())
- pResolveAttachments = &m_resolveAttachments[0];
-
- pDepthStencilAttachment = &m_depthStencilAttachment;
-
- if (!m_preserveAttachments.empty())
- pPreserveAttachments = &m_preserveAttachments[0];
-}
-
-SubpassDescription::SubpassDescription (const SubpassDescription& rhs) {
- *this = rhs;
-}
-
-SubpassDescription& SubpassDescription::operator= (const SubpassDescription& rhs)
-{
- *static_cast<vk::VkSubpassDescription*>(this) = rhs;
-
- m_inputAttachments = rhs.m_inputAttachments;
- m_colorAttachments = rhs.m_colorAttachments;
- m_resolveAttachments = rhs.m_resolveAttachments;
- m_preserveAttachments = rhs.m_preserveAttachments;
- m_depthStencilAttachment = rhs.m_depthStencilAttachment;
-
- if (!m_inputAttachments.empty())
- pInputAttachments = &m_inputAttachments[0];
-
- if (!m_colorAttachments.empty())
- pColorAttachments = &m_colorAttachments[0];
-
- if (!m_resolveAttachments.empty())
- pResolveAttachments = &m_resolveAttachments[0];
-
- pDepthStencilAttachment = &m_depthStencilAttachment;
-
- if (!m_preserveAttachments.empty())
- pPreserveAttachments = &m_preserveAttachments[0];
-
- return *this;
-}
-
-SubpassDependency::SubpassDependency (deUint32 _srcSubpass,
- deUint32 _dstSubpass,
- vk::VkPipelineStageFlags _srcStageMask,
- vk::VkPipelineStageFlags _dstStageMask,
- vk::VkAccessFlags _srcAccessMask,
- vk::VkAccessFlags _dstAccessMask,
- vk::VkDependencyFlags _dependencyFlags)
-{
- srcSubpass = _srcSubpass;
- dstSubpass = _dstSubpass;
- srcStageMask = _srcStageMask;
- dstStageMask = _dstStageMask;
- srcAccessMask = _srcAccessMask;
- dstAccessMask = _dstAccessMask;
- dependencyFlags = _dependencyFlags;
-}
-
-SubpassDependency::SubpassDependency (const vk::VkSubpassDependency& rhs)
-{
- srcSubpass = rhs.srcSubpass;
- dstSubpass = rhs.dstSubpass;
- srcStageMask = rhs.srcStageMask;
- dstStageMask = rhs.dstStageMask;
- srcAccessMask = rhs.srcAccessMask;
- dstAccessMask = rhs.dstAccessMask;
- dependencyFlags = rhs.dependencyFlags;
-}
-
-CmdBufferBeginInfo::CmdBufferBeginInfo (vk::VkCommandBufferUsageFlags _flags)
-{
- sType = vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- pNext = DE_NULL;
- flags = _flags;
- pInheritanceInfo = DE_NULL;
-}
-
-DescriptorPoolCreateInfo::DescriptorPoolCreateInfo (const std::vector<vk::VkDescriptorPoolSize>& poolSizeCounts,
- vk::VkDescriptorPoolCreateFlags _flags,
- deUint32 _maxSets)
- : m_poolSizeCounts(poolSizeCounts)
-{
- sType = vk::VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
- pNext = DE_NULL;
- flags = _flags;
- maxSets = _maxSets;
- poolSizeCount = static_cast<deUint32>(m_poolSizeCounts.size());
- pPoolSizes = &m_poolSizeCounts[0];
-}
-
-DescriptorPoolCreateInfo& DescriptorPoolCreateInfo::addDescriptors (vk::VkDescriptorType type, deUint32 count)
-{
- vk::VkDescriptorPoolSize descriptorTypeCount = { type, count };
- m_poolSizeCounts.push_back(descriptorTypeCount);
-
- poolSizeCount = static_cast<deUint32>(m_poolSizeCounts.size());
- pPoolSizes = &m_poolSizeCounts[0];
-
- return *this;
-}
-
-DescriptorSetLayoutCreateInfo::DescriptorSetLayoutCreateInfo (deUint32 _bindingCount, const vk::VkDescriptorSetLayoutBinding* _pBindings)
-{
- sType = vk::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0;
- bindingCount = _bindingCount;
- pBindings = _pBindings;
-}
-
-PipelineLayoutCreateInfo::PipelineLayoutCreateInfo (deUint32 _descriptorSetCount,
- const vk::VkDescriptorSetLayout* _pSetLayouts,
- deUint32 _pushConstantRangeCount,
- const vk::VkPushConstantRange* _pPushConstantRanges)
- : m_pushConstantRanges(_pPushConstantRanges, _pPushConstantRanges + _pushConstantRangeCount)
-{
- for (unsigned int i = 0; i < _descriptorSetCount; i++)
- {
- m_setLayouts.push_back(_pSetLayouts[i]);
- }
-
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
- pNext = DE_NULL;
-
- flags = 0u;
- setLayoutCount = static_cast<deUint32>(m_setLayouts.size());
- pSetLayouts = setLayoutCount > 0 ? &m_setLayouts[0] : DE_NULL;
- pushConstantRangeCount = static_cast<deUint32>(m_pushConstantRanges.size());
-
- if (m_pushConstantRanges.size())
- {
- pPushConstantRanges = &m_pushConstantRanges[0];
- }
- else
- {
- pPushConstantRanges = DE_NULL;
- }
-}
-
-PipelineLayoutCreateInfo::PipelineLayoutCreateInfo (const std::vector<vk::VkDescriptorSetLayout>& setLayouts,
- deUint32 _pushConstantRangeCount,
- const vk::VkPushConstantRange* _pPushConstantRanges)
- : m_setLayouts (setLayouts)
- , m_pushConstantRanges (_pPushConstantRanges, _pPushConstantRanges + _pushConstantRangeCount)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
- pNext = DE_NULL;
-
- flags = 0u;
- setLayoutCount = static_cast<deUint32>(m_setLayouts.size());
-
- if (setLayoutCount)
- {
- pSetLayouts = &m_setLayouts[0];
- }
- else
- {
- pSetLayouts = DE_NULL;
- }
-
- pushConstantRangeCount = static_cast<deUint32>(m_pushConstantRanges.size());
- if (pushConstantRangeCount)
- {
- pPushConstantRanges = &m_pushConstantRanges[0];
- }
- else
- {
- pPushConstantRanges = DE_NULL;
- }
-}
-
-PipelineCreateInfo::PipelineShaderStage::PipelineShaderStage (vk::VkShaderModule _module, const char* _pName, vk::VkShaderStageFlagBits _stage)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- stage = _stage;
- module = _module;
- pName = _pName;
- pSpecializationInfo = DE_NULL;
-}
-
-PipelineCreateInfo::VertexInputState::VertexInputState (deUint32 _vertexBindingDescriptionCount,
- const vk::VkVertexInputBindingDescription* _pVertexBindingDescriptions,
- deUint32 _vertexAttributeDescriptionCount,
- const vk::VkVertexInputAttributeDescription* _pVertexAttributeDescriptions)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- vertexBindingDescriptionCount = _vertexBindingDescriptionCount;
- pVertexBindingDescriptions = _pVertexBindingDescriptions;
- vertexAttributeDescriptionCount = _vertexAttributeDescriptionCount;
- pVertexAttributeDescriptions = _pVertexAttributeDescriptions;
-}
-
-PipelineCreateInfo::InputAssemblerState::InputAssemblerState (vk::VkPrimitiveTopology _topology,
- vk::VkBool32 _primitiveRestartEnable)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- topology = _topology;
- primitiveRestartEnable = _primitiveRestartEnable;
-}
-
-PipelineCreateInfo::TessellationState::TessellationState (deUint32 _patchControlPoints)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- patchControlPoints = _patchControlPoints;
-}
-
-PipelineCreateInfo::ViewportState::ViewportState (deUint32 _viewportCount,
- std::vector<vk::VkViewport> _viewports,
- std::vector<vk::VkRect2D> _scissors)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- viewportCount = _viewportCount;
- scissorCount = _viewportCount;
-
- if (!_viewports.size())
- {
- m_viewports.resize(viewportCount);
- deMemset(&m_viewports[0], 0, sizeof(m_viewports[0]) * m_viewports.size());
- }
- else
- {
- m_viewports = _viewports;
- }
-
- if (!_scissors.size())
- {
- m_scissors.resize(scissorCount);
- deMemset(&m_scissors[0], 0, sizeof(m_scissors[0]) * m_scissors.size());
- }
- else
- {
- m_scissors = _scissors;
- }
-
- pViewports = &m_viewports[0];
- pScissors = &m_scissors[0];
-}
-
-PipelineCreateInfo::ViewportState::ViewportState (const ViewportState& other)
-{
- sType = other.sType;
- pNext = other.pNext;
- flags = other.flags;
- viewportCount = other.viewportCount;
- scissorCount = other.scissorCount;
-
- m_viewports = std::vector<vk::VkViewport>(other.pViewports, other.pViewports + viewportCount);
- m_scissors = std::vector<vk::VkRect2D>(other.pScissors, other.pScissors + scissorCount);
-
- pViewports = &m_viewports[0];
- pScissors = &m_scissors[0];
-}
-
-PipelineCreateInfo::ViewportState& PipelineCreateInfo::ViewportState::operator= (const ViewportState& other)
-{
- sType = other.sType;
- pNext = other.pNext;
- flags = other.flags;
- viewportCount = other.viewportCount;
- scissorCount = other.scissorCount;
-
- m_viewports = std::vector<vk::VkViewport>(other.pViewports, other.pViewports + scissorCount);
- m_scissors = std::vector<vk::VkRect2D>(other.pScissors, other.pScissors + scissorCount);
-
- pViewports = &m_viewports[0];
- pScissors = &m_scissors[0];
- return *this;
-}
-
-PipelineCreateInfo::RasterizerState::RasterizerState (vk::VkBool32 _depthClampEnable,
- vk::VkBool32 _rasterizerDiscardEnable,
- vk::VkPolygonMode _polygonMode,
- vk::VkCullModeFlags _cullMode,
- vk::VkFrontFace _frontFace,
- vk::VkBool32 _depthBiasEnable,
- float _depthBiasConstantFactor,
- float _depthBiasClamp,
- float _depthBiasSlopeFactor,
- float _lineWidth)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- depthClampEnable = _depthClampEnable;
- rasterizerDiscardEnable = _rasterizerDiscardEnable;
- polygonMode = _polygonMode;
- cullMode = _cullMode;
- frontFace = _frontFace;
-
- depthBiasEnable = _depthBiasEnable;
- depthBiasConstantFactor = _depthBiasConstantFactor;
- depthBiasClamp = _depthBiasClamp;
- depthBiasSlopeFactor = _depthBiasSlopeFactor;
- lineWidth = _lineWidth;
-}
-
-PipelineCreateInfo::MultiSampleState::MultiSampleState (vk::VkSampleCountFlagBits _rasterizationSamples,
- vk::VkBool32 _sampleShadingEnable,
- float _minSampleShading,
- const std::vector<vk::VkSampleMask>& _sampleMask,
- bool _alphaToCoverageEnable,
- bool _alphaToOneEnable)
- : m_sampleMask(_sampleMask)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- rasterizationSamples = _rasterizationSamples;
- sampleShadingEnable = _sampleShadingEnable;
- minSampleShading = _minSampleShading;
- pSampleMask = &m_sampleMask[0];
- alphaToCoverageEnable = _alphaToCoverageEnable;
- alphaToOneEnable = _alphaToOneEnable;
-}
-
-PipelineCreateInfo::MultiSampleState::MultiSampleState (const MultiSampleState& other)
-{
- sType = other.sType;
- pNext = other.pNext;
- flags = other.flags;
- rasterizationSamples = other.rasterizationSamples;
- sampleShadingEnable = other.sampleShadingEnable;
- minSampleShading = other.minSampleShading;
-
- const size_t sampleMaskArrayLen = (sizeof(vk::VkSampleMask) * 8 + other.rasterizationSamples) / (sizeof(vk::VkSampleMask) * 8);
-
- m_sampleMask = std::vector<vk::VkSampleMask>(other.pSampleMask, other.pSampleMask + sampleMaskArrayLen);
- pSampleMask = &m_sampleMask[0];
-}
-
-PipelineCreateInfo::MultiSampleState& PipelineCreateInfo::MultiSampleState::operator= (const MultiSampleState& other)
-{
- sType = other.sType;
- pNext = other.pNext;
- flags = other.flags;
- rasterizationSamples = other.rasterizationSamples;
- sampleShadingEnable = other.sampleShadingEnable;
- minSampleShading = other.minSampleShading;
-
- const size_t sampleMaskArrayLen = (sizeof(vk::VkSampleMask) * 8 + other.rasterizationSamples) / (sizeof(vk::VkSampleMask) * 8);
-
- m_sampleMask = std::vector<vk::VkSampleMask>(other.pSampleMask, other.pSampleMask + sampleMaskArrayLen);
- pSampleMask = &m_sampleMask[0];
-
- return *this;
-}
-
-PipelineCreateInfo::ColorBlendState::ColorBlendState (const std::vector<vk::VkPipelineColorBlendAttachmentState>& _attachments,
- vk::VkBool32 _logicOpEnable,
- vk::VkLogicOp _logicOp)
- : m_attachments(_attachments)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- logicOpEnable = _logicOpEnable;
- logicOp = _logicOp;
- attachmentCount = static_cast<deUint32>(m_attachments.size());
- pAttachments = &m_attachments[0];
-}
-
-PipelineCreateInfo::ColorBlendState::ColorBlendState (deUint32 _attachmentCount,
- const vk::VkPipelineColorBlendAttachmentState* _attachments,
- vk::VkBool32 _logicOpEnable,
- vk::VkLogicOp _logicOp)
- : m_attachments(_attachments, _attachments + _attachmentCount)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- logicOpEnable = _logicOpEnable;
- logicOp = _logicOp;
- attachmentCount = static_cast<deUint32>(m_attachments.size());
- pAttachments = &m_attachments[0];
-}
-
-PipelineCreateInfo::ColorBlendState::ColorBlendState (const vk::VkPipelineColorBlendStateCreateInfo& createInfo)
- : m_attachments (createInfo.pAttachments, createInfo.pAttachments + createInfo.attachmentCount)
-{
- sType = createInfo.sType;
- pNext = createInfo.pNext;
- flags = createInfo.flags;
- logicOpEnable = createInfo.logicOpEnable;
- logicOp = createInfo.logicOp;
- attachmentCount = static_cast<deUint32>(m_attachments.size());
- pAttachments = &m_attachments[0];
-}
-
-PipelineCreateInfo::ColorBlendState::ColorBlendState (const ColorBlendState& createInfo, std::vector<float> _blendConstants)
- : m_attachments (createInfo.pAttachments, createInfo.pAttachments + createInfo.attachmentCount)
-{
- sType = createInfo.sType;
- pNext = createInfo.pNext;
- flags = createInfo.flags;
- logicOpEnable = createInfo.logicOpEnable;
- logicOp = createInfo.logicOp;
- attachmentCount = static_cast<deUint32>(m_attachments.size());
- pAttachments = &m_attachments[0];
- deMemcpy(blendConstants, &_blendConstants[0], 4 * sizeof(float));
-}
-
-PipelineCreateInfo::ColorBlendState::Attachment::Attachment (vk::VkBool32 _blendEnable,
- vk::VkBlendFactor _srcColorBlendFactor,
- vk::VkBlendFactor _dstColorBlendFactor,
- vk::VkBlendOp _colorBlendOp,
- vk::VkBlendFactor _srcAlphaBlendFactor,
- vk::VkBlendFactor _dstAlphaBlendFactor,
- vk::VkBlendOp _alphaBlendOp,
- deUint8 _colorWriteMask)
-{
- blendEnable = _blendEnable;
- srcColorBlendFactor = _srcColorBlendFactor;
- dstColorBlendFactor = _dstColorBlendFactor;
- colorBlendOp = _colorBlendOp;
- srcAlphaBlendFactor = _srcAlphaBlendFactor;
- dstAlphaBlendFactor = _dstAlphaBlendFactor;
- alphaBlendOp = _alphaBlendOp;
- colorWriteMask = _colorWriteMask;
-}
-
-PipelineCreateInfo::DepthStencilState::StencilOpState::StencilOpState (vk::VkStencilOp _failOp,
- vk::VkStencilOp _passOp,
- vk::VkStencilOp _depthFailOp,
- vk::VkCompareOp _compareOp,
- deUint32 _compareMask,
- deUint32 _writeMask,
- deUint32 _reference)
-{
- failOp = _failOp;
- passOp = _passOp;
- depthFailOp = _depthFailOp;
- compareOp = _compareOp;
-
- compareMask = _compareMask;
- writeMask = _writeMask;
- reference = _reference;
-}
-
-PipelineCreateInfo::DepthStencilState::DepthStencilState (vk::VkBool32 _depthTestEnable,
- vk::VkBool32 _depthWriteEnable,
- vk::VkCompareOp _depthCompareOp,
- vk::VkBool32 _depthBoundsTestEnable,
- vk::VkBool32 _stencilTestEnable,
- StencilOpState _front,
- StencilOpState _back,
- float _minDepthBounds,
- float _maxDepthBounds)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- depthTestEnable = _depthTestEnable;
- depthWriteEnable = _depthWriteEnable;
- depthCompareOp = _depthCompareOp;
- depthBoundsTestEnable = _depthBoundsTestEnable;
- stencilTestEnable = _stencilTestEnable;
- front = _front;
- back = _back;
-
- minDepthBounds = _minDepthBounds;
- maxDepthBounds = _maxDepthBounds;
-}
-
-PipelineCreateInfo::DynamicState::DynamicState (const std::vector<vk::VkDynamicState>& _dynamicStates)
-{
- sType = vk::VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
-
- if (!_dynamicStates.size())
- {
- for (size_t i = 0; i < vk::VK_DYNAMIC_STATE_LAST; ++i)
- {
- m_dynamicStates.push_back(static_cast<vk::VkDynamicState>(i));
- }
- }
- else
- m_dynamicStates = _dynamicStates;
-
- dynamicStateCount = static_cast<deUint32>(m_dynamicStates.size());
- pDynamicStates = &m_dynamicStates[0];
-}
-
-PipelineCreateInfo::DynamicState::DynamicState (const DynamicState &other)
-{
- sType = other.sType;
- pNext = other.pNext;
- flags = other.flags;
-
- dynamicStateCount = other.dynamicStateCount;
-
- m_dynamicStates = std::vector<vk::VkDynamicState>(other.pDynamicStates, other.pDynamicStates + dynamicStateCount);
- pDynamicStates = &m_dynamicStates[0];
-}
-
-PipelineCreateInfo::DynamicState& PipelineCreateInfo::DynamicState::operator= (const DynamicState& other)
-{
- sType = other.sType;
- pNext = other.pNext;
- flags = other.flags;
-
- dynamicStateCount = other.dynamicStateCount;
-
- m_dynamicStates = std::vector<vk::VkDynamicState>(other.pDynamicStates, other.pDynamicStates + dynamicStateCount);
- pDynamicStates = &m_dynamicStates[0];
-
- return *this;
-}
-
-PipelineCreateInfo::PipelineCreateInfo (vk::VkPipelineLayout _layout,
- vk::VkRenderPass _renderPass,
- int _subpass,
- vk::VkPipelineCreateFlags _flags)
-{
- deMemset(static_cast<vk::VkGraphicsPipelineCreateInfo *>(this), 0,
- sizeof(vk::VkGraphicsPipelineCreateInfo));
-
- sType = vk::VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
- pNext = DE_NULL;
- flags = _flags;
- renderPass = _renderPass;
- subpass = _subpass;
- layout = _layout;
- basePipelineHandle = DE_NULL;
- basePipelineIndex = 0;
- pDynamicState = DE_NULL;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addShader (const vk::VkPipelineShaderStageCreateInfo& shader)
-{
- m_shaders.push_back(shader);
-
- stageCount = static_cast<deUint32>(m_shaders.size());
- pStages = &m_shaders[0];
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineVertexInputStateCreateInfo& state)
-{
- m_vertexInputState = state;
- pVertexInputState = &m_vertexInputState;
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineInputAssemblyStateCreateInfo& state)
-{
- m_inputAssemblyState = state;
- pInputAssemblyState = &m_inputAssemblyState;
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineColorBlendStateCreateInfo& state)
-{
- m_colorBlendStateAttachments = std::vector<vk::VkPipelineColorBlendAttachmentState>(state.pAttachments, state.pAttachments + state.attachmentCount);
- m_colorBlendState = state;
- m_colorBlendState.pAttachments = &m_colorBlendStateAttachments[0];
- pColorBlendState = &m_colorBlendState;
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineViewportStateCreateInfo& state)
-{
- m_viewports = std::vector<vk::VkViewport>(state.pViewports, state.pViewports + state.viewportCount);
- m_scissors = std::vector<vk::VkRect2D>(state.pScissors, state.pScissors + state.scissorCount);
- m_viewportState = state;
- m_viewportState.pViewports = &m_viewports[0];
- m_viewportState.pScissors = &m_scissors[0];
- pViewportState = &m_viewportState;
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineDepthStencilStateCreateInfo& state)
-{
- m_dynamicDepthStencilState = state;
- pDepthStencilState = &m_dynamicDepthStencilState;
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineTessellationStateCreateInfo& state)
-{
- m_tessState = state;
- pTessellationState = &m_tessState;
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineRasterizationStateCreateInfo& state)
-{
- m_rasterState = state;
- pRasterizationState = &m_rasterState;
-
- return *this;
-}
-
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineMultisampleStateCreateInfo& state)
-{
-
- const size_t sampleMaskArrayLen = (sizeof(vk::VkSampleMask) * 8 + state.rasterizationSamples) / ( sizeof(vk::VkSampleMask) * 8 );
- m_multisampleStateSampleMask = std::vector<vk::VkSampleMask>(state.pSampleMask, state.pSampleMask + sampleMaskArrayLen);
- m_multisampleState = state;
- m_multisampleState.pSampleMask = &m_multisampleStateSampleMask[0];
- pMultisampleState = &m_multisampleState;
-
- return *this;
-}
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineDynamicStateCreateInfo& state)
-{
- m_dynamicStates = std::vector<vk::VkDynamicState>(state.pDynamicStates, state.pDynamicStates + state.dynamicStateCount);
- m_dynamicState = state;
- m_dynamicState.pDynamicStates = &m_dynamicStates[0];
- pDynamicState = &m_dynamicState;
-
- return *this;
-}
-
-SamplerCreateInfo::SamplerCreateInfo (vk::VkFilter _magFilter,
- vk::VkFilter _minFilter,
- vk::VkSamplerMipmapMode _mipmapMode,
- vk::VkSamplerAddressMode _addressModeU,
- vk::VkSamplerAddressMode _addressModeV,
- vk::VkSamplerAddressMode _addressModeW,
- float _mipLodBias,
- vk::VkBool32 _anisotropyEnable,
- float _maxAnisotropy,
- vk::VkBool32 _compareEnable,
- vk::VkCompareOp _compareOp,
- float _minLod,
- float _maxLod,
- vk::VkBorderColor _borderColor,
- vk::VkBool32 _unnormalizedCoordinates)
-{
- sType = vk::VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
- pNext = DE_NULL;
- flags = 0u;
- magFilter = _magFilter;
- minFilter = _minFilter;
- mipmapMode = _mipmapMode;
- addressModeU = _addressModeU;
- addressModeV = _addressModeV;
- addressModeW = _addressModeW;
- mipLodBias = _mipLodBias;
- anisotropyEnable = _anisotropyEnable;
- maxAnisotropy = _maxAnisotropy;
- compareEnable = _compareEnable;
- compareOp = _compareOp;
- minLod = _minLod;
- maxLod = _maxLod;
- borderColor = _borderColor;
- unnormalizedCoordinates = _unnormalizedCoordinates;
-}
-
-} // QueryPool
-} // vkt
+++ /dev/null
-#ifndef _VKTQUERYPOOLCREATEINFOUTIL_HPP
-#define _VKTQUERYPOOLCREATEINFOUTIL_HPP
-/*------------------------------------------------------------------------
- * Vulkan Conformance Tests
- * ------------------------
- *
- * Copyright (c) 2015 The Khronos Group Inc.
- * Copyright (c) 2015 Intel Corporation
- *
- * 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.
- *
- *//*!
- * \file
- * \brief CreateInfo utilities
- *//*--------------------------------------------------------------------*/
-
-#include "vkDefs.hpp"
-#include "tcuVector.hpp"
-#include "deSharedPtr.hpp"
-#include <vector>
-
-namespace vkt
-{
-namespace QueryPool
-{
-
-class ImageSubresourceRange : public vk::VkImageSubresourceRange
-{
-public:
- ImageSubresourceRange (vk::VkImageAspectFlags aspectMask,
- deUint32 baseMipLevel = 0,
- deUint32 levelCount = 1,
- deUint32 baseArrayLayer = 0,
- deUint32 layerCount = 1);
-};
-
-class ComponentMapping : public vk::VkComponentMapping
-{
-public:
- ComponentMapping (vk::VkComponentSwizzle r = vk::VK_COMPONENT_SWIZZLE_R,
- vk::VkComponentSwizzle g = vk::VK_COMPONENT_SWIZZLE_G,
- vk::VkComponentSwizzle b = vk::VK_COMPONENT_SWIZZLE_B,
- vk::VkComponentSwizzle a = vk::VK_COMPONENT_SWIZZLE_A);
-};
-
-class ImageViewCreateInfo : public vk::VkImageViewCreateInfo
-{
-public:
- ImageViewCreateInfo (vk::VkImage image,
- vk::VkImageViewType viewType,
- vk::VkFormat format,
- const vk::VkImageSubresourceRange& subresourceRange,
- const vk::VkComponentMapping& components = ComponentMapping(),
- vk::VkImageViewCreateFlags flags = 0);
-
- ImageViewCreateInfo (vk::VkImage image,
- vk::VkImageViewType viewType,
- vk::VkFormat format,
- const vk::VkComponentMapping& components = ComponentMapping(),
- vk::VkImageViewCreateFlags flags = 0);
-};
-
-class BufferViewCreateInfo : public vk::VkBufferViewCreateInfo
-{
-public:
- BufferViewCreateInfo (vk::VkBuffer buffer,
- vk::VkFormat format,
- vk::VkDeviceSize offset,
- vk::VkDeviceSize range);
-};
-
-class BufferCreateInfo : public vk::VkBufferCreateInfo
-{
-public:
- BufferCreateInfo (vk::VkDeviceSize size,
- vk::VkBufferCreateFlags usage,
- vk::VkSharingMode sharingMode = vk::VK_SHARING_MODE_EXCLUSIVE,
- deUint32 queueFamilyIndexCount = 0,
- const deUint32* pQueueFamilyIndices = DE_NULL,
- vk::VkBufferCreateFlags flags = 0);
-
- BufferCreateInfo (const BufferCreateInfo& other);
- BufferCreateInfo& operator= (const BufferCreateInfo& other);
-
-private:
- std::vector<deUint32> m_queueFamilyIndices;
-};
-
-class ImageCreateInfo : public vk::VkImageCreateInfo
-{
-public:
- ImageCreateInfo (vk::VkImageType imageType,
- vk::VkFormat format,
- vk::VkExtent3D extent,
- deUint32 mipLevels,
- deUint32 arrayLayers,
- vk::VkSampleCountFlagBits samples,
- vk::VkImageTiling tiling,
- vk::VkImageUsageFlags usage,
- vk::VkSharingMode sharingMode = vk::VK_SHARING_MODE_EXCLUSIVE,
- deUint32 queueFamilyIndexCount = 0,
- const deUint32* pQueueFamilyIndices = DE_NULL,
- vk::VkImageCreateFlags flags = 0,
- vk::VkImageLayout initialLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED);
-
-private:
- ImageCreateInfo (const ImageCreateInfo& other);
- ImageCreateInfo& operator= (const ImageCreateInfo& other);
-
- std::vector<deUint32> m_queueFamilyIndices;
-};
-
-class FramebufferCreateInfo : public vk::VkFramebufferCreateInfo
-{
-public:
- FramebufferCreateInfo (vk::VkRenderPass renderPass,
- const std::vector<vk::VkImageView>& attachments,
- deUint32 width,
- deUint32 height,
- deUint32 layers);
-};
-
-class AttachmentDescription : public vk::VkAttachmentDescription
-{
-public:
- AttachmentDescription (vk::VkFormat format,
- vk::VkSampleCountFlagBits samples,
- vk::VkAttachmentLoadOp loadOp,
- vk::VkAttachmentStoreOp storeOp,
- vk::VkAttachmentLoadOp stencilLoadOp,
- vk::VkAttachmentStoreOp stencilStoreOp,
- vk::VkImageLayout initialLayout,
- vk::VkImageLayout finalLayout);
-
- AttachmentDescription (const vk::VkAttachmentDescription &);
-};
-
-class AttachmentReference : public vk::VkAttachmentReference
-{
-public:
- AttachmentReference (deUint32 attachment, vk::VkImageLayout layout);
- AttachmentReference (void);
-};
-
-class SubpassDescription : public vk::VkSubpassDescription
-{
-public:
- SubpassDescription (vk::VkPipelineBindPoint pipelineBindPoint,
- vk::VkSubpassDescriptionFlags flags,
- deUint32 inputAttachmentCount,
- const vk::VkAttachmentReference* inputAttachments,
- deUint32 colorAttachmentCount,
- const vk::VkAttachmentReference* colorAttachments,
- const vk::VkAttachmentReference* resolveAttachments,
- vk::VkAttachmentReference depthStencilAttachment,
- deUint32 preserveAttachmentCount,
- const deUint32* preserveAttachments);
-
- SubpassDescription (const vk::VkSubpassDescription& other);
- SubpassDescription (const SubpassDescription& other);
- SubpassDescription& operator= (const SubpassDescription& other);
-
-private:
- std::vector<vk::VkAttachmentReference> m_inputAttachments;
- std::vector<vk::VkAttachmentReference> m_colorAttachments;
- std::vector<vk::VkAttachmentReference> m_resolveAttachments;
- std::vector<deUint32> m_preserveAttachments;
-
- vk::VkAttachmentReference m_depthStencilAttachment;
-};
-
-class SubpassDependency : public vk::VkSubpassDependency
-{
-public:
- SubpassDependency ( deUint32 srcSubpass,
- deUint32 dstSubpass,
- vk::VkPipelineStageFlags srcStageMask,
- vk::VkPipelineStageFlags dstStageMask,
- vk::VkAccessFlags srcAccessMask,
- vk::VkAccessFlags dstAccessMask,
- vk::VkDependencyFlags dependencyFlags);
-
- SubpassDependency (const vk::VkSubpassDependency& other);
-};
-
-class RenderPassCreateInfo : public vk::VkRenderPassCreateInfo
-{
-public:
- RenderPassCreateInfo (const std::vector<vk::VkAttachmentDescription>& attachments,
- const std::vector<vk::VkSubpassDescription>& subpasses,
- const std::vector<vk::VkSubpassDependency>& dependiences = std::vector<vk::VkSubpassDependency>());
-
- RenderPassCreateInfo (deUint32 attachmentCount = 0,
- const vk::VkAttachmentDescription* pAttachments = DE_NULL,
- deUint32 subpassCount = 0,
- const vk::VkSubpassDescription* pSubpasses = DE_NULL,
- deUint32 dependencyCount = 0,
- const vk::VkSubpassDependency* pDependiences = DE_NULL);
-
- void addAttachment (vk::VkAttachmentDescription attachment);
- void addSubpass (vk::VkSubpassDescription subpass);
- void addDependency (vk::VkSubpassDependency dependency);
-
-private:
- std::vector<AttachmentDescription> m_attachments;
- std::vector<SubpassDescription> m_subpasses;
- std::vector<SubpassDependency> m_dependiences;
-
- std::vector<vk::VkAttachmentDescription> m_attachmentsStructs;
- std::vector<vk::VkSubpassDescription> m_subpassesStructs;
- std::vector<vk::VkSubpassDependency> m_dependiencesStructs;
-
- RenderPassCreateInfo (const RenderPassCreateInfo &other); //Not allowed!
- RenderPassCreateInfo& operator= (const RenderPassCreateInfo &other); //Not allowed!
-};
-
-class RenderPassBeginInfo : public vk::VkRenderPassBeginInfo
-{
-public:
- RenderPassBeginInfo (vk::VkRenderPass renderPass,
- vk::VkFramebuffer framebuffer,
- vk::VkRect2D renderArea,
- const std::vector<vk::VkClearValue>& clearValues = std::vector<vk::VkClearValue>());
-
-private:
- std::vector<vk::VkClearValue> m_clearValues;
-
- RenderPassBeginInfo (const RenderPassBeginInfo& other); //Not allowed!
- RenderPassBeginInfo& operator= (const RenderPassBeginInfo& other); //Not allowed!
-};
-
-class CmdPoolCreateInfo : public vk::VkCommandPoolCreateInfo
-{
-public:
- CmdPoolCreateInfo (deUint32 queueFamilyIndex,
- vk::VkCommandPoolCreateFlags flags = vk::VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT);
-};
-
-class CmdBufferBeginInfo : public vk::VkCommandBufferBeginInfo
-{
-public:
- CmdBufferBeginInfo (vk::VkCommandBufferUsageFlags flags = 0);
-};
-
-class DescriptorPoolSize : public vk::VkDescriptorPoolSize
-{
-public:
- DescriptorPoolSize (vk::VkDescriptorType _type, deUint32 _descriptorCount)
- {
- type = _type;
- descriptorCount = _descriptorCount;
- }
-};
-
-class DescriptorPoolCreateInfo : public vk::VkDescriptorPoolCreateInfo
-{
-public:
- DescriptorPoolCreateInfo (const std::vector<vk::VkDescriptorPoolSize>& poolSizeCounts,
- vk::VkDescriptorPoolCreateFlags flags,
- deUint32 maxSets);
-
- DescriptorPoolCreateInfo& addDescriptors (vk::VkDescriptorType type, deUint32 count);
-
-private:
- std::vector<vk::VkDescriptorPoolSize> m_poolSizeCounts;
-};
-
-class DescriptorSetLayoutCreateInfo : public vk::VkDescriptorSetLayoutCreateInfo
-{
-public:
- DescriptorSetLayoutCreateInfo (deUint32 bindingCount, const vk::VkDescriptorSetLayoutBinding* pBindings);
-};
-
-class PipelineLayoutCreateInfo : public vk::VkPipelineLayoutCreateInfo
-{
-public:
- PipelineLayoutCreateInfo (deUint32 descriptorSetCount,
- const vk::VkDescriptorSetLayout* pSetLayouts,
- deUint32 pushConstantRangeCount = 0,
- const vk::VkPushConstantRange* pPushConstantRanges = DE_NULL);
-
- PipelineLayoutCreateInfo (const std::vector<vk::VkDescriptorSetLayout>& setLayouts = std::vector<vk::VkDescriptorSetLayout>(),
- deUint32 pushConstantRangeCount = 0,
- const vk::VkPushConstantRange* pPushConstantRanges = DE_NULL);
-
-private:
- std::vector<vk::VkDescriptorSetLayout> m_setLayouts;
- std::vector<vk::VkPushConstantRange> m_pushConstantRanges;
-};
-
-class PipelineCreateInfo : public vk::VkGraphicsPipelineCreateInfo
-{
-public:
- class VertexInputState : public vk::VkPipelineVertexInputStateCreateInfo
- {
- public:
- VertexInputState (deUint32 vertexBindingDescriptionCount = 0,
- const vk::VkVertexInputBindingDescription* pVertexBindingDescriptions = NULL,
- deUint32 vertexAttributeDescriptionCount = 0,
- const vk::VkVertexInputAttributeDescription* pVertexAttributeDescriptions = NULL);
- };
-
- class InputAssemblerState : public vk::VkPipelineInputAssemblyStateCreateInfo
- {
- public:
- InputAssemblerState (vk::VkPrimitiveTopology topology, vk::VkBool32 primitiveRestartEnable = false);
- };
-
- class TessellationState : public vk::VkPipelineTessellationStateCreateInfo
- {
- public:
- TessellationState (deUint32 patchControlPoints = 0);
- };
-
- class ViewportState : public vk::VkPipelineViewportStateCreateInfo
- {
- public:
- ViewportState (deUint32 viewportCount,
- std::vector<vk::VkViewport> viewports = std::vector<vk::VkViewport>(0),
- std::vector<vk::VkRect2D> scissors = std::vector<vk::VkRect2D>(0));
-
- ViewportState (const ViewportState& other);
- ViewportState& operator= (const ViewportState& other);
-
- std::vector<vk::VkViewport> m_viewports;
- std::vector<vk::VkRect2D> m_scissors;
- };
-
- class RasterizerState : public vk::VkPipelineRasterizationStateCreateInfo
- {
- public:
- RasterizerState (vk::VkBool32 depthClampEnable = false,
- vk::VkBool32 rasterizerDiscardEnable = false,
- vk::VkPolygonMode polygonMode = vk::VK_POLYGON_MODE_FILL,
- vk::VkCullModeFlags cullMode = vk::VK_CULL_MODE_NONE,
- vk::VkFrontFace frontFace = vk::VK_FRONT_FACE_CLOCKWISE,
- vk::VkBool32 depthBiasEnable = true,
- float depthBiasConstantFactor = 0.0f,
- float depthBiasClamp = 0.0f,
- float depthBiasSlopeFactor = 0.0f,
- float lineWidth = 1.0f);
- };
-
- class MultiSampleState : public vk::VkPipelineMultisampleStateCreateInfo
- {
- public:
- MultiSampleState (vk::VkSampleCountFlagBits rasterizationSamples = vk::VK_SAMPLE_COUNT_1_BIT,
- vk::VkBool32 sampleShadingEnable = false,
- float minSampleShading = 0.0f,
- const std::vector<vk::VkSampleMask>& sampleMask = std::vector<vk::VkSampleMask>(1, 0xffffffff),
- bool alphaToCoverageEnable = false,
- bool alphaToOneEnable = false);
-
- MultiSampleState (const MultiSampleState& other);
- MultiSampleState& operator= (const MultiSampleState& other);
-
- private:
- std::vector<vk::VkSampleMask> m_sampleMask;
- };
-
- class ColorBlendState : public vk::VkPipelineColorBlendStateCreateInfo
- {
- public:
- class Attachment : public vk::VkPipelineColorBlendAttachmentState
- {
- public:
- Attachment (vk::VkBool32 blendEnable = false,
- vk::VkBlendFactor srcColorBlendFactor = vk::VK_BLEND_FACTOR_SRC_COLOR,
- vk::VkBlendFactor dstColorBlendFactor = vk::VK_BLEND_FACTOR_DST_COLOR,
- vk::VkBlendOp colorBlendOp = vk::VK_BLEND_OP_ADD,
- vk::VkBlendFactor srcAlphaBlendFactor = vk::VK_BLEND_FACTOR_SRC_COLOR,
- vk::VkBlendFactor dstAlphaBlendFactor = vk::VK_BLEND_FACTOR_DST_COLOR,
- vk::VkBlendOp alphaBlendOp = vk::VK_BLEND_OP_ADD,
- deUint8 colorWriteMask = 0xff);
- };
-
- ColorBlendState (const std::vector<vk::VkPipelineColorBlendAttachmentState>& attachments,
- vk::VkBool32 alphaToCoverageEnable = false,
- vk::VkLogicOp logicOp = vk::VK_LOGIC_OP_COPY);
-
- ColorBlendState (deUint32 attachmentCount,
- const vk::VkPipelineColorBlendAttachmentState* attachments,
- vk::VkBool32 logicOpEnable = false,
- vk::VkLogicOp logicOp = vk::VK_LOGIC_OP_COPY);
-
- ColorBlendState (const vk::VkPipelineColorBlendStateCreateInfo& createInfo);
- ColorBlendState (const ColorBlendState& createInfo,
- std::vector<float> blendConstants = std::vector<float>(4));
-
- private:
- std::vector<vk::VkPipelineColorBlendAttachmentState> m_attachments;
- };
-
- class DepthStencilState : public vk::VkPipelineDepthStencilStateCreateInfo
- {
- public:
- class StencilOpState : public vk::VkStencilOpState
- {
- public:
- StencilOpState (vk::VkStencilOp failOp = vk::VK_STENCIL_OP_REPLACE,
- vk::VkStencilOp passOp = vk::VK_STENCIL_OP_REPLACE,
- vk::VkStencilOp depthFailOp = vk::VK_STENCIL_OP_REPLACE,
- vk::VkCompareOp compareOp = vk::VK_COMPARE_OP_ALWAYS,
- deUint32 compareMask = 0xffffffffu,
- deUint32 writeMask = 0xffffffffu,
- deUint32 reference = 0);
- };
-
- DepthStencilState (vk::VkBool32 depthTestEnable = false,
- vk::VkBool32 depthWriteEnable = false,
- vk::VkCompareOp depthCompareOp = vk::VK_COMPARE_OP_ALWAYS,
- vk::VkBool32 depthBoundsTestEnable = false,
- vk::VkBool32 stencilTestEnable = false,
- StencilOpState front = StencilOpState(),
- StencilOpState back = StencilOpState(),
- float minDepthBounds = -1.0f,
- float maxDepthBounds = 1.0f);
- };
-
- class PipelineShaderStage : public vk::VkPipelineShaderStageCreateInfo
- {
- public:
- PipelineShaderStage (vk::VkShaderModule shaderModule, const char* pName, vk::VkShaderStageFlagBits stage);
- };
-
- class DynamicState : public vk::VkPipelineDynamicStateCreateInfo
- {
- public:
- DynamicState (const std::vector<vk::VkDynamicState>& dynamicStates = std::vector<vk::VkDynamicState>(0));
-
- DynamicState (const DynamicState& other);
- DynamicState& operator= (const DynamicState& other);
-
- std::vector<vk::VkDynamicState> m_dynamicStates;
- };
-
- PipelineCreateInfo (vk::VkPipelineLayout layout,
- vk::VkRenderPass renderPass,
- int subpass,
- vk::VkPipelineCreateFlags flags);
-
- PipelineCreateInfo& addShader (const vk::VkPipelineShaderStageCreateInfo& shader);
-
- PipelineCreateInfo& addState (const vk::VkPipelineVertexInputStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineInputAssemblyStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineColorBlendStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineViewportStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineDepthStencilStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineTessellationStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineRasterizationStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineMultisampleStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineDynamicStateCreateInfo& state);
-
-private:
- std::vector<vk::VkPipelineShaderStageCreateInfo> m_shaders;
-
- vk::VkPipelineVertexInputStateCreateInfo m_vertexInputState;
- vk::VkPipelineInputAssemblyStateCreateInfo m_inputAssemblyState;
- std::vector<vk::VkPipelineColorBlendAttachmentState> m_colorBlendStateAttachments;
- vk::VkPipelineColorBlendStateCreateInfo m_colorBlendState;
- vk::VkPipelineViewportStateCreateInfo m_viewportState;
- vk::VkPipelineDepthStencilStateCreateInfo m_dynamicDepthStencilState;
- vk::VkPipelineTessellationStateCreateInfo m_tessState;
- vk::VkPipelineRasterizationStateCreateInfo m_rasterState;
- vk::VkPipelineMultisampleStateCreateInfo m_multisampleState;
- vk::VkPipelineDynamicStateCreateInfo m_dynamicState;
-
- std::vector<vk::VkDynamicState> m_dynamicStates;
-
- std::vector<vk::VkViewport> m_viewports;
- std::vector<vk::VkRect2D> m_scissors;
-
- std::vector<vk::VkSampleMask> m_multisampleStateSampleMask;
-};
-
-class SamplerCreateInfo : public vk::VkSamplerCreateInfo
-{
-public:
- SamplerCreateInfo (vk::VkFilter magFilter = vk::VK_FILTER_NEAREST,
- vk::VkFilter minFilter = vk::VK_FILTER_NEAREST,
- vk::VkSamplerMipmapMode mipmapMode = vk::VK_SAMPLER_MIPMAP_MODE_NEAREST,
- vk::VkSamplerAddressMode addressU = vk::VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
- vk::VkSamplerAddressMode addressV = vk::VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
- vk::VkSamplerAddressMode addressW = vk::VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
- float mipLodBias = 0.0f,
- vk::VkBool32 anisotropyEnable = VK_FALSE,
- float maxAnisotropy = 1.0f,
- vk::VkBool32 compareEnable = false,
- vk::VkCompareOp compareOp = vk::VK_COMPARE_OP_ALWAYS,
- float minLod = 0.0f,
- float maxLod = 16.0f,
- vk::VkBorderColor borderColor = vk::VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE,
- vk::VkBool32 unnormalizedCoordinates = false);
-};
-
-} // QueryPool
-} // vkt
-
-#endif // _VKTQUERYPOOLCREATEINFOUTIL_HPP
+++ /dev/null
-/*------------------------------------------------------------------------
- * Vulkan Conformance Tests
- * ------------------------
- *
- * Copyright (c) 2015 The Khronos Group Inc.
- * Copyright (c) 2015 Intel Corporation
- *
- * 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.
- *
- *//*!
- * \file
- * \brief Image Object Util
- *//*--------------------------------------------------------------------*/
-
-#include "vktQueryPoolImageObjectUtil.hpp"
-
-#include "tcuSurface.hpp"
-#include "tcuVectorUtil.hpp"
-
-#include "vkRefUtil.hpp"
-#include "vkQueryUtil.hpp"
-#include "vkImageUtil.hpp"
-#include "vktQueryPoolCreateInfoUtil.hpp"
-#include "vktQueryPoolBufferObjectUtil.hpp"
-
-#include "tcuTextureUtil.hpp"
-
-namespace vkt
-{
-namespace QueryPool
-{
-
-void MemoryOp::pack (int pixelSize,
- int width,
- int height,
- int depth,
- vk::VkDeviceSize rowPitchOrZero,
- vk::VkDeviceSize depthPitchOrZero,
- const void * srcBuffer,
- void * destBuffer)
-{
- vk::VkDeviceSize rowPitch = rowPitchOrZero;
- vk::VkDeviceSize depthPitch = depthPitchOrZero;
-
- if (rowPitch == 0)
- rowPitch = width * pixelSize;
-
- if (depthPitch == 0)
- depthPitch = rowPitch * height;
-
- const vk::VkDeviceSize size = depthPitch * depth;
-
- const char *srcRow = reinterpret_cast<const char *>(srcBuffer);
- const char *srcStart;
- srcStart = srcRow;
- char *dstRow = reinterpret_cast<char *>(destBuffer);
- char *dstStart;
- dstStart = dstRow;
-
- if (rowPitch == static_cast<vk::VkDeviceSize>(width * pixelSize) &&
- depthPitch == static_cast<vk::VkDeviceSize>(rowPitch * height))
- {
- // fast path
- deMemcpy(dstRow, srcRow, static_cast<size_t>(size));
- }
- else
- {
- // slower, per row path
- for (int d = 0; d < depth; d++)
- {
- vk::VkDeviceSize offsetDepthDst = d * depthPitch;
- vk::VkDeviceSize offsetDepthSrc = d * (pixelSize * width * height);
- srcRow = srcStart + offsetDepthSrc;
- dstRow = dstStart + offsetDepthDst;
- for (int r = 0; r < height; ++r)
- {
- deMemcpy(dstRow, srcRow, static_cast<size_t>(rowPitch));
- srcRow += pixelSize * width;
- dstRow += rowPitch;
- }
- }
- }
-}
-
-void MemoryOp::unpack (int pixelSize,
- int width,
- int height,
- int depth,
- vk::VkDeviceSize rowPitchOrZero,
- vk::VkDeviceSize depthPitchOrZero,
- const void * srcBuffer,
- void * destBuffer)
-{
- vk::VkDeviceSize rowPitch = rowPitchOrZero;
- vk::VkDeviceSize depthPitch = depthPitchOrZero;
-
- if (rowPitch == 0)
- rowPitch = width * pixelSize;
-
- if (depthPitch == 0)
- depthPitch = rowPitch * height;
-
- const vk::VkDeviceSize size = depthPitch * depth;
-
- const char *srcRow = reinterpret_cast<const char *>(srcBuffer);
- const char *srcStart;
- srcStart = srcRow;
- char *dstRow = reinterpret_cast<char *>(destBuffer);
- char *dstStart;
- dstStart = dstRow;
-
- if (rowPitch == static_cast<vk::VkDeviceSize>(width * pixelSize) &&
- depthPitch == static_cast<vk::VkDeviceSize>(rowPitch * height))
- {
- // fast path
- deMemcpy(dstRow, srcRow, static_cast<size_t>(size));
- }
- else
- {
- // slower, per row path
- for (size_t d = 0; d < (size_t)depth; d++)
- {
- vk::VkDeviceSize offsetDepthDst = d * (pixelSize * width * height);
- vk::VkDeviceSize offsetDepthSrc = d * depthPitch;
- srcRow = srcStart + offsetDepthSrc;
- dstRow = dstStart + offsetDepthDst;
- for (int r = 0; r < height; ++r)
- {
- deMemcpy(dstRow, srcRow, static_cast<size_t>(pixelSize * width));
- srcRow += rowPitch;
- dstRow += pixelSize * width;
- }
- }
- }
-}
-
-Image::Image (const vk::DeviceInterface& vk,
- vk::VkDevice device,
- vk::VkFormat format,
- const vk::VkExtent3D& extend,
- deUint32 levelCount,
- deUint32 layerCount,
- vk::Move<vk::VkImage> object_)
- : m_allocation (DE_NULL)
- , m_object (object_)
- , m_format (format)
- , m_extent (extend)
- , m_levelCount (levelCount)
- , m_layerCount (layerCount)
- , m_vk(vk)
- , m_device(device)
-{
-}
-
-tcu::ConstPixelBufferAccess Image::readVolume (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- m_pixelAccessData.resize(width * height * depth * vk::mapVkFormat(m_format).getPixelSize());
- deMemset(m_pixelAccessData.data(), 0, m_pixelAccessData.size());
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR_BIT)
- {
- read(queue, allocator, layout, offset, width, height, depth, mipLevel, arrayElement, aspect, vk::VK_IMAGE_TYPE_3D,
- m_pixelAccessData.data());
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT || aspect == vk::VK_IMAGE_ASPECT_STENCIL_BIT)
- {
- readUsingBuffer(queue, allocator, layout, offset, width, height, depth, mipLevel, arrayElement, aspect, m_pixelAccessData.data());
- }
- return tcu::ConstPixelBufferAccess(vk::mapVkFormat(m_format), width, height, depth, m_pixelAccessData.data());
-}
-
-tcu::ConstPixelBufferAccess Image::readSurface1D(vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- m_pixelAccessData.resize(width * vk::mapVkFormat(m_format).getPixelSize());
- deMemset(m_pixelAccessData.data(), 0, m_pixelAccessData.size());
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR_BIT)
- {
- read(queue, allocator, layout, offset, width, 1, 1, mipLevel, arrayElement, aspect, vk::VK_IMAGE_TYPE_1D,
- m_pixelAccessData.data());
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT || aspect == vk::VK_IMAGE_ASPECT_STENCIL_BIT)
- {
- readUsingBuffer(queue, allocator, layout, offset, width, 1, 1, mipLevel, arrayElement, aspect,
- m_pixelAccessData.data());
- }
- return tcu::ConstPixelBufferAccess(vk::mapVkFormat(m_format), width, 1, 1, m_pixelAccessData.data());
-}
-
-void Image::read (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- vk::VkImageType type,
- void * data)
-{
- DE_ASSERT(layout == vk::VK_IMAGE_LAYOUT_GENERAL || layout == vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
-
- de::SharedPtr<Image> stagingResource = copyToLinearImage(queue, allocator, layout, offset, width,
- height, depth, mipLevel, arrayElement, aspect, type);
- const vk::VkOffset3D zeroOffset = {0, 0, 0};
- stagingResource->readLinear(zeroOffset, width, height, depth, 0, 0, aspect, data);
-}
-
-void Image::readUsingBuffer (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- void * data)
-{
- DE_ASSERT(layout == vk::VK_IMAGE_LAYOUT_GENERAL || layout == vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);;
-
- de::SharedPtr<Buffer> stagingResource;
-
- bool isCombinedType = isCombinedDepthStencilType(vk::mapVkFormat(m_format).type);
- vk::VkDeviceSize bufferSize = 0;
-
- if (!isCombinedType)
- bufferSize = vk::mapVkFormat(m_format).getPixelSize() * width * height * depth;
-
- if (isCombinedType)
- {
- int pixelSize = 0;
- switch (m_format)
- {
- case vk::VK_FORMAT_D16_UNORM_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 2 : 1;
- break;
- case vk::VK_FORMAT_D32_SFLOAT_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 4 : 1;
- break;
- case vk::VK_FORMAT_X8_D24_UNORM_PACK32:
- case vk::VK_FORMAT_D24_UNORM_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 3 : 1;
- break;
-
- default:
- DE_FATAL("Not implemented");
- }
- bufferSize = pixelSize*width*height*depth;
- }
-
- BufferCreateInfo stagingBufferResourceCreateInfo(bufferSize, vk::VK_BUFFER_USAGE_TRANSFER_DST_BIT | vk::VK_BUFFER_USAGE_TRANSFER_SRC_BIT);
- stagingResource = Buffer::createAndAlloc(m_vk, m_device, stagingBufferResourceCreateInfo, allocator, vk::MemoryRequirement::HostVisible);
-
- {
- //todo [scygan] get proper queueFamilyIndex
- CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
- vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
-
- const vk::VkCommandBufferAllocateInfo cmdBufferAllocateInfo =
- {
- vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- *copyCmdPool, // VkCommandPool commandPool;
- vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCommandBufferLevel level;
- 1u, // deUint32 bufferCount;
- };
- vk::Unique<vk::VkCommandBuffer> copyCmdBuffer(vk::allocateCommandBuffer(m_vk, m_device, &cmdBufferAllocateInfo));
-
- CmdBufferBeginInfo beginInfo;
- VK_CHECK(m_vk.beginCommandBuffer(*copyCmdBuffer, &beginInfo));
-
- if (layout == vk::VK_IMAGE_LAYOUT_UNDEFINED)
- {
- layout = vk::VK_IMAGE_LAYOUT_GENERAL;
-
- vk::VkImageMemoryBarrier barrier;
- barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- barrier.pNext = DE_NULL;
- barrier.srcAccessMask = 0;
- barrier.dstAccessMask = 0;
- barrier.oldLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED;
- barrier.newLayout = vk::VK_IMAGE_LAYOUT_GENERAL;
- barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.image = object();
-
- barrier.subresourceRange.aspectMask = aspect;
- barrier.subresourceRange.baseMipLevel = 0;
- barrier.subresourceRange.levelCount = m_levelCount;
- barrier.subresourceRange.baseArrayLayer = 0;
- barrier.subresourceRange.layerCount = m_layerCount;
-
- m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, (vk::VkDependencyFlags)0,
- 0, (const vk::VkMemoryBarrier*)DE_NULL,
- 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
- 1, &barrier);
- }
-
- const vk::VkBufferImageCopy region =
- {
- 0, 0, 0,
- { (vk::VkImageAspectFlags)aspect, mipLevel, arrayElement, 1 },
- offset,
- { (deUint32)width, (deUint32)height, (deUint32)depth }
- };
-
- m_vk.cmdCopyImageToBuffer(*copyCmdBuffer, object(), layout, stagingResource->object(), 1, ®ion);
- VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
-
- const vk::VkSubmitInfo submitInfo =
- {
- vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- (const vk::VkPipelineStageFlags*)DE_NULL,
- 1, // deUint32 commandBufferCount;
- ©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
- DE_NULL // const VkSemaphore* pSignalSemaphores;
- };
- m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-
- // TODO: make this less intrusive
- VK_CHECK(m_vk.queueWaitIdle(queue));
- }
-
- char* destPtr = reinterpret_cast<char*>(stagingResource->getBoundMemory().getHostPtr());
- deMemcpy(data, destPtr, static_cast<size_t>(bufferSize));
-}
-
-tcu::ConstPixelBufferAccess Image::readSurfaceLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- m_pixelAccessData.resize(width * height * vk::mapVkFormat(m_format).getPixelSize());
- readLinear(offset, width, height, depth, mipLevel, arrayElement, aspect, m_pixelAccessData.data());
- return tcu::ConstPixelBufferAccess(vk::mapVkFormat(m_format), width, height, 1, m_pixelAccessData.data());
-}
-
-void Image::readLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- void * data)
-{
- vk::VkImageSubresource imageSubResource = { (vk::VkImageAspectFlags)aspect, mipLevel, arrayElement };
-
- vk::VkSubresourceLayout imageLayout;
- deMemset(&imageLayout, 0, sizeof(imageLayout));
-
- m_vk.getImageSubresourceLayout(m_device, object(), &imageSubResource, &imageLayout);
-
- const char* srcPtr = reinterpret_cast<const char*>(getBoundMemory().getHostPtr());
- srcPtr += imageLayout.offset + getPixelOffset(offset, imageLayout.rowPitch, imageLayout.depthPitch, mipLevel, arrayElement);
-
- MemoryOp::unpack(vk::mapVkFormat(m_format).getPixelSize(), width, height, depth,
- imageLayout.rowPitch, imageLayout.depthPitch, srcPtr, data);
-}
-
-de::SharedPtr<Image> Image::copyToLinearImage (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- vk::VkImageType type)
-{
- de::SharedPtr<Image> stagingResource;
- {
- vk::VkExtent3D stagingExtent = {(deUint32)width, (deUint32)height, (deUint32)depth};
- ImageCreateInfo stagingResourceCreateInfo(type, m_format, stagingExtent, 1, 1, vk::VK_SAMPLE_COUNT_1_BIT,
- vk::VK_IMAGE_TILING_LINEAR, vk::VK_IMAGE_USAGE_TRANSFER_DST_BIT);
-
- stagingResource = Image::createAndAlloc(m_vk, m_device, stagingResourceCreateInfo, allocator,
- vk::MemoryRequirement::HostVisible);
-
- //todo [scygan] get proper queueFamilyIndex
- CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
- vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
-
- const vk::VkCommandBufferAllocateInfo cmdBufferAllocateInfo =
- {
- vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- *copyCmdPool, // VkCommandPool commandPool;
- vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCommandBufferLevel level;
- 1u, // deUint32 bufferCount;
- };
- vk::Unique<vk::VkCommandBuffer> copyCmdBuffer(vk::allocateCommandBuffer(m_vk, m_device, &cmdBufferAllocateInfo));
-
- CmdBufferBeginInfo beginInfo;
- VK_CHECK(m_vk.beginCommandBuffer(*copyCmdBuffer, &beginInfo));
-
- transition2DImage(m_vk, *copyCmdBuffer, stagingResource->object(), aspect, vk::VK_IMAGE_LAYOUT_UNDEFINED, vk::VK_IMAGE_LAYOUT_GENERAL, 0, vk::VK_ACCESS_TRANSFER_WRITE_BIT);
-
- const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
- vk::VkImageCopy region = { { (vk::VkImageAspectFlags)aspect, mipLevel, arrayElement, 1}, offset, { (vk::VkImageAspectFlags)aspect, 0, 0, 1}, zeroOffset, {(deUint32)width, (deUint32)height, (deUint32)depth} };
-
- m_vk.cmdCopyImage(*copyCmdBuffer, object(), layout, stagingResource->object(), vk::VK_IMAGE_LAYOUT_GENERAL, 1, ®ion);
- VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
-
- const vk::VkSubmitInfo submitInfo =
- {
- vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- (const vk::VkPipelineStageFlags*)DE_NULL,
- 1, // deUint32 commandBufferCount;
- ©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
- DE_NULL // const VkSemaphore* pSignalSemaphores;
- };
- m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-
- // TODO: make this less intrusive
- VK_CHECK(m_vk.queueWaitIdle(queue));
- }
- return stagingResource;
-}
-
-void Image::uploadVolume(const tcu::ConstPixelBufferAccess& access,
- vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR_BIT)
- {
- upload(queue, allocator, layout, offset, access.getWidth(),
- access.getHeight(), access.getDepth(), mipLevel, arrayElement, aspect, vk::VK_IMAGE_TYPE_3D,
- access.getDataPtr());
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT || aspect == vk::VK_IMAGE_ASPECT_STENCIL_BIT)
- {
- uploadUsingBuffer(queue, allocator, layout, offset, access.getWidth(),
- access.getHeight(), access.getDepth(), mipLevel, arrayElement, aspect, access.getDataPtr());
- }
-}
-
-void Image::uploadSurface (const tcu::ConstPixelBufferAccess& access,
- vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR_BIT)
- {
- upload(queue, allocator, layout, offset, access.getWidth(),
- access.getHeight(), access.getDepth(), mipLevel, arrayElement, aspect, vk::VK_IMAGE_TYPE_2D,
- access.getDataPtr());
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT || aspect == vk::VK_IMAGE_ASPECT_STENCIL_BIT)
- {
- uploadUsingBuffer(queue, allocator, layout, offset, access.getWidth(),
- access.getHeight(), access.getDepth(), mipLevel, arrayElement, aspect, access.getDataPtr());
- }
-}
-
-void Image::uploadSurface1D (const tcu::ConstPixelBufferAccess& access,
- vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR_BIT)
- {
- upload(queue, allocator, layout, offset, access.getWidth(),
- access.getHeight(), access.getDepth(), mipLevel, arrayElement, aspect, vk::VK_IMAGE_TYPE_1D,
- access.getDataPtr());
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT || aspect == vk::VK_IMAGE_ASPECT_STENCIL_BIT)
- {
- uploadUsingBuffer(queue, allocator, layout, offset, access.getWidth(),
- access.getHeight(), access.getDepth(), mipLevel, arrayElement, aspect, access.getDataPtr());
- }
-}
-
-void Image::uploadSurfaceLinear (const tcu::ConstPixelBufferAccess& access,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
-{
- uploadLinear(offset, width, height, depth, mipLevel, arrayElement, aspect, access.getDataPtr());
-}
-
-void Image::upload (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- vk::VkImageType type,
- const void * data)
-{
- DE_ASSERT(layout == vk::VK_IMAGE_LAYOUT_GENERAL || layout == vk::VK_IMAGE_LAYOUT_UNDEFINED || layout == vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
-
- de::SharedPtr<Image> stagingResource;
- vk::VkExtent3D extent = {(deUint32)width, (deUint32)height, (deUint32)depth};
- ImageCreateInfo stagingResourceCreateInfo(
- type, m_format, extent, 1, 1, vk::VK_SAMPLE_COUNT_1_BIT,
- vk::VK_IMAGE_TILING_LINEAR, vk::VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
-
- stagingResource = Image::createAndAlloc(m_vk, m_device, stagingResourceCreateInfo, allocator,
- vk::MemoryRequirement::HostVisible);
-
- const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
- stagingResource->uploadLinear(zeroOffset, width, height, depth, 0, 0, aspect, data);
-
- {
- //todo [scygan] get proper queueFamilyIndex
- CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
- vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
-
- const vk::VkCommandBufferAllocateInfo cmdBufferAllocateInfo =
- {
- vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- *copyCmdPool, // VkCommandPool commandPool;
- vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCommandBufferLevel level;
- 1u, // deUint32 bufferCount;
- };
-
- vk::Unique<vk::VkCommandBuffer> copyCmdBuffer(vk::allocateCommandBuffer(m_vk, m_device, &cmdBufferAllocateInfo));
-
- CmdBufferBeginInfo beginInfo;
- VK_CHECK(m_vk.beginCommandBuffer(*copyCmdBuffer, &beginInfo));
-
- if (layout == vk::VK_IMAGE_LAYOUT_UNDEFINED)
- {
- layout = vk::VK_IMAGE_LAYOUT_GENERAL;
-
- vk::VkImageMemoryBarrier barrier;
- barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- barrier.pNext = DE_NULL;
- barrier.srcAccessMask = 0;
- barrier.dstAccessMask = 0;
- barrier.oldLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED;
- barrier.newLayout = vk::VK_IMAGE_LAYOUT_GENERAL;
- barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.image = object();
-
- barrier.subresourceRange.aspectMask = aspect;
- barrier.subresourceRange.baseMipLevel = 0;
- barrier.subresourceRange.levelCount = m_levelCount;
- barrier.subresourceRange.baseArrayLayer = 0;
- barrier.subresourceRange.layerCount = m_layerCount;
-
- m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, (vk::VkDependencyFlags)0,
- 0, (const vk::VkMemoryBarrier*)DE_NULL,
- 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
- 1, &barrier);
- }
-
- transition2DImage(m_vk, *copyCmdBuffer, stagingResource->object(), aspect, vk::VK_IMAGE_LAYOUT_UNDEFINED, vk::VK_IMAGE_LAYOUT_GENERAL);
-
- vk::VkImageCopy region = {{(vk::VkImageAspectFlags)aspect, 0, 0, 1},
- zeroOffset,
- {(vk::VkImageAspectFlags)aspect, mipLevel, arrayElement, 1},
- offset,
- {(deUint32)width, (deUint32)height, (deUint32)depth}};
-
- m_vk.cmdCopyImage(*copyCmdBuffer, stagingResource->object(),
- vk::VK_IMAGE_LAYOUT_GENERAL, object(), layout, 1, ®ion);
- VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
-
- const vk::VkSubmitInfo submitInfo =
- {
- vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- (const vk::VkPipelineStageFlags*)DE_NULL,
- 1, // deUint32 commandBufferCount;
- ©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
- DE_NULL // const VkSemaphore* pSignalSemaphores;
- };
- m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-
- // TODO: make this less intrusive
- VK_CHECK(m_vk.queueWaitIdle(queue));
- }
-}
-
-void Image::uploadUsingBuffer (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- const void * data)
-{
- DE_ASSERT(layout == vk::VK_IMAGE_LAYOUT_GENERAL || layout == vk::VK_IMAGE_LAYOUT_UNDEFINED || layout == vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
-
- de::SharedPtr<Buffer> stagingResource;
- bool isCombinedType = isCombinedDepthStencilType(vk::mapVkFormat(m_format).type);
- vk::VkDeviceSize bufferSize = 0;
- if (!isCombinedType)
- bufferSize = vk::mapVkFormat(m_format).getPixelSize() *width*height*depth;
- if (isCombinedType)
- {
- int pixelSize = 0;
- switch (m_format)
- {
- case vk::VK_FORMAT_D16_UNORM_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 2 : 1;
- break;
- case vk::VK_FORMAT_D32_SFLOAT_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 4 : 1;
- break;
- case vk::VK_FORMAT_X8_D24_UNORM_PACK32:
- case vk::VK_FORMAT_D24_UNORM_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 3 : 1;
- break;
-
- default:
- DE_FATAL("Not implemented");
- }
- bufferSize = pixelSize*width*height*depth;
- }
- BufferCreateInfo stagingBufferResourceCreateInfo(bufferSize, vk::VK_BUFFER_USAGE_TRANSFER_DST_BIT | vk::VK_BUFFER_USAGE_TRANSFER_SRC_BIT);
- stagingResource = Buffer::createAndAlloc(m_vk, m_device, stagingBufferResourceCreateInfo, allocator, vk::MemoryRequirement::HostVisible);
- char* destPtr = reinterpret_cast<char*>(stagingResource->getBoundMemory().getHostPtr());
- deMemcpy(destPtr, data, static_cast<size_t>(bufferSize));
- vk::flushMappedMemoryRange(m_vk, m_device, stagingResource->getBoundMemory().getMemory(), stagingResource->getBoundMemory().getOffset(), bufferSize);
- {
- //todo [scygan] get proper queueFamilyIndex
- CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
- vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
-
- const vk::VkCommandBufferAllocateInfo cmdBufferAllocateInfo =
- {
- vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- *copyCmdPool, // VkCommandPool commandPool;
- vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCommandBufferLevel level;
- 1u, // deUint32 bufferCount;
- };
- vk::Unique<vk::VkCommandBuffer> copyCmdBuffer(vk::allocateCommandBuffer(m_vk, m_device, &cmdBufferAllocateInfo));
-
- CmdBufferBeginInfo beginInfo;
- VK_CHECK(m_vk.beginCommandBuffer(*copyCmdBuffer, &beginInfo));
-
- if (layout == vk::VK_IMAGE_LAYOUT_UNDEFINED)
- {
- layout = vk::VK_IMAGE_LAYOUT_GENERAL;
-
- vk::VkImageMemoryBarrier barrier;
- barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- barrier.pNext = DE_NULL;
- barrier.srcAccessMask = 0;
- barrier.dstAccessMask = 0;
- barrier.oldLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED;
- barrier.newLayout = vk::VK_IMAGE_LAYOUT_GENERAL;
- barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.image = object();
-
- barrier.subresourceRange.aspectMask = aspect;
- barrier.subresourceRange.baseMipLevel = 0;
- barrier.subresourceRange.levelCount = m_levelCount;
- barrier.subresourceRange.baseArrayLayer = 0;
- barrier.subresourceRange.layerCount = m_layerCount;
-
- m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, (vk::VkDependencyFlags)0,
- 0, (const vk::VkMemoryBarrier*)DE_NULL,
- 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
- 1, &barrier);
- }
-
- vk::VkBufferImageCopy region =
- {
- 0, 0, 0,
- { (vk::VkImageAspectFlags)aspect, mipLevel, arrayElement, 1 },
- offset,
- { (deUint32)width, (deUint32)height, (deUint32)depth }
- };
-
- m_vk.cmdCopyBufferToImage(*copyCmdBuffer, stagingResource->object(),
- object(), layout, 1, ®ion);
- VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
-
- vk::VkSubmitInfo submitInfo =
- {
- vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- (const vk::VkPipelineStageFlags*)DE_NULL,
- 1, // deUint32 commandBufferCount;
- ©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
- DE_NULL // const VkSemaphore* pSignalSemaphores;
- };
- m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-
- // TODO: make this less intrusive
- VK_CHECK(m_vk.queueWaitIdle(queue));
- }
-}
-
-void Image::uploadLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- const void * data)
-{
- vk::VkSubresourceLayout imageLayout;
-
- vk::VkImageSubresource imageSubResource = {(vk::VkImageAspectFlags)aspect, mipLevel, arrayElement};
-
- m_vk.getImageSubresourceLayout(m_device, object(), &imageSubResource,
- &imageLayout);
-
- char* destPtr = reinterpret_cast<char*>(getBoundMemory().getHostPtr());
-
- destPtr += imageLayout.offset + getPixelOffset(offset, imageLayout.rowPitch, imageLayout.depthPitch, mipLevel, arrayElement);
-
- MemoryOp::pack(vk::mapVkFormat(m_format).getPixelSize(), width, height, depth,
- imageLayout.rowPitch, imageLayout.depthPitch, data, destPtr);
-}
-
-vk::VkDeviceSize Image::getPixelOffset (vk::VkOffset3D offset,
- vk::VkDeviceSize rowPitch,
- vk::VkDeviceSize depthPitch,
- unsigned int level,
- unsigned int layer)
-{
- DE_ASSERT(level < m_levelCount);
- DE_ASSERT(layer < m_layerCount);
-
- vk::VkDeviceSize mipLevelSizes[32];
- vk::VkDeviceSize mipLevelRectSizes[32];
- tcu::IVec3 mipExtend
- = tcu::IVec3(m_extent.width, m_extent.height, m_extent.depth);
-
- vk::VkDeviceSize arrayElemSize = 0;
- for (unsigned int i = 0; i < m_levelCount && (mipExtend[0] > 1 || mipExtend[1] > 1 || mipExtend[2] > 1); ++i)
- {
- // Rect size is just a 3D image size;
- mipLevelSizes[i] = mipExtend[2] * depthPitch;
-
- arrayElemSize += mipLevelSizes[0];
-
- mipExtend = tcu::max(mipExtend / 2, tcu::IVec3(1));
- }
-
- vk::VkDeviceSize pixelOffset = layer * arrayElemSize;
- for (size_t i = 0; i < level; ++i)
- {
- pixelOffset += mipLevelSizes[i];
- }
- pixelOffset += offset.z * mipLevelRectSizes[level];
- pixelOffset += offset.y * rowPitch;
- pixelOffset += offset.x;
-
- return pixelOffset;
-}
-
-void Image::bindMemory (de::MovePtr<vk::Allocation> allocation)
-{
- DE_ASSERT(allocation);
- VK_CHECK(m_vk.bindImageMemory(m_device, *m_object, allocation->getMemory(), allocation->getOffset()));
-
- DE_ASSERT(!m_allocation);
- m_allocation = allocation;
-}
-
-de::SharedPtr<Image> Image::createAndAlloc(const vk::DeviceInterface& vk,
- vk::VkDevice device,
- const vk::VkImageCreateInfo& createInfo,
- vk::Allocator& allocator,
- vk::MemoryRequirement memoryRequirement)
-{
- de::SharedPtr<Image> ret = create(vk, device, createInfo);
-
- vk::VkMemoryRequirements imageRequirements = vk::getImageMemoryRequirements(vk, device, ret->object());
- ret->bindMemory(allocator.allocate(imageRequirements, memoryRequirement));
- return ret;
-}
-
-de::SharedPtr<Image> Image::create(const vk::DeviceInterface& vk,
- vk::VkDevice device,
- const vk::VkImageCreateInfo &createInfo)
-{
- return de::SharedPtr<Image>(new Image(vk, device, createInfo.format, createInfo.extent,
- createInfo.mipLevels, createInfo.arrayLayers,
- vk::createImage(vk, device, &createInfo)));
-}
-
-void transition2DImage (const vk::DeviceInterface& vk,
- vk::VkCommandBuffer cmdBuffer,
- vk::VkImage image,
- vk::VkImageAspectFlags aspectMask,
- vk::VkImageLayout oldLayout,
- vk::VkImageLayout newLayout,
- vk::VkAccessFlags srcAccessMask,
- vk::VkAccessFlags dstAccessMask)
-{
- vk::VkImageMemoryBarrier barrier;
- barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- barrier.pNext = DE_NULL;
- barrier.srcAccessMask = srcAccessMask;
- barrier.dstAccessMask = dstAccessMask;
- barrier.oldLayout = oldLayout;
- barrier.newLayout = newLayout;
- barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.image = image;
- barrier.subresourceRange.aspectMask = aspectMask;
- barrier.subresourceRange.baseMipLevel = 0;
- barrier.subresourceRange.levelCount = 1;
- barrier.subresourceRange.baseArrayLayer = 0;
- barrier.subresourceRange.layerCount = 1;
-
- vk.cmdPipelineBarrier(cmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, (vk::VkDependencyFlags)0,
- 0, (const vk::VkMemoryBarrier*)DE_NULL,
- 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
- 1, &barrier);
-}
-
-void initialTransitionColor2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout)
-{
- transition2DImage(vk, cmdBuffer, image, vk::VK_IMAGE_ASPECT_COLOR_BIT, vk::VK_IMAGE_LAYOUT_UNDEFINED, layout);
-}
-
-void initialTransitionDepth2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout)
-{
- transition2DImage(vk, cmdBuffer, image, vk::VK_IMAGE_ASPECT_DEPTH_BIT, vk::VK_IMAGE_LAYOUT_UNDEFINED, layout);
-}
-
-void initialTransitionStencil2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout)
-{
- transition2DImage(vk, cmdBuffer, image, vk::VK_IMAGE_ASPECT_STENCIL_BIT, vk::VK_IMAGE_LAYOUT_UNDEFINED, layout);
-}
-
-void initialTransitionDepthStencil2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout)
-{
- transition2DImage(vk, cmdBuffer, image, vk::VK_IMAGE_ASPECT_DEPTH_BIT | vk::VK_IMAGE_ASPECT_STENCIL_BIT, vk::VK_IMAGE_LAYOUT_UNDEFINED, layout);
-}
-
-} // QueryPool
-} // vkt
+++ /dev/null
-#ifndef _VKTQUERYPOOLIMAGEOBJECTUTIL_HPP
-#define _VKTQUERYPOOLIMAGEOBJECTUTIL_HPP
-/*------------------------------------------------------------------------
- * Vulkan Conformance Tests
- * ------------------------
- *
- * Copyright (c) 2015 The Khronos Group Inc.
- * Copyright (c) 2015 Intel Corporation
- *
- * 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.
- *
- *//*!
- * \file
- * \brief Image Object Util
- *//*--------------------------------------------------------------------*/
-
-#include "vkMemUtil.hpp"
-#include "vkRefUtil.hpp"
-
-#include "deSharedPtr.hpp"
-
-#include "tcuTexture.hpp"
-
-namespace vkt
-{
-namespace QueryPool
-{
-
-class MemoryOp
-{
-public:
- static void pack (int pixelSize,
- int width,
- int height,
- int depth,
- vk::VkDeviceSize rowPitchOrZero,
- vk::VkDeviceSize depthPitchOrZero,
- const void * srcBuffer,
- void * destBuffer);
-
- static void unpack (int pixelSize,
- int width,
- int height,
- int depth,
- vk::VkDeviceSize rowPitchOrZero,
- vk::VkDeviceSize depthPitchOrZero,
- const void * srcBuffer,
- void * destBuffer);
-};
-
-class Image
-{
-public:
- static de::SharedPtr<Image> create (const vk::DeviceInterface& vk, vk::VkDevice device, const vk::VkImageCreateInfo& createInfo);
-
- static de::SharedPtr<Image> createAndAlloc (const vk::DeviceInterface& vk,
- vk::VkDevice device,
- const vk::VkImageCreateInfo& createInfo,
- vk::Allocator& allocator,
- vk::MemoryRequirement memoryRequirement = vk::MemoryRequirement::Any);
-
- tcu::ConstPixelBufferAccess readSurface1D (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- tcu::ConstPixelBufferAccess readVolume (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- tcu::ConstPixelBufferAccess readSurfaceLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- void read (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- vk::VkImageType type,
- void * data);
-
- void readUsingBuffer (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- void * data);
-
- void readLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- void * data);
-
- void uploadVolume (const tcu::ConstPixelBufferAccess& access,
- vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- void uploadSurface (const tcu::ConstPixelBufferAccess& access,
- vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- void uploadSurface1D (const tcu::ConstPixelBufferAccess& access,
- vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- void uploadSurfaceLinear (const tcu::ConstPixelBufferAccess& access,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspectFlagBits aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
- void upload (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- vk::VkImageType type,
- const void * data);
-
- void uploadUsingBuffer (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- const void * data);
-
- void uploadLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- const void * data);
-
- de::SharedPtr<Image> copyToLinearImage (vk::VkQueue queue,
- vk::Allocator& allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspectFlagBits aspect,
- vk::VkImageType type);
-
- const vk::VkFormat& getFormat (void) const { return m_format; }
- vk::VkImage object (void) const { return *m_object; }
- void bindMemory (de::MovePtr<vk::Allocation> allocation);
- vk::Allocation getBoundMemory (void) const { return *m_allocation; }
-
-private:
- vk::VkDeviceSize getPixelOffset (vk::VkOffset3D offset,
- vk::VkDeviceSize rowPitch,
- vk::VkDeviceSize depthPitch,
- unsigned int mipLevel,
- unsigned int arrayElement);
-
- Image (const vk::DeviceInterface& vk,
- vk::VkDevice device,
- vk::VkFormat format,
- const vk::VkExtent3D& extend,
- deUint32 levelCount,
- deUint32 layerCount,
- vk::Move<vk::VkImage> object);
-
- Image (const Image& other); // Not allowed!
- Image& operator= (const Image& other); // Not allowed!
-
- de::MovePtr<vk::Allocation> m_allocation;
- vk::Unique<vk::VkImage> m_object;
-
- vk::VkFormat m_format;
- vk::VkExtent3D m_extent;
- deUint32 m_levelCount;
- deUint32 m_layerCount;
-
- std::vector<deUint8> m_pixelAccessData;
-
- const vk::DeviceInterface& m_vk;
- vk::VkDevice m_device;
-};
-
-void transition2DImage (const vk::DeviceInterface& vk,
- vk::VkCommandBuffer cmdBuffer,
- vk::VkImage image,
- vk::VkImageAspectFlags aspectMask,
- vk::VkImageLayout oldLayout,
- vk::VkImageLayout newLayout,
- vk::VkAccessFlags srcAccessMask = 0,
- vk::VkAccessFlags dstAccessMask = 0);
-
-void initialTransitionColor2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-
-void initialTransitionDepth2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-
-void initialTransitionStencil2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-
-void initialTransitionDepthStencil2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-
-} //QueryPool
-} //vkt
-
-#endif // _VKTQUERYPOOLIMAGEOBJECTUTIL_HPP
#include "vktTestCase.hpp"
-#include "vktQueryPoolImageObjectUtil.hpp"
-#include "vktQueryPoolBufferObjectUtil.hpp"
-#include "vktQueryPoolCreateInfoUtil.hpp"
+#include "vktDrawImageObjectUtil.hpp"
+#include "vktDrawBufferObjectUtil.hpp"
+#include "vktDrawCreateInfoUtil.hpp"
#include "vkBuilderUtil.hpp"
#include "vkRefUtil.hpp"
#include "vkPrograms.hpp"
#include "tcuImageCompare.hpp"
#include "tcuCommandLine.hpp"
-using namespace vkt::QueryPool;
+namespace vkt
+{
+
+namespace QueryPool
+{
+
+using namespace Draw;
namespace
{
} //anonymous
-namespace vkt
-{
-
-namespace QueryPool
-{
-
QueryPoolOcclusionTests::QueryPoolOcclusionTests (tcu::TestContext &testCtx)
: TestCaseGroup(testCtx, "occlusion_query", "Tests for occlusion queries")
{