+++ /dev/null
-#ifndef _VKT_DYNAMIC_STATE_IMAGEOBJECTUTIL_HPP
-#define _VKT_DYNAMIC_STATE_IMAGEOBJECTUTIL_HPP
-/*------------------------------------------------------------------------
- * Vulkan Conformance Tests
- * ------------------------
- *
- * Copyright (c) 2015 The Khronos Group Inc.
- * Copyright (c) 2015 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and/or associated documentation files (the
- * "Materials"), to deal in the Materials without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Materials, and to
- * permit persons to whom the Materials are furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice(s) and this permission notice shall be included
- * in all copies or substantial portions of the Materials.
- *
- * The Materials are Confidential Information as defined by the
- * Khronos Membership Agreement until designated non-confidential by Khronos,
- * at which point this condition clause shall be removed.
- *
- * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
- *
- *//*!
- * \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 rowPitch,
- vk::VkDeviceSize depthPitch,
- const void * srcBuffer,
- void * destBuffer);
-
- static void unpack (int pixelSize,
- int width,
- int height,
- int depth,
- vk::VkDeviceSize rowPitch,
- vk::VkDeviceSize depthPitch,
- 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::VkImageAspect 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::VkImageAspect 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::VkImageAspect aspect,
- unsigned int mipLevel = 0,
- unsigned int arrayElement = 0);
-
-
- tcu::ConstPixelBufferAccess readSurfaceLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspect 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::VkImageAspect 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::VkImageAspect aspect,
- void * data);
-
- void readLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspect aspect,
- void * data);
-
- void uploadVolume (const tcu::ConstPixelBufferAccess &access,
- vk::VkQueue queue,
- vk::Allocator &allocator,
- vk::VkImageLayout layout,
- vk::VkOffset3D offset,
- vk::VkImageAspect 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::VkImageAspect 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::VkImageAspect 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::VkImageAspect 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::VkImageAspect 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::VkImageAspect aspect,
- const void * data);
-
- void uploadLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- unsigned int mipLevel,
- unsigned int arrayElement,
- vk::VkImageAspect 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::VkImageAspect aspect,
- vk::VkImageType type);
-
- inline const vk::VkFormat & getFormat (void) const
- {
- return m_format;
- }
-
- inline vk::VkImage object (void) const { return *m_object; }
-
- void bindMemory (de::MovePtr<vk::Allocation> allocation);
-
- inline 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 mipLevels,
- deUint32 arraySize,
- 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_mipLevels;
- deUint32 m_arraySize;
-
- std::vector<deUint8> m_pixelAccessData;
-
- const vk::DeviceInterface &m_vk;
- vk::VkDevice m_device;
-};
-
-void transition2DImage (const vk::DeviceInterface &vk, vk::VkCmdBuffer cmdBuffer, vk::VkImage image, vk::VkImageAspectFlags aspectMask, vk::VkImageLayout oldLayout, vk::VkImageLayout newLayout);
-
-void initialTransitionColor2DImage (const vk::DeviceInterface &vk, vk::VkCmdBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-
-void initialTransitionDepth2DImage (const vk::DeviceInterface &vk, vk::VkCmdBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-
-void initialTransitionStencil2DImage (const vk::DeviceInterface &vk, vk::VkCmdBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-
-void initialTransitionDepthStencil2DImage (const vk::DeviceInterface &vk, vk::VkCmdBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-
-} //DynamicState
-} //vkt
-
-#endif // _VKT_DYNAMIC_STATE_IMAGEOBJECTUTIL_HPP
#include "vkRefUtil.hpp"
#include "vkImageUtil.hpp"
+#include "vktDynamicStateCreateInfoUtil.hpp"
#include "vktDynamicStateImageObjectUtil.hpp"
#include "vktDynamicStateBufferObjectUtil.hpp"
-#include "vktDynamicStateCreateInfoUtil.hpp"
#include "vkPrograms.hpp"
namespace vkt
tcu::Vec4 position;
tcu::Vec4 color;
};
-
-vk::Move<vk::VkShader> createShader(const vk::DeviceInterface &vk, const vk::VkDevice device,
- const vk::VkShaderModule module, const char* name, vk::VkShaderStage stage);
class DynamicStateBaseClass : public TestInstance
{
PipelineCreateInfo::VertexInputState m_vertexInputState;
de::SharedPtr<Buffer> m_vertexBuffer;
- vk::Move<vk::VkCmdPool> m_cmdPool;
- vk::Move<vk::VkCmdBuffer> m_cmdBuffer;
+ vk::Move<vk::VkCommandPool> m_cmdPool;
+ vk::Move<vk::VkCommandBuffer> m_cmdBuffer;
vk::Move<vk::VkFramebuffer> m_framebuffer;
vk::Move<vk::VkRenderPass> m_renderPass;
m_pipelineLayout = vk::createPipelineLayout(m_vk, device, &pipelineLayoutCreateInfo);
const vk::VkExtent3D targetImageExtent = { WIDTH, HEIGHT, 1 };
- const ImageCreateInfo targetImageCreateInfo(vk::VK_IMAGE_TYPE_2D, m_colorAttachmentFormat, targetImageExtent, 1, 1, 1,
- vk::VK_IMAGE_TILING_OPTIMAL, vk::VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | vk::VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT);
+ const ImageCreateInfo targetImageCreateInfo(vk::VK_IMAGE_TYPE_2D, m_colorAttachmentFormat, targetImageExtent, 1, 1, vk::VK_SAMPLE_COUNT_1_BIT,
+ vk::VK_IMAGE_TILING_OPTIMAL, vk::VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | vk::VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
- m_colorTargetImage = Image::CreateAndAlloc(m_vk, device, targetImageCreateInfo, m_context.getDefaultAllocator());
+ m_colorTargetImage = Image::createAndAlloc(m_vk, device, targetImageCreateInfo, m_context.getDefaultAllocator());
const ImageViewCreateInfo colorTargetViewInfo(m_colorTargetImage->object(), vk::VK_IMAGE_VIEW_TYPE_2D, m_colorAttachmentFormat);
m_colorTargetView = vk::createImageView(m_vk, device, &colorTargetViewInfo);
RenderPassCreateInfo renderPassCreateInfo;
renderPassCreateInfo.addAttachment(AttachmentDescription(
m_colorAttachmentFormat,
- 1,
+ vk::VK_SAMPLE_COUNT_1_BIT,
vk::VK_ATTACHMENT_LOAD_OP_LOAD,
vk::VK_ATTACHMENT_STORE_OP_STORE,
vk::VK_ATTACHMENT_LOAD_OP_DONT_CARE,
{
0,
sizeof(tcu::Vec4) * 2,
- vk::VK_VERTEX_INPUT_STEP_RATE_VERTEX,
+ vk::VK_VERTEX_INPUT_RATE_VERTEX,
};
const vk::VkVertexInputAttributeDescription vertexInputAttributeDescriptions[2] =
vertexInputAttributeDescriptions);
const vk::VkDeviceSize dataSize = m_data.size() * sizeof(Vec4RGBA);
- m_vertexBuffer = Buffer::CreateAndAlloc(m_vk, device, BufferCreateInfo(dataSize,
+ m_vertexBuffer = Buffer::createAndAlloc(m_vk, device, BufferCreateInfo(dataSize,
vk::VK_BUFFER_USAGE_VERTEX_BUFFER_BIT), m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);
unsigned char *ptr = reinterpret_cast<unsigned char *>(m_vertexBuffer->getBoundMemory().getHostPtr());
const CmdPoolCreateInfo cmdPoolCreateInfo(queueFamilyIndex);
m_cmdPool = vk::createCommandPool(m_vk, device, &cmdPoolCreateInfo);
- const CmdBufferCreateInfo cmdBufCreateInfo(*m_cmdPool, vk::VK_CMD_BUFFER_LEVEL_PRIMARY, 0);
- m_cmdBuffer = vk::createCommandBuffer(m_vk, device, &cmdBufCreateInfo);
+ const vk::VkCommandBufferAllocateInfo cmdBufferAllocateInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ *m_cmdPool, // VkCommandPool commandPool;
+ vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCommandBufferLevel level;
+ 1u, // deUint32 bufferCount;
+ };
+ m_cmdBuffer = vk::allocateCommandBuffer(m_vk, device, &cmdBufferAllocateInfo);
initPipeline(device);
}
virtual void initPipeline (const vk::VkDevice device)
{
- const vk::Unique<vk::VkShader> vs(createShader(m_vk, device,
- *createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_vertexShaderName), 0),
- "main", vk::VK_SHADER_STAGE_VERTEX));
-
- const vk::Unique<vk::VkShader> fs(createShader(m_vk, device,
- *createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_fragmentShaderName), 0),
- "main", vk::VK_SHADER_STAGE_FRAGMENT));
+ const vk::Unique<vk::VkShaderModule> vs(createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_vertexShaderName), 0));
+ const vk::Unique<vk::VkShaderModule> fs(createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_fragmentShaderName), 0));
const PipelineCreateInfo::ColorBlendState::Attachment vkCbAttachmentState;
PipelineCreateInfo pipelineCreateInfo(*m_pipelineLayout, *m_renderPass, 0, 0);
- pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, vk::VK_SHADER_STAGE_VERTEX));
- pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, vk::VK_SHADER_STAGE_FRAGMENT));
+ pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, "main", vk::VK_SHADER_STAGE_VERTEX_BIT));
+ pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, "main", vk::VK_SHADER_STAGE_FRAGMENT_BIT));
pipelineCreateInfo.addState(PipelineCreateInfo::VertexInputState(m_vertexInputState));
pipelineCreateInfo.addState(PipelineCreateInfo::InputAssemblerState(m_topology));
pipelineCreateInfo.addState(PipelineCreateInfo::ColorBlendState(1, &vkCbAttachmentState));
const vk::VkRect2D renderArea = { { 0, 0 }, { WIDTH, HEIGHT } };
const RenderPassBeginInfo renderPassBegin(*m_renderPass, *m_framebuffer, renderArea);
- m_vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBegin, vk::VK_RENDER_PASS_CONTENTS_INLINE);
+ m_vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBegin, vk::VK_SUBPASS_CONTENTS_INLINE);
}
void setDynamicViewportState (const deUint32 width, const deUint32 height)
{
vk::VkViewport viewport;
- viewport.originX = 0;
- viewport.originY = 0;
+ viewport.x = 0;
+ viewport.y = 0;
viewport.width = static_cast<float>(width);
viewport.height = static_cast<float>(height);
viewport.minDepth = 0.0f;
m_vk.cmdSetScissor(*m_cmdBuffer, viewportCount, pScissors);
}
- void setDynamicRasterState (const float lineWidth = 1.0f,
- const float depthBias = 0.0f,
+ void setDynamicRasterizationState (const float lineWidth = 1.0f,
+ const float depthBiasConstantFactor = 0.0f,
const float depthBiasClamp = 0.0f,
- const float slopeScaledDepthBias = 0.0f)
+ const float depthBiasSlopeFactor = 0.0f)
{
m_vk.cmdSetLineWidth(*m_cmdBuffer, lineWidth);
- m_vk.cmdSetDepthBias(*m_cmdBuffer, depthBias, depthBiasClamp, slopeScaledDepthBias);
+ m_vk.cmdSetDepthBias(*m_cmdBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
}
void setDynamicBlendState (const float const1 = 0.0f, const float const2 = 0.0f,
const float const3 = 0.0f, const float const4 = 0.0f)
{
- float blendConstants[4] = { const1, const2, const3, const4 };
- m_vk.cmdSetBlendConstants(*m_cmdBuffer, blendConstants);
+ float blendConstantsants[4] = { const1, const2, const3, const4 };
+ m_vk.cmdSetBlendConstants(*m_cmdBuffer, blendConstantsants);
}
void setDynamicDepthStencilState (const float minDepthBounds = -1.0f,
void Buffer::bindMemory (de::MovePtr<vk::Allocation> allocation)
{
- if (allocation)
- {
- VK_CHECK(m_vk.bindBufferMemory(m_device, *m_object, allocation->getMemory(), allocation->getOffset()));
- }
- else
- {
- VK_CHECK(m_vk.bindBufferMemory(m_device, *m_object, DE_NULL, 0));
- }
+ 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> 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);
+ 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,
+de::SharedPtr<Buffer> Buffer::create (const vk::DeviceInterface &vk,
vk::VkDevice device,
const vk::VkBufferCreateInfo &createInfo)
{
{
public:
- static de::SharedPtr<Buffer> Create (const vk::DeviceInterface& vk, vk::VkDevice device, const vk::VkBufferCreateInfo &createInfo);
+ 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,
+ 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);
+ Buffer (const vk::DeviceInterface &vk, vk::VkDevice device, vk::Move<vk::VkBuffer> object);
- inline vk::VkBuffer object (void) const { return *m_object; }
- void bindMemory (de::MovePtr<vk::Allocation> allocation);
- inline vk::Allocation getBoundMemory (void) const { return *m_allocation; }
+ 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!
+ 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;
+ const vk::DeviceInterface& m_vk;
vk::VkDevice m_device;
};
virtual void initPipeline (const vk::VkDevice device)
{
- const vk::Unique<vk::VkShader> vs(createShader(m_vk, device,
- *createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_vertexShaderName), 0),
- "main", vk::VK_SHADER_STAGE_VERTEX));
-
- const vk::Unique<vk::VkShader> fs(createShader(m_vk, device,
- *createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_fragmentShaderName), 0),
- "main", vk::VK_SHADER_STAGE_FRAGMENT));
-
+ const vk::Unique<vk::VkShaderModule> vs (createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_vertexShaderName), 0));
+ const vk::Unique<vk::VkShaderModule> fs (createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_fragmentShaderName), 0));
+
const vk::VkPipelineColorBlendAttachmentState VkPipelineColorBlendAttachmentState =
PipelineCreateInfo::ColorBlendState::Attachment(
vk::VK_TRUE,
- vk::VK_BLEND_SRC_ALPHA, vk::VK_BLEND_CONSTANT_COLOR, vk::VK_BLEND_OP_ADD,
- vk::VK_BLEND_SRC_ALPHA, vk::VK_BLEND_CONSTANT_ALPHA, vk::VK_BLEND_OP_ADD);
+ vk::VK_BLEND_FACTOR_SRC_ALPHA, vk::VK_BLEND_FACTOR_CONSTANT_COLOR, vk::VK_BLEND_OP_ADD,
+ vk::VK_BLEND_FACTOR_SRC_ALPHA, vk::VK_BLEND_FACTOR_CONSTANT_ALPHA, vk::VK_BLEND_OP_ADD);
PipelineCreateInfo pipelineCreateInfo(*m_pipelineLayout, *m_renderPass, 0, 0);
- pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, vk::VK_SHADER_STAGE_VERTEX));
- pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, vk::VK_SHADER_STAGE_FRAGMENT));
+ pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, "main", vk::VK_SHADER_STAGE_VERTEX_BIT));
+ pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, "main", vk::VK_SHADER_STAGE_FRAGMENT_BIT));
pipelineCreateInfo.addState(PipelineCreateInfo::VertexInputState(m_vertexInputState));
pipelineCreateInfo.addState(PipelineCreateInfo::InputAssemblerState(m_topology));
pipelineCreateInfo.addState(PipelineCreateInfo::ColorBlendState(1, &VkPipelineColorBlendAttachmentState));
// bind states here
setDynamicViewportState(WIDTH, HEIGHT);
- setDynamicRasterState();
+ setDynamicRasterizationState();
setDynamicDepthStencilState();
setDynamicBlendState(0.33f, 0.1f, 0.66f, 0.5f);
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
- const vk::VkCmdBuffer cmdBuffer = *m_cmdBuffer;
- VK_CHECK(m_vk.queueSubmit(queue, 1, &cmdBuffer, DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
+ DE_NULL, // const void* pNext;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
+ &m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
+ 0, // deUint32 signalSemaphoreCount;\r
+ DE_NULL // const VkSemaphore* pSignalSemaphores;\r
+ };
+ m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
VK_CHECK(m_vk.queueWaitIdle(queue));
//validation
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
- vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR);
+ vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
qpTestResult res = QP_TEST_RESULT_PASS;
namespace DynamicState
{
-ImageSubresourceRange::ImageSubresourceRange ( vk::VkImageAspectFlags _aspectMask,
- deUint32 _baseMipLevel,
- deUint32 _mipLevels,
- deUint32 _baseArrayLayer,
- deUint32 _arraySize)
+ImageSubresourceRange::ImageSubresourceRange (vk::VkImageAspectFlags _aspectMask,
+ deUint32 _baseMipLevel,
+ deUint32 _levelCount,
+ deUint32 _baseArrayLayer,
+ deUint32 _layerCount)
{
aspectMask = _aspectMask;
baseMipLevel = _baseMipLevel;
- mipLevels = _mipLevels;
+ levelCount = _levelCount;
baseArrayLayer = _baseArrayLayer;
- arraySize = _arraySize;
+ layerCount = _layerCount;
}
-ChannelMapping::ChannelMapping (vk::VkChannelSwizzle _r,
- vk::VkChannelSwizzle _g,
- vk::VkChannelSwizzle _b,
- vk::VkChannelSwizzle _a)
+ComponentMapping::ComponentMapping (vk::VkComponentSwizzle _r,
+ vk::VkComponentSwizzle _g,
+ vk::VkComponentSwizzle _b,
+ vk::VkComponentSwizzle _a)
{
r = _r;
g = _g;
a = _a;
}
-ImageViewCreateInfo::ImageViewCreateInfo ( vk::VkImage _image,
- vk::VkImageViewType _viewType,
- vk::VkFormat _format,
- const vk::VkImageSubresourceRange& _subresourceRange,
- const vk::VkChannelMapping& _channels,
- vk::VkImageViewCreateFlags _flags)
+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;
- channels.r = _channels.r;
- channels.g = _channels.g;
- channels.b = _channels.b;
- channels.a = _channels.a;
+ 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::VkChannelMapping& _channels,
- vk::VkImageViewCreateFlags _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;
- image = _image;
- viewType = _viewType;
- format = _format;
- channels.r = _channels.r;
- channels.g = _channels.g;
- channels.b = _channels.b;
- channels.a = _channels.a;
+ 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::R:\r
- case tcu::TextureFormat::A:\r
- case tcu::TextureFormat::I:\r
- case tcu::TextureFormat::L:\r
- case tcu::TextureFormat::LA:\r
- case tcu::TextureFormat::RG:\r
- case tcu::TextureFormat::RA:\r
- case tcu::TextureFormat::RGB:\r
- case tcu::TextureFormat::RGBA:\r
- case tcu::TextureFormat::ARGB:\r
- case tcu::TextureFormat::BGRA:\r
- case tcu::TextureFormat::sR:\r
- case tcu::TextureFormat::sRG:\r
- case tcu::TextureFormat::sRGB:\r
- case tcu::TextureFormat::sRGBA:
- aspectFlags = vk::VK_IMAGE_ASPECT_COLOR_BIT;
- break;
case tcu::TextureFormat::D:
aspectFlags = vk::VK_IMAGE_ASPECT_DEPTH_BIT;
break;
aspectFlags = vk::VK_IMAGE_ASPECT_STENCIL_BIT | vk::VK_IMAGE_ASPECT_DEPTH_BIT;
break;
default:
- TCU_FAIL("unhandled format");
+ aspectFlags = vk::VK_IMAGE_ASPECT_COLOR_BIT;
+ break;
}
subresourceRange = ImageSubresourceRange(aspectFlags);;
}
-BufferCreateInfo::BufferCreateInfo ( vk::VkDeviceSize _size,
- vk::VkBufferUsageFlags _usage,
- vk::VkSharingMode _sharingMode,
- deUint32 _queueFamilyCount,
- const deUint32* _pQueueFamilyIndices,
- vk::VkBufferCreateFlags _flags)
+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;
- queueFamilyCount = _queueFamilyCount;
+ size = _size;
+ usage = _usage;
+ flags = _flags;
+ sharingMode = _sharingMode;
+ queueFamilyIndexCount = _queueFamilyIndexCount;
- if (_queueFamilyCount)
+ if (_queueFamilyIndexCount)
{
m_queueFamilyIndices = std::vector<deUint32>(
- _pQueueFamilyIndices, _pQueueFamilyIndices + _queueFamilyCount);
+ _pQueueFamilyIndices, _pQueueFamilyIndices + _queueFamilyIndexCount);
pQueueFamilyIndices = &m_queueFamilyIndices[0];
- } else
+ }
+ 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;
- queueFamilyCount = other.queueFamilyCount;
+ 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() == queueFamilyCount);
+ m_queueFamilyIndices = other.m_queueFamilyIndices;
+ DE_ASSERT(m_queueFamilyIndices.size() == queueFamilyIndexCount);
if (m_queueFamilyIndices.size())
{
BufferCreateInfo & BufferCreateInfo::operator= (const BufferCreateInfo &other)
{
- sType = other.sType;
- pNext = other.pNext;
- size = other.size;
- usage = other.usage;
- flags = other.flags;
- sharingMode = other.sharingMode;
- queueFamilyCount = other.queueFamilyCount;
+ 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;
+ m_queueFamilyIndices = other.m_queueFamilyIndices;
- DE_ASSERT(m_queueFamilyIndices.size() == queueFamilyCount);
+ DE_ASSERT(m_queueFamilyIndices.size() == queueFamilyIndexCount);
if (m_queueFamilyIndices.size())
{
return *this;
}
-ImageCreateInfo::ImageCreateInfo ( vk::VkImageType _imageType,
- vk::VkFormat _format,
- vk::VkExtent3D _extent,
- deUint32 _mipLevels,
- deUint32 _arraySize,
- deUint32 _samples,
- vk::VkImageTiling _tiling,
- vk::VkImageUsageFlags _usage,
- vk::VkSharingMode _sharingMode,
- deUint32 _queueFamilyCount,
- const deUint32* _pQueueFamilyIndices,
- vk::VkImageCreateFlags _flags,
- vk::VkImageLayout _initialLayout)
-{
- if (_queueFamilyCount)
+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 + _queueFamilyCount);
+ m_queueFamilyIndices = std::vector<deUint32>(_pQueueFamilyIndices, _pQueueFamilyIndices + _queueFamilyIndexCount);
}
sType = vk::VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
pNext = DE_NULL;
- imageType = _imageType;
- format = _format;
- extent = _extent;
- mipLevels = _mipLevels;
- arraySize = _arraySize;
- samples = _samples;
- tiling = _tiling;
- usage = _usage;
- sharingMode = _sharingMode;
- queueFamilyCount = _queueFamilyCount;
+ 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 = DE_NULL;
}
-
- flags = _flags;
initialLayout = _initialLayout;
}
-FramebufferCreateInfo::FramebufferCreateInfo ( vk::VkRenderPass _renderPass,
- const std::vector<vk::VkImageView>& atachments,
- deUint32 _width,
- deUint32 _height,
- deUint32 _layers)
+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());
{
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];
pDependencies = &m_dependiencesStructs[0];
}
-RenderPassCreateInfo::RenderPassCreateInfo ( deUint32 _attachmentCount,
- const vk::VkAttachmentDescription* _pAttachments,
- deUint32 _subpassCount,
- const vk::VkSubpassDescription* _pSubpasses,
- deUint32 _dependencyCount,
- const vk::VkSubpassDependency* _pDependiences)
+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);
sType = vk::VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
pNext = DE_NULL;
+ flags = 0;
attachmentCount = static_cast<deUint32>(m_attachments.size());
pDependencies = &m_dependiencesStructs[0];
}
-RenderPassBeginInfo::RenderPassBeginInfo ( vk::VkRenderPass _renderPass,
- vk::VkFramebuffer _framebuffer,
- vk::VkRect2D _renderArea,
- const std::vector<vk::VkClearValue>& _clearValues)
+RenderPassBeginInfo::RenderPassBeginInfo (vk::VkRenderPass _renderPass,
+ vk::VkFramebuffer _framebuffer,
+ vk::VkRect2D _renderArea,
+ const std::vector<vk::VkClearValue>& _clearValues)
{
m_clearValues = _clearValues;
CmdPoolCreateInfo::CmdPoolCreateInfo (deUint32 _queueFamilyIndex, unsigned int _flags)
{
- sType = vk::VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO;
+ sType = vk::VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
pNext = DE_NULL;
queueFamilyIndex = _queueFamilyIndex;
- flags = _flags;
-}
-
-CmdBufferCreateInfo::CmdBufferCreateInfo (vk::VkCmdPool _pool, vk::VkCmdBufferLevel _level, unsigned int _flags)
-{
- sType = vk::VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO;
- pNext = DE_NULL;
- cmdPool = _pool;
- level = _level;
- flags = _flags;
+ flags = _flags;
}
-AttachmentDescription::AttachmentDescription ( vk::VkFormat _format,
- deUint32 _samples,
- vk::VkAttachmentLoadOp _loadOp,
- vk::VkAttachmentStoreOp _storeOp,
- vk::VkAttachmentLoadOp _stencilLoadOp,
- vk::VkAttachmentStoreOp _stencilStoreOp,
- vk::VkImageLayout _initialLayout,
- vk::VkImageLayout _finalLayout)
+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)
{
- sType = vk::VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION;
- pNext = DE_NULL;
+ flags = 0;
format = _format;
samples = _samples;
loadOp = _loadOp;
AttachmentDescription::AttachmentDescription (const vk::VkAttachmentDescription &rhs)
{
-
- DE_ASSERT(rhs.sType == vk::VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION);
- DE_ASSERT(rhs.pNext == DE_NULL);
-
- sType = rhs.sType;
- pNext = rhs.pNext;
+ flags = rhs.flags;
format = rhs.format;
samples = rhs.samples;
loadOp = rhs.loadOp;
layout = vk::VK_IMAGE_LAYOUT_UNDEFINED;
}
-SubpassDescription::SubpassDescription( vk::VkPipelineBindPoint _pipelineBindPoint,
- vk::VkSubpassDescriptionFlags _flags,
- deUint32 _inputCount,
- const vk::VkAttachmentReference* _inputAttachments,
- deUint32 _colorCount,
- const vk::VkAttachmentReference* _colorAttachments,
- const vk::VkAttachmentReference* _resolveAttachments,
- vk::VkAttachmentReference _depthStencilAttachment,
- deUint32 _preserveCount,
- const vk::VkAttachmentReference* _preserveAttachments)
+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 vk::VkAttachmentReference* _preserveAttachments)
{
- m_InputAttachments = std::vector<vk::VkAttachmentReference>(_inputAttachments, _inputAttachments + _inputCount);
- m_ColorAttachments = std::vector<vk::VkAttachmentReference>(_colorAttachments, _colorAttachments + _colorCount);
+ 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 + _colorCount);
+ m_resolveAttachments = std::vector<vk::VkAttachmentReference>(_resolveAttachments, _resolveAttachments + _colorAttachmentCount);
}
- m_PreserveAttachments = std::vector<vk::VkAttachmentReference>(_preserveAttachments, _preserveAttachments + _preserveCount);
+ m_preserveAttachments = std::vector<vk::VkAttachmentReference>(_preserveAttachments, _preserveAttachments + _preserveAttachmentCount);
- sType = vk::VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION;
- pNext = DE_NULL;
+ m_depthStencilAttachment = depthStencilAttachment;
+
+ flags = _flags;
pipelineBindPoint = _pipelineBindPoint;
- flags = _flags;
- inputCount = _inputCount;
+ inputAttachmentCount = _inputAttachmentCount;
pInputAttachments = DE_NULL;
- colorCount = _colorCount;
+ colorAttachmentCount = _colorAttachmentCount;
pColorAttachments = DE_NULL;
pResolveAttachments = DE_NULL;
- depthStencilAttachment = _depthStencilAttachment;
+ pDepthStencilAttachment = &m_depthStencilAttachment;
pPreserveAttachments = DE_NULL;
- preserveCount = _preserveCount;
+ preserveAttachmentCount = _preserveAttachmentCount;
- if (m_InputAttachments.size()) {
- pInputAttachments = &m_InputAttachments[0];
+ if (m_inputAttachments.size()) {
+ pInputAttachments = &m_inputAttachments[0];
}
- if (m_ColorAttachments.size()) {
- pColorAttachments = &m_ColorAttachments[0];
+ if (m_colorAttachments.size()) {
+ pColorAttachments = &m_colorAttachments[0];
}
- if (m_ResolveAttachments.size()) {
- pResolveAttachments = &m_ResolveAttachments[0];
+ if (m_resolveAttachments.size()) {
+ pResolveAttachments = &m_resolveAttachments[0];
}
- if (m_PreserveAttachments.size()) {
- pPreserveAttachments = &m_PreserveAttachments[0];
+ if (m_preserveAttachments.size()) {
+ pPreserveAttachments = &m_preserveAttachments[0];
}
}
-SubpassDescription::SubpassDescription (const vk::VkSubpassDescription &rhs)
+SubpassDescription::SubpassDescription (const vk::VkSubpassDescription& rhs)
{
-
- DE_ASSERT(rhs.sType == vk::VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION);
- DE_ASSERT(rhs.pNext == DE_NULL);
-
*static_cast<vk::VkSubpassDescription*>(this) = rhs;
- m_InputAttachments = std::vector<vk::VkAttachmentReference>(
- rhs.pInputAttachments, rhs.pInputAttachments + rhs.inputCount);
+ m_inputAttachments = std::vector<vk::VkAttachmentReference>(
+ rhs.pInputAttachments, rhs.pInputAttachments + rhs.inputAttachmentCount);
- m_ColorAttachments = std::vector<vk::VkAttachmentReference>(
- rhs.pColorAttachments, rhs.pColorAttachments + rhs.colorCount);
+ 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.colorCount);
+ m_resolveAttachments = std::vector<vk::VkAttachmentReference>(
+ rhs.pResolveAttachments, rhs.pResolveAttachments + rhs.colorAttachmentCount);
+ }
+ m_preserveAttachments = std::vector<vk::VkAttachmentReference>(
+ rhs.pPreserveAttachments, rhs.pPreserveAttachments + rhs.preserveAttachmentCount);
+
+ if (rhs.pDepthStencilAttachment)
+ {
+ m_depthStencilAttachment = *rhs.pDepthStencilAttachment;
}
- m_PreserveAttachments = std::vector<vk::VkAttachmentReference>(
- rhs.pPreserveAttachments, rhs.pPreserveAttachments + rhs.preserveCount);
- if (m_InputAttachments.size()) {
- pInputAttachments = &m_InputAttachments[0];
+ if (m_inputAttachments.size()) {
+ pInputAttachments = &m_inputAttachments[0];
}
- if (m_ColorAttachments.size()) {
- pColorAttachments = &m_ColorAttachments[0];
+ if (m_colorAttachments.size()) {
+ pColorAttachments = &m_colorAttachments[0];
}
- if (m_ResolveAttachments.size()) {
- pResolveAttachments = &m_ResolveAttachments[0];
+ if (m_resolveAttachments.size()) {
+ pResolveAttachments = &m_resolveAttachments[0];
}
- if (m_PreserveAttachments.size()) {
- pPreserveAttachments = &m_PreserveAttachments[0];
+ pDepthStencilAttachment = &m_depthStencilAttachment;
+
+ if (m_preserveAttachments.size()) {
+ pPreserveAttachments = &m_preserveAttachments[0];
}
}
-SubpassDescription::SubpassDescription (const SubpassDescription &rhs) {
+SubpassDescription::SubpassDescription (const SubpassDescription& rhs) {
*this = rhs;
}
-SubpassDescription &SubpassDescription::operator= (const SubpassDescription &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_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.size()) {
- pInputAttachments = &m_InputAttachments[0];
+ if (m_inputAttachments.size()) {
+ pInputAttachments = &m_inputAttachments[0];
}
- if (m_ColorAttachments.size()) {
- pColorAttachments = &m_ColorAttachments[0];
+ if (m_colorAttachments.size()) {
+ pColorAttachments = &m_colorAttachments[0];
}
- if (m_ResolveAttachments.size()) {
- pResolveAttachments = &m_ResolveAttachments[0];
+ if (m_resolveAttachments.size()) {
+ pResolveAttachments = &m_resolveAttachments[0];
}
- if (m_PreserveAttachments.size()) {
- pPreserveAttachments = &m_PreserveAttachments[0];
+ pDepthStencilAttachment = &m_depthStencilAttachment;
+
+ if (m_preserveAttachments.size()) {
+ pPreserveAttachments = &m_preserveAttachments[0];
}
return *this;
}
-SubpassDependency::SubpassDependency ( deUint32 _srcSubpass,
- deUint32 _destSubpass,
- vk::VkPipelineStageFlags _srcStageMask,
- vk::VkPipelineStageFlags _destStageMask,
- vk::VkMemoryOutputFlags _outputMask,
- vk::VkMemoryInputFlags _inputMask,
- vk::VkBool32 _byRegion)
+SubpassDependency::SubpassDependency (deUint32 _srcSubpass,
+ deUint32 _dstSubpass,
+ vk::VkPipelineStageFlags _srcStageMask,
+ vk::VkPipelineStageFlags _dstStageMask,
+ vk::VkAccessFlags _srcAccessMask,
+ vk::VkAccessFlags _dstAccessMask,
+ vk::VkDependencyFlags _dependencyFlags)
{
-
- sType = vk::VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY;
- pNext = DE_NULL;
srcSubpass = _srcSubpass;
- destSubpass = _destSubpass;
+ dstSubpass = _dstSubpass;
srcStageMask = _srcStageMask;
- destStageMask = _destStageMask;
- outputMask = _outputMask;
- inputMask = _inputMask;
- byRegion = _byRegion;
+ dstStageMask = _dstStageMask;
+ srcAccessMask = _srcAccessMask;
+ dstAccessMask = _dstAccessMask;
+ dependencyFlags = _dependencyFlags;
}
SubpassDependency::SubpassDependency (const vk::VkSubpassDependency &rhs)
{
-
- DE_ASSERT(rhs.sType == vk::VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY);
- DE_ASSERT(rhs.pNext == DE_NULL);
-
- sType = rhs.sType;
- pNext = DE_NULL;
srcSubpass = rhs.srcSubpass;
- destSubpass = rhs.destSubpass;
+ dstSubpass = rhs.dstSubpass;
srcStageMask = rhs.srcStageMask;
- destStageMask = rhs.destStageMask;
- outputMask = rhs.outputMask;
- inputMask = rhs.inputMask;
- byRegion = rhs.byRegion;
+ dstStageMask = rhs.dstStageMask;
+ srcAccessMask = rhs.srcAccessMask;
+ dstAccessMask = rhs.dstAccessMask;
+ dependencyFlags = rhs.dependencyFlags;
}
-CmdBufferBeginInfo::CmdBufferBeginInfo (vk::VkCmdBufferOptimizeFlags _flags)
+CmdBufferBeginInfo::CmdBufferBeginInfo (vk::VkCommandBufferUsageFlags _flags)
{
- sType = vk::VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO;
+ sType = vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
pNext = DE_NULL;
- renderPass = DE_NULL;
- subpass = 0;
- framebuffer = DE_NULL;
- flags = _flags;
+ renderPass = DE_NULL;
+ subpass = 0;
+ framebuffer = DE_NULL;
+ flags = _flags;
+ occlusionQueryEnable = false;
+ queryFlags = 0u;
+ pipelineStatistics = 0u;
}
-CmdBufferBeginInfo::CmdBufferBeginInfo (vk::VkRenderPass _renderPass,
- deUint32 _subpass,
- vk::VkFramebuffer _framebuffer,
- vk::VkCmdBufferOptimizeFlags _flags)
+CmdBufferBeginInfo::CmdBufferBeginInfo (vk::VkRenderPass _renderPass,
+ deUint32 _subpass,
+ vk::VkFramebuffer _framebuffer,
+ vk::VkCommandBufferUsageFlags _flags,
+ bool _occlusionQueryEnable,\r
+ vk::VkQueryControlFlags _queryFlags,\r
+ vk::VkQueryPipelineStatisticFlags _pipelineStatistics)
{
- sType = vk::VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO;
+ sType = vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
pNext = DE_NULL;
- renderPass = _renderPass;
- subpass = _subpass;
- framebuffer = _framebuffer;
- flags = _flags;
+ renderPass = _renderPass;
+ subpass = _subpass;
+ framebuffer = _framebuffer;
+ flags = _flags;
+ occlusionQueryEnable = _occlusionQueryEnable;
+ queryFlags = _queryFlags;
+ pipelineStatistics = _pipelineStatistics;
}
-DescriptorPoolCreateInfo::DescriptorPoolCreateInfo (const std::vector<vk::VkDescriptorTypeCount>& typeCounts,\r
- vk::VkDescriptorPoolUsage _poolUsage,\r
- deUint32 _maxSets)
- : m_typeCounts(typeCounts)
+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;
- poolUsage = _poolUsage;
- maxSets = _maxSets;
- count = static_cast<deUint32>(m_typeCounts.size());
- pTypeCount = &m_typeCounts[0];
+ flags = _flags;
+ maxSets = _maxSets;
+ poolSizeCount = static_cast<deUint32>(m_poolSizeCounts.size());
+ pPoolSizes = &m_poolSizeCounts[0];
}
DescriptorPoolCreateInfo& DescriptorPoolCreateInfo::addDescriptors (vk::VkDescriptorType type, deUint32 count)
{
- vk::VkDescriptorTypeCount typeCount = { type, count };
- m_typeCounts.push_back(typeCount);
+ vk::VkDescriptorPoolSize descriptorTypeCount = { type, count };
+ m_poolSizeCounts.push_back(descriptorTypeCount);
- count = static_cast<deUint32>(m_typeCounts.size());
- pTypeCount = &m_typeCounts[0];
+ poolSizeCount = static_cast<deUint32>(m_poolSizeCounts.size());
+ pPoolSizes = &m_poolSizeCounts[0];
return *this;
}
-DescriptorSetLayoutCreateInfo::DescriptorSetLayoutCreateInfo (deUint32 _count, const vk::VkDescriptorSetLayoutBinding* _pBinding)
+DescriptorSetLayoutCreateInfo::DescriptorSetLayoutCreateInfo (deUint32 _bindingCount, const vk::VkDescriptorSetLayoutBinding* _pBindings)
{
sType = vk::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
pNext = DE_NULL;
- count = _count;
- pBinding = _pBinding;
+ flags = 0;
+ bindingCount = _bindingCount;
+ pBinding = _pBindings;
}
PipelineLayoutCreateInfo::PipelineLayoutCreateInfo (deUint32 _descriptorSetCount,
- const vk::VkDescriptorSetLayout* _pSetLayouts,
- deUint32 _pushConstantRangeCount,
- const vk::VkPushConstantRange* _pPushConstantRanges)
+ const vk::VkDescriptorSetLayout* _pSetLayouts,
+ deUint32 _pushConstantRangeCount,
+ const vk::VkPushConstantRange* _pPushConstantRanges)
: m_pushConstantRanges(_pPushConstantRanges, _pPushConstantRanges + _pushConstantRangeCount)
{
for (unsigned int i = 0; i < _descriptorSetCount; i++)
sType = vk::VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
pNext = DE_NULL;
- descriptorSetCount = static_cast<deUint32>(m_setLayouts.size());
- pSetLayouts = descriptorSetCount > 0 ? &m_setLayouts[0] : 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()) {
}
}
-PipelineLayoutCreateInfo::PipelineLayoutCreateInfo ( const std::vector<vk::VkDescriptorSetLayout>& setLayouts,
- deUint32 _pushConstantRangeCount,
- const vk::VkPushConstantRange* _pPushConstantRanges)
+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;
- descriptorSetCount = static_cast<deUint32>(m_setLayouts.size());
+ setLayoutCount = static_cast<deUint32>(m_setLayouts.size());
- if (descriptorSetCount)
+ if (setLayoutCount)
{
pSetLayouts = &m_setLayouts[0];
}
}
-PipelineCreateInfo::PipelineShaderStage::PipelineShaderStage (vk::VkShader _shader, vk::VkShaderStage _stage)
+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;
- shader = _shader;
+ module = _module;
+ pName = _pName;
pSpecializationInfo = DE_NULL;
}
-PipelineCreateInfo::VertexInputState::VertexInputState ( deUint32 _bindingCount,
- const vk::VkVertexInputBindingDescription* _pVertexBindingDescriptions,
- deUint32 _attributeCount,
- const vk::VkVertexInputAttributeDescription* _pVertexAttributeDescriptions)
+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;
- bindingCount = _bindingCount;
+ flags = 0u;
+ vertexBindingDescriptionCount = _vertexBindingDescriptionCount;
pVertexBindingDescriptions = _pVertexBindingDescriptions;
- attributeCount = _attributeCount;
+ vertexAttributeDescriptionCount = _vertexAttributeDescriptionCount;
pVertexAttributeDescriptions = _pVertexAttributeDescriptions;
}
-PipelineCreateInfo::InputAssemblerState::InputAssemblerState ( vk::VkPrimitiveTopology _topology,
- vk::VkBool32 _primitiveRestartEnable)
+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;
}
patchControlPoints = _patchControlPoints;
}
-PipelineCreateInfo::ViewportState::ViewportState ( deUint32 _viewportCount,
- std::vector<vk::VkViewport> _viewports,
- std::vector<vk::VkRect2D> _scissors)
+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;
- viewportCount = _viewportCount;\r
- scissorCount = _viewportCount;\r
- \r
- if (!_viewports.size())\r
- {\r
- m_viewports.resize(viewportCount);\r
- deMemset(&m_viewports[0], 0, sizeof(m_viewports[0]) * m_viewports.size());\r
- }\r
- else\r
- {\r
- m_viewports = _viewports;\r
- }\r
-\r
- if (!_scissors.size())\r
- {\r
- m_scissors.resize(scissorCount);\r
- deMemset(&m_scissors[0], 0, sizeof(m_scissors[0]) * m_scissors.size());\r
- }\r
- else\r
- {\r
- m_scissors = _scissors;\r
- }\r
-\r
- pViewports = &m_viewports[0];\r
+ 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;\r
+ sType = other.sType;
pNext = other.pNext;
- viewportCount = other.viewportCount;\r
+ 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];\r
+ pViewports = &m_viewports[0];
pScissors = &m_scissors[0];
}
PipelineCreateInfo::ViewportState & PipelineCreateInfo::ViewportState::operator= (const ViewportState &other)
{
- sType = other.sType;\r
+ sType = other.sType;
pNext = other.pNext;
- viewportCount = other.viewportCount;\r
+ 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];\r
+ pViewports = &m_viewports[0];
pScissors = &m_scissors[0];
return *this;
}
-PipelineCreateInfo::RasterizerState::RasterizerState ( vk::VkBool32 _depthClipEnable,
- vk::VkBool32 _rasterizerDiscardEnable,
- vk::VkFillMode _fillMode,
- vk::VkCullMode _cullMode,
- vk::VkFrontFace _frontFace,
- vk::VkBool32 _depthBiasEnable,\r
- float _depthBias,
- float _depthBiasClamp,
- float _slopeScaledDepthBias,
- float _lineWidth)
+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_RASTER_STATE_CREATE_INFO;
+ sType = vk::VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
pNext = DE_NULL;
- depthClipEnable = _depthClipEnable;
+ flags = 0u;
+ depthClampEnable = _depthClampEnable;
rasterizerDiscardEnable = _rasterizerDiscardEnable;
- fillMode = _fillMode;
+ polygonMode = _polygonMode;
cullMode = _cullMode;
frontFace = _frontFace;
- depthBiasEnable = _depthBiasEnable;\r
- depthBias = _depthBias;
+ depthBiasEnable = _depthBiasEnable;
+ depthBiasConstantFactor = _depthBiasConstantFactor;
depthBiasClamp = _depthBiasClamp;
- slopeScaledDepthBias = _slopeScaledDepthBias;
+ depthBiasSlopeFactor = _depthBiasSlopeFactor;
lineWidth = _lineWidth;
}
-PipelineCreateInfo::MultiSampleState::MultiSampleState ( deUint32 _rasterSamples,
- vk::VkBool32 _sampleShadingEnable,
- float _minSampleShading,
- const std::vector<vk::VkSampleMask>& _sampleMask)
+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;
- rasterSamples = _rasterSamples;
- sampleShadingEnable = _sampleShadingEnable;
- minSampleShading = _minSampleShading;
- pSampleMask = &m_sampleMask[0];
+ 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;\r
- pNext = other.pNext;\r
- rasterSamples = other.rasterSamples;\r
- sampleShadingEnable = other.sampleShadingEnable;\r
- minSampleShading = other.minSampleShading;\r
- \r
- const size_t sampleMaskArrayLen = (sizeof(vk::VkSampleMask) * 8 + other.rasterSamples) / (sizeof(vk::VkSampleMask) * 8);
+ sType = other.sType;
+ pNext = other.pNext;
+ 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);\r
+ 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;\r
- pNext = other.pNext;\r
- rasterSamples = other.rasterSamples;\r
- sampleShadingEnable = other.sampleShadingEnable;\r
- minSampleShading = other.minSampleShading;\r
-\r
- const size_t sampleMaskArrayLen = (sizeof(vk::VkSampleMask) * 8 + other.rasterSamples) / (sizeof(vk::VkSampleMask) * 8);
+ sType = other.sType;
+ pNext = other.pNext;
+ rasterizationSamples = other.rasterizationSamples;
+ sampleShadingEnable = other.sampleShadingEnable;
+ minSampleShading = other.minSampleShading;
- m_sampleMask = std::vector<vk::VkSampleMask>(other.pSampleMask, other.pSampleMask + sampleMaskArrayLen);\r
+ 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 _alphaToCoverageEnable,
- vk::VkBool32 _logicOpEnable,
- vk::VkLogicOp _logicOp,
- vk::VkBool32 _alphaToOneEnable)
+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;
- alphaToCoverageEnable = _alphaToCoverageEnable;
- alphaToOneEnable = _alphaToOneEnable;
+ 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 _alphaToCoverageEnable,
- vk::VkBool32 _logicOpEnable,
- vk::VkLogicOp _logicOp,
- vk::VkBool32 _alphaToOneEnable)
+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;
- alphaToCoverageEnable = _alphaToCoverageEnable;
- alphaToOneEnable = _alphaToOneEnable;
-
logicOpEnable = _logicOpEnable;
logicOp = _logicOp;
- attachmentCount = _attachmentCount;
attachmentCount = static_cast<deUint32>(m_attachments.size());
pAttachments = &m_attachments[0];
}
{
sType = createInfo.sType;
pNext = createInfo.pNext;
- alphaToCoverageEnable = createInfo.alphaToCoverageEnable;
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> _blendConst)
+PipelineCreateInfo::ColorBlendState::ColorBlendState (const ColorBlendState &createInfo, std::vector<float> _blendConstants)
: m_attachments (createInfo.pAttachments, createInfo.pAttachments + createInfo.attachmentCount)
{
sType = createInfo.sType;
pNext = createInfo.pNext;
- alphaToCoverageEnable = createInfo.alphaToCoverageEnable;
logicOpEnable = createInfo.logicOpEnable;
logicOp = createInfo.logicOp;
attachmentCount = static_cast<deUint32>(m_attachments.size());
pAttachments = &m_attachments[0];
- deMemcpy(blendConst, &_blendConst[0], 4 * sizeof(float));
+ deMemcpy(blendConstants, &_blendConstants[0], 4 * sizeof(float));
}
-PipelineCreateInfo::ColorBlendState::Attachment::Attachment ( vk::VkBool32 _blendEnable,
- vk::VkBlend _srcBlendColor,
- vk::VkBlend _destBlendColor,
- vk::VkBlendOp _blendOpColor,
- vk::VkBlend _srcBlendAlpha,
- vk::VkBlend _destBlendAlpha,
- vk::VkBlendOp _blendOpAlpha,
- deUint8 _channelWriteMask)
+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;
- srcBlendColor = _srcBlendColor;
- destBlendColor = _destBlendColor;
- blendOpColor = _blendOpColor;
- srcBlendAlpha = _srcBlendAlpha;
- destBlendAlpha = _destBlendAlpha;
- blendOpAlpha = _blendOpAlpha;
- channelWriteMask = _channelWriteMask;
-}
-
-PipelineCreateInfo::DepthStencilState::StencilOpState::StencilOpState ( vk::VkStencilOp _stencilFailOp,
- vk::VkStencilOp _stencilPassOp,
- vk::VkStencilOp _stencilDepthFailOp,
- vk::VkCompareOp _stencilCompareOp,
- deUint32 _stencilCompareMask,\r
- deUint32 _stencilWriteMask,\r
- deUint32 _stencilReference)
-{
- stencilFailOp = _stencilFailOp;
- stencilPassOp = _stencilPassOp;
- stencilDepthFailOp = _stencilDepthFailOp;
- stencilCompareOp = _stencilCompareOp;
-\r
- stencilCompareMask = _stencilCompareMask;
- stencilWriteMask = _stencilWriteMask;
- stencilReference = _stencilReference;
-}
-
-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)
+ 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;
PipelineCreateInfo::DynamicState::DynamicState (const DynamicState &other)
{
- sType = other.sType;\r
+ sType = other.sType;
pNext = other.pNext;
dynamicStateCount = other.dynamicStateCount;
PipelineCreateInfo::DynamicState & PipelineCreateInfo::DynamicState::operator= (const DynamicState &other)
{
- sType = other.sType;\r
+ sType = other.sType;
pNext = other.pNext;
dynamicStateCount = other.dynamicStateCount;
int _subpass,
vk::VkPipelineCreateFlags _flags)
{
- memset(static_cast<vk::VkGraphicsPipelineCreateInfo *>(this), 0,
+ 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;
-
- flags = _flags;
layout = _layout;
basePipelineHandle = DE_NULL;
basePipelineIndex = 0;
PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineVertexInputStateCreateInfo& state)
{
- m_vertexInputState = de::SharedPtr<vk::VkPipelineVertexInputStateCreateInfo>(
- new vk::VkPipelineVertexInputStateCreateInfo(state));
-
- pVertexInputState = m_vertexInputState.get();
+ m_vertexInputState = state;
+ pVertexInputState = &m_vertexInputState;
return *this;
}
PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineInputAssemblyStateCreateInfo& state)
{
- m_iputAssemblyState = de::SharedPtr<vk::VkPipelineInputAssemblyStateCreateInfo>(
- new vk::VkPipelineInputAssemblyStateCreateInfo(state));
-
- pInputAssemblyState = m_iputAssemblyState.get();
+ 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 = de::SharedPtr<vk::VkPipelineColorBlendStateCreateInfo>(
- new vk::VkPipelineColorBlendStateCreateInfo(state));
-
- m_colorBlendState->pAttachments = &m_colorBlendStateAttachments[0];
-
- pColorBlendState = m_colorBlendState.get();
+ 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 = de::SharedPtr<vk::VkPipelineViewportStateCreateInfo>(
- new vk::VkPipelineViewportStateCreateInfo(state));
-
- m_viewportState->pViewports = &m_viewports[0];
- m_viewportState->pScissors = &m_scissors[0];
-
- pViewportState = m_viewportState.get();
+ 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 = de::SharedPtr<vk::VkPipelineDepthStencilStateCreateInfo>(
- new vk::VkPipelineDepthStencilStateCreateInfo(state));
-
- pDepthStencilState = m_dynamicDepthStencilState.get();
-
+ m_dynamicDepthStencilState = state;
+ pDepthStencilState = &m_dynamicDepthStencilState;
return *this;
}
PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineTessellationStateCreateInfo& state)
{
- m_tessState = de::SharedPtr<vk::VkPipelineTessellationStateCreateInfo>(
- new vk::VkPipelineTessellationStateCreateInfo(state));
-
- pTessellationState = m_tessState.get();
+ m_tessState = state;
+ pTessellationState = &m_tessState;
return *this;
}
-PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineRasterStateCreateInfo& state)
+PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineRasterizationStateCreateInfo& state)
{
- m_rasterState = de::SharedPtr<vk::VkPipelineRasterStateCreateInfo>(new vk::VkPipelineRasterStateCreateInfo(state));
- pRasterState = m_rasterState.get();
+ m_rasterState = state;
+ pRasterizationState = &m_rasterState;
return *this;
}
PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineMultisampleStateCreateInfo& state)
{
- const size_t sampleMaskArrayLen = (sizeof(vk::VkSampleMask) * 8 + state.rasterSamples) / ( sizeof(vk::VkSampleMask) * 8 );
+ 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 = de::SharedPtr<vk::VkPipelineMultisampleStateCreateInfo>(new vk::VkPipelineMultisampleStateCreateInfo(state));
-
- m_multisampleState->pSampleMask = &m_multisampleStateSampleMask[0];
-
- pMultisampleState = m_multisampleState.get();
+ 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 = de::SharedPtr<vk::VkPipelineDynamicStateCreateInfo>(new vk::VkPipelineDynamicStateCreateInfo(state));
-
- m_dynamicState->pDynamicStates = &m_dynamicStates[0];
-
- pDynamicState = m_dynamicState.get();
+ 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::VkTexFilter _magFilter,
- vk::VkTexFilter _minFilter,
- vk::VkTexMipmapMode _mipMode,
- vk::VkTexAddressMode _addressModeU,
- vk::VkTexAddressMode _addressModeV,
- vk::VkTexAddressMode _addressModeW,
- float _mipLodBias,
- float _maxAnisotropy,
- vk::VkBool32 _compareEnable,
- vk::VkCompareOp _compareOp,
- float _minLod,
- float _maxLod,
- vk::VkBorderColor _borderColor,
- vk::VkBool32 _unnormalizedCoordinates)
+SamplerCreateInfo::SamplerCreateInfo (vk::VkFilter _magFilter,
+ vk::VkFilter _minFilter,
+ vk::VkSamplerMipmapMode _mipmapMode,
+ vk::VkSamplerAddressMode _addressModeU,
+ vk::VkSamplerAddressMode _addressModeV,
+ vk::VkSamplerAddressMode _addressModeW,
+ float _mipLodBias,
+ 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;
- mipMode = _mipMode;
+ mipmapMode = _mipmapMode;
addressModeU = _addressModeU;
addressModeV = _addressModeV;
addressModeW = _addressModeW;
borderColor = _borderColor;
unnormalizedCoordinates = _unnormalizedCoordinates;
}
-
} // DynamicState
} // vkt
public:
ImageSubresourceRange ( vk::VkImageAspectFlags aspectMask,
deUint32 baseMipLevel = 0,
- deUint32 mipLevels = 1,
+ deUint32 levelCount = 1,
deUint32 baseArrayLayer = 0,
- deUint32 arraySize = 1);
+ deUint32 layerCount = 1);
};
-class ChannelMapping : public vk::VkChannelMapping
+class ComponentMapping : public vk::VkComponentMapping
{
public:
- ChannelMapping ( vk::VkChannelSwizzle r = vk::VK_CHANNEL_SWIZZLE_R,
- vk::VkChannelSwizzle g = vk::VK_CHANNEL_SWIZZLE_G,
- vk::VkChannelSwizzle b = vk::VK_CHANNEL_SWIZZLE_B,
- vk::VkChannelSwizzle a = vk::VK_CHANNEL_SWIZZLE_A);
+ 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
vk::VkImageViewType viewType,
vk::VkFormat format,
const vk::VkImageSubresourceRange& subresourceRange,
- const vk::VkChannelMapping& channels = ChannelMapping(),
+ const vk::VkComponentMapping& components = ComponentMapping(),
vk::VkImageViewCreateFlags flags = 0);
ImageViewCreateInfo ( vk::VkImage image,
vk::VkImageViewType viewType,
vk::VkFormat format,
- const vk::VkChannelMapping& channels = ChannelMapping(),
+ const vk::VkComponentMapping& components = ComponentMapping(),
vk::VkImageViewCreateFlags flags = 0);
};
public:
BufferCreateInfo ( vk::VkDeviceSize size,
vk::VkBufferCreateFlags usage,
- vk::VkSharingMode sharingMode = vk::VK_SHARING_MODE_EXCLUSIVE,
- deUint32 queueFamilyCount = 0,
- const deUint32* pQueueFamilyIndices = DE_NULL,
- vk::VkBufferCreateFlags flags = 0);
+ 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);
class ImageCreateInfo : public vk::VkImageCreateInfo
{
public:
- ImageCreateInfo ( vk::VkImageType imageType,
- vk::VkFormat format,
- vk::VkExtent3D extent,
- deUint32 mipLevels,
- deUint32 arraySize,
- deUint32 samples,
- vk::VkImageTiling tiling,
- vk::VkImageUsageFlags usage,
- vk::VkSharingMode sharingMode = vk::VK_SHARING_MODE_EXCLUSIVE,
- deUint32 queueFamilyCount = 0,
- const deUint32* pQueueFamilyIndices = DE_NULL,
- vk::VkImageCreateFlags flags = 0,
- vk::VkImageLayout initialLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED);
+ 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);
{
public:
AttachmentDescription ( vk::VkFormat format,
- deUint32 samples,
- vk::VkAttachmentLoadOp loadOp,
- vk::VkAttachmentStoreOp storeOp,
- vk::VkAttachmentLoadOp stencilLoadOp,
- vk::VkAttachmentStoreOp stencilStoreOp,
+ vk::VkSampleCountFlagBits samples,
+ vk::VkAttachmentLoadOp loadOp,
+ vk::VkAttachmentStoreOp storeOp,
+ vk::VkAttachmentLoadOp stencilLoadOp,
+ vk::VkAttachmentStoreOp stencilStoreOp,
vk::VkImageLayout initialLayout,
vk::VkImageLayout finalLayout);
public:
SubpassDescription ( vk::VkPipelineBindPoint pipelineBindPoint,
vk::VkSubpassDescriptionFlags flags,
- deUint32 inputCount,
+ deUint32 inputAttachmentCount,
const vk::VkAttachmentReference* inputAttachments,
- deUint32 colorCount,
- const vk::VkAttachmentReference* colorAttachments,
- const vk::VkAttachmentReference* resolveAttachments,
+ deUint32 colorAttachmentCount,
+ const vk::VkAttachmentReference* colorAttachments,
+ const vk::VkAttachmentReference* resolveAttachments,
vk::VkAttachmentReference depthStencilAttachment,
- deUint32 preserveCount,
- const vk::VkAttachmentReference* preserveAttachments);
+ deUint32 preserveAttachmentCount,
+ const vk::VkAttachmentReference* preserveAttachments);
- SubpassDescription (const vk::VkSubpassDescription &other);
- SubpassDescription (const SubpassDescription &other);
- SubpassDescription &operator= (const SubpassDescription &other);
+ 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<vk::VkAttachmentReference> m_PreserveAttachments;
+ std::vector<vk::VkAttachmentReference> m_inputAttachments;
+ std::vector<vk::VkAttachmentReference> m_colorAttachments;
+ std::vector<vk::VkAttachmentReference> m_resolveAttachments;
+ std::vector<vk::VkAttachmentReference> m_preserveAttachments;
+
+ vk::VkAttachmentReference m_depthStencilAttachment;
};
class SubpassDependency : public vk::VkSubpassDependency
{
public:
SubpassDependency ( deUint32 srcSubpass,
- deUint32 destSubpass,
+ deUint32 dstSubpass,
vk::VkPipelineStageFlags srcStageMask,
- vk::VkPipelineStageFlags destStageMask,
- vk::VkMemoryOutputFlags outputMask,
- vk::VkMemoryInputFlags inputMask,
- vk::VkBool32 byRegion);
+ vk::VkPipelineStageFlags dstStageMask,
+ vk::VkAccessFlags srcAccessMask,
+ vk::VkAccessFlags dstAccessMask,
+ vk::VkDependencyFlags dependencyFlags);
SubpassDependency (const vk::VkSubpassDependency& other);
};
void addDependency (vk::VkSubpassDependency dependency);
private:
- std::vector<AttachmentDescription> m_attachments;
- std::vector<SubpassDescription> m_subpasses;
- std::vector<SubpassDependency> m_dependiences;
+ 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;
+ 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!
RenderPassBeginInfo &operator= (const RenderPassBeginInfo &other); //Not allowed!
};
-class CmdPoolCreateInfo : public vk::VkCmdPoolCreateInfo
+class CmdPoolCreateInfo : public vk::VkCommandPoolCreateInfo
{
public:
CmdPoolCreateInfo (deUint32 queueFamilyIndex,
- vk::VkCmdPoolCreateFlags flags = vk::VK_CMD_POOL_CREATE_RESET_COMMAND_BUFFER_BIT);
+ vk::VkCommandPoolCreateFlags flags = vk::VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT);
};
-class CmdBufferCreateInfo : public vk::VkCmdBufferCreateInfo
+class CmdBufferBeginInfo : public vk::VkCommandBufferBeginInfo
{
public:
- CmdBufferCreateInfo (vk::VkCmdPool pool, vk::VkCmdBufferLevel level, vk::VkCmdBufferCreateFlags flags);
+ CmdBufferBeginInfo (vk::VkCommandBufferUsageFlags flags = 0);
+ CmdBufferBeginInfo (vk::VkRenderPass renderPass,
+ deUint32 subpass,
+ vk::VkFramebuffer framebuffer,
+ vk::VkCommandBufferUsageFlags flags = 0,
+ bool occlusionQueryEnable = false,
+ vk::VkQueryControlFlags queryFlags = 0u,
+ vk::VkQueryPipelineStatisticFlags pipelineStatistics = 0u);
};
-class CmdBufferBeginInfo : public vk::VkCmdBufferBeginInfo
-{
-public:
- CmdBufferBeginInfo (vk::VkCmdBufferOptimizeFlags flags = 0);
- CmdBufferBeginInfo (vk::VkRenderPass renderPass,
- deUint32 subpass,
- vk::VkFramebuffer framebuffer,
- vk::VkCmdBufferOptimizeFlags flags = 0);
-};
-
-class DescriptorTypeCount : public vk::VkDescriptorTypeCount
+class DescriptorPoolSize : public vk::VkDescriptorPoolSize
{
public:
- DescriptorTypeCount (vk::VkDescriptorType _type, deUint32 _count)
+ DescriptorPoolSize (vk::VkDescriptorType _type, deUint32 _descriptorCount)
{
- type = _type;
- count = _count;
+ type = _type;
+ descriptorCount = _descriptorCount;
}
};
class DescriptorPoolCreateInfo : public vk::VkDescriptorPoolCreateInfo
{
public:
- DescriptorPoolCreateInfo ( const std::vector<vk::VkDescriptorTypeCount>& typeCounts,\r
- vk::VkDescriptorPoolUsage poolUsage, \r
+ DescriptorPoolCreateInfo ( const std::vector<vk::VkDescriptorPoolSize>& poolSizeCounts,\r
+ vk::VkDescriptorPoolCreateFlags flags, \r
deUint32 maxSets);
DescriptorPoolCreateInfo& addDescriptors (vk::VkDescriptorType type, deUint32 count);
private:
- std::vector<vk::VkDescriptorTypeCount> m_typeCounts;
+ std::vector<vk::VkDescriptorPoolSize> m_poolSizeCounts;
};
class DescriptorSetLayoutCreateInfo : public vk::VkDescriptorSetLayoutCreateInfo
{
public:
- DescriptorSetLayoutCreateInfo (deUint32 count, const vk::VkDescriptorSetLayoutBinding* pBinding);
+ DescriptorSetLayoutCreateInfo (deUint32 bindingCount, const vk::VkDescriptorSetLayoutBinding* pBindings);
};
class VertexInputState : public vk::VkPipelineVertexInputStateCreateInfo
{
public:
- VertexInputState ( deUint32 bindingCount = 0,
+ VertexInputState ( deUint32 vertexBindingDescriptionCount = 0,
const vk::VkVertexInputBindingDescription* pVertexBindingDescriptions = NULL,
- deUint32 attributeCount = 0,
+ deUint32 vertexAttributeDescriptionCount = 0,
const vk::VkVertexInputAttributeDescription* pVertexAttributeDescriptions = NULL);
};
std::vector<vk::VkRect2D> scissors = std::vector<vk::VkRect2D>(0));
ViewportState (const ViewportState &other);
- ViewportState &operator= (const ViewportState &other);
+ ViewportState &operator= (const ViewportState &other);
std::vector<vk::VkViewport> m_viewports;
std::vector<vk::VkRect2D> m_scissors;
};
- class RasterizerState : public vk::VkPipelineRasterStateCreateInfo
+ class RasterizerState : public vk::VkPipelineRasterizationStateCreateInfo
{
public:
- RasterizerState ( vk::VkBool32 depthClipEnable = false,
- vk::VkBool32 rasterizerDiscardEnable = false,
- vk::VkFillMode fillMode = vk::VK_FILL_MODE_SOLID,
- vk::VkCullMode cullMode = vk::VK_CULL_MODE_NONE,
- vk::VkFrontFace frontFace = vk::VK_FRONT_FACE_CW,
- vk::VkBool32 depthBiasEnable = true,\r
- float depthBias = 0.0f,
- float depthBiasClamp = 0.0f,
- float slopeScaledDepthBias = 0.0f,
- float lineWidth = 1.0f);
+ 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,\r
+ float depthBiasConstantFactor = 0.0f,
+ float depthBiasClamp = 0.0f,
+ float depthBiasSlopeFactor = 0.0f,
+ float lineWidth = 1.0f);
};
class MultiSampleState : public vk::VkPipelineMultisampleStateCreateInfo
{
public:
- MultiSampleState ( deUint32 rasterSamples = 1,
- vk::VkBool32 sampleShadingEnable = false,
- float minSampleShading = 0.0f,
- const std::vector<vk::VkSampleMask>& sampleMask = std::vector<vk::VkSampleMask>(1, 0xffffffff));
+ 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);
class Attachment : public vk::VkPipelineColorBlendAttachmentState
{
public:
- Attachment (vk::VkBool32 blendEnable = false,
- vk::VkBlend srcBlendColor = vk::VK_BLEND_SRC_COLOR,
- vk::VkBlend destBlendColor = vk::VK_BLEND_DEST_COLOR,
- vk::VkBlendOp blendOpColor = vk::VK_BLEND_OP_ADD,
- vk::VkBlend srcBlendAlpha = vk::VK_BLEND_SRC_COLOR,
- vk::VkBlend destBlendAlpha = vk::VK_BLEND_DEST_COLOR,
- vk::VkBlendOp blendOpAlpha = vk::VK_BLEND_OP_ADD,
- deUint8 channelWriteMask = 0xff);
+ 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::VkBool32 logicOpEnable = false,
- vk::VkLogicOp logicOp = vk::VK_LOGIC_OP_COPY,
- vk::VkBool32 alphaToOneEnable = false);
+ vk::VkLogicOp logicOp = vk::VK_LOGIC_OP_COPY);
ColorBlendState ( deUint32 attachmentCount,
const vk::VkPipelineColorBlendAttachmentState* attachments,
- vk::VkBool32 alphaToCoverageEnable = false,
vk::VkBool32 logicOpEnable = false,
- vk::VkLogicOp logicOp = vk::VK_LOGIC_OP_COPY,
- vk::VkBool32 alphaToOneEnable = false);
+ vk::VkLogicOp logicOp = vk::VK_LOGIC_OP_COPY);
ColorBlendState (const vk::VkPipelineColorBlendStateCreateInfo &createInfo);
- ColorBlendState (const ColorBlendState &createInfo, std::vector<float> blendConst = std::vector<float>(4));
+ ColorBlendState (const ColorBlendState &createInfo, std::vector<float> blendConstants = std::vector<float>(4));
private:
std::vector<vk::VkPipelineColorBlendAttachmentState> m_attachments;
class StencilOpState : public vk::VkStencilOpState
{
public:
- StencilOpState (vk::VkStencilOp stencilFailOp = vk::VK_STENCIL_OP_REPLACE,
- vk::VkStencilOp stencilPassOp = vk::VK_STENCIL_OP_REPLACE,
- vk::VkStencilOp stencilDepthFailOp = vk::VK_STENCIL_OP_REPLACE,
- vk::VkCompareOp stencilCompareOp = vk::VK_COMPARE_OP_ALWAYS,
- deUint32 stencilCompareMask = 0xffffffffu,\r
- deUint32 stencilWriteMask = 0xffffffffu,\r
- deUint32 stencilReference = 0);
+ 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,\r
+ deUint32 writeMask = 0xffffffffu,\r
+ deUint32 reference = 0);
};
DepthStencilState ( vk::VkBool32 depthTestEnable = false,
class PipelineShaderStage : public vk::VkPipelineShaderStageCreateInfo
{
public:
- PipelineShaderStage (vk::VkShader shader, vk::VkShaderStage stage);
+ PipelineShaderStage (vk::VkShaderModule shaderModule, const char* _pName, vk::VkShaderStageFlagBits stage);
};
class DynamicState : public vk::VkPipelineDynamicStateCreateInfo
PipelineCreateInfo(vk::VkPipelineLayout layout, vk::VkRenderPass renderPass, int subpass, vk::VkPipelineCreateFlags flags);
- PipelineCreateInfo &addShader (const vk::VkPipelineShaderStageCreateInfo& shader);
+ 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::VkPipelineRasterStateCreateInfo& state);
- PipelineCreateInfo &addState (const vk::VkPipelineMultisampleStateCreateInfo& state);
- PipelineCreateInfo &addState (const vk::VkPipelineDynamicStateCreateInfo& state);
+ 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;
-
- de::SharedPtr<vk::VkPipelineVertexInputStateCreateInfo> m_vertexInputState;
- de::SharedPtr<vk::VkPipelineInputAssemblyStateCreateInfo> m_iputAssemblyState;
- std::vector<vk::VkPipelineColorBlendAttachmentState> m_colorBlendStateAttachments;
- de::SharedPtr<vk::VkPipelineColorBlendStateCreateInfo> m_colorBlendState;
- de::SharedPtr<vk::VkPipelineViewportStateCreateInfo> m_viewportState;
- de::SharedPtr<vk::VkPipelineDepthStencilStateCreateInfo> m_dynamicDepthStencilState;
- de::SharedPtr<vk::VkPipelineTessellationStateCreateInfo> m_tessState;
- de::SharedPtr<vk::VkPipelineRasterStateCreateInfo> m_rasterState;
- de::SharedPtr<vk::VkPipelineMultisampleStateCreateInfo> m_multisampleState;
- de::SharedPtr<vk::VkPipelineDynamicStateCreateInfo> m_dynamicState;
+ 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::VkViewport> m_viewports;
+ std::vector<vk::VkRect2D> m_scissors;
std::vector<vk::VkSampleMask> m_multisampleStateSampleMask;
};
class SamplerCreateInfo : public vk::VkSamplerCreateInfo
{
public:
- SamplerCreateInfo ( vk::VkTexFilter magFilter = vk::VK_TEX_FILTER_NEAREST,
- vk::VkTexFilter minFilter = vk::VK_TEX_FILTER_NEAREST,
- vk::VkTexMipmapMode mipMode = vk::VK_TEX_MIPMAP_MODE_NEAREST,
- vk::VkTexAddressMode addressU = vk::VK_TEX_ADDRESS_MODE_MIRROR,
- vk::VkTexAddressMode addressV = vk::VK_TEX_ADDRESS_MODE_MIRROR,
- vk::VkTexAddressMode addressW = vk::VK_TEX_ADDRESS_MODE_MIRROR,
- float mipLodBias = 0.0f,
- 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);
+ 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,
+ 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
return tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f);
}
-vk::Move<vk::VkShader> createShader(const vk::DeviceInterface &vk, const vk::VkDevice device,
- const vk::VkShaderModule module, const char* name, const vk::VkShaderStage stage)
-{
- vk::VkShaderCreateInfo createInfo;
- createInfo.sType = vk::VK_STRUCTURE_TYPE_SHADER_CREATE_INFO;
- createInfo.pNext = DE_NULL;
- createInfo.module = module;
- createInfo.pName = name;
- createInfo.flags = 0;
- createInfo.stage = stage;
- return vk::createShader(vk, device, &createInfo);
-}
-
namespace
{
de::SharedPtr<Image> m_colorTargetImage;
vk::Move<vk::VkImageView> m_colorTargetView;
-
+
de::SharedPtr<Image> m_depthStencilImage;
vk::Move<vk::VkImageView> m_attachmentView;
PipelineCreateInfo::VertexInputState m_vertexInputState;
de::SharedPtr<Buffer> m_vertexBuffer;
- vk::Move<vk::VkCmdPool> m_cmdPool;
- vk::Move<vk::VkCmdBuffer> m_cmdBuffer;
+ vk::Move<vk::VkCommandPool> m_cmdPool;
+ vk::Move<vk::VkCommandBuffer> m_cmdBuffer;
vk::Move<vk::VkFramebuffer> m_framebuffer;
vk::Move<vk::VkRenderPass> m_renderPass;
std::vector<Vec4RGBA> m_data;
- PipelineCreateInfo::DepthStencilState m_depthStencilState_1;
- PipelineCreateInfo::DepthStencilState m_depthStencilState_2;
+ PipelineCreateInfo::DepthStencilState m_depthStencilState_1;
+ PipelineCreateInfo::DepthStencilState m_depthStencilState_2;
void initialize (void)
{
const PipelineLayoutCreateInfo pipelineLayoutCreateInfo;
m_pipelineLayout = vk::createPipelineLayout(m_vk, device, &pipelineLayoutCreateInfo);
- const vk::Unique<vk::VkShader> vs(createShader(m_vk, device,
- *createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_vertexShaderName), 0),
- "main", vk::VK_SHADER_STAGE_VERTEX));
-
- const vk::Unique<vk::VkShader> fs(createShader(m_vk, device,
- *createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_fragmentShaderName), 0),
- "main", vk::VK_SHADER_STAGE_FRAGMENT));
-
+ const vk::Unique<vk::VkShaderModule> vs(createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_vertexShaderName), 0));
+ const vk::Unique<vk::VkShaderModule> fs(createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_fragmentShaderName), 0));
const vk::VkExtent3D imageExtent = { WIDTH, HEIGHT, 1 };
- const ImageCreateInfo targetImageCreateInfo(vk::VK_IMAGE_TYPE_2D, m_colorAttachmentFormat, imageExtent, 1, 1, 1,
- vk::VK_IMAGE_TILING_OPTIMAL, vk::VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | vk::VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT);
+ const ImageCreateInfo targetImageCreateInfo(vk::VK_IMAGE_TYPE_2D, m_colorAttachmentFormat, imageExtent, 1, 1, vk::VK_SAMPLE_COUNT_1_BIT,
+ vk::VK_IMAGE_TILING_OPTIMAL, vk::VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | vk::VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
- m_colorTargetImage = Image::CreateAndAlloc(m_vk, device, targetImageCreateInfo, m_context.getDefaultAllocator());
+ m_colorTargetImage = Image::createAndAlloc(m_vk, device, targetImageCreateInfo, m_context.getDefaultAllocator());
const ImageCreateInfo depthStencilImageCreateInfo(
vk::VK_IMAGE_TYPE_2D, m_depthStencilAttachmentFormat, imageExtent,
- 1, 1, 1, vk::VK_IMAGE_TILING_OPTIMAL,
+ 1, 1, vk::VK_SAMPLE_COUNT_1_BIT, vk::VK_IMAGE_TILING_OPTIMAL,
vk::VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT);
- m_depthStencilImage = Image::CreateAndAlloc(m_vk, device, depthStencilImageCreateInfo, m_context.getDefaultAllocator());
+ m_depthStencilImage = Image::createAndAlloc(m_vk, device, depthStencilImageCreateInfo, m_context.getDefaultAllocator());
const ImageViewCreateInfo colorTargetViewInfo(m_colorTargetImage->object(), vk::VK_IMAGE_VIEW_TYPE_2D, m_colorAttachmentFormat);
m_colorTargetView = vk::createImageView(m_vk, device, &colorTargetViewInfo);
RenderPassCreateInfo renderPassCreateInfo;
renderPassCreateInfo.addAttachment(AttachmentDescription(
m_colorAttachmentFormat,
- 1,
+ vk::VK_SAMPLE_COUNT_1_BIT,
vk::VK_ATTACHMENT_LOAD_OP_LOAD,
vk::VK_ATTACHMENT_STORE_OP_STORE,
vk::VK_ATTACHMENT_LOAD_OP_DONT_CARE,
renderPassCreateInfo.addAttachment(AttachmentDescription(
m_depthStencilAttachmentFormat,
- 1,
+ vk::VK_SAMPLE_COUNT_1_BIT,
vk::VK_ATTACHMENT_LOAD_OP_LOAD,
vk::VK_ATTACHMENT_STORE_OP_STORE,
vk::VK_ATTACHMENT_LOAD_OP_DONT_CARE,
renderPassCreateInfo.addSubpass(SubpassDescription(
vk::VK_PIPELINE_BIND_POINT_GRAPHICS,
- vk::VK_SUBPASS_DESCRIPTION_NO_OVERDRAW_BIT,
+ 0,
0,
DE_NULL,
1,
{
0,
sizeof(tcu::Vec4) * 2,
- vk::VK_VERTEX_INPUT_STEP_RATE_VERTEX,
+ vk::VK_VERTEX_INPUT_RATE_VERTEX,
};
const vk::VkVertexInputAttributeDescription vertexInputAttributeDescriptions[2] =
const PipelineCreateInfo::ColorBlendState::Attachment vkCbAttachmentState;
PipelineCreateInfo pipelineCreateInfo_1(*m_pipelineLayout, *m_renderPass, 0, 0);
- pipelineCreateInfo_1.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, vk::VK_SHADER_STAGE_VERTEX));
- pipelineCreateInfo_1.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, vk::VK_SHADER_STAGE_FRAGMENT));
+ pipelineCreateInfo_1.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, "main", vk::VK_SHADER_STAGE_VERTEX_BIT));
+ pipelineCreateInfo_1.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, "main", vk::VK_SHADER_STAGE_FRAGMENT_BIT));
pipelineCreateInfo_1.addState(PipelineCreateInfo::VertexInputState(m_vertexInputState));
pipelineCreateInfo_1.addState(PipelineCreateInfo::InputAssemblerState(m_topology));
pipelineCreateInfo_1.addState(PipelineCreateInfo::ColorBlendState(1, &vkCbAttachmentState));
pipelineCreateInfo_1.addState(PipelineCreateInfo::DynamicState());
PipelineCreateInfo pipelineCreateInfo_2(*m_pipelineLayout, *m_renderPass, 0, 0);
- pipelineCreateInfo_2.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, vk::VK_SHADER_STAGE_VERTEX));
- pipelineCreateInfo_2.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, vk::VK_SHADER_STAGE_FRAGMENT));
+ pipelineCreateInfo_2.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, "main", vk::VK_SHADER_STAGE_VERTEX_BIT));
+ pipelineCreateInfo_2.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, "main", vk::VK_SHADER_STAGE_FRAGMENT_BIT));
pipelineCreateInfo_2.addState(PipelineCreateInfo::VertexInputState(m_vertexInputState));
pipelineCreateInfo_2.addState(PipelineCreateInfo::InputAssemblerState(m_topology));
pipelineCreateInfo_2.addState(PipelineCreateInfo::ColorBlendState(1, &vkCbAttachmentState));
m_framebuffer = vk::createFramebuffer(m_vk, device, &framebufferCreateInfo);
const vk::VkDeviceSize dataSize = m_data.size() * sizeof(Vec4RGBA);
- m_vertexBuffer = Buffer::CreateAndAlloc(m_vk, device, BufferCreateInfo(dataSize,
+ m_vertexBuffer = Buffer::createAndAlloc(m_vk, device, BufferCreateInfo(dataSize,
vk::VK_BUFFER_USAGE_VERTEX_BUFFER_BIT),
m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);
const CmdPoolCreateInfo cmdPoolCreateInfo(m_context.getUniversalQueueFamilyIndex());
m_cmdPool = vk::createCommandPool(m_vk, device, &cmdPoolCreateInfo);
- const CmdBufferCreateInfo cmdBufCreateInfo(*m_cmdPool, vk::VK_CMD_BUFFER_LEVEL_PRIMARY, 0);
- m_cmdBuffer = vk::createCommandBuffer(m_vk, device, &cmdBufCreateInfo);
+ const vk::VkCommandBufferAllocateInfo cmdBufferAllocateInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ *m_cmdPool, // VkCommandPool commandPool;
+ vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCommandBufferLevel level;
+ 1u, // deUint32 bufferCount;
+ };
+ m_cmdBuffer = vk::allocateCommandBuffer(m_vk, device, &cmdBufferAllocateInfo);
}
virtual tcu::TestStatus iterate (void)
m_vk.beginCommandBuffer(*m_cmdBuffer, &beginInfo);
initialTransitionColor2DImage(m_vk, *m_cmdBuffer, m_colorTargetImage->object(), vk::VK_IMAGE_LAYOUT_GENERAL);
- initialTransitionDepthStencil2DImage(m_vk, *m_cmdBuffer, m_depthStencilImage->object(), vk::VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL);
+ initialTransitionDepthStencil2DImage(m_vk, *m_cmdBuffer, m_depthStencilImage->object(), vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
const ImageSubresourceRange subresourceRangeImage(vk::VK_IMAGE_ASPECT_COLOR_BIT);
m_vk.cmdClearColorImage(*m_cmdBuffer, m_colorTargetImage->object(),
const ImageSubresourceRange subresourceRangeDepthStencil[2] = { vk::VK_IMAGE_ASPECT_DEPTH_BIT, vk::VK_IMAGE_ASPECT_STENCIL_BIT };
m_vk.cmdClearDepthStencilImage(*m_cmdBuffer, m_depthStencilImage->object(),
- vk::VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL, &depthStencilClearValue, 2, subresourceRangeDepthStencil);
+ vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &depthStencilClearValue, 2, subresourceRangeDepthStencil);
const vk::VkRect2D renderArea = { { 0, 0 }, { WIDTH, HEIGHT } };
const RenderPassBeginInfo renderPassBegin(*m_renderPass, *m_framebuffer, renderArea);
- m_vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBegin, vk::VK_RENDER_PASS_CONTENTS_INLINE);
+ m_vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBegin, vk::VK_SUBPASS_CONTENTS_INLINE);
}
void setDynamicViewportState (const deUint32 width, const deUint32 height)
{
vk::VkViewport viewport;
- viewport.originX = 0;
- viewport.originY = 0;
+ viewport.x = 0;
+ viewport.y = 0;
viewport.width = static_cast<float>(width);
viewport.height = static_cast<float>(height);
viewport.minDepth = 0.0f;
m_vk.cmdSetScissor(*m_cmdBuffer, viewportCount, pScissors);
}
- void setDynamicRasterState(const float lineWidth = 1.0f,
- const float depthBias = 0.0f,
+ void setDynamicRasterizationState(const float lineWidth = 1.0f,
+ const float depthBiasConstantFactor = 0.0f,
const float depthBiasClamp = 0.0f,
- const float slopeScaledDepthBias = 0.0f)
+ const float depthBiasSlopeFactor = 0.0f)
{
m_vk.cmdSetLineWidth(*m_cmdBuffer, lineWidth);
- m_vk.cmdSetDepthBias(*m_cmdBuffer, depthBias, depthBiasClamp, slopeScaledDepthBias);
+ m_vk.cmdSetDepthBias(*m_cmdBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
}
void setDynamicBlendState(const float const1 = 0.0f, const float const2 = 0.0f,
const float const3 = 0.0f, const float const4 = 0.0f)
{
- float blendConstants[4] = { const1, const2, const3, const4 };
- m_vk.cmdSetBlendConstants(*m_cmdBuffer, blendConstants);
+ float blendConstantsants[4] = { const1, const2, const3, const4 };
+ m_vk.cmdSetBlendConstants(*m_cmdBuffer, blendConstantsants);
}
void setDynamicDepthStencilState(const float minDepthBounds = -1.0f,
// set states here
setDynamicViewportState(WIDTH, HEIGHT);
- setDynamicRasterState();
+ setDynamicRasterizationState();
setDynamicBlendState();
setDynamicDepthStencilState(0.5f, 0.75f);
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
- const vk::VkCmdBuffer cmdBuffer = *m_cmdBuffer;
- VK_CHECK(m_vk.queueSubmit(queue, 1, &cmdBuffer, DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 1, // deUint32 commandBufferCount;
+ &m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
+ 0, // deUint32 signalSemaphoreCount;
+ DE_NULL // const VkSemaphore* pSignalSemaphores;
+ };
+ m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
// validation
{
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
- vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR);
+ vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
qpTestResult res = QP_TEST_RESULT_PASS;
// set states here
setDynamicViewportState(WIDTH, HEIGHT);
- setDynamicRasterState();
+ setDynamicRasterizationState();
setDynamicBlendState();
const vk::VkDeviceSize vertexBufferOffset = 0;
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
- const vk::VkCmdBuffer cmdBuffer = *m_cmdBuffer;
- VK_CHECK(m_vk.queueSubmit(queue, 1, &cmdBuffer, DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 1, // deUint32 commandBufferCount;
+ &m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
+ 0, // deUint32 signalSemaphoreCount;
+ DE_NULL // const VkSemaphore* pSignalSemaphores;
+ };
+ m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
// validation
{
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
- vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR);
+ vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
qpTestResult res = QP_TEST_RESULT_PASS;
// set states here
setDynamicViewportState(WIDTH, HEIGHT);
- setDynamicRasterState();
+ setDynamicRasterizationState();
setDynamicBlendState();
const vk::VkDeviceSize vertexBufferOffset = 0;
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
- const vk::VkCmdBuffer cmdBuffer = *m_cmdBuffer;
- VK_CHECK(m_vk.queueSubmit(queue, 1, &cmdBuffer, DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 1, // deUint32 commandBufferCount;
+ &m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
+ 0, // deUint32 signalSemaphoreCount;
+ DE_NULL // const VkSemaphore* pSignalSemaphores;
+ };
+ m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
// validation
{
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
- vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR);
+ vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
qpTestResult res = QP_TEST_RESULT_PASS;
#include "vktTestCaseUtil.hpp"
#include "vktDynamicStateTestCaseUtil.hpp"
#include "vktDynamicStateBaseClass.hpp"
+#include "vktDynamicStateCreateInfoUtil.hpp"
+#include "vktDynamicStateImageObjectUtil.hpp"
+#include "vktDynamicStateBufferObjectUtil.hpp"
#include "tcuTestLog.hpp"
#include "tcuResource.hpp"
#include "tcuTextureUtil.hpp"
#include "vkDefs.hpp"
-#include "vktDynamicStateCreateInfoUtil.hpp"
-#include "vktDynamicStateImageObjectUtil.hpp"
namespace vkt
{
vk::VkRect2D scissor_1 = { { 0, 0 }, { WIDTH / 2, HEIGHT / 2 } };
vk::VkRect2D scissor_2 = { { WIDTH / 2, HEIGHT / 2 }, { WIDTH / 2, HEIGHT / 2 } };
- setDynamicRasterState();
+ setDynamicRasterizationState();
setDynamicBlendState();
setDynamicDepthStencilState();
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
- const vk::VkCmdBuffer cmdBuffer = *m_cmdBuffer;
- VK_CHECK(m_vk.queueSubmit(queue, 1, &cmdBuffer, DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
+ DE_NULL, // const void* pNext;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
+ &m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
+ 0, // deUint32 signalSemaphoreCount;\r
+ DE_NULL // const VkSemaphore* pSignalSemaphores;\r
+ };
+ m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
//validation
VK_CHECK(m_vk.queueWaitIdle(queue));
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
- vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR);
+ vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
qpTestResult res = QP_TEST_RESULT_PASS;
vk::VkRect2D scissor_1 = { { 0, 0 }, { WIDTH / 2, HEIGHT / 2 } };
vk::VkRect2D scissor_2 = { { WIDTH / 2, HEIGHT / 2 }, { WIDTH / 2, HEIGHT / 2 } };
- setDynamicRasterState();
+ setDynamicRasterizationState();
setDynamicBlendState();
setDynamicDepthStencilState();
setDynamicViewportState(1, &viewport, &scissor_1);
// rebind in different order
setDynamicBlendState();
- setDynamicRasterState();
+ setDynamicRasterizationState();
setDynamicDepthStencilState();
// bind first state
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
- const vk::VkCmdBuffer cmdBuffer = *m_cmdBuffer;
- VK_CHECK(m_vk.queueSubmit(queue, 1, &cmdBuffer, DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
+ DE_NULL, // const void* pNext;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
+ &m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
+ 0, // deUint32 signalSemaphoreCount;\r
+ DE_NULL // const VkSemaphore* pSignalSemaphores;\r
+ };
+ m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
//validation
VK_CHECK(m_vk.queueWaitIdle(queue));
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
- vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR);
+ vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
qpTestResult res = QP_TEST_RESULT_PASS;
virtual void initPipeline (const vk::VkDevice device)
{
// shaders
- const vk::Unique<vk::VkShader> vs(createShader(m_vk, device,
- *createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_vertexShaderName), 0),
- "main", vk::VK_SHADER_STAGE_VERTEX));
-
- const vk::Unique<vk::VkShader> fs(createShader(m_vk, device,
- *createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_fragmentShaderName), 0),
- "main", vk::VK_SHADER_STAGE_FRAGMENT));
-
+ const vk::Unique<vk::VkShaderModule> vs (createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_vertexShaderName), 0));
+ const vk::Unique<vk::VkShaderModule> fs (createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_fragmentShaderName), 0));
+
const PipelineCreateInfo::ColorBlendState::Attachment vkCbAttachmentState;
PipelineCreateInfo pipelineCreateInfo_1(*m_pipelineLayout, *m_renderPass, 0, 0);
- pipelineCreateInfo_1.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, vk::VK_SHADER_STAGE_VERTEX));
- pipelineCreateInfo_1.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, vk::VK_SHADER_STAGE_FRAGMENT));
+ pipelineCreateInfo_1.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, "main", vk::VK_SHADER_STAGE_VERTEX_BIT));
+ pipelineCreateInfo_1.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, "main", vk::VK_SHADER_STAGE_FRAGMENT_BIT));
pipelineCreateInfo_1.addState(PipelineCreateInfo::VertexInputState(m_vertexInputState));
pipelineCreateInfo_1.addState(PipelineCreateInfo::InputAssemblerState(vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
pipelineCreateInfo_1.addState(PipelineCreateInfo::ColorBlendState(1, &vkCbAttachmentState));
pipelineCreateInfo_1.addState(PipelineCreateInfo::DynamicState());
PipelineCreateInfo pipelineCreateInfo_2(*m_pipelineLayout, *m_renderPass, 0, 0);
- pipelineCreateInfo_2.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, vk::VK_SHADER_STAGE_VERTEX));
- pipelineCreateInfo_2.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, vk::VK_SHADER_STAGE_FRAGMENT));
+ pipelineCreateInfo_2.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, "main", vk::VK_SHADER_STAGE_VERTEX_BIT));
+ pipelineCreateInfo_2.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, "main", vk::VK_SHADER_STAGE_FRAGMENT_BIT));
pipelineCreateInfo_2.addState(PipelineCreateInfo::VertexInputState(m_vertexInputState));
pipelineCreateInfo_2.addState(PipelineCreateInfo::InputAssemblerState(vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
pipelineCreateInfo_2.addState(PipelineCreateInfo::ColorBlendState(1, &vkCbAttachmentState));
const vk::VkRect2D scissor_1 = { { 0, 0 }, { WIDTH / 2, HEIGHT / 2 } };
const vk::VkRect2D scissor_2 = { { WIDTH / 2, HEIGHT / 2 }, { WIDTH / 2, HEIGHT / 2 } };
- setDynamicRasterState();
+ setDynamicRasterizationState();
setDynamicBlendState();
setDynamicDepthStencilState();
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
- const vk::VkCmdBuffer cmdBuffer = *m_cmdBuffer;
- VK_CHECK(m_vk.queueSubmit(queue, 1, &cmdBuffer, DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
+ DE_NULL, // const void* pNext;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
+ &m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
+ 0, // deUint32 signalSemaphoreCount;\r
+ DE_NULL // const VkSemaphore* pSignalSemaphores;\r
+ };
+ m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
//validation
VK_CHECK(m_vk.queueWaitIdle(queue));
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
- vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR);
+ vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
qpTestResult res = QP_TEST_RESULT_PASS;
vk::VkDevice device,
vk::VkFormat format,
const vk::VkExtent3D &extend,
- deUint32 mipLevels,
- deUint32 arraySize,
+ deUint32 levelCount,
+ deUint32 layerCount,
vk::Move<vk::VkImage> object)
: m_allocation (DE_NULL)
, m_object (object)
, m_format (format)
, m_extent (extend)
- , m_mipLevels (mipLevels)
- , m_arraySize (arraySize)
+ , 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::VkImageAspect aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
+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());
- memset(m_pixelAccessData.data(), 0, m_pixelAccessData.size());
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR)
+ 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 || aspect == vk::VK_IMAGE_ASPECT_STENCIL)
+ 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::VkImageAspect aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
+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());
- memset(m_pixelAccessData.data(), 0, m_pixelAccessData.size());
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR)
+ 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 || aspect == vk::VK_IMAGE_ASPECT_STENCIL)
+ 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::VkImageAspect aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
+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());
- memset(m_pixelAccessData.data(), 0, m_pixelAccessData.size());
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR)
+ 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 || aspect == vk::VK_IMAGE_ASPECT_STENCIL)
+ 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::VkImageAspect aspect,
- vk::VkImageType type,
- void * 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)
{
- if (layout != vk::VK_IMAGE_LAYOUT_GENERAL && layout != vk::VK_IMAGE_LAYOUT_TRANSFER_SOURCE_OPTIMAL)
+ if (layout != vk::VK_IMAGE_LAYOUT_GENERAL && layout != vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL)
TCU_FAIL("Image::uploadFromSurface usage error: this function is not going to change Image layout!");
de::SharedPtr<Image> stagingResource = copyToLinearImage(queue, allocator, layout, offset, width,
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::VkImageAspect aspect,
- void * 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)
{
- if (layout != vk::VK_IMAGE_LAYOUT_GENERAL && layout != vk::VK_IMAGE_LAYOUT_TRANSFER_SOURCE_OPTIMAL)
+ if (layout != vk::VK_IMAGE_LAYOUT_GENERAL && layout != vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL)
TCU_FAIL("Image::uploadFromSurface usage error: this function is not going to change Image layout!");
de::SharedPtr<Buffer> stagingResource;
switch (m_format)
{
case vk::VK_FORMAT_D16_UNORM_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH) ? 2 : 1;
+ 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) ? 4 : 1;
+ pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 4 : 1;
break;
- case vk::VK_FORMAT_D24_UNORM_X8:
+ case vk::VK_FORMAT_X8_D24_UNORM_PACK32:
case vk::VK_FORMAT_D24_UNORM_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH) ? 3 : 1;
+ pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 3 : 1;
break;
}
bufferSize = pixelSize*width*height*depth;
}
- BufferCreateInfo stagingBufferResourceCreateInfo(bufferSize, vk::VK_BUFFER_USAGE_TRANSFER_DESTINATION_BIT | vk::VK_BUFFER_USAGE_TRANSFER_SOURCE_BIT);
- stagingResource = Buffer::CreateAndAlloc(m_vk, m_device, stagingBufferResourceCreateInfo, allocator, vk::MemoryRequirement::HostVisible);
+ 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);
{
#pragma message("Get queue family index")
CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
- vk::Unique<vk::VkCmdPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
-
- CmdBufferCreateInfo copyCmdBufCreateInfo(*copyCmdPool, vk::VK_CMD_BUFFER_LEVEL_PRIMARY, 0);
- vk::Unique<vk::VkCmdBuffer> copyCmdBuffer(vk::createCommandBuffer(m_vk, m_device, ©CmdBufCreateInfo));
+ 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));
vk::VkImageMemoryBarrier barrier;
barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
barrier.pNext = DE_NULL;
- barrier.outputMask = 0;
- barrier.inputMask = 0;
+ barrier.srcAccessMask = 0;
+ barrier.dstAccessMask = 0;
barrier.oldLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED;
barrier.newLayout = vk::VK_IMAGE_LAYOUT_GENERAL;
barrier.srcQueueFamilyIndex = vk::VK_QUEUE_FAMILY_IGNORED;
- barrier.destQueueFamilyIndex = vk::VK_QUEUE_FAMILY_IGNORED;
+ barrier.dstQueueFamilyIndex = vk::VK_QUEUE_FAMILY_IGNORED;
barrier.image = object();
- vk::VkImageAspectFlags aspectMask = 0;
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_COLOR_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_DEPTH_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_STENCIL)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_STENCIL_BIT;
- }
-
- barrier.subresourceRange.aspectMask = aspectMask;
+ barrier.subresourceRange.aspectMask = aspect;
barrier.subresourceRange.baseMipLevel = 0;
- barrier.subresourceRange.mipLevels = m_mipLevels;
+ barrier.subresourceRange.levelCount = m_levelCount;
barrier.subresourceRange.baseArrayLayer = 0;
- barrier.subresourceRange.arraySize = m_arraySize;
+ barrier.subresourceRange.layerCount = m_layerCount;
void* barriers[] = { &barrier };
- m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
+ m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
false, DE_LENGTH_OF_ARRAY(barriers), barriers);
}
- vk::VkImageAspectFlags aspectMask = 0;
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_COLOR_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_DEPTH_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_STENCIL)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_STENCIL_BIT;
- }
-
vk::VkBufferImageCopy region =
{
0, 0, 0,
m_vk.cmdCopyImageToBuffer(*copyCmdBuffer, object(), layout, stagingResource->object(), 1, ®ion);
VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
- VK_CHECK(m_vk.queueSubmit(queue, 1, ©CmdBuffer.get(), DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
+ DE_NULL, // const void* pNext;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
+ ©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
+ 0, // deUint32 signalSemaphoreCount;\r
+ DE_NULL // const VkSemaphore* pSignalSemaphores;\r
+ };
+ m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
// TODO: make this less intrusive
VK_CHECK(m_vk.queueWaitIdle(queue));
deMemcpy(data, destPtr, bufferSize);
}
-tcu::ConstPixelBufferAccess Image::readSurfaceLinear (vk::VkOffset3D offset,
- int width,
- int height,
- int depth,
- vk::VkImageAspect aspect,
- unsigned int mipLevel,
- unsigned int arrayElement)
+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::VkImageAspect aspect,
- void * 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 = { aspect, mipLevel, arrayElement };
vk::VkSubresourceLayout imageLayout = {};
- VK_CHECK(m_vk.getImageSubresourceLayout(m_device, object(), &imageSubResource, &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);
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::VkImageAspect aspect,
- vk::VkImageType type)
+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 = {width, height, depth};
ImageCreateInfo stagingResourceCreateInfo(
- type, m_format, stagingExtent, 1, 1, 1,
- vk::VK_IMAGE_TILING_LINEAR, vk::VK_IMAGE_USAGE_TRANSFER_DESTINATION_BIT);
+ 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,
+ stagingResource = Image::createAndAlloc(m_vk, m_device, stagingResourceCreateInfo, allocator,
vk::MemoryRequirement::HostVisible);
#pragma message("Get queue family index")
CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
- vk::Unique<vk::VkCmdPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
+ vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
- CmdBufferCreateInfo copyCmdBufCreateInfo(*copyCmdPool, vk::VK_CMD_BUFFER_LEVEL_PRIMARY, 0);
- vk::Unique<vk::VkCmdBuffer> copyCmdBuffer(vk::createCommandBuffer(m_vk, m_device, ©CmdBufCreateInfo));
+ 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));
-
- vk::VkImageAspectFlags aspectMask = 0;
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_COLOR_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_DEPTH_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_STENCIL)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_STENCIL_BIT;
- }
-
- transition2DImage(m_vk, *copyCmdBuffer, stagingResource->object(), aspectMask, vk::VK_IMAGE_LAYOUT_UNDEFINED, vk::VK_IMAGE_LAYOUT_GENERAL);
+ 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 = { {aspect, mipLevel, arrayElement, 1}, offset, {aspect, 0, 0, 1}, zeroOffset, {width, height, depth} };
m_vk.cmdCopyImage(*copyCmdBuffer, object(), layout, stagingResource->object(), vk::VK_IMAGE_LAYOUT_GENERAL, 1, ®ion);
VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
- VK_CHECK(m_vk.queueSubmit(queue, 1, ©CmdBuffer.get(), DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
+ DE_NULL, // const void* pNext;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
+ ©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
+ 0, // deUint32 signalSemaphoreCount;\r
+ DE_NULL // const VkSemaphore* pSignalSemaphores;\r
+ };
+ 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,
+void Image::uploadVolume(const tcu::ConstPixelBufferAccess& access,
vk::VkQueue queue,
- vk::Allocator &allocator,
+ vk::Allocator& allocator,
vk::VkImageLayout layout,
vk::VkOffset3D offset,
- vk::VkImageAspect aspect,
+ vk::VkImageAspectFlagBits aspect,
unsigned int mipLevel,
unsigned int arrayElement)
{
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR)
+ 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 || aspect == vk::VK_IMAGE_ASPECT_STENCIL)
+ 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,
+void Image::uploadSurface (const tcu::ConstPixelBufferAccess& access,
vk::VkQueue queue,
- vk::Allocator &allocator,
+ vk::Allocator& allocator,
vk::VkImageLayout layout,
vk::VkOffset3D offset,
- vk::VkImageAspect aspect,
+ vk::VkImageAspectFlagBits aspect,
unsigned int mipLevel,
unsigned int arrayElement)
{
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR)
+ 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 || aspect == vk::VK_IMAGE_ASPECT_STENCIL)
+ 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,
+void Image::uploadSurface1D (const tcu::ConstPixelBufferAccess& access,
vk::VkQueue queue,
- vk::Allocator &allocator,
+ vk::Allocator& allocator,
vk::VkImageLayout layout,
vk::VkOffset3D offset,
- vk::VkImageAspect aspect,
+ vk::VkImageAspectFlagBits aspect,
unsigned int mipLevel,
unsigned int arrayElement)
{
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR)
+ 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 || aspect == vk::VK_IMAGE_ASPECT_STENCIL)
+ 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,
+void Image::uploadSurfaceLinear (const tcu::ConstPixelBufferAccess& access,
vk::VkOffset3D offset,
int width,
int height,
int depth,
- vk::VkImageAspect aspect,
+ 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::VkImageAspect aspect,
- vk::VkImageType type,
- const void * data)
+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)
{
if (layout != vk::VK_IMAGE_LAYOUT_UNDEFINED
&& layout != vk::VK_IMAGE_LAYOUT_GENERAL
- && layout != vk::VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL)
+ && layout != vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL)
{
TCU_FAIL("Image::uploadFromRaw usage error: this function is not going to change Image layout!");
}
de::SharedPtr<Image> stagingResource;
vk::VkExtent3D extent = {width, height, depth};
ImageCreateInfo stagingResourceCreateInfo(
- type, m_format, extent, 1, 1, 1,
- vk::VK_IMAGE_TILING_LINEAR, vk::VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT);
+ 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,
+ stagingResource = Image::createAndAlloc(m_vk, m_device, stagingResourceCreateInfo, allocator,
vk::MemoryRequirement::HostVisible);
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
{
#pragma message("Get queue family index")
CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
- vk::Unique<vk::VkCmdPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
+ vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
- CmdBufferCreateInfo copyCmdBufCreateInfo(*copyCmdPool, vk::VK_CMD_BUFFER_LEVEL_PRIMARY, 0);
- vk::Unique<vk::VkCmdBuffer> copyCmdBuffer(vk::createCommandBuffer(m_vk, m_device, ©CmdBufCreateInfo));
+ 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));
vk::VkImageMemoryBarrier barrier;
barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
barrier.pNext = DE_NULL;
- barrier.outputMask = 0;
- barrier.inputMask = 0;
+ barrier.srcAccessMask = 0;
+ barrier.dstAccessMask = 0;
barrier.oldLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED;
barrier.newLayout = vk::VK_IMAGE_LAYOUT_GENERAL;
barrier.srcQueueFamilyIndex = vk::VK_QUEUE_FAMILY_IGNORED;
- barrier.destQueueFamilyIndex = vk::VK_QUEUE_FAMILY_IGNORED;
+ barrier.dstQueueFamilyIndex = vk::VK_QUEUE_FAMILY_IGNORED;
barrier.image = object();
- vk::VkImageAspectFlags aspectMask = 0;
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_COLOR_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_DEPTH_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_STENCIL)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_STENCIL_BIT;
- }
-
- barrier.subresourceRange.aspectMask = aspectMask;
+ barrier.subresourceRange.aspectMask = aspect;
barrier.subresourceRange.baseMipLevel = 0;
- barrier.subresourceRange.mipLevels = m_mipLevels;
+ barrier.subresourceRange.levelCount = m_levelCount;
barrier.subresourceRange.baseArrayLayer = 0;
- barrier.subresourceRange.arraySize = m_arraySize;
+ barrier.subresourceRange.layerCount = m_layerCount;
void* barriers[] = { &barrier };
- m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, false, DE_LENGTH_OF_ARRAY(barriers), barriers);
- }
-
- vk::VkImageAspectFlags aspectMask = 0;
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_COLOR_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_DEPTH_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_STENCIL)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_STENCIL_BIT;
+ m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, false, DE_LENGTH_OF_ARRAY(barriers), barriers);
}
- transition2DImage(m_vk, *copyCmdBuffer, stagingResource->object(), aspectMask, vk::VK_IMAGE_LAYOUT_UNDEFINED, vk::VK_IMAGE_LAYOUT_GENERAL);
+ transition2DImage(m_vk, *copyCmdBuffer, stagingResource->object(), aspect, vk::VK_IMAGE_LAYOUT_UNDEFINED, vk::VK_IMAGE_LAYOUT_GENERAL);
vk::VkImageCopy region = {{aspect, 0, 0, 1},
zeroOffset,
vk::VK_IMAGE_LAYOUT_GENERAL, object(), layout, 1, ®ion);
VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
- VK_CHECK(m_vk.queueSubmit(queue, 1, ©CmdBuffer.get(), DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
+ DE_NULL, // const void* pNext;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
+ ©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
+ 0, // deUint32 signalSemaphoreCount;\r
+ DE_NULL // const VkSemaphore* pSignalSemaphores;\r
+ };
+ 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::VkImageAspect aspect,
- const void * data)
+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)
{
if (layout != vk::VK_IMAGE_LAYOUT_UNDEFINED
&& layout != vk::VK_IMAGE_LAYOUT_GENERAL
- && layout != vk::VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL)
+ && layout != vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL)
{
TCU_FAIL("Image::uploadFromRaw usage error: this function is not going to change Image layout!");
}
switch (m_format)
{
case vk::VK_FORMAT_D16_UNORM_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH) ? 2 : 1;
+ 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) ? 4 : 1;
+ pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 4 : 1;
break;
- case vk::VK_FORMAT_D24_UNORM_X8:
+ case vk::VK_FORMAT_X8_D24_UNORM_PACK32:
case vk::VK_FORMAT_D24_UNORM_S8_UINT:
- pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH) ? 3 : 1;
+ pixelSize = (aspect == vk::VK_IMAGE_ASPECT_DEPTH_BIT) ? 3 : 1;
break;
}
bufferSize = pixelSize*width*height*depth;
}
- BufferCreateInfo stagingBufferResourceCreateInfo(bufferSize, vk::VK_BUFFER_USAGE_TRANSFER_DESTINATION_BIT | vk::VK_BUFFER_USAGE_TRANSFER_SOURCE_BIT);
- stagingResource = Buffer::CreateAndAlloc(m_vk, m_device, stagingBufferResourceCreateInfo, allocator, vk::MemoryRequirement::HostVisible);
+ 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, bufferSize);
vk::flushMappedMemoryRange(m_vk, m_device, stagingResource->getBoundMemory().getMemory(), stagingResource->getBoundMemory().getOffset(), bufferSize);
{
#pragma message("Get queue family index")
CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
- vk::Unique<vk::VkCmdPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
+ vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
- CmdBufferCreateInfo copyCmdBufCreateInfo(*copyCmdPool, vk::VK_CMD_BUFFER_LEVEL_PRIMARY, 0);
- vk::Unique<vk::VkCmdBuffer> copyCmdBuffer(vk::createCommandBuffer(m_vk, m_device, ©CmdBufCreateInfo));
+ 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));
vk::VkImageMemoryBarrier barrier;
barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
barrier.pNext = DE_NULL;
- barrier.outputMask = 0;
- barrier.inputMask = 0;
+ barrier.srcAccessMask = 0;
+ barrier.dstAccessMask = 0;
barrier.oldLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED;
barrier.newLayout = vk::VK_IMAGE_LAYOUT_GENERAL;
barrier.srcQueueFamilyIndex = vk::VK_QUEUE_FAMILY_IGNORED;
- barrier.destQueueFamilyIndex = vk::VK_QUEUE_FAMILY_IGNORED;
+ barrier.dstQueueFamilyIndex = vk::VK_QUEUE_FAMILY_IGNORED;
barrier.image = object();
- vk::VkImageAspectFlags aspectMask = 0;
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_COLOR_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_DEPTH_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_STENCIL)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_STENCIL_BIT;
- }
-
- barrier.subresourceRange.aspectMask = aspectMask;
+ barrier.subresourceRange.aspectMask = aspect;
barrier.subresourceRange.baseMipLevel = 0;
- barrier.subresourceRange.mipLevels = m_mipLevels;
+ barrier.subresourceRange.levelCount = m_levelCount;
barrier.subresourceRange.baseArrayLayer = 0;
- barrier.subresourceRange.arraySize = m_arraySize;
+ barrier.subresourceRange.layerCount = m_layerCount;
void* barriers[] = { &barrier };
- m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, false, DE_LENGTH_OF_ARRAY(barriers), barriers);
- }
-
- vk::VkImageAspectFlags aspectMask = 0;
- if (aspect == vk::VK_IMAGE_ASPECT_COLOR)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_COLOR_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_DEPTH)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_DEPTH_BIT;
- }
- if (aspect == vk::VK_IMAGE_ASPECT_STENCIL)
- {
- aspectMask |= vk::VK_IMAGE_ASPECT_STENCIL_BIT;
+ m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, false, DE_LENGTH_OF_ARRAY(barriers), barriers);
}
vk::VkBufferImageCopy region = {
object(), layout, 1, ®ion);
VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
- VK_CHECK(m_vk.queueSubmit(queue, 1, ©CmdBuffer.get(), DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
+ DE_NULL, // const void* pNext;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
+ ©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
+ 0, // deUint32 signalSemaphoreCount;\r
+ DE_NULL // const VkSemaphore* pSignalSemaphores;\r
+ };
+ 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::VkImageAspect aspect,
- const void * data)
+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 = {aspect, mipLevel, arrayElement};
- VK_CHECK(m_vk.getImageSubresourceLayout(m_device, object(), &imageSubResource,
- &imageLayout));
+ m_vk.getImageSubresourceLayout(m_device, object(), &imageSubResource,
+ &imageLayout);
char* destPtr = reinterpret_cast<char*>(getBoundMemory().getHostPtr());
vk::VkDeviceSize Image::getPixelOffset (vk::VkOffset3D offset,
vk::VkDeviceSize rowPitch,
vk::VkDeviceSize depthPitch,
- unsigned int mipLevel,
- unsigned int arrayElement)
+ unsigned int level,
+ unsigned int layer)
{
- if (mipLevel >= m_mipLevels)
+ if (level >= m_levelCount)
TCU_FAIL("mip level too large");
- if (arrayElement >= m_arraySize)
+ if (layer >= m_layerCount)
TCU_FAIL("array element too large");
vk::VkDeviceSize mipLevelSizes[32];
= tcu::IVec3(m_extent.width, m_extent.height, m_extent.depth);
vk::VkDeviceSize arrayElemSize = 0;
- for (unsigned int i = 0; i < m_mipLevels && (mipExtend[0] > 1 || mipExtend[1] > 1 || mipExtend[2] > 1); ++i)
+ 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;
mipExtend = tcu::max(mipExtend / 2, tcu::IVec3(1));
}
- vk::VkDeviceSize pixelOffset = arrayElement * arrayElemSize;
- for (size_t i = 0; i < mipLevel; ++i) {
+ vk::VkDeviceSize pixelOffset = layer * arrayElemSize;
+ for (size_t i = 0; i < level; ++i) {
pixelOffset += mipLevelSizes[i];
}
- pixelOffset += offset.z * mipLevelRectSizes[mipLevel];
+ pixelOffset += offset.z * mipLevelRectSizes[level];
pixelOffset += offset.y * rowPitch;
pixelOffset += offset.x;
void Image::bindMemory (de::MovePtr<vk::Allocation> allocation)
{
- if (allocation)
- {
- VK_CHECK(m_vk.bindImageMemory(m_device, *m_object, allocation->getMemory(), allocation->getOffset()));
- }
- else
- {
- VK_CHECK(m_vk.bindImageMemory(m_device, *m_object, DE_NULL, 0));
- }
+ 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,
+de::SharedPtr<Image> Image::createAndAlloc(const vk::DeviceInterface& vk,
vk::VkDevice device,
- const vk::VkImageCreateInfo &createInfo,
- vk::Allocator &allocator,
+ const vk::VkImageCreateInfo& createInfo,
+ vk::Allocator& allocator,
vk::MemoryRequirement memoryRequirement)
{
- de::SharedPtr<Image> ret = Create(vk, device, createInfo);
+ 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,
+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.arraySize,
+ createInfo.mipLevels, createInfo.arrayLayers,
vk::createImage(vk, device, &createInfo)));
}
-void transition2DImage (const vk::DeviceInterface &vk,
- vk::VkCmdBuffer cmdBuffer,
+void transition2DImage (const vk::DeviceInterface& vk,
+ vk::VkCommandBuffer cmdBuffer,
vk::VkImage image,
vk::VkImageAspectFlags aspectMask,
vk::VkImageLayout oldLayout,
vk::VkImageLayout newLayout)
{
vk::VkImageMemoryBarrier barrier;
- barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- barrier.pNext = DE_NULL;
- barrier.outputMask = 0;
- barrier.inputMask = 0;
- barrier.oldLayout = oldLayout;
- barrier.newLayout = newLayout;
- barrier.srcQueueFamilyIndex = vk::VK_QUEUE_FAMILY_IGNORED;
- barrier.destQueueFamilyIndex = vk::VK_QUEUE_FAMILY_IGNORED;
- barrier.image = image;
- barrier.subresourceRange.aspectMask = aspectMask;
- barrier.subresourceRange.baseMipLevel = 0;
- barrier.subresourceRange.mipLevels = 1;
+ barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
+ barrier.pNext = DE_NULL;
+ barrier.srcAccessMask = 0;
+ barrier.dstAccessMask = 0;
+ barrier.oldLayout = oldLayout;
+ barrier.newLayout = newLayout;
+ barrier.srcQueueFamilyIndex = vk::VK_QUEUE_FAMILY_IGNORED;
+ barrier.dstQueueFamilyIndex = vk::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.arraySize = 1;
+ barrier.subresourceRange.layerCount = 1;
void* barriers[] = { &barrier };
- vk.cmdPipelineBarrier(cmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, false, DE_LENGTH_OF_ARRAY(barriers), barriers);
+ vk.cmdPipelineBarrier(cmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, false, DE_LENGTH_OF_ARRAY(barriers), barriers);
}
-void initialTransitionColor2DImage (const vk::DeviceInterface &vk, vk::VkCmdBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout)
+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::VkCmdBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout 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::VkCmdBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout 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::VkCmdBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout 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);
}
--- /dev/null
+#ifndef _VKT_DYNAMIC_STATE_IMAGEOBJECTUTIL_HPP
+#define _VKT_DYNAMIC_STATE_IMAGEOBJECTUTIL_HPP
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2015 The Khronos Group Inc.
+ * Copyright (c) 2015 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * The Materials are Confidential Information as defined by the
+ * Khronos Membership Agreement until designated non-confidential by Khronos,
+ * at which point this condition clause shall be removed.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//*!
+ * \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 rowPitch,
+ vk::VkDeviceSize depthPitch,
+ const void * srcBuffer,
+ void * destBuffer);
+
+ static void unpack (int pixelSize,
+ int width,
+ int height,
+ int depth,
+ vk::VkDeviceSize rowPitch,
+ vk::VkDeviceSize depthPitch,
+ 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);
+
+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);
+
+} //DynamicState
+} //vkt
+
+#endif // _VKT_DYNAMIC_STATE_IMAGEOBJECTUTIL_HPP
PipelineCreateInfo::VertexInputState m_vertexInputState;
de::SharedPtr<Buffer> m_vertexBuffer;
- vk::Move<vk::VkCmdPool> m_cmdPool;
- vk::Move<vk::VkCmdBuffer> m_cmdBuffer;
+ vk::Move<vk::VkCommandPool> m_cmdPool;
+ vk::Move<vk::VkCommandBuffer> m_cmdBuffer;
vk::Move<vk::VkFramebuffer> m_framebuffer;
vk::Move<vk::VkRenderPass> m_renderPass;
std::vector<Vec4RGBA> m_data;
- PipelineCreateInfo::DepthStencilState m_depthStencilState;
+ PipelineCreateInfo::DepthStencilState m_depthStencilState;
void initialize (void)
{
const PipelineLayoutCreateInfo pipelineLayoutCreateInfo;
m_pipelineLayout = vk::createPipelineLayout(m_vk, device, &pipelineLayoutCreateInfo);
- const vk::Unique<vk::VkShader> vs(createShader(m_vk, device,
- *createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_vertexShaderName), 0),
- "main", vk::VK_SHADER_STAGE_VERTEX));
-
- const vk::Unique<vk::VkShader> fs(createShader(m_vk, device,
- *createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_fragmentShaderName), 0),
- "main", vk::VK_SHADER_STAGE_FRAGMENT));
+ const vk::Unique<vk::VkShaderModule> vs(createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_vertexShaderName), 0));
+ const vk::Unique<vk::VkShaderModule> fs(createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_fragmentShaderName), 0));
const vk::VkExtent3D imageExtent = { WIDTH, HEIGHT, 1 };
ImageCreateInfo targetImageCreateInfo(
- vk::VK_IMAGE_TYPE_2D, m_colorAttachmentFormat, imageExtent, 1, 1, 1, vk::VK_IMAGE_TILING_OPTIMAL,
- vk::VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | vk::VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT);
+ vk::VK_IMAGE_TYPE_2D, m_colorAttachmentFormat, imageExtent, 1, 1, vk::VK_SAMPLE_COUNT_1_BIT, vk::VK_IMAGE_TILING_OPTIMAL,
+ vk::VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | vk::VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
- m_colorTargetImage = Image::CreateAndAlloc(m_vk, device, targetImageCreateInfo, m_context.getDefaultAllocator());
+ m_colorTargetImage = Image::createAndAlloc(m_vk, device, targetImageCreateInfo, m_context.getDefaultAllocator());
const ImageCreateInfo depthStencilImageCreateInfo(
vk::VK_IMAGE_TYPE_2D, m_depthStencilAttachmentFormat, imageExtent,
- 1, 1, 1, vk::VK_IMAGE_TILING_OPTIMAL,
+ 1, 1, vk::VK_SAMPLE_COUNT_1_BIT, vk::VK_IMAGE_TILING_OPTIMAL,
vk::VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT);
- m_depthStencilImage = Image::CreateAndAlloc(m_vk, device, depthStencilImageCreateInfo, m_context.getDefaultAllocator());
+ m_depthStencilImage = Image::createAndAlloc(m_vk, device, depthStencilImageCreateInfo, m_context.getDefaultAllocator());
const ImageViewCreateInfo colorTargetViewInfo(m_colorTargetImage->object(), vk::VK_IMAGE_VIEW_TYPE_2D, m_colorAttachmentFormat);
m_colorTargetView = vk::createImageView(m_vk, device, &colorTargetViewInfo);
RenderPassCreateInfo renderPassCreateInfo;
renderPassCreateInfo.addAttachment(AttachmentDescription(
m_colorAttachmentFormat,
- 1,
+ vk::VK_SAMPLE_COUNT_1_BIT,
vk::VK_ATTACHMENT_LOAD_OP_LOAD,
vk::VK_ATTACHMENT_STORE_OP_STORE,
vk::VK_ATTACHMENT_LOAD_OP_DONT_CARE,
renderPassCreateInfo.addAttachment(AttachmentDescription(
m_depthStencilAttachmentFormat,
- 1,
+ vk::VK_SAMPLE_COUNT_1_BIT,
vk::VK_ATTACHMENT_LOAD_OP_LOAD,
vk::VK_ATTACHMENT_STORE_OP_STORE,
vk::VK_ATTACHMENT_LOAD_OP_DONT_CARE,
renderPassCreateInfo.addSubpass(SubpassDescription(
vk::VK_PIPELINE_BIND_POINT_GRAPHICS,
- vk::VK_SUBPASS_DESCRIPTION_NO_OVERDRAW_BIT,
+ 0,
0,
DE_NULL,
1,
{
0,
sizeof(tcu::Vec4) * 2,
- vk::VK_VERTEX_INPUT_STEP_RATE_VERTEX,
+ vk::VK_VERTEX_INPUT_RATE_VERTEX,
};
const vk::VkVertexInputAttributeDescription vertexInputAttributeDescriptions[2] =
const PipelineCreateInfo::ColorBlendState::Attachment vkCbAttachmentState;
PipelineCreateInfo pipelineCreateInfo(*m_pipelineLayout, *m_renderPass, 0, 0);
- pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, vk::VK_SHADER_STAGE_VERTEX));
- pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, vk::VK_SHADER_STAGE_FRAGMENT));
+ pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, "main", vk::VK_SHADER_STAGE_VERTEX_BIT));
+ pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, "main", vk::VK_SHADER_STAGE_FRAGMENT_BIT));
pipelineCreateInfo.addState(PipelineCreateInfo::VertexInputState(m_vertexInputState));
pipelineCreateInfo.addState(PipelineCreateInfo::InputAssemblerState(m_topology));
pipelineCreateInfo.addState(PipelineCreateInfo::ColorBlendState(1, &vkCbAttachmentState));
m_framebuffer = vk::createFramebuffer(m_vk, device, &framebufferCreateInfo);
const vk::VkDeviceSize dataSize = m_data.size() * sizeof(Vec4RGBA);
- m_vertexBuffer = Buffer::CreateAndAlloc(m_vk, device, BufferCreateInfo(dataSize,
+ m_vertexBuffer = Buffer::createAndAlloc(m_vk, device, BufferCreateInfo(dataSize,
vk::VK_BUFFER_USAGE_VERTEX_BUFFER_BIT),
m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);
const CmdPoolCreateInfo cmdPoolCreateInfo(m_context.getUniversalQueueFamilyIndex());
m_cmdPool = vk::createCommandPool(m_vk, device, &cmdPoolCreateInfo);
- const CmdBufferCreateInfo cmdBufCreateInfo(*m_cmdPool, vk::VK_CMD_BUFFER_LEVEL_PRIMARY, 0);
- m_cmdBuffer = vk::createCommandBuffer(m_vk, device, &cmdBufCreateInfo);
+ const vk::VkCommandBufferAllocateInfo cmdBufferAllocateInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ *m_cmdPool, // VkCommandPool commandPool;
+ vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCommandBufferLevel level;
+ 1u, // deUint32 bufferCount;
+ };
+ m_cmdBuffer = vk::allocateCommandBuffer(m_vk, device, &cmdBufferAllocateInfo);
}
virtual tcu::TestStatus iterate (void)
m_vk.beginCommandBuffer(*m_cmdBuffer, &beginInfo);
initialTransitionColor2DImage(m_vk, *m_cmdBuffer, m_colorTargetImage->object(), vk::VK_IMAGE_LAYOUT_GENERAL);
- initialTransitionDepthStencil2DImage(m_vk, *m_cmdBuffer, m_depthStencilImage->object(), vk::VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL);
+ initialTransitionDepthStencil2DImage(m_vk, *m_cmdBuffer, m_depthStencilImage->object(), vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
const ImageSubresourceRange subresourceRangeImage(vk::VK_IMAGE_ASPECT_COLOR_BIT);
m_vk.cmdClearColorImage(*m_cmdBuffer, m_colorTargetImage->object(),
const ImageSubresourceRange subresourceRangeDepthStencil[2] = { vk::VK_IMAGE_ASPECT_DEPTH_BIT, vk::VK_IMAGE_ASPECT_STENCIL_BIT };
m_vk.cmdClearDepthStencilImage(*m_cmdBuffer, m_depthStencilImage->object(),
- vk::VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL, &depthStencilClearValue, 2, subresourceRangeDepthStencil);
+ vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &depthStencilClearValue, 2, subresourceRangeDepthStencil);
const vk::VkRect2D renderArea = { { 0, 0 }, { WIDTH, HEIGHT } };
const RenderPassBeginInfo renderPassBegin(*m_renderPass, *m_framebuffer, renderArea);
- m_vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBegin, vk::VK_RENDER_PASS_CONTENTS_INLINE);
+ m_vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBegin, vk::VK_SUBPASS_CONTENTS_INLINE);
}
void setDynamicViewportState (const deUint32 width, const deUint32 height)
{
vk::VkViewport viewport;
- viewport.originX = 0;
- viewport.originY = 0;
+ viewport.x = 0;
+ viewport.y = 0;
viewport.width = static_cast<float>(width);
viewport.height = static_cast<float>(height);
viewport.minDepth = 0.0f;
m_vk.cmdSetScissor(*m_cmdBuffer, viewportCount, pScissors);
}
- void setDynamicRasterState (const float lineWidth = 1.0f,
- const float depthBias = 0.0f,
+ void setDynamicRasterizationState (const float lineWidth = 1.0f,
+ const float depthBiasConstantFactor = 0.0f,
const float depthBiasClamp = 0.0f,
- const float slopeScaledDepthBias = 0.0f)
+ const float depthBiasSlopeFactor = 0.0f)
{
m_vk.cmdSetLineWidth(*m_cmdBuffer, lineWidth);
- m_vk.cmdSetDepthBias(*m_cmdBuffer, depthBias, depthBiasClamp, slopeScaledDepthBias);
+ m_vk.cmdSetDepthBias(*m_cmdBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
}
void setDynamicBlendState (const float const1 = 0.0f, const float const2 = 0.0f,
const float const3 = 0.0f, const float const4 = 0.0f)
{
- float blendConstants[4] = { const1, const2, const3, const4 };
- m_vk.cmdSetBlendConstants(*m_cmdBuffer, blendConstants);
+ float blendConstantsants[4] = { const1, const2, const3, const4 };
+ m_vk.cmdSetBlendConstants(*m_cmdBuffer, blendConstantsants);
}
void setDynamicDepthStencilState (const float minDepthBounds = -1.0f, const float maxDepthBounds = 1.0f,
// enable depth test
m_depthStencilState = PipelineCreateInfo::DepthStencilState(
- vk::VK_TRUE, vk::VK_TRUE, vk::VK_COMPARE_OP_GREATER_EQUAL);
+ vk::VK_TRUE, vk::VK_TRUE, vk::VK_COMPARE_OP_GREATER_OR_EQUAL);
DepthBiasBaseCase::initialize();
}
const vk::VkBuffer vertexBuffer = m_vertexBuffer->object();
m_vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
- setDynamicRasterState(1.0f, 0.0f);
+ setDynamicRasterizationState(1.0f, 0.0f);
m_vk.cmdDraw(*m_cmdBuffer, 4, 1, 0, 0);
m_vk.cmdDraw(*m_cmdBuffer, 4, 1, 4, 0);
- setDynamicRasterState(1.0f, -1.0f);
+ setDynamicRasterizationState(1.0f, -1.0f);
m_vk.cmdDraw(*m_cmdBuffer, 4, 1, 8, 0);
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
- const vk::VkCmdBuffer cmdBuffer = *m_cmdBuffer;
- VK_CHECK(m_vk.queueSubmit(queue, 1, &cmdBuffer, DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 1, // deUint32 commandBufferCount;
+ &m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
+ 0, // deUint32 signalSemaphoreCount;
+ DE_NULL // const VkSemaphore* pSignalSemaphores;
+ };
+ m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
// validation
{
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
- vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR);
+ vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
qpTestResult res = QP_TEST_RESULT_PASS;
// enable depth test
m_depthStencilState = PipelineCreateInfo::DepthStencilState(
- vk::VK_TRUE, vk::VK_TRUE, vk::VK_COMPARE_OP_GREATER_EQUAL);
+ vk::VK_TRUE, vk::VK_TRUE, vk::VK_COMPARE_OP_GREATER_OR_EQUAL);
DepthBiasBaseCase::initialize();
}
const vk::VkBuffer vertexBuffer = m_vertexBuffer->object();
m_vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
- setDynamicRasterState(1.0f, 1000.0f, 0.005f);
+ setDynamicRasterizationState(1.0f, 1000.0f, 0.005f);
m_vk.cmdDraw(*m_cmdBuffer, 4, 1, 0, 0);
- setDynamicRasterState(1.0f, 0.0f);
+ setDynamicRasterizationState(1.0f, 0.0f);
m_vk.cmdDraw(*m_cmdBuffer, 4, 1, 4, 0);
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
- const vk::VkCmdBuffer cmdBuffer = *m_cmdBuffer;
- VK_CHECK(m_vk.queueSubmit(queue, 1, &cmdBuffer, DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 1, // deUint32 commandBufferCount;
+ &m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
+ 0, // deUint32 signalSemaphoreCount;
+ DE_NULL // const VkSemaphore* pSignalSemaphores;
+ };
+ m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
// validation
{
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
- vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR);
+ vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
qpTestResult res = QP_TEST_RESULT_PASS;
setDynamicViewportState(WIDTH, HEIGHT);
setDynamicBlendState();
setDynamicDepthStencilState();
- setDynamicRasterState(floor(deviceProperties.limits.lineWidthRange[1]));
+ setDynamicRasterizationState(floor(deviceProperties.limits.lineWidthRange[1]));
m_vk.cmdBindPipeline(*m_cmdBuffer, vk::VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipeline);
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
- const vk::VkCmdBuffer cmdBuffer = *m_cmdBuffer;
- VK_CHECK(m_vk.queueSubmit(queue, 1, &cmdBuffer, DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 1, // deUint32 commandBufferCount;
+ &m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
+ 0, // deUint32 signalSemaphoreCount;
+ DE_NULL // const VkSemaphore* pSignalSemaphores;
+ };
+ m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
// validation
{
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
- vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR);
+ vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
qpTestResult res = QP_TEST_RESULT_PASS;
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
- const vk::VkCmdBuffer cmdBuffer = *m_cmdBuffer;
- VK_CHECK(m_vk.queueSubmit(queue, 1, &cmdBuffer, DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
+ DE_NULL, // const void* pNext;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
+ &m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
+ 0, // deUint32 signalSemaphoreCount;\r
+ DE_NULL // const VkSemaphore* pSignalSemaphores;\r
+ };
+ m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
// validation
{
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
- vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR);
+ vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
qpTestResult res = QP_TEST_RESULT_PASS;
const vk::VkRect2D scissor = { { 0, 0 }, { WIDTH, HEIGHT } };
setDynamicViewportState(1, &viewport, &scissor);
- setDynamicRasterState();
+ setDynamicRasterizationState();
setDynamicBlendState();
setDynamicDepthStencilState();
}
const vk::VkRect2D scissor = { { 0, 0 }, { WIDTH / 2, HEIGHT / 2 } };
setDynamicViewportState(1, &viewport, &scissor);
- setDynamicRasterState();
+ setDynamicRasterizationState();
setDynamicBlendState();
setDynamicDepthStencilState();
}
{
for (int i = 0; i < 4; i++)
{
- m_data.push_back(Vec4RGBA(tcu::Vec4(-1.0f, 1.0f, (float)i, 1.0f), vec4Green()));
- m_data.push_back(Vec4RGBA(tcu::Vec4(1.0f, 1.0f, (float)i, 1.0f), vec4Green()));
- m_data.push_back(Vec4RGBA(tcu::Vec4(-1.0f, -1.0f, (float)i, 1.0f), vec4Green()));
- m_data.push_back(Vec4RGBA(tcu::Vec4(1.0f, -1.0f, (float)i, 1.0f), vec4Green()));
+ m_data.push_back(Vec4RGBA(tcu::Vec4(-1.0f, 1.0f, (float)i / 3.0f, 1.0f), vec4Green()));
+ m_data.push_back(Vec4RGBA(tcu::Vec4(1.0f, 1.0f, (float)i / 3.0f, 1.0f), vec4Green()));
+ m_data.push_back(Vec4RGBA(tcu::Vec4(-1.0f, -1.0f, (float)i / 3.0f, 1.0f), vec4Green()));
+ m_data.push_back(Vec4RGBA(tcu::Vec4(1.0f, -1.0f, (float)i / 3.0f, 1.0f), vec4Green()));
}
DynamicStateBaseClass::initialize();
virtual void initPipeline (const vk::VkDevice device)
{
- const vk::Unique<vk::VkShader> vs(createShader(m_vk, device,
- *createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_vertexShaderName), 0),
- "main", vk::VK_SHADER_STAGE_VERTEX));
-
- const vk::Unique<vk::VkShader> gs(createShader(m_vk, device,
- *createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_geometryShaderName), 0),
- "main", vk::VK_SHADER_STAGE_GEOMETRY));
-
- const vk::Unique<vk::VkShader> fs(createShader(m_vk, device,
- *createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_fragmentShaderName), 0),
- "main", vk::VK_SHADER_STAGE_FRAGMENT));
+ const vk::Unique<vk::VkShaderModule> vs(createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_vertexShaderName), 0));
+ const vk::Unique<vk::VkShaderModule> gs(createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_geometryShaderName), 0));
+ const vk::Unique<vk::VkShaderModule> fs(createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_fragmentShaderName), 0));
const PipelineCreateInfo::ColorBlendState::Attachment vkCbAttachmentState;
PipelineCreateInfo pipelineCreateInfo(*m_pipelineLayout, *m_renderPass, 0, 0);
- pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, vk::VK_SHADER_STAGE_VERTEX));
- pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*gs, vk::VK_SHADER_STAGE_GEOMETRY));
- pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, vk::VK_SHADER_STAGE_FRAGMENT));
+ pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, "main", vk::VK_SHADER_STAGE_VERTEX_BIT));
+ pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*gs, "main", vk::VK_SHADER_STAGE_GEOMETRY_BIT));
+ pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, "main", vk::VK_SHADER_STAGE_FRAGMENT_BIT));
pipelineCreateInfo.addState(PipelineCreateInfo::VertexInputState(m_vertexInputState));
pipelineCreateInfo.addState(PipelineCreateInfo::InputAssemblerState(m_topology));
pipelineCreateInfo.addState(PipelineCreateInfo::ColorBlendState(1, &vkCbAttachmentState));
};
setDynamicViewportState(4, viewports, scissors);
- setDynamicRasterState();
+ setDynamicRasterizationState();
setDynamicBlendState();
setDynamicDepthStencilState();
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
- const vk::VkCmdBuffer cmdBuffer = *m_cmdBuffer;
- VK_CHECK(m_vk.queueSubmit(queue, 1, &cmdBuffer, DE_NULL));
+ vk::VkSubmitInfo submitInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
+ DE_NULL, // const void* pNext;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
+ &m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
+ 0, // deUint32 signalSemaphoreCount;\r
+ DE_NULL // const VkSemaphore* pSignalSemaphores;\r
+ };
+ m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
// validation
{
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
- vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR);
+ vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
qpTestResult res = QP_TEST_RESULT_PASS;