return makeRect2D(0, 0, extent.width, extent.height);
}
+inline VkRect2D makeRect2D(const deUint32 width, const deUint32 height)
+{
+ return makeRect2D(0, 0, width, height);
+}
+
inline VkViewport makeViewport(const tcu::IVec2& vec)
{
return makeViewport(0.0f, 0.0f, (float)vec.x(), (float)vec.y(), 0.0f, 1.0f);
return makeViewport(0.0f, 0.0f, (float)extent.width, (float)extent.height, 0.0f, 1.0f);
}
+inline VkViewport makeViewport(const deUint32 width, const deUint32 height)
+{
+ return makeViewport(0.0f, 0.0f, (float)width, (float)height, 0.0f, 1.0f);
+}
+
} // vk
#endif // _VKTYPEUTIL_HPP
#include "vkQueryUtil.hpp"
#include "vkRefUtil.hpp"
#include "vkCmdUtil.hpp"
+#include "vkTypeUtil.hpp"
#include "vktTestCase.hpp"
#include "tcuTestLog.hpp"
{
const DeviceInterface& vk = m_context.getDeviceInterface();
- const VkRect2D renderArea =
- {
- { 0, 0 }, // VkOffset2D offset;
- { 1, 1 } // VkExtent2D extent;
- };
+ const VkRect2D renderArea = makeRect2D(1u, 1u);
vk::beginRenderPass(vk, *m_cmdBuffer, *m_renderPass, *m_frameBuffer, renderArea);
}
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
VK_FALSE // primitiveRestartEnable
};
- const VkViewport viewports[] =
- {
- { 0.0f, 0.0f, 64.f, 64.f, 0.0f, 1.0f }
- };
- const VkRect2D scissors[] =
- {
- { { 0, 0 }, { 64, 64 } }
- };
+ const VkViewport viewport = makeViewport(tcu::UVec2(64));
+ const VkRect2D scissor = makeRect2D(tcu::UVec2(64));
+
const VkPipelineViewportStateCreateInfo viewportState =
{
VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
DE_NULL,
(VkPipelineViewportStateCreateFlags)0,
- DE_LENGTH_OF_ARRAY(viewports),
- viewports,
- DE_LENGTH_OF_ARRAY(scissors),
- scissors,
+ 1u,
+ &viewport,
+ 1u,
+ &scissor,
};
const VkPipelineRasterizationStateCreateInfo rasterState =
{
#include "vktDrawBaseClass.hpp"
#include "vkQueryUtil.hpp"
#include "vkCmdUtil.hpp"
+#include "vkTypeUtil.hpp"
#include "vktTestGroupUtil.hpp"
#include "deDefs.h"
const PipelineCreateInfo::ColorBlendState::Attachment vkCbAttachmentState;
- vk::VkViewport viewport;
- viewport.x = 0;
- viewport.y = 0;
- viewport.width = static_cast<float>(WIDTH);
- viewport.height = static_cast<float>(HEIGHT);
- viewport.minDepth = 0.0f;
- viewport.maxDepth = 1.0f;
-
- vk::VkRect2D scissor;
- scissor.offset.x = 0;
- scissor.offset.y = 0;
- scissor.extent.width = WIDTH;
- scissor.extent.height = HEIGHT;
+ vk::VkViewport viewport = vk::makeViewport(WIDTH, HEIGHT);
+ vk::VkRect2D scissor = vk::makeRect2D(WIDTH, HEIGHT);
PipelineCreateInfo pipelineCreateInfo(*m_pipelineLayout, *m_renderPass, 0, 0);
pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, "main", vk::VK_SHADER_STAGE_VERTEX_BIT));
vk::VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
0, 1, &memBarrier, 0, DE_NULL, 0, DE_NULL);
- const vk::VkRect2D renderArea = { { 0, 0 }, { WIDTH, HEIGHT } };
+ const vk::VkRect2D renderArea = vk::makeRect2D(WIDTH, HEIGHT);
vk::beginRenderPass(m_vk, *m_cmdBuffer, *m_renderPass, *m_framebuffer, renderArea, tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
}
#include "vktDrawBaseClass.hpp"
#include "vkCmdUtil.hpp"
+#include "vkTypeUtil.hpp"
namespace vkt
{
const PipelineCreateInfo::ColorBlendState::Attachment vkCbAttachmentState;
- vk::VkViewport viewport;
- viewport.x = 0;
- viewport.y = 0;
- viewport.width = static_cast<float>(WIDTH);
- viewport.height = static_cast<float>(HEIGHT);
- viewport.minDepth = 0.0f;
- viewport.maxDepth = 1.0f;
-
- vk::VkRect2D scissor;
- scissor.offset.x = 0;
- scissor.offset.y = 0;
- scissor.extent.width = WIDTH;
- scissor.extent.height = HEIGHT;
+ vk::VkViewport viewport = vk::makeViewport(WIDTH, HEIGHT);
+ vk::VkRect2D scissor = vk::makeRect2D(WIDTH, HEIGHT);
PipelineCreateInfo pipelineCreateInfo(*m_pipelineLayout, *m_renderPass, 0, 0);
pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, "main", vk::VK_SHADER_STAGE_VERTEX_BIT));
vk::VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
0, 1, &memBarrier, 0, DE_NULL, 0, DE_NULL);
- const vk::VkRect2D renderArea = { { 0, 0 }, { WIDTH, HEIGHT } };
+ const vk::VkRect2D renderArea = vk::makeRect2D(WIDTH, HEIGHT);
vk::beginRenderPass(m_vk, *m_cmdBuffer, *m_renderPass, *m_framebuffer, renderArea);
}
#include "vktDrawBaseClass.hpp"
#include "vkQueryUtil.hpp"
#include "vkCmdUtil.hpp"
+#include "vkTypeUtil.hpp"
#include "vktTestGroupUtil.hpp"
#include "deDefs.h"
Move<VkPipelineLayout> pipelineLayout = createPipelineLayout(vk, device, &pipelineLayoutCreateInfo);
const PipelineCreateInfo::ColorBlendState::Attachment vkCbAttachmentState;
- VkViewport viewport;
- viewport.x = 0;
- viewport.y = 0;
- viewport.width = static_cast<float>(WIDTH);
- viewport.height = static_cast<float>(HEIGHT);
- viewport.minDepth = 0.0f;
- viewport.maxDepth = 1.0f;
-
- VkRect2D scissor;
- scissor.offset.x = 0;
- scissor.offset.y = 0;
- scissor.extent.width = WIDTH;
- scissor.extent.height = HEIGHT;
+ VkViewport viewport = makeViewport(WIDTH, HEIGHT);
+ VkRect2D scissor = makeRect2D(WIDTH, HEIGHT);
const VkVertexInputBindingDescription vertexInputBindingDescription = { 0, (deUint32)sizeof(tcu::Vec4) * 2, VK_VERTEX_INPUT_RATE_VERTEX };
VK_ACCESS_TRANSFER_WRITE_BIT,
VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT
};
- const VkRect2D renderArea = { { 0, 0 }, { WIDTH, HEIGHT } };
+ const VkRect2D renderArea = makeRect2D(WIDTH, HEIGHT);
const VkDeviceSize vertexBufferOffset = 0;
const VkBuffer buffer = vertexBuffer->object();
const VkOffset3D zeroOffset = { 0, 0, 0 };
#include "vkImageUtil.hpp"
#include "vkPrograms.hpp"
#include "vkCmdUtil.hpp"
+#include "vkTypeUtil.hpp"
#include "vktDrawBufferObjectUtil.hpp"
#include "vktDrawCreateInfoUtil.hpp"
#include "vktDrawImageObjectUtil.hpp"
const PipelineCreateInfo::ColorBlendState::Attachment vkCbAttachmentState;
- vk::VkViewport viewport;
- viewport.x = 0;
- viewport.y = 0;
- viewport.width = static_cast<float>(WIDTH);
- viewport.height = static_cast<float>(HEIGHT);
- viewport.minDepth = 0.0f;
- viewport.maxDepth = 1.0f;
-
- vk::VkRect2D scissor;
- scissor.offset.x = 0;
- scissor.offset.y = 0;
- scissor.extent.width = WIDTH;
- scissor.extent.height = HEIGHT;
+ vk::VkViewport viewport = vk::makeViewport(WIDTH, HEIGHT);
+ vk::VkRect2D scissor = vk::makeRect2D(WIDTH, HEIGHT);
PipelineCreateInfo pipelineCreateInfo(*m_pipelineLayout, *m_renderPass, 0, 0);
pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, "main", vk::VK_SHADER_STAGE_VERTEX_BIT));
vk::VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
0, 1, &memBarrier, 0, DE_NULL, 0, DE_NULL);
- const vk::VkRect2D renderArea = { { 0, 0 }, { WIDTH, HEIGHT } };
+ const vk::VkRect2D renderArea = vk::makeRect2D(WIDTH, HEIGHT);
beginRenderPass(m_vk, *m_cmdBuffer, *m_renderPass, *m_framebuffer, renderArea);
if (m_params.function == TestParams::FUNCTION_DRAW_INDEXED || m_params.function == TestParams::FUNCTION_DRAW_INDEXED_INDIRECT)
// Graphics pipeline
- const VkRect2D scissor =
- {
- { 0, 0 }, // x, y
- { 256, 256 }, // width, height
- };
+ const VkRect2D scissor = makeRect2D(256u, 256u);
std::vector<VkDynamicState> dynamicStates;
dynamicStates.push_back(VK_DYNAMIC_STATE_VIEWPORT);
// Graphics pipeline
- const VkRect2D scissor =
- {
- { 0, 0 }, // x, y
- { WIDTH, HEIGHT }, // width, height
- };
+ const VkRect2D scissor = makeRect2D(WIDTH, HEIGHT);
std::vector<VkDynamicState> dynamicStates;
dynamicStates.push_back(VK_DYNAMIC_STATE_VIEWPORT);
for (std::vector<UVec4>::const_iterator it = cells.begin(); it != cells.end(); ++it) {
const VkViewport viewport = makeViewport(float(it->x()), float(it->y()), float(it->z()), float(it->w()), 0.0f, 1.0f);
viewports.push_back(viewport);
- const VkRect2D rect = { {0, 0}, {renderSize.x(), renderSize.y()} };
+ const VkRect2D rect = makeRect2D(renderSize);
rectScissors.push_back(rect);
}
void DynamicStateBaseClass::setDynamicViewportState (const deUint32 width, const deUint32 height)
{
- vk::VkViewport viewport;
- viewport.x = 0;
- viewport.y = 0;
- viewport.width = static_cast<float>(width);
- viewport.height = static_cast<float>(height);
- viewport.minDepth = 0.0f;
- viewport.maxDepth = 1.0f;
-
+ vk::VkViewport viewport = vk::makeViewport(tcu::UVec2(width, height));
m_vk.cmdSetViewport(*m_cmdBuffer, 0, 1, &viewport);
- vk::VkRect2D scissor;
- scissor.offset.x = 0;
- scissor.offset.y = 0;
- scissor.extent.width = width;
- scissor.extent.height = height;
+ vk::VkRect2D scissor = vk::makeRect2D(tcu::UVec2(width, height));
m_vk.cmdSetScissor(*m_cmdBuffer, 0, 1, &scissor);
}
void setDynamicViewportState (const deUint32 width, const deUint32 height)
{
- vk::VkViewport viewport;
- viewport.x = 0;
- viewport.y = 0;
- viewport.width = static_cast<float>(width);
- viewport.height = static_cast<float>(height);
- viewport.minDepth = 0.0f;
- viewport.maxDepth = 1.0f;
-
+ vk::VkViewport viewport = vk::makeViewport(tcu::UVec2(width, height));
m_vk.cmdSetViewport(*m_cmdBuffer, 0, 1, &viewport);
- vk::VkRect2D scissor;
- scissor.offset.x = 0;
- scissor.offset.y = 0;
- scissor.extent.width = width;
- scissor.extent.height = height;
+ vk::VkRect2D scissor = vk::makeRect2D(tcu::UVec2(width, height));
m_vk.cmdSetScissor(*m_cmdBuffer, 0, 1, &scissor);
}
void setDynamicViewportState (const deUint32 width, const deUint32 height)
{
- vk::VkViewport viewport;
- viewport.x = 0;
- viewport.y = 0;
- viewport.width = static_cast<float>(width);
- viewport.height = static_cast<float>(height);
- viewport.minDepth = 0.0f;
- viewport.maxDepth = 1.0f;
-
+ vk::VkViewport viewport = vk::makeViewport(tcu::UVec2(width, height));
m_vk.cmdSetViewport(*m_cmdBuffer, 0, 1, &viewport);
- vk::VkRect2D scissor;
- scissor.offset.x = 0;
- scissor.offset.y = 0;
- scissor.extent.width = width;
- scissor.extent.height = height;
+ vk::VkRect2D scissor = vk::makeRect2D(tcu::UVec2(width, height));
m_vk.cmdSetScissor(*m_cmdBuffer, 0, 1, &scissor);
}
m_patchControlPoints, // uint32_t patchControlPoints;
};
- const VkViewport viewport = makeViewport(
- 0.0f, 0.0f,
- static_cast<float>(m_renderSize.x()), static_cast<float>(m_renderSize.y()),
- 0.0f, 1.0f);
-
- const VkRect2D scissor = {
- makeOffset2D(0, 0),
- makeExtent2D(m_renderSize.x(), m_renderSize.y()),
- };
+ const VkViewport viewport = makeViewport(m_renderSize);
+ const VkRect2D scissor = makeRect2D(m_renderSize);
const VkPipelineViewportStateCreateInfo pipelineViewportStateInfo =
{
MovePtr<Buffer> dstImageBuffer = MovePtr<Buffer>(new Buffer(vk, device, allocator, dstImageBufferInfo, MemoryRequirement::HostVisible));
const VkExtent2D renderSize (makeExtent2D(uncompressedImageRes.x(), uncompressedImageRes.y()));
- const VkViewport viewport = makeViewport(0.0f, 0.0f, static_cast<float>(renderSize.width), static_cast<float>(renderSize.height), 0.0f, 1.0f);
- const VkRect2D scissor = makeScissor(renderSize.width, renderSize.height);
+ const VkViewport viewport = makeViewport(renderSize);
+ const VkRect2D scissor = makeRect2D(renderSize);
for (deUint32 layerNdx = 0; layerNdx < getLayerCount(); ++layerNdx)
{
const VkImageCreateInfo srcImageCreateInfo = makeCreateImageInfo(m_srcFormat, m_parameters.imageType, srcImageResolution, m_srcImageUsageFlags, imgCreateFlagsOverride, SINGLE_LEVEL, SINGLE_LAYER);
const VkExtent2D renderSize (makeExtent2D(uncompressedImageRes.x(), uncompressedImageRes.y()));
- const VkViewport viewport = makeViewport(0.0f, 0.0f, static_cast<float>(renderSize.width), static_cast<float>(renderSize.height), 0.0f, 1.0f);
- const VkRect2D scissor = makeScissor(renderSize.width, renderSize.height);
+ const VkViewport viewport = makeViewport(renderSize);
+ const VkRect2D scissor = makeRect2D(renderSize);
for (deUint32 layerNdx = 0; layerNdx < getLayerCount(); ++layerNdx)
{
MovePtr<Buffer> dstImageBuffer = MovePtr<Buffer>(new Buffer(vk, device, allocator, dstImageBufferInfo, MemoryRequirement::HostVisible));
const VkExtent2D renderSize (makeExtent2D(uncompressedImageRes.x(), uncompressedImageRes.y()));
- const VkViewport viewport = makeViewport(0.0f, 0.0f, static_cast<float>(renderSize.width), static_cast<float>(renderSize.height), 0.0f, 1.0f);
- const VkRect2D scissor = makeScissor(renderSize.width, renderSize.height);
+ const VkViewport viewport = makeViewport(renderSize);
+ const VkRect2D scissor = makeRect2D(renderSize);
for (deUint32 layerNdx = 0; layerNdx < getLayerCount(); ++layerNdx)
{
const VkImageCreateInfo srcImageCreateInfo = makeCreateImageInfo(m_srcFormat, m_parameters.imageType, srcImageResolution, m_srcImageUsageFlags, imgCreateFlagsOverride, SINGLE_LEVEL, SINGLE_LAYER);
const VkExtent2D renderSize (makeExtent2D(uncompressedImageRes.x(), uncompressedImageRes.y()));
- const VkViewport viewport = makeViewport(0.0f, 0.0f, static_cast<float>(renderSize.width), static_cast<float>(renderSize.height), 0.0f, 1.0f);
- const VkRect2D scissor = makeScissor(renderSize.width, renderSize.height);
+ const VkViewport viewport = makeViewport(renderSize);
+ const VkRect2D scissor = makeRect2D(renderSize);
for (deUint32 layerNdx = 0; layerNdx < getLayerCount(); ++layerNdx)
{
return createFramebuffer(vk, device, &framebufferInfo);
}
-VkRect2D makeScissor (const deUint32 width,
- const deUint32 height)
-{
- const VkRect2D scissor =
- {
- { 0u, 0u }, // VkOffset2D offset;
- { width, height } // VkExtent2D extent;
- };
-
- return scissor;
-}
-
} // image
} // vkt
const vk::VkExtent2D& size,
const deUint32 layersCount);
-vk::VkRect2D makeScissor (const deUint32 width,
- const deUint32 height);
-
} // image
} // vkt
VK_FALSE, // VkBool32 primitiveRestartEnable;
};
- const VkViewport viewport =
- {
- 0.0f, // float originX;
- 0.0f, // float originY;
- (float)m_parameters.extent.width, // float width;
- (float)m_parameters.extent.height, // float height;
- 0.0f, // float minDepth;
- 1.0f // float maxDepth;
- };
-
- const VkRect2D scissor =
- {
- { 0, 0 }, // VkOffset2D offset;
- { m_parameters.extent.width, m_parameters.extent.height } // VkExtent2D extent;
- };
+ const VkViewport viewport = makeViewport(m_parameters.extent);
+ const VkRect2D scissor = makeRect2D(m_parameters.extent);
const VkPipelineViewportStateCreateInfo viewportStateParams =
{
void MultiViewReadbackTestInstance::drawClears (const deUint32 subpassCount, VkRenderPass renderPass, VkFramebuffer frameBuffer, vector<PipelineSp>& pipelines, const bool clearPass)
{
- const VkRect2D renderArea = { { 0, 0 }, { m_parameters.extent.width, m_parameters.extent.height } };
+ const VkRect2D renderArea = makeRect2D(m_parameters.extent);
const deUint32 drawCountPerSubpass = (subpassCount == 1) ? m_squareCount : 1u;
const bool withClearColor = (clearPass && m_parameters.viewIndex == TEST_TYPE_READBACK_WITH_IMPLICIT_CLEAR);
// Draw commands
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(renderSize.x(), renderSize.y()),
- };
- const tcu::Vec4 clearColor (0.0f, 0.0f, 0.0f, 1.0f);
- const VkDeviceSize vertexBufferOffset = 0ull;
+ const VkRect2D renderArea = makeRect2D(renderSize);
+ const tcu::Vec4 clearColor (0.0f, 0.0f, 0.0f, 1.0f);
+ const VkDeviceSize vertexBufferOffset = 0ull;
beginCommandBuffer(vk, *cmdBuffer);
const vk::VkSubpassContents subpassContents = m_cmdBufferType == CMD_BUFFER_SECONDARY
? vk::VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS
: vk::VK_SUBPASS_CONTENTS_INLINE;
- beginRenderPass(vk, *cmdBuffer, *renderPass, *framebuffer, vk::makeRect2D(0, 0, RENDER_WIDTH, RENDER_HEIGHT), clearValue, subpassContents);
+ beginRenderPass(vk, *cmdBuffer, *renderPass, *framebuffer, vk::makeRect2D(RENDER_WIDTH, RENDER_HEIGHT), clearValue, subpassContents);
if (m_cmdBufferType == CMD_BUFFER_SECONDARY)
{
0u, //uint32_t colorAttachment
m_clearValue // VkClearValue clearValue;
};
- const vk::VkOffset2D offset =
- {
- 0, //int32_t x;
- 0 //int32_t y;
- };
- const vk::VkExtent2D extent =
- {
- RENDER_WIDTH, //uint32_t width;
- RENDER_HEIGHT //uint32_t height;
- };
- const vk::VkRect2D rect2D =
- {
- offset, //VkOffset2D offset;
- extent //VkExtent2D extent;
- };
+ const vk::VkRect2D rect2D = vk::makeRect2D(RENDER_WIDTH, RENDER_HEIGHT);
const vk::VkClearRect clearRect =
{
rect2D, // VkRect2D rect;
pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, "main", vk::VK_SHADER_STAGE_FRAGMENT_BIT));
pipelineCreateInfo.addState(PipelineCreateInfo::InputAssemblerState(primitive));
pipelineCreateInfo.addState(PipelineCreateInfo::ColorBlendState(1, &attachmentState));
- const vk::VkViewport viewport =
- {
- 0, // float x;
- 0, // float y;
- WIDTH, // float width;
- HEIGHT, // float height;
- 0.0f, // float minDepth;
- 1.0f // float maxDepth;
- };
-
- const vk::VkRect2D scissor =
- {
- {
- 0, // deInt32 x
- 0, // deInt32 y
- }, // VkOffset2D offset;
- {
- WIDTH, // deInt32 width;
- HEIGHT, // deInt32 height
- }, // VkExtent2D extent;
- };
+ const vk::VkViewport viewport = vk::makeViewport(WIDTH, HEIGHT);
+ const vk::VkRect2D scissor = vk::makeRect2D(WIDTH, HEIGHT);
pipelineCreateInfo.addState(PipelineCreateInfo::ViewportState(1, std::vector<vk::VkViewport>(1, viewport), std::vector<vk::VkRect2D>(1, scissor)));
pipelineCreateInfo.addState(PipelineCreateInfo::DepthStencilState(true, true, vk::VK_COMPARE_OP_GREATER_OR_EQUAL));
pipelineCreateInfo.addState(PipelineCreateInfo::RasterizerState());
pipelineCreateInfo.addState(PipelineCreateInfo::InputAssemblerState(m_parametersGraphic.primitiveTopology));
pipelineCreateInfo.addState(PipelineCreateInfo::ColorBlendState(1, &attachmentState));
- const VkViewport viewport =
- {
- 0.0f, // float x;
- 0.0f, // float y;
- WIDTH, // float width;
- HEIGHT, // float height;
- 0.0f, // float minDepth;
- 1.0f // float maxDepth;
- };
-
- const VkRect2D scissor =
- {
- {
- 0, // deInt32 x
- 0, // deInt32 y
- }, // VkOffset2D offset;
- {
- WIDTH, // deInt32 width;
- HEIGHT, // deInt32 height
- }, // VkExtent2D extent;
- };
+ const VkViewport viewport = makeViewport(WIDTH, HEIGHT);
+ const VkRect2D scissor = makeRect2D(WIDTH, HEIGHT);
pipelineCreateInfo.addState(PipelineCreateInfo::ViewportState(1u, std::vector<VkViewport>(1, viewport), std::vector<VkRect2D>(1, scissor)));
pipelineCreateInfo.addState(PipelineCreateInfo::DepthStencilState());
pipelineCreateInfo.addState(PipelineCreateInfo::RasterizerState());
pipelineCreateInfo.addState(PipelineCreateInfo::InputAssemblerState(m_parametersGraphic.primitiveTopology));
pipelineCreateInfo.addState(PipelineCreateInfo::ColorBlendState(1, &attachmentState));
- const VkViewport viewport =
- {
- 0.0f, // float x;
- 0.0f, // float y;
- WIDTH, // float width;
- HEIGHT, // float height;
- 0.0f, // float minDepth;
- 1.0f // float maxDepth;
- };
+ const VkViewport viewport = makeViewport(WIDTH, HEIGHT);
+ const VkRect2D scissor = makeRect2D(WIDTH, HEIGHT);
- const VkRect2D scissor =
- {
- {
- 0, // deInt32 x
- 0, // deInt32 y
- }, // VkOffset2D offset;
- {
- WIDTH, // deInt32 width;
- HEIGHT, // deInt32 height
- }, // VkExtent2D extent;
- };
pipelineCreateInfo.addState(PipelineCreateInfo::ViewportState(1, std::vector<VkViewport>(1, viewport), std::vector<VkRect2D>(1, scissor)));
if (m_context.getDeviceFeatures().depthBounds)
pipelineCreateInfo.addState(PipelineCreateInfo::InputAssemblerState(VK_PRIMITIVE_TOPOLOGY_PATCH_LIST));
pipelineCreateInfo.addState(PipelineCreateInfo::ColorBlendState(1, &attachmentState));
- const VkViewport viewport =
- {
- 0.0f, // float x;
- 0.0f, // float y;
- WIDTH, // float width;
- HEIGHT, // float height;
- 0.0f, // float minDepth;
- 1.0f // float maxDepth;
- };
+ const VkViewport viewport = makeViewport(WIDTH, HEIGHT);
+ const VkRect2D scissor = makeRect2D(WIDTH, HEIGHT);
- const VkRect2D scissor =
- {
- {
- 0, // deInt32 x
- 0, // deInt32 y
- }, // VkOffset2D offset;
- {
- WIDTH, // deInt32 width;
- HEIGHT, // deInt32 height
- }, // VkExtent2D extent;
- };
pipelineCreateInfo.addState(PipelineCreateInfo::ViewportState(1, std::vector<VkViewport>(1, viewport), std::vector<VkRect2D>(1, scissor)));
pipelineCreateInfo.addState(PipelineCreateInfo::DepthStencilState());
pipelineCreateInfo.addState(PipelineCreateInfo::RasterizerState());
for (deUint32 width = 1u; width < maxWidth; ++width)
{
const Unique<VkFramebuffer> framebuffer (makeFramebuffer(context, *renderPass, discardableImage.getImageView(), maxWidth, 1));
- const VkViewport viewport = {0.0f, 0.0f, static_cast<float>(maxWidth), 1.0f, 0.0f, 1.0f};
- const VkRect2D scissor = {{0, 0}, {maxWidth, 1}};
+ const VkViewport viewport = makeViewport(maxWidth, 1u);
+ const VkRect2D scissor = makeRect2D(maxWidth, 1u);
const vk::VkDeviceSize imageResultSize = tcu::getPixelSize(vk::mapVkFormat(format)) * maxWidth;
Buffer imageBufferResult (context, imageResultSize, VK_BUFFER_USAGE_TRANSFER_DST_BIT);
const VkDeviceSize vertexBufferOffset = 0u;
{
totalIterations++;
const Unique<VkFramebuffer> framebuffer (makeFramebuffer(context, *renderPass, discardableImage.getImageView(), maxWidth, 1));
- const VkViewport viewport = {0.0f, 0.0f, static_cast<float>(maxWidth), 1.0f, 0.0f, 1.0f};
- const VkRect2D scissor = {{0, 0}, {maxWidth, 1}};
+ const VkViewport viewport = makeViewport(maxWidth, 1u);
+ const VkRect2D scissor = makeRect2D(maxWidth, 1u);
const vk::VkDeviceSize imageResultSize = tcu::getPixelSize(vk::mapVkFormat(format)) * maxWidth;
Buffer imageBufferResult (context, imageResultSize, VK_BUFFER_USAGE_TRANSFER_DST_BIT);
const VkDeviceSize vertexBufferOffset = 0u;
const VkDeviceSize resultImageSizeInBytes = maxWidth * 1 * getFormatSizeInBytes(format);
Image resultImage (context, maxWidth, 1, format, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
const Unique<VkFramebuffer> framebuffer (makeFramebuffer(context, *renderPass, resultImage.getImageView(), maxWidth, 1));
- const VkViewport viewport = {0.0f, 0.0f, static_cast<float>(maxWidth), 1.0f, 0.0f, 1.0f};
- const VkRect2D scissor = {{0, 0}, {maxWidth, 1}};
+ const VkViewport viewport = makeViewport(maxWidth, 1u);
+ const VkRect2D scissor = makeRect2D(maxWidth, 1u);
const vk::VkDeviceSize imageResultSize = tcu::getPixelSize(vk::mapVkFormat(format)) * maxWidth;
Buffer imageBufferResult (context, imageResultSize, VK_BUFFER_USAGE_TRANSFER_DST_BIT);
const VkImageSubresourceRange subresourceRange =
{
totalIterations++;
const Unique<VkFramebuffer> framebuffer (makeFramebuffer(context, *renderPass, discardableImage.getImageView(), maxWidth, 1));
- const VkViewport viewport = {0.0f, 0.0f, static_cast<float>(maxWidth), 1.0f, 0.0f, 1.0f};
- const VkRect2D scissor = {{0, 0}, {maxWidth, 1}};
+ const VkViewport viewport = makeViewport(maxWidth, 1u);
+ const VkRect2D scissor = makeRect2D(maxWidth, 1u);
const vk::VkDeviceSize imageResultSize = tcu::getPixelSize(vk::mapVkFormat(format)) * maxWidth;
Buffer imageBufferResult (context, imageResultSize, VK_BUFFER_USAGE_TRANSFER_DST_BIT);
const VkDeviceSize vertexBufferOffset = 0u;
beginCommandBuffer(context.getDeviceInterface(), *cmdBuffer);
- VkViewport viewport = {0.0f, 0.0f, static_cast<float>(width),
- static_cast<float>(height), 0.0f, 1.0f
- };
+ VkViewport viewport = makeViewport(width, height);
context.getDeviceInterface().cmdSetViewport(
*cmdBuffer, 0, 1, &viewport);
}
{
- const VkRect2D renderArea =
- {
- makeOffset2D(0, 0),
- makeExtent2D(1, 1),
- };
+ const VkRect2D renderArea = makeRect2D(1u, 1u);
const tcu::Vec4 clearColor = tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f);
beginRenderPass(vk, *cmdBuffer, renderPass, *framebuffer, renderArea, clearColor);
}
}
{
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(m_colorImageExtent.width, m_colorImageExtent.height),
- };
- const tcu::Vec4 clearColor = tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ const VkRect2D renderArea = makeRect2D(m_colorImageExtent);
+ const tcu::Vec4 clearColor = tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f);
beginRenderPass(vk, cmdBuffer, *m_renderPass, *m_framebuffer, renderArea, clearColor);
}
}
{
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(m_attachmentExtent.width, m_attachmentExtent.height),
- };
- const tcu::Vec4 clearColor = tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ const VkRect2D renderArea = makeRect2D(m_attachmentExtent);
+ const tcu::Vec4 clearColor = tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f);
beginRenderPass(vk, cmdBuffer, *m_renderPass, *m_framebuffer, renderArea, clearColor);
}
m_clearValue // VkClearValue clearValue;
};
- const VkRect2D rect2D =
- {
- { 0u, 0u, }, // VkOffset2D offset;
- { m_resource.getImage().extent.width, m_resource.getImage().extent.height }, // VkExtent2D extent;
- };
+ const VkRect2D rect2D = makeRect2D(m_resource.getImage().extent);
const VkClearRect clearRect =
{
}
{
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(m_colorImageExtent.width, m_colorImageExtent.height),
- };
- const tcu::Vec4 clearColor = tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ const VkRect2D renderArea = makeRect2D(m_colorImageExtent);
+ const tcu::Vec4 clearColor = tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f);
beginRenderPass(vk, cmdBuffer, *m_renderPass, *m_framebuffer, renderArea, clearColor);
}
}
{
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(m_colorImageExtent.width, m_colorImageExtent.height),
- };
- const tcu::Vec4 clearColor = tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ const VkRect2D renderArea = makeRect2D(m_colorImageExtent);
+ const tcu::Vec4 clearColor = tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f);
beginRenderPass(vk, cmdBuffer, *m_renderPass, *m_framebuffer, renderArea, clearColor);
}
// Begin render pass
{
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(renderSize.x(), renderSize.y()),
- };
- const tcu::Vec4 clearColor(0.0f, 0.0f, 0.0f, 1.0f);
+ const VkRect2D renderArea = makeRect2D(renderSize);
+ const tcu::Vec4 clearColor (0.0f, 0.0f, 0.0f, 1.0f);
beginRenderPass(vk, *cmdBuffer, *renderPass, *framebuffer, renderArea, clearColor);
}
// Begin render pass
{
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(renderSize.x(), renderSize.y()),
- };
- const tcu::Vec4 clearColor(0.0f, 0.0f, 0.0f, 1.0f);
+ const VkRect2D renderArea = makeRect2D(renderSize);
+ const tcu::Vec4 clearColor (0.0f, 0.0f, 0.0f, 1.0f);
beginRenderPass(vk, *cmdBuffer, *renderPass, *framebuffer, renderArea, clearColor);
}
// Begin render pass
{
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(renderSize.x(), renderSize.y()),
- };
- const tcu::Vec4 clearColor(0.0f, 0.0f, 0.0f, 1.0f);
+ const VkRect2D renderArea = makeRect2D(renderSize);
+ const tcu::Vec4 clearColor (0.0f, 0.0f, 0.0f, 1.0f);
beginRenderPass(vk, *cmdBuffer, *renderPass, *framebuffer, renderArea, clearColor);
}
// Begin render pass
{
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(renderSize.x(), renderSize.y()),
- };
- const tcu::Vec4 clearColor(0.0f, 0.0f, 0.0f, 1.0f);
+ const VkRect2D renderArea = makeRect2D(renderSize);
+ const tcu::Vec4 clearColor (0.0f, 0.0f, 0.0f, 1.0f);
beginRenderPass(vk, *cmdBuffer, *renderPass, *framebuffer, renderArea, clearColor);
}
// Begin render pass
{
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(renderSize.x(), renderSize.y()),
- };
- const tcu::Vec4 clearColor(0.0f, 0.0f, 0.0f, 1.0f);
+ const VkRect2D renderArea = makeRect2D(renderSize);
+ const tcu::Vec4 clearColor (0.0f, 0.0f, 0.0f, 1.0f);
beginRenderPass(vk, *cmdBuffer, *renderPass, *framebuffer, renderArea, clearColor);
}
// Begin render pass
{
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(renderSize.x(), renderSize.y()),
- };
- const tcu::Vec4 clearColor = tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ const VkRect2D renderArea = makeRect2D(renderSize);
+ const tcu::Vec4 clearColor = tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f);
beginRenderPass(vk, *cmdBuffer, *renderPass, *framebuffer, renderArea, clearColor);
}
// Begin render pass
{
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(renderSize.x(), renderSize.y()),
- };
- const tcu::Vec4 clearColor(0.0f, 0.0f, 0.0f, 1.0f);
+ const VkRect2D renderArea = makeRect2D(renderSize);
+ const tcu::Vec4 clearColor (0.0f, 0.0f, 0.0f, 1.0f);
beginRenderPass(vk, *cmdBuffer, *renderPass, *framebuffer, renderArea, clearColor);
}
}
{
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(renderSize.x(), renderSize.y()),
- };
+ const VkRect2D renderArea = makeRect2D(renderSize);
const tcu::Vec4 clearColor(0.0f, 0.0f, 0.0f, 1.0f);
beginRenderPass(vk, *cmdBuffer, *renderPass, *framebuffer, renderArea, clearColor);
// Begin render pass
{
- const VkRect2D renderArea = {
- makeOffset2D(0, 0),
- makeExtent2D(renderSize.x(), renderSize.y()),
- };
- const tcu::Vec4 clearColor = tcu::RGBA::red().toVec();
+ const VkRect2D renderArea = makeRect2D(renderSize);
+ const tcu::Vec4 clearColor = tcu::RGBA::red().toVec();
beginRenderPass(vk, *cmdBuffer, *renderPass, *framebuffer, renderArea, clearColor);
}
};
vk.cmdSetViewport(*cmdBuffer, 0, 1, &viewport);
- const VkRect2D scissor =
- {
- makeOffset2D(0, 0),
- makeExtent2D(renderSize.x(), renderSize.y()),
- };
+ const VkRect2D scissor = makeRect2D(renderSize);
vk.cmdSetScissor(*cmdBuffer, 0, 1, &scissor);
vk.cmdBindPipeline(*cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, testCases[caseNdx].pipeline);
if (frameNdx == 0)
{
- const vk::VkRect2D scissor =
- {
- { 0u, 0u },
- { imageWidth, imageHeight }
- };
-
+ const vk::VkRect2D scissor = vk::makeRect2D(imageWidth, imageHeight);
vkd.cmdSetScissor(commandBuffer, 0u, 1u, &scissor);
const vk::VkClearAttachment attachment =
{
vkd.cmdPipelineBarrier(*commandBuffer, vk::VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, vk::VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, 0, 0, DE_NULL, 0, DE_NULL, 1, &barrier);
}
- beginRenderPass(vkd, *commandBuffer, renderPass, framebuffer, vk::makeRect2D(0, 0, imageWidth, imageHeight), tcu::Vec4(0.25f, 0.5f, 0.75f, 1.0f));
+ beginRenderPass(vkd, *commandBuffer, renderPass, framebuffer, vk::makeRect2D(imageWidth, imageHeight), tcu::Vec4(0.25f, 0.5f, 0.75f, 1.0f));
for (size_t frameNdx = imageNextFrame; frameNdx <= currentFrame; frameNdx++)
cmdRenderFrame(vkd, *commandBuffer, pipelineLayout, pipeline, frameNdx, imageWidth, imageHeight);