1 /*------------------------------------------------------------------------ 2 * Vulkan Conformance Tests 3 * ------------------------ 4 * 5 * Copyright (c) 2015 The Khronos Group Inc. 6 * Copyright (c) 2015 Intel Corporation 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 * 20 *//*! 21 * \file 22 * \brief CreateInfo utilities 23 *//*--------------------------------------------------------------------*/ 24 25 #include "vktDrawCreateInfoUtil.hpp" 26 27 #include "vkImageUtil.hpp" 28 29 namespace vkt 30 { 31 namespace Draw 32 { 33 34 ImageSubresourceRange::ImageSubresourceRange (vk::VkImageAspectFlags _aspectMask, 35 deUint32 _baseMipLevel, 36 deUint32 _levelCount, 37 deUint32 _baseArrayLayer, 38 deUint32 _layerCount) 39 { 40 aspectMask = _aspectMask; 41 baseMipLevel = _baseMipLevel; 42 levelCount = _levelCount; 43 baseArrayLayer = _baseArrayLayer; 44 layerCount = _layerCount; 45 } 46 47 ComponentMapping::ComponentMapping (vk::VkComponentSwizzle _r, 48 vk::VkComponentSwizzle _g, 49 vk::VkComponentSwizzle _b, 50 vk::VkComponentSwizzle _a) 51 { 52 r = _r; 53 g = _g; 54 b = _b; 55 a = _a; 56 } 57 58 ImageViewCreateInfo::ImageViewCreateInfo (vk::VkImage _image, 59 vk::VkImageViewType _viewType, 60 vk::VkFormat _format, 61 const vk::VkImageSubresourceRange& _subresourceRange, 62 const vk::VkComponentMapping& _components, 63 vk::VkImageViewCreateFlags _flags) 64 { 65 sType = vk::VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; 66 pNext = DE_NULL; 67 flags = 0u; 68 image = _image; 69 viewType = _viewType; 70 format = _format; 71 components.r = _components.r; 72 components.g = _components.g; 73 components.b = _components.b; 74 components.a = _components.a; 75 subresourceRange = _subresourceRange; 76 flags = _flags; 77 } 78 79 ImageViewCreateInfo::ImageViewCreateInfo (vk::VkImage _image, 80 vk::VkImageViewType _viewType, 81 vk::VkFormat _format, 82 const vk::VkComponentMapping& _components, 83 vk::VkImageViewCreateFlags _flags) 84 { 85 sType = vk::VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; 86 pNext = DE_NULL; 87 flags = 0u; 88 image = _image; 89 viewType = _viewType; 90 format = _format; 91 components.r = _components.r; 92 components.g = _components.g; 93 components.b = _components.b; 94 components.a = _components.a; 95 96 vk::VkImageAspectFlags aspectFlags; 97 const tcu::TextureFormat tcuFormat = vk::mapVkFormat(_format); 98 99 switch (tcuFormat.order) 100 { 101 case tcu::TextureFormat::D: 102 aspectFlags = vk::VK_IMAGE_ASPECT_DEPTH_BIT; 103 break; 104 case tcu::TextureFormat::S: 105 aspectFlags = vk::VK_IMAGE_ASPECT_STENCIL_BIT; 106 break; 107 case tcu::TextureFormat::DS: 108 aspectFlags = vk::VK_IMAGE_ASPECT_STENCIL_BIT | vk::VK_IMAGE_ASPECT_DEPTH_BIT; 109 break; 110 default: 111 aspectFlags = vk::VK_IMAGE_ASPECT_COLOR_BIT; 112 break; 113 } 114 115 subresourceRange = ImageSubresourceRange(aspectFlags);; 116 flags = _flags; 117 } 118 119 BufferViewCreateInfo::BufferViewCreateInfo (vk::VkBuffer _buffer, 120 vk::VkFormat _format, 121 vk::VkDeviceSize _offset, 122 vk::VkDeviceSize _range) 123 { 124 sType = vk::VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO; 125 pNext = DE_NULL; 126 127 flags = 0; 128 buffer = _buffer; 129 format = _format; 130 offset = _offset; 131 range = _range; 132 } 133 134 BufferCreateInfo::BufferCreateInfo (vk::VkDeviceSize _size, 135 vk::VkBufferUsageFlags _usage, 136 vk::VkSharingMode _sharingMode, 137 deUint32 _queueFamilyIndexCount, 138 const deUint32* _pQueueFamilyIndices, 139 vk::VkBufferCreateFlags _flags) 140 { 141 sType = vk::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; 142 pNext = DE_NULL; 143 size = _size; 144 usage = _usage; 145 flags = _flags; 146 sharingMode = _sharingMode; 147 queueFamilyIndexCount = _queueFamilyIndexCount; 148 149 if (_queueFamilyIndexCount) 150 { 151 m_queueFamilyIndices = std::vector<deUint32>( 152 _pQueueFamilyIndices, _pQueueFamilyIndices + _queueFamilyIndexCount); 153 pQueueFamilyIndices = &m_queueFamilyIndices[0]; 154 } 155 else 156 { 157 pQueueFamilyIndices = _pQueueFamilyIndices; 158 } 159 } 160 161 BufferCreateInfo::BufferCreateInfo (const BufferCreateInfo &other) 162 { 163 sType = other.sType; 164 pNext = other.pNext; 165 size = other.size; 166 usage = other.usage; 167 flags = other.flags; 168 sharingMode = other.sharingMode; 169 queueFamilyIndexCount = other.queueFamilyIndexCount; 170 171 m_queueFamilyIndices = other.m_queueFamilyIndices; 172 DE_ASSERT(m_queueFamilyIndices.size() == queueFamilyIndexCount); 173 174 if (m_queueFamilyIndices.size()) 175 { 176 pQueueFamilyIndices = &m_queueFamilyIndices[0]; 177 } 178 else 179 { 180 pQueueFamilyIndices = DE_NULL; 181 } 182 } 183 184 BufferCreateInfo & BufferCreateInfo::operator= (const BufferCreateInfo &other) 185 { 186 sType = other.sType; 187 pNext = other.pNext; 188 size = other.size; 189 usage = other.usage; 190 flags = other.flags; 191 sharingMode = other.sharingMode; 192 queueFamilyIndexCount = other.queueFamilyIndexCount; 193 194 m_queueFamilyIndices = other.m_queueFamilyIndices; 195 196 DE_ASSERT(m_queueFamilyIndices.size() == queueFamilyIndexCount); 197 198 if (m_queueFamilyIndices.size()) 199 { 200 pQueueFamilyIndices = &m_queueFamilyIndices[0]; 201 } 202 else 203 { 204 pQueueFamilyIndices = DE_NULL; 205 } 206 207 return *this; 208 } 209 210 ImageCreateInfo::ImageCreateInfo (vk::VkImageType _imageType, 211 vk::VkFormat _format, 212 vk::VkExtent3D _extent, 213 deUint32 _mipLevels, 214 deUint32 _arrayLayers, 215 vk::VkSampleCountFlagBits _samples, 216 vk::VkImageTiling _tiling, 217 vk::VkImageUsageFlags _usage, 218 vk::VkSharingMode _sharingMode, 219 deUint32 _queueFamilyIndexCount, 220 const deUint32* _pQueueFamilyIndices, 221 vk::VkImageCreateFlags _flags, 222 vk::VkImageLayout _initialLayout) 223 { 224 if (_queueFamilyIndexCount) 225 { 226 m_queueFamilyIndices = std::vector<deUint32>(_pQueueFamilyIndices, _pQueueFamilyIndices + _queueFamilyIndexCount); 227 } 228 229 sType = vk::VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; 230 pNext = DE_NULL; 231 flags = _flags; 232 imageType = _imageType; 233 format = _format; 234 extent = _extent; 235 mipLevels = _mipLevels; 236 arrayLayers = _arrayLayers; 237 samples = _samples; 238 tiling = _tiling; 239 usage = _usage; 240 sharingMode = _sharingMode; 241 queueFamilyIndexCount = _queueFamilyIndexCount; 242 243 if (m_queueFamilyIndices.size()) 244 { 245 pQueueFamilyIndices = &m_queueFamilyIndices[0]; 246 } 247 else 248 { 249 pQueueFamilyIndices = DE_NULL; 250 } 251 initialLayout = _initialLayout; 252 } 253 254 FramebufferCreateInfo::FramebufferCreateInfo (vk::VkRenderPass _renderPass, 255 const std::vector<vk::VkImageView>& atachments, 256 deUint32 _width, 257 deUint32 _height, 258 deUint32 _layers) 259 { 260 sType = vk::VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; 261 pNext = DE_NULL; 262 flags = 0u; 263 264 renderPass = _renderPass; 265 attachmentCount = static_cast<deUint32>(atachments.size()); 266 267 if (attachmentCount) 268 { 269 pAttachments = const_cast<vk::VkImageView *>(&atachments[0]); 270 } 271 272 width = _width; 273 height = _height; 274 layers = _layers; 275 } 276 277 RenderPassCreateInfo::RenderPassCreateInfo (const std::vector<vk::VkAttachmentDescription>& attachments, 278 const std::vector<vk::VkSubpassDescription>& subpasses, 279 const std::vector<vk::VkSubpassDependency>& dependiences) 280 281 : m_attachments (attachments.begin(), attachments.end()) 282 , m_subpasses (subpasses.begin(), subpasses.end()) 283 , m_dependiences (dependiences.begin(), dependiences.end()) 284 , m_attachmentsStructs (m_attachments.begin(), m_attachments.end()) 285 , m_subpassesStructs (m_subpasses.begin(), m_subpasses.end()) 286 , m_dependiencesStructs (m_dependiences.begin(), m_dependiences.end()) 287 { 288 sType = vk::VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; 289 pNext = DE_NULL; 290 flags = 0; 291 292 attachmentCount = static_cast<deUint32>(m_attachments.size()); 293 pAttachments = &m_attachmentsStructs[0]; 294 subpassCount = static_cast<deUint32>(m_subpasses.size()); 295 pSubpasses = &m_subpassesStructs[0]; 296 dependencyCount = static_cast<deUint32>(m_dependiences.size()); 297 pDependencies = &m_dependiencesStructs[0]; 298 } 299 300 RenderPassCreateInfo::RenderPassCreateInfo (deUint32 _attachmentCount, 301 const vk::VkAttachmentDescription* _pAttachments, 302 deUint32 _subpassCount, 303 const vk::VkSubpassDescription* _pSubpasses, 304 deUint32 _dependencyCount, 305 const vk::VkSubpassDependency* _pDependiences) 306 { 307 308 m_attachments = std::vector<AttachmentDescription>(_pAttachments, _pAttachments + _attachmentCount); 309 m_subpasses = std::vector<SubpassDescription>(_pSubpasses, _pSubpasses + _subpassCount); 310 m_dependiences = std::vector<SubpassDependency>(_pDependiences, _pDependiences + _dependencyCount); 311 312 m_attachmentsStructs = std::vector<vk::VkAttachmentDescription> (m_attachments.begin(), m_attachments.end()); 313 m_subpassesStructs = std::vector<vk::VkSubpassDescription> (m_subpasses.begin(), m_subpasses.end()); 314 m_dependiencesStructs = std::vector<vk::VkSubpassDependency> (m_dependiences.begin(), m_dependiences.end()); 315 316 sType = vk::VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; 317 pNext = DE_NULL; 318 flags = 0; 319 320 attachmentCount = static_cast<deUint32>(m_attachments.size()); 321 322 if (attachmentCount) { 323 pAttachments = &m_attachmentsStructs[0]; 324 } 325 else 326 { 327 pAttachments = DE_NULL; 328 } 329 330 subpassCount = static_cast<deUint32>(m_subpasses.size()); 331 332 if (subpassCount) { 333 pSubpasses = &m_subpassesStructs[0]; 334 } 335 else 336 { 337 pSubpasses = DE_NULL; 338 } 339 340 dependencyCount = static_cast<deUint32>(m_dependiences.size()); 341 342 if (dependencyCount) { 343 pDependencies = &m_dependiencesStructs[0]; 344 } 345 else 346 { 347 pDependencies = DE_NULL; 348 } 349 } 350 351 void 352 RenderPassCreateInfo::addAttachment (vk::VkAttachmentDescription attachment) 353 { 354 355 m_attachments.push_back(attachment); 356 m_attachmentsStructs = std::vector<vk::VkAttachmentDescription>(m_attachments.begin(), m_attachments.end()); 357 attachmentCount = static_cast<deUint32>(m_attachments.size()); 358 pAttachments = &m_attachmentsStructs[0]; 359 } 360 361 void 362 RenderPassCreateInfo::addSubpass (vk::VkSubpassDescription subpass) 363 { 364 365 m_subpasses.push_back(subpass); 366 m_subpassesStructs = std::vector<vk::VkSubpassDescription>(m_subpasses.begin(), m_subpasses.end()); 367 subpassCount = static_cast<deUint32>(m_subpasses.size()); 368 pSubpasses = &m_subpassesStructs[0]; 369 } 370 371 void 372 RenderPassCreateInfo::addDependency (vk::VkSubpassDependency dependency) 373 { 374 375 m_dependiences.push_back(dependency); 376 m_dependiencesStructs = std::vector<vk::VkSubpassDependency>(m_dependiences.begin(), m_dependiences.end()); 377 378 dependencyCount = static_cast<deUint32>(m_dependiences.size()); 379 pDependencies = &m_dependiencesStructs[0]; 380 } 381 382 RenderPassBeginInfo::RenderPassBeginInfo (vk::VkRenderPass _renderPass, 383 vk::VkFramebuffer _framebuffer, 384 vk::VkRect2D _renderArea, 385 const std::vector<vk::VkClearValue>& _clearValues) 386 { 387 388 m_clearValues = _clearValues; 389 390 sType = vk::VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; 391 pNext = DE_NULL; 392 renderPass = _renderPass; 393 framebuffer = _framebuffer; 394 renderArea = _renderArea; 395 clearValueCount = static_cast<deUint32>(m_clearValues.size()); 396 pClearValues = m_clearValues.size() ? &m_clearValues[0] : DE_NULL; 397 } 398 399 CmdPoolCreateInfo::CmdPoolCreateInfo (deUint32 _queueFamilyIndex, unsigned int _flags) 400 { 401 sType = vk::VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; 402 pNext = DE_NULL; 403 404 queueFamilyIndex = _queueFamilyIndex; 405 flags = _flags; 406 } 407 408 AttachmentDescription::AttachmentDescription (vk::VkFormat _format, 409 vk::VkSampleCountFlagBits _samples, 410 vk::VkAttachmentLoadOp _loadOp, 411 vk::VkAttachmentStoreOp _storeOp, 412 vk::VkAttachmentLoadOp _stencilLoadOp, 413 vk::VkAttachmentStoreOp _stencilStoreOp, 414 vk::VkImageLayout _initialLayout, 415 vk::VkImageLayout _finalLayout) 416 { 417 flags = 0; 418 format = _format; 419 samples = _samples; 420 loadOp = _loadOp; 421 storeOp = _storeOp; 422 stencilLoadOp = _stencilLoadOp; 423 stencilStoreOp = _stencilStoreOp; 424 initialLayout = _initialLayout; 425 finalLayout = _finalLayout; 426 } 427 428 AttachmentDescription::AttachmentDescription (const vk::VkAttachmentDescription& rhs) 429 { 430 flags = rhs.flags; 431 format = rhs.format; 432 samples = rhs.samples; 433 loadOp = rhs.loadOp; 434 storeOp = rhs.storeOp; 435 stencilLoadOp = rhs.stencilLoadOp; 436 stencilStoreOp = rhs.stencilStoreOp; 437 initialLayout = rhs.initialLayout; 438 finalLayout = rhs.finalLayout; 439 } 440 441 AttachmentReference::AttachmentReference (deUint32 _attachment, vk::VkImageLayout _layout) 442 { 443 attachment = _attachment; 444 layout = _layout; 445 } 446 447 AttachmentReference::AttachmentReference (void) 448 { 449 attachment = VK_ATTACHMENT_UNUSED; 450 layout = vk::VK_IMAGE_LAYOUT_UNDEFINED; 451 } 452 453 SubpassDescription::SubpassDescription (vk::VkPipelineBindPoint _pipelineBindPoint, 454 vk::VkSubpassDescriptionFlags _flags, 455 deUint32 _inputAttachmentCount, 456 const vk::VkAttachmentReference* _inputAttachments, 457 deUint32 _colorAttachmentCount, 458 const vk::VkAttachmentReference* _colorAttachments, 459 const vk::VkAttachmentReference* _resolveAttachments, 460 vk::VkAttachmentReference depthStencilAttachment, 461 deUint32 _preserveAttachmentCount, 462 const deUint32* _preserveAttachments) 463 { 464 m_inputAttachments = std::vector<vk::VkAttachmentReference>(_inputAttachments, _inputAttachments + _inputAttachmentCount); 465 m_colorAttachments = std::vector<vk::VkAttachmentReference>(_colorAttachments, _colorAttachments + _colorAttachmentCount); 466 467 if (_resolveAttachments) 468 m_resolveAttachments = std::vector<vk::VkAttachmentReference>(_resolveAttachments, _resolveAttachments + _colorAttachmentCount); 469 470 m_preserveAttachments = std::vector<deUint32>(_preserveAttachments, _preserveAttachments + _preserveAttachmentCount); 471 472 m_depthStencilAttachment = depthStencilAttachment; 473 474 flags = _flags; 475 pipelineBindPoint = _pipelineBindPoint; 476 inputAttachmentCount = _inputAttachmentCount; 477 pInputAttachments = DE_NULL; 478 colorAttachmentCount = _colorAttachmentCount; 479 pColorAttachments = DE_NULL; 480 pResolveAttachments = DE_NULL; 481 pDepthStencilAttachment = &m_depthStencilAttachment; 482 pPreserveAttachments = DE_NULL; 483 preserveAttachmentCount = _preserveAttachmentCount; 484 485 if (!m_inputAttachments.empty()) 486 pInputAttachments = &m_inputAttachments[0]; 487 488 if (!m_colorAttachments.empty()) 489 pColorAttachments = &m_colorAttachments[0]; 490 491 if (!m_resolveAttachments.empty()) 492 pResolveAttachments = &m_resolveAttachments[0]; 493 494 if (!m_preserveAttachments.empty()) 495 pPreserveAttachments = &m_preserveAttachments[0]; 496 } 497 498 SubpassDescription::SubpassDescription (const vk::VkSubpassDescription& rhs) 499 { 500 *static_cast<vk::VkSubpassDescription*>(this) = rhs; 501 502 m_inputAttachments = std::vector<vk::VkAttachmentReference>( 503 rhs.pInputAttachments, rhs.pInputAttachments + rhs.inputAttachmentCount); 504 505 m_colorAttachments = std::vector<vk::VkAttachmentReference>( 506 rhs.pColorAttachments, rhs.pColorAttachments + rhs.colorAttachmentCount); 507 508 if (rhs.pResolveAttachments) 509 m_resolveAttachments = std::vector<vk::VkAttachmentReference>( 510 rhs.pResolveAttachments, rhs.pResolveAttachments + rhs.colorAttachmentCount); 511 512 m_preserveAttachments = std::vector<deUint32>( 513 rhs.pPreserveAttachments, rhs.pPreserveAttachments + rhs.preserveAttachmentCount); 514 515 if (rhs.pDepthStencilAttachment) 516 m_depthStencilAttachment = *rhs.pDepthStencilAttachment; 517 518 if (!m_inputAttachments.empty()) 519 pInputAttachments = &m_inputAttachments[0]; 520 521 if (!m_colorAttachments.empty()) 522 pColorAttachments = &m_colorAttachments[0]; 523 524 if (!m_resolveAttachments.empty()) 525 pResolveAttachments = &m_resolveAttachments[0]; 526 527 pDepthStencilAttachment = &m_depthStencilAttachment; 528 529 if (!m_preserveAttachments.empty()) 530 pPreserveAttachments = &m_preserveAttachments[0]; 531 } 532 533 SubpassDescription::SubpassDescription (const SubpassDescription& rhs) { 534 *this = rhs; 535 } 536 537 SubpassDescription& SubpassDescription::operator= (const SubpassDescription& rhs) 538 { 539 *static_cast<vk::VkSubpassDescription*>(this) = rhs; 540 541 m_inputAttachments = rhs.m_inputAttachments; 542 m_colorAttachments = rhs.m_colorAttachments; 543 m_resolveAttachments = rhs.m_resolveAttachments; 544 m_preserveAttachments = rhs.m_preserveAttachments; 545 m_depthStencilAttachment = rhs.m_depthStencilAttachment; 546 547 if (!m_inputAttachments.empty()) 548 pInputAttachments = &m_inputAttachments[0]; 549 550 if (!m_colorAttachments.empty()) 551 pColorAttachments = &m_colorAttachments[0]; 552 553 if (!m_resolveAttachments.empty()) 554 pResolveAttachments = &m_resolveAttachments[0]; 555 556 pDepthStencilAttachment = &m_depthStencilAttachment; 557 558 if (!m_preserveAttachments.empty()) 559 pPreserveAttachments = &m_preserveAttachments[0]; 560 561 return *this; 562 } 563 564 SubpassDependency::SubpassDependency (deUint32 _srcSubpass, 565 deUint32 _dstSubpass, 566 vk::VkPipelineStageFlags _srcStageMask, 567 vk::VkPipelineStageFlags _dstStageMask, 568 vk::VkAccessFlags _srcAccessMask, 569 vk::VkAccessFlags _dstAccessMask, 570 vk::VkDependencyFlags _dependencyFlags) 571 { 572 srcSubpass = _srcSubpass; 573 dstSubpass = _dstSubpass; 574 srcStageMask = _srcStageMask; 575 dstStageMask = _dstStageMask; 576 srcAccessMask = _srcAccessMask; 577 dstAccessMask = _dstAccessMask; 578 dependencyFlags = _dependencyFlags; 579 } 580 581 SubpassDependency::SubpassDependency (const vk::VkSubpassDependency& rhs) 582 { 583 srcSubpass = rhs.srcSubpass; 584 dstSubpass = rhs.dstSubpass; 585 srcStageMask = rhs.srcStageMask; 586 dstStageMask = rhs.dstStageMask; 587 srcAccessMask = rhs.srcAccessMask; 588 dstAccessMask = rhs.dstAccessMask; 589 dependencyFlags = rhs.dependencyFlags; 590 } 591 592 CmdBufferBeginInfo::CmdBufferBeginInfo (vk::VkCommandBufferUsageFlags _flags) 593 { 594 sType = vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; 595 pNext = DE_NULL; 596 flags = _flags; 597 pInheritanceInfo = DE_NULL; 598 } 599 600 DescriptorPoolCreateInfo::DescriptorPoolCreateInfo (const std::vector<vk::VkDescriptorPoolSize>& poolSizeCounts, 601 vk::VkDescriptorPoolCreateFlags _flags, 602 deUint32 _maxSets) 603 : m_poolSizeCounts(poolSizeCounts) 604 { 605 sType = vk::VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; 606 pNext = DE_NULL; 607 flags = _flags; 608 maxSets = _maxSets; 609 poolSizeCount = static_cast<deUint32>(m_poolSizeCounts.size()); 610 pPoolSizes = &m_poolSizeCounts[0]; 611 } 612 613 DescriptorPoolCreateInfo& DescriptorPoolCreateInfo::addDescriptors (vk::VkDescriptorType type, deUint32 count) 614 { 615 vk::VkDescriptorPoolSize descriptorTypeCount = { type, count }; 616 m_poolSizeCounts.push_back(descriptorTypeCount); 617 618 poolSizeCount = static_cast<deUint32>(m_poolSizeCounts.size()); 619 pPoolSizes = &m_poolSizeCounts[0]; 620 621 return *this; 622 } 623 624 DescriptorSetLayoutCreateInfo::DescriptorSetLayoutCreateInfo (deUint32 _bindingCount, const vk::VkDescriptorSetLayoutBinding* _pBindings) 625 { 626 sType = vk::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; 627 pNext = DE_NULL; 628 flags = 0; 629 bindingCount = _bindingCount; 630 pBindings = _pBindings; 631 } 632 633 PipelineLayoutCreateInfo::PipelineLayoutCreateInfo (deUint32 _descriptorSetCount, 634 const vk::VkDescriptorSetLayout* _pSetLayouts, 635 deUint32 _pushConstantRangeCount, 636 const vk::VkPushConstantRange* _pPushConstantRanges) 637 : m_pushConstantRanges(_pPushConstantRanges, _pPushConstantRanges + _pushConstantRangeCount) 638 { 639 for (unsigned int i = 0; i < _descriptorSetCount; i++) 640 { 641 m_setLayouts.push_back(_pSetLayouts[i]); 642 } 643 644 sType = vk::VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; 645 pNext = DE_NULL; 646 flags = 0; 647 setLayoutCount = static_cast<deUint32>(m_setLayouts.size()); 648 pSetLayouts = setLayoutCount > 0 ? &m_setLayouts[0] : DE_NULL; 649 pushConstantRangeCount = static_cast<deUint32>(m_pushConstantRanges.size()); 650 651 if (m_pushConstantRanges.size()) { 652 pPushConstantRanges = &m_pushConstantRanges[0]; 653 } 654 else 655 { 656 pPushConstantRanges = DE_NULL; 657 } 658 } 659 660 PipelineLayoutCreateInfo::PipelineLayoutCreateInfo (const std::vector<vk::VkDescriptorSetLayout>& setLayouts, 661 deUint32 _pushConstantRangeCount, 662 const vk::VkPushConstantRange* _pPushConstantRanges) 663 : m_setLayouts (setLayouts) 664 , m_pushConstantRanges (_pPushConstantRanges, _pPushConstantRanges + _pushConstantRangeCount) 665 { 666 sType = vk::VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; 667 pNext = DE_NULL; 668 669 flags = 0; 670 setLayoutCount = static_cast<deUint32>(m_setLayouts.size()); 671 672 if (setLayoutCount) 673 { 674 pSetLayouts = &m_setLayouts[0]; 675 } 676 else 677 { 678 pSetLayouts = DE_NULL; 679 } 680 681 pushConstantRangeCount = static_cast<deUint32>(m_pushConstantRanges.size()); 682 if (pushConstantRangeCount) { 683 pPushConstantRanges = &m_pushConstantRanges[0]; 684 } 685 else 686 { 687 pPushConstantRanges = DE_NULL; 688 } 689 } 690 691 PipelineCreateInfo::PipelineShaderStage::PipelineShaderStage (vk::VkShaderModule _module, const char* _pName, vk::VkShaderStageFlagBits _stage) 692 { 693 sType = vk::VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; 694 pNext = DE_NULL; 695 flags = 0u; 696 stage = _stage; 697 module = _module; 698 pName = _pName; 699 pSpecializationInfo = DE_NULL; 700 } 701 702 PipelineCreateInfo::VertexInputState::VertexInputState (deUint32 _vertexBindingDescriptionCount, 703 const vk::VkVertexInputBindingDescription* _pVertexBindingDescriptions, 704 deUint32 _vertexAttributeDescriptionCount, 705 const vk::VkVertexInputAttributeDescription* _pVertexAttributeDescriptions) 706 { 707 sType = vk::VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; 708 pNext = DE_NULL; 709 flags = 0u; 710 vertexBindingDescriptionCount = _vertexBindingDescriptionCount; 711 pVertexBindingDescriptions = _pVertexBindingDescriptions; 712 vertexAttributeDescriptionCount = _vertexAttributeDescriptionCount; 713 pVertexAttributeDescriptions = _pVertexAttributeDescriptions; 714 } 715 716 PipelineCreateInfo::VertexInputState& PipelineCreateInfo::VertexInputState::addDivisors (deUint32 _vertexBindingDivisorCount, 717 const vk::VkVertexInputBindingDivisorDescriptionEXT* _pVertexBindingDivisors) 718 { 719 m_divisorState.sType = vk::VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT; 720 m_divisorState.vertexBindingDivisorCount = _vertexBindingDivisorCount; 721 m_divisorState.pVertexBindingDivisors = _pVertexBindingDivisors; 722 723 // Link it into the chainadd 724 m_divisorState.pNext = this->pNext; 725 pNext = &m_divisorState; 726 727 return *this; 728 } 729 730 PipelineCreateInfo::InputAssemblerState::InputAssemblerState (vk::VkPrimitiveTopology _topology, 731 vk::VkBool32 _primitiveRestartEnable) 732 { 733 sType = vk::VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; 734 pNext = DE_NULL; 735 flags = 0u; 736 topology = _topology; 737 primitiveRestartEnable = _primitiveRestartEnable; 738 } 739 740 PipelineCreateInfo::TessellationState::TessellationState (deUint32 _patchControlPoints) 741 { 742 sType = vk::VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO; 743 pNext = DE_NULL; 744 flags = 0; 745 patchControlPoints = _patchControlPoints; 746 } 747 748 PipelineCreateInfo::ViewportState::ViewportState (deUint32 _viewportCount, 749 std::vector<vk::VkViewport> _viewports, 750 std::vector<vk::VkRect2D> _scissors) 751 { 752 sType = vk::VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; 753 pNext = DE_NULL; 754 flags = 0u; 755 viewportCount = _viewportCount; 756 scissorCount = _viewportCount; 757 758 if (!_viewports.size()) 759 { 760 m_viewports.resize(viewportCount); 761 deMemset(&m_viewports[0], 0, sizeof(m_viewports[0]) * m_viewports.size()); 762 } 763 else 764 { 765 m_viewports = _viewports; 766 } 767 768 if (!_scissors.size()) 769 { 770 m_scissors.resize(scissorCount); 771 deMemset(&m_scissors[0], 0, sizeof(m_scissors[0]) * m_scissors.size()); 772 } 773 else 774 { 775 m_scissors = _scissors; 776 } 777 778 pViewports = &m_viewports[0]; 779 pScissors = &m_scissors[0]; 780 } 781 782 PipelineCreateInfo::ViewportState::ViewportState (const ViewportState& other) 783 { 784 sType = other.sType; 785 pNext = other.pNext; 786 flags = other.flags; 787 viewportCount = other.viewportCount; 788 scissorCount = other.scissorCount; 789 790 m_viewports = std::vector<vk::VkViewport>(other.pViewports, other.pViewports + viewportCount); 791 m_scissors = std::vector<vk::VkRect2D>(other.pScissors, other.pScissors + scissorCount); 792 793 pViewports = &m_viewports[0]; 794 pScissors = &m_scissors[0]; 795 } 796 797 PipelineCreateInfo::ViewportState& PipelineCreateInfo::ViewportState::operator= (const ViewportState& other) 798 { 799 sType = other.sType; 800 pNext = other.pNext; 801 flags = other.flags; 802 viewportCount = other.viewportCount; 803 scissorCount = other.scissorCount; 804 805 m_viewports = std::vector<vk::VkViewport>(other.pViewports, other.pViewports + scissorCount); 806 m_scissors = std::vector<vk::VkRect2D>(other.pScissors, other.pScissors + scissorCount); 807 808 pViewports = &m_viewports[0]; 809 pScissors = &m_scissors[0]; 810 return *this; 811 } 812 813 PipelineCreateInfo::RasterizerState::RasterizerState (vk::VkBool32 _depthClampEnable, 814 vk::VkBool32 _rasterizerDiscardEnable, 815 vk::VkPolygonMode _polygonMode, 816 vk::VkCullModeFlags _cullMode, 817 vk::VkFrontFace _frontFace, 818 vk::VkBool32 _depthBiasEnable, 819 float _depthBiasConstantFactor, 820 float _depthBiasClamp, 821 float _depthBiasSlopeFactor, 822 float _lineWidth) 823 { 824 sType = vk::VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; 825 pNext = DE_NULL; 826 flags = 0u; 827 depthClampEnable = _depthClampEnable; 828 rasterizerDiscardEnable = _rasterizerDiscardEnable; 829 polygonMode = _polygonMode; 830 cullMode = _cullMode; 831 frontFace = _frontFace; 832 833 depthBiasEnable = _depthBiasEnable; 834 depthBiasConstantFactor = _depthBiasConstantFactor; 835 depthBiasClamp = _depthBiasClamp; 836 depthBiasSlopeFactor = _depthBiasSlopeFactor; 837 lineWidth = _lineWidth; 838 } 839 840 PipelineCreateInfo::MultiSampleState::MultiSampleState (vk::VkSampleCountFlagBits _rasterizationSamples, 841 vk::VkBool32 _sampleShadingEnable, 842 float _minSampleShading, 843 const std::vector<vk::VkSampleMask>& _sampleMask, 844 bool _alphaToCoverageEnable, 845 bool _alphaToOneEnable) 846 : m_sampleMask(_sampleMask) 847 { 848 sType = vk::VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; 849 pNext = DE_NULL; 850 flags = 0u; 851 rasterizationSamples = _rasterizationSamples; 852 sampleShadingEnable = _sampleShadingEnable; 853 minSampleShading = _minSampleShading; 854 pSampleMask = &m_sampleMask[0]; 855 alphaToCoverageEnable = _alphaToCoverageEnable; 856 alphaToOneEnable = _alphaToOneEnable; 857 } 858 859 PipelineCreateInfo::MultiSampleState::MultiSampleState (const MultiSampleState& other) 860 { 861 sType = other.sType; 862 pNext = other.pNext; 863 flags = other.flags; 864 rasterizationSamples = other.rasterizationSamples; 865 sampleShadingEnable = other.sampleShadingEnable; 866 minSampleShading = other.minSampleShading; 867 868 const size_t sampleMaskArrayLen = (sizeof(vk::VkSampleMask) * 8 + other.rasterizationSamples) / (sizeof(vk::VkSampleMask) * 8); 869 870 m_sampleMask = std::vector<vk::VkSampleMask>(other.pSampleMask, other.pSampleMask + sampleMaskArrayLen); 871 pSampleMask = &m_sampleMask[0]; 872 } 873 874 PipelineCreateInfo::MultiSampleState& PipelineCreateInfo::MultiSampleState::operator= (const MultiSampleState& other) 875 { 876 sType = other.sType; 877 pNext = other.pNext; 878 flags = other.flags; 879 rasterizationSamples = other.rasterizationSamples; 880 sampleShadingEnable = other.sampleShadingEnable; 881 minSampleShading = other.minSampleShading; 882 883 const size_t sampleMaskArrayLen = (sizeof(vk::VkSampleMask) * 8 + other.rasterizationSamples) / (sizeof(vk::VkSampleMask) * 8); 884 885 m_sampleMask = std::vector<vk::VkSampleMask>(other.pSampleMask, other.pSampleMask + sampleMaskArrayLen); 886 pSampleMask = &m_sampleMask[0]; 887 888 return *this; 889 } 890 891 PipelineCreateInfo::ColorBlendState::ColorBlendState (const std::vector<vk::VkPipelineColorBlendAttachmentState>& _attachments, 892 vk::VkBool32 _logicOpEnable, 893 vk::VkLogicOp _logicOp) 894 : m_attachments(_attachments) 895 { 896 sType = vk::VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; 897 pNext = DE_NULL; 898 flags = 0u; 899 logicOpEnable = _logicOpEnable; 900 logicOp = _logicOp; 901 attachmentCount = static_cast<deUint32>(m_attachments.size()); 902 pAttachments = &m_attachments[0]; 903 } 904 905 PipelineCreateInfo::ColorBlendState::ColorBlendState (deUint32 _attachmentCount, 906 const vk::VkPipelineColorBlendAttachmentState* _attachments, 907 vk::VkBool32 _logicOpEnable, 908 vk::VkLogicOp _logicOp) 909 : m_attachments(_attachments, _attachments + _attachmentCount) 910 { 911 sType = vk::VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; 912 pNext = DE_NULL; 913 flags = 0; 914 logicOpEnable = _logicOpEnable; 915 logicOp = _logicOp; 916 attachmentCount = static_cast<deUint32>(m_attachments.size()); 917 pAttachments = &m_attachments[0]; 918 } 919 920 PipelineCreateInfo::ColorBlendState::ColorBlendState (const vk::VkPipelineColorBlendStateCreateInfo& createInfo) 921 : m_attachments (createInfo.pAttachments, createInfo.pAttachments + createInfo.attachmentCount) 922 { 923 sType = createInfo.sType; 924 pNext = createInfo.pNext; 925 flags = createInfo.flags; 926 logicOpEnable = createInfo.logicOpEnable; 927 logicOp = createInfo.logicOp; 928 attachmentCount = static_cast<deUint32>(m_attachments.size()); 929 pAttachments = &m_attachments[0]; 930 } 931 932 PipelineCreateInfo::ColorBlendState::ColorBlendState (const ColorBlendState& createInfo, std::vector<float> _blendConstants) 933 : m_attachments (createInfo.pAttachments, createInfo.pAttachments + createInfo.attachmentCount) 934 { 935 sType = createInfo.sType; 936 pNext = createInfo.pNext; 937 flags = createInfo.flags; 938 logicOpEnable = createInfo.logicOpEnable; 939 logicOp = createInfo.logicOp; 940 attachmentCount = static_cast<deUint32>(m_attachments.size()); 941 pAttachments = &m_attachments[0]; 942 deMemcpy(blendConstants, &_blendConstants[0], 4 * sizeof(float)); 943 } 944 945 PipelineCreateInfo::ColorBlendState::Attachment::Attachment (vk::VkBool32 _blendEnable, 946 vk::VkBlendFactor _srcColorBlendFactor, 947 vk::VkBlendFactor _dstColorBlendFactor, 948 vk::VkBlendOp _colorBlendOp, 949 vk::VkBlendFactor _srcAlphaBlendFactor, 950 vk::VkBlendFactor _dstAlphaBlendFactor, 951 vk::VkBlendOp _alphaBlendOp, 952 vk::VkColorComponentFlags _colorWriteMask) 953 { 954 blendEnable = _blendEnable; 955 srcColorBlendFactor = _srcColorBlendFactor; 956 dstColorBlendFactor = _dstColorBlendFactor; 957 colorBlendOp = _colorBlendOp; 958 srcAlphaBlendFactor = _srcAlphaBlendFactor; 959 dstAlphaBlendFactor = _dstAlphaBlendFactor; 960 alphaBlendOp = _alphaBlendOp; 961 colorWriteMask = _colorWriteMask; 962 } 963 964 PipelineCreateInfo::DepthStencilState::StencilOpState::StencilOpState (vk::VkStencilOp _failOp, 965 vk::VkStencilOp _passOp, 966 vk::VkStencilOp _depthFailOp, 967 vk::VkCompareOp _compareOp, 968 deUint32 _compareMask, 969 deUint32 _writeMask, 970 deUint32 _reference) 971 { 972 failOp = _failOp; 973 passOp = _passOp; 974 depthFailOp = _depthFailOp; 975 compareOp = _compareOp; 976 977 compareMask = _compareMask; 978 writeMask = _writeMask; 979 reference = _reference; 980 } 981 982 PipelineCreateInfo::DepthStencilState::DepthStencilState (vk::VkBool32 _depthTestEnable, 983 vk::VkBool32 _depthWriteEnable, 984 vk::VkCompareOp _depthCompareOp, 985 vk::VkBool32 _depthBoundsTestEnable, 986 vk::VkBool32 _stencilTestEnable, 987 StencilOpState _front, 988 StencilOpState _back, 989 float _minDepthBounds, 990 float _maxDepthBounds) 991 { 992 sType = vk::VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO; 993 pNext = DE_NULL; 994 flags = 0u; 995 depthTestEnable = _depthTestEnable; 996 depthWriteEnable = _depthWriteEnable; 997 depthCompareOp = _depthCompareOp; 998 depthBoundsTestEnable = _depthBoundsTestEnable; 999 stencilTestEnable = _stencilTestEnable; 1000 front = _front; 1001 back = _back; 1002 1003 minDepthBounds = _minDepthBounds; 1004 maxDepthBounds = _maxDepthBounds; 1005 } 1006 1007 PipelineCreateInfo::DynamicState::DynamicState (const std::vector<vk::VkDynamicState>& _dynamicStates) 1008 { 1009 sType = vk::VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO; 1010 pNext = DE_NULL; 1011 flags = 0; 1012 1013 if (!_dynamicStates.size()) 1014 { 1015 const vk::VkDynamicState dynamicState[] = 1016 { 1017 vk::VK_DYNAMIC_STATE_VIEWPORT, 1018 vk::VK_DYNAMIC_STATE_SCISSOR, 1019 vk::VK_DYNAMIC_STATE_LINE_WIDTH, 1020 vk::VK_DYNAMIC_STATE_DEPTH_BIAS, 1021 vk::VK_DYNAMIC_STATE_BLEND_CONSTANTS, 1022 vk::VK_DYNAMIC_STATE_DEPTH_BOUNDS, 1023 vk::VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK, 1024 vk::VK_DYNAMIC_STATE_STENCIL_WRITE_MASK, 1025 vk::VK_DYNAMIC_STATE_STENCIL_REFERENCE, 1026 }; 1027 1028 for (size_t i = 0; i < DE_LENGTH_OF_ARRAY(dynamicState); ++i) 1029 { 1030 m_dynamicStates.push_back(dynamicState[i]); 1031 } 1032 } 1033 else 1034 m_dynamicStates = _dynamicStates; 1035 1036 dynamicStateCount = static_cast<deUint32>(m_dynamicStates.size()); 1037 pDynamicStates = &m_dynamicStates[0]; 1038 } 1039 1040 PipelineCreateInfo::DynamicState::DynamicState (const DynamicState &other) 1041 { 1042 sType = other.sType; 1043 pNext = other.pNext; 1044 1045 flags = other.flags; 1046 dynamicStateCount = other.dynamicStateCount; 1047 m_dynamicStates = std::vector<vk::VkDynamicState>(other.pDynamicStates, other.pDynamicStates + dynamicStateCount); 1048 pDynamicStates = &m_dynamicStates[0]; 1049 } 1050 1051 PipelineCreateInfo::DynamicState& PipelineCreateInfo::DynamicState::operator= (const DynamicState& other) 1052 { 1053 sType = other.sType; 1054 pNext = other.pNext; 1055 1056 flags = other.flags; 1057 dynamicStateCount = other.dynamicStateCount; 1058 m_dynamicStates = std::vector<vk::VkDynamicState>(other.pDynamicStates, other.pDynamicStates + dynamicStateCount); 1059 pDynamicStates = &m_dynamicStates[0]; 1060 1061 return *this; 1062 } 1063 1064 PipelineCreateInfo::PipelineCreateInfo (vk::VkPipelineLayout _layout, 1065 vk::VkRenderPass _renderPass, 1066 int _subpass, 1067 vk::VkPipelineCreateFlags _flags) 1068 { 1069 deMemset(static_cast<vk::VkGraphicsPipelineCreateInfo *>(this), 0, 1070 sizeof(vk::VkGraphicsPipelineCreateInfo)); 1071 1072 sType = vk::VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; 1073 pNext = DE_NULL; 1074 flags = _flags; 1075 renderPass = _renderPass; 1076 subpass = _subpass; 1077 layout = _layout; 1078 basePipelineHandle = DE_NULL; 1079 basePipelineIndex = 0; 1080 pDynamicState = DE_NULL; 1081 } 1082 1083 PipelineCreateInfo& PipelineCreateInfo::addShader (const vk::VkPipelineShaderStageCreateInfo& shader) 1084 { 1085 m_shaders.push_back(shader); 1086 1087 stageCount = static_cast<deUint32>(m_shaders.size()); 1088 pStages = &m_shaders[0]; 1089 1090 return *this; 1091 } 1092 1093 PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineVertexInputStateCreateInfo& state) 1094 { 1095 m_vertexInputState = state; 1096 pVertexInputState = &m_vertexInputState; 1097 1098 return *this; 1099 } 1100 1101 PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineInputAssemblyStateCreateInfo& state) 1102 { 1103 m_inputAssemblyState = state; 1104 pInputAssemblyState = &m_inputAssemblyState; 1105 1106 return *this; 1107 } 1108 1109 PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineColorBlendStateCreateInfo& state) 1110 { 1111 m_colorBlendStateAttachments = std::vector<vk::VkPipelineColorBlendAttachmentState>(state.pAttachments, state.pAttachments + state.attachmentCount); 1112 m_colorBlendState = state; 1113 m_colorBlendState.pAttachments = &m_colorBlendStateAttachments[0]; 1114 pColorBlendState = &m_colorBlendState; 1115 1116 return *this; 1117 } 1118 1119 PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineViewportStateCreateInfo& state) 1120 { 1121 m_viewports = std::vector<vk::VkViewport>(state.pViewports, state.pViewports + state.viewportCount); 1122 m_scissors = std::vector<vk::VkRect2D>(state.pScissors, state.pScissors + state.scissorCount); 1123 m_viewportState = state; 1124 m_viewportState.pViewports = &m_viewports[0]; 1125 m_viewportState.pScissors = &m_scissors[0]; 1126 pViewportState = &m_viewportState; 1127 1128 return *this; 1129 } 1130 1131 PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineDepthStencilStateCreateInfo& state) 1132 { 1133 m_dynamicDepthStencilState = state; 1134 pDepthStencilState = &m_dynamicDepthStencilState; 1135 return *this; 1136 } 1137 1138 PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineTessellationStateCreateInfo& state) 1139 { 1140 m_tessState = state; 1141 pTessellationState = &m_tessState; 1142 1143 return *this; 1144 } 1145 1146 PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineRasterizationStateCreateInfo& state) 1147 { 1148 m_rasterState = state; 1149 pRasterizationState = &m_rasterState; 1150 1151 return *this; 1152 } 1153 1154 PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineMultisampleStateCreateInfo& state) 1155 { 1156 1157 const size_t sampleMaskArrayLen = (sizeof(vk::VkSampleMask) * 8 + state.rasterizationSamples) / ( sizeof(vk::VkSampleMask) * 8 ); 1158 m_multisampleStateSampleMask = std::vector<vk::VkSampleMask>(state.pSampleMask, state.pSampleMask + sampleMaskArrayLen); 1159 m_multisampleState = state; 1160 m_multisampleState.pSampleMask = &m_multisampleStateSampleMask[0]; 1161 pMultisampleState = &m_multisampleState; 1162 1163 return *this; 1164 } 1165 PipelineCreateInfo& PipelineCreateInfo::addState (const vk::VkPipelineDynamicStateCreateInfo& state) 1166 { 1167 m_dynamicStates = std::vector<vk::VkDynamicState>(state.pDynamicStates, state.pDynamicStates + state.dynamicStateCount); 1168 m_dynamicState = state; 1169 m_dynamicState.pDynamicStates = &m_dynamicStates[0]; 1170 pDynamicState = &m_dynamicState; 1171 1172 return *this; 1173 } 1174 1175 SamplerCreateInfo::SamplerCreateInfo (vk::VkFilter _magFilter, 1176 vk::VkFilter _minFilter, 1177 vk::VkSamplerMipmapMode _mipmapMode, 1178 vk::VkSamplerAddressMode _addressModeU, 1179 vk::VkSamplerAddressMode _addressModeV, 1180 vk::VkSamplerAddressMode _addressModeW, 1181 float _mipLodBias, 1182 vk::VkBool32 _anisotropyEnable, 1183 float _maxAnisotropy, 1184 vk::VkBool32 _compareEnable, 1185 vk::VkCompareOp _compareOp, 1186 float _minLod, 1187 float _maxLod, 1188 vk::VkBorderColor _borderColor, 1189 vk::VkBool32 _unnormalizedCoordinates) 1190 { 1191 sType = vk::VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; 1192 pNext = DE_NULL; 1193 flags = 0u; 1194 magFilter = _magFilter; 1195 minFilter = _minFilter; 1196 mipmapMode = _mipmapMode; 1197 addressModeU = _addressModeU; 1198 addressModeV = _addressModeV; 1199 addressModeW = _addressModeW; 1200 mipLodBias = _mipLodBias; 1201 anisotropyEnable = _anisotropyEnable; 1202 maxAnisotropy = _maxAnisotropy; 1203 compareEnable = _compareEnable; 1204 compareOp = _compareOp; 1205 minLod = _minLod; 1206 maxLod = _maxLod; 1207 borderColor = _borderColor; 1208 unnormalizedCoordinates = _unnormalizedCoordinates; 1209 } 1210 } // Draw 1211 } // vkt 1212