Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1 | /* |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 2 | * |
Courtney Goeltzenleuchter | 8a17da5 | 2015-10-29 13:50:34 -0600 | [diff] [blame] | 3 | * Copyright (C) 2015 Valve Corporation |
Michael Lentine | e6c6dd5 | 2015-11-03 16:20:30 -0800 | [diff] [blame] | 4 | * Copyright (C) 2015 Google, Inc. |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included |
| 14 | * in all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 | * DEALINGS IN THE SOFTWARE. |
| 23 | * |
Courtney Goeltzenleuchter | 96cd795 | 2015-10-30 11:14:30 -0600 | [diff] [blame] | 24 | * Author: Courtney Goeltzenleuchter <courtney@LunarG.com> |
| 25 | * |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | #ifndef VKRENDERFRAMEWORK_H |
| 29 | #define VKRENDERFRAMEWORK_H |
| 30 | |
Michael Lentine | e6c6dd5 | 2015-11-03 16:20:30 -0800 | [diff] [blame] | 31 | #ifdef ANDROID |
| 32 | #include "vktestframeworkandroid.h" |
| 33 | class VkImageObj; |
| 34 | #else |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 35 | #include "vktestframework.h" |
Michael Lentine | e6c6dd5 | 2015-11-03 16:20:30 -0800 | [diff] [blame] | 36 | #endif |
Courtney Goeltzenleuchter | acb1359 | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 37 | #include "vulkan/vk_ext_debug_report.h" |
David Pinedo | a31fe0b | 2015-11-24 09:00:24 -0700 | [diff] [blame] | 38 | #include "vulkan/vk_lunarg_debug_marker.h" |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 39 | |
Michael Lentine | e6c6dd5 | 2015-11-03 16:20:30 -0800 | [diff] [blame] | 40 | #include <vector> |
| 41 | |
| 42 | using namespace std; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 43 | |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 44 | class VkDeviceObj : public vk_testing::Device |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 45 | { |
| 46 | public: |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 47 | VkDeviceObj(uint32_t id, VkPhysicalDevice obj); |
Courtney Goeltzenleuchter | 61414de | 2015-07-07 11:47:33 -0600 | [diff] [blame] | 48 | VkDeviceObj(uint32_t id, VkPhysicalDevice obj, |
| 49 | std::vector<const char *> &layers, |
| 50 | std::vector<const char *> &extension_names); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 51 | |
Chia-I Wu | a263629 | 2015-07-03 10:41:20 +0800 | [diff] [blame] | 52 | VkDevice device() { return handle(); } |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 53 | void get_device_queue(); |
| 54 | |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 55 | uint32_t id; |
| 56 | VkPhysicalDeviceProperties props; |
Cody Northrop | ef72e2a | 2015-08-03 17:04:53 -0600 | [diff] [blame] | 57 | const VkQueueFamilyProperties *queue_props; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 58 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 59 | VkQueue m_queue; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 60 | }; |
| 61 | |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 62 | class VkDepthStencilObj : public vk_testing::Image |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 63 | { |
| 64 | public: |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 65 | VkDepthStencilObj(); |
Chia-I Wu | c278df8 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 66 | void Init(VkDeviceObj *device, int32_t width, int32_t height, VkFormat format); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 67 | bool Initialized(); |
Courtney Goeltzenleuchter | 1856d6f | 2015-09-01 17:30:39 -0600 | [diff] [blame] | 68 | VkImageView* BindInfo(); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 69 | |
| 70 | protected: |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 71 | VkDeviceObj *m_device; |
| 72 | bool m_initialized; |
Courtney Goeltzenleuchter | 1856d6f | 2015-09-01 17:30:39 -0600 | [diff] [blame] | 73 | vk_testing::ImageView m_imageView; |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 74 | VkFormat m_depth_stencil_fmt; |
Courtney Goeltzenleuchter | 1856d6f | 2015-09-01 17:30:39 -0600 | [diff] [blame] | 75 | VkImageView m_attachmentBindInfo; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 76 | }; |
| 77 | |
Tony Barbour | 1490c91 | 2015-07-28 10:17:20 -0600 | [diff] [blame] | 78 | class VkCommandBufferObj; |
| 79 | |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 80 | class VkRenderFramework : public VkTestFramework |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 81 | { |
| 82 | public: |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 83 | VkRenderFramework(); |
| 84 | ~VkRenderFramework(); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 85 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 86 | VkDevice device() {return m_device->device();} |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 87 | VkPhysicalDevice gpu() {return objs[0];} |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 88 | VkRenderPass renderPass() {return m_renderPass;} |
| 89 | VkFramebuffer framebuffer() {return m_framebuffer;} |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 90 | void InitViewport(float width, float height); |
| 91 | void InitViewport(); |
| 92 | void InitRenderTarget(); |
| 93 | void InitRenderTarget(uint32_t targets); |
Courtney Goeltzenleuchter | 1856d6f | 2015-09-01 17:30:39 -0600 | [diff] [blame] | 94 | void InitRenderTarget(VkImageView *dsBinding); |
| 95 | void InitRenderTarget(uint32_t targets, VkImageView *dsBinding); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 96 | void InitFramework(); |
Courtney Goeltzenleuchter | f5c6195 | 2015-07-06 09:10:47 -0600 | [diff] [blame] | 97 | void InitFramework( |
| 98 | std::vector<const char *> instance_layer_names, |
| 99 | std::vector<const char *> device_layer_names, |
| 100 | std::vector<const char *> instance_extension_names, |
| 101 | std::vector<const char *> device_extension_names, |
Courtney Goeltzenleuchter | acb1359 | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 102 | PFN_vkDebugReportCallbackEXT=NULL, |
Courtney Goeltzenleuchter | f5c6195 | 2015-07-06 09:10:47 -0600 | [diff] [blame] | 103 | void *userData=NULL); |
| 104 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 105 | void ShutdownFramework(); |
| 106 | void InitState(); |
| 107 | |
Chia-I Wu | c278df8 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 108 | const VkRenderPassBeginInfo &renderPassBeginInfo() const { return m_renderPassBeginInfo; } |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 109 | |
| 110 | protected: |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 111 | VkApplicationInfo app_info; |
| 112 | VkInstance inst; |
| 113 | VkPhysicalDevice objs[16]; |
| 114 | uint32_t gpu_count; |
| 115 | VkDeviceObj *m_device; |
Chia-I Wu | 1f85191 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 116 | VkCommandPool m_commandPool; |
| 117 | VkCommandBufferObj *m_commandBuffer; |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 118 | VkRenderPass m_renderPass; |
| 119 | VkFramebuffer m_framebuffer; |
Courtney Goeltzenleuchter | 09772bb | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 120 | std::vector<VkViewport> m_viewports; |
| 121 | std::vector<VkRect2D> m_scissors; |
| 122 | float m_lineWidth; |
Chia-I Wu | fa950c5 | 2015-10-26 19:08:09 +0800 | [diff] [blame] | 123 | float m_depthBiasConstantFactor; |
Courtney Goeltzenleuchter | 09772bb | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 124 | float m_depthBiasClamp; |
Chia-I Wu | fa950c5 | 2015-10-26 19:08:09 +0800 | [diff] [blame] | 125 | float m_depthBiasSlopeFactor; |
Chia-I Wu | 7e47070 | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 126 | float m_blendConstants[4]; |
Courtney Goeltzenleuchter | 09772bb | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 127 | float m_minDepthBounds; |
| 128 | float m_maxDepthBounds; |
Chia-I Wu | c51b121 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 129 | uint32_t m_compareMask; |
| 130 | uint32_t m_writeMask; |
| 131 | uint32_t m_reference; |
Chia-I Wu | c278df8 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 132 | std::vector<VkClearValue> m_renderPassClearValues; |
| 133 | VkRenderPassBeginInfo m_renderPassBeginInfo; |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 134 | vector<VkImageObj*> m_renderTargets; |
| 135 | float m_width, m_height; |
| 136 | VkFormat m_render_target_fmt; |
| 137 | VkFormat m_depth_stencil_fmt; |
Chris Forbes | e310597 | 2015-06-24 14:34:53 +1200 | [diff] [blame] | 138 | VkClearColorValue m_clear_color; |
Chris Forbes | 23e6db6 | 2015-06-15 09:32:35 +1200 | [diff] [blame] | 139 | bool m_clear_via_load_op; |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 140 | float m_depth_clear_color; |
| 141 | uint32_t m_stencil_clear_color; |
| 142 | VkDepthStencilObj *m_depthStencil; |
Courtney Goeltzenleuchter | 895819d | 2015-12-15 09:25:15 -0700 | [diff] [blame^] | 143 | PFN_vkCreateDebugReportCallbackEXT m_CreateDebugReportCallback; |
| 144 | PFN_vkDestroyDebugReportCallbackEXT m_DestroyDebugReportCallback; |
| 145 | PFN_vkDebugReportMessageEXT m_DebugReportMessage; |
| 146 | VkDebugReportCallbackEXT m_globalMsgCallback; |
| 147 | VkDebugReportCallbackEXT m_devMsgCallback; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 148 | |
| 149 | /* |
| 150 | * SetUp and TearDown are called by the Google Test framework |
| 151 | * to initialize a test framework based on this class. |
| 152 | */ |
| 153 | virtual void SetUp() { |
| 154 | this->app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; |
| 155 | this->app_info.pNext = NULL; |
Chia-I Wu | 1f85191 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 156 | this->app_info.pApplicationName = "base"; |
| 157 | this->app_info.applicationVersion = 1; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 158 | this->app_info.pEngineName = "unittest"; |
| 159 | this->app_info.engineVersion = 1; |
| 160 | this->app_info.apiVersion = VK_API_VERSION; |
| 161 | |
| 162 | InitFramework(); |
| 163 | } |
| 164 | |
| 165 | virtual void TearDown() { |
| 166 | ShutdownFramework(); |
| 167 | } |
| 168 | }; |
| 169 | |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 170 | class VkDescriptorSetObj; |
| 171 | class VkIndexBufferObj; |
| 172 | class VkConstantBufferObj; |
| 173 | class VkPipelineObj; |
| 174 | class VkDescriptorSetObj; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 175 | |
Chia-I Wu | 1f85191 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 176 | class VkCommandBufferObj : public vk_testing::CommandBuffer |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 177 | { |
| 178 | public: |
Chia-I Wu | 1f85191 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 179 | VkCommandBufferObj(VkDeviceObj *device, VkCommandPool pool); |
| 180 | VkCommandBuffer GetBufferHandle(); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 181 | VkResult BeginCommandBuffer(); |
Chia-I Wu | 1f85191 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 182 | VkResult BeginCommandBuffer(VkCommandBufferBeginInfo *pInfo); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 183 | VkResult EndCommandBuffer(); |
Chia-I Wu | 1f85191 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 184 | void PipelineBarrier(VkPipelineStageFlags src_stages, VkPipelineStageFlags dest_stages, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const void* const* ppMemoryBarriers); |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 185 | void AddRenderTarget(VkImageObj *renderTarget); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 186 | void AddDepthStencil(); |
Chris Forbes | e310597 | 2015-06-24 14:34:53 +1200 | [diff] [blame] | 187 | void ClearAllBuffers(VkClearColorValue clear_color, float depth_clear_color, uint32_t stencil_clear_color, VkDepthStencilObj *depthStencilObj); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 188 | void PrepareAttachments(); |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 189 | void BindPipeline(VkPipelineObj &pipeline); |
| 190 | void BindDescriptorSet(VkDescriptorSetObj &descriptorSet); |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 191 | void BindVertexBuffer(VkConstantBufferObj *vertexBuffer, VkDeviceSize offset, uint32_t binding); |
Cody Northrop | 1684adb | 2015-08-05 11:15:02 -0600 | [diff] [blame] | 192 | void BindIndexBuffer(VkIndexBufferObj *indexBuffer, VkDeviceSize offset); |
Chia-I Wu | c278df8 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 193 | void BeginRenderPass(const VkRenderPassBeginInfo &info); |
Chia-I Wu | 88eaa3b | 2015-06-26 15:34:39 +0800 | [diff] [blame] | 194 | void EndRenderPass(); |
Tony Barbour | e389b88 | 2015-07-20 13:00:10 -0600 | [diff] [blame] | 195 | void FillBuffer(VkBuffer buffer, VkDeviceSize offset, VkDeviceSize fill_size, uint32_t data); |
Courtney Goeltzenleuchter | 4ff11cc | 2015-09-23 12:31:50 -0600 | [diff] [blame] | 196 | void Draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); |
| 197 | void DrawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 198 | void QueueCommandBuffer(); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 199 | void QueueCommandBuffer(VkFence fence); |
Courtney Goeltzenleuchter | 932cdb5 | 2015-09-21 11:44:06 -0600 | [diff] [blame] | 200 | void SetViewport(uint32_t viewportCount, const VkViewport* pViewports); |
| 201 | void SetScissor(uint32_t scissorCount, const VkRect2D* pScissors); |
Courtney Goeltzenleuchter | 09772bb | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 202 | void SetLineWidth(float lineWidth); |
Chia-I Wu | fa950c5 | 2015-10-26 19:08:09 +0800 | [diff] [blame] | 203 | void SetDepthBias(float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor); |
Chia-I Wu | 7e47070 | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 204 | void SetBlendConstants(const float blendConstants[4]); |
Courtney Goeltzenleuchter | 09772bb | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 205 | void SetDepthBounds(float minDepthBounds, float maxDepthBounds); |
Chia-I Wu | c51b121 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 206 | void SetStencilReadMask(VkStencilFaceFlags faceMask, uint32_t compareMask); |
| 207 | void SetStencilWriteMask(VkStencilFaceFlags faceMask, uint32_t writeMask); |
| 208 | void SetStencilReference(VkStencilFaceFlags faceMask, uint32_t reference); |
Chia-I Wu | 1f85191 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 209 | void UpdateBuffer(VkBuffer buffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t *pData); |
| 210 | void CopyImage(VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions); |
| 211 | void ResolveImage(VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 212 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 213 | protected: |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 214 | VkDeviceObj *m_device; |
| 215 | vector<VkImageObj*> m_renderTargets; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 216 | }; |
| 217 | |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 218 | class VkConstantBufferObj : public vk_testing::Buffer |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 219 | { |
| 220 | public: |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 221 | VkConstantBufferObj(VkDeviceObj *device); |
| 222 | VkConstantBufferObj(VkDeviceObj *device, int constantCount, int constantSize, const void* data); |
| 223 | ~VkConstantBufferObj(); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 224 | void BufferMemoryBarrier( |
Chia-I Wu | 989de84 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 225 | VkFlags srcAccessMask = |
| 226 | VK_ACCESS_HOST_WRITE_BIT | |
| 227 | VK_ACCESS_SHADER_WRITE_BIT | |
| 228 | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | |
| 229 | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | |
| 230 | VK_ACCESS_TRANSFER_WRITE_BIT, |
| 231 | VkFlags dstAccessMask = |
| 232 | VK_ACCESS_HOST_READ_BIT | |
| 233 | VK_ACCESS_INDIRECT_COMMAND_READ_BIT | |
| 234 | VK_ACCESS_INDEX_READ_BIT | |
| 235 | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | |
| 236 | VK_ACCESS_UNIFORM_READ_BIT | |
| 237 | VK_ACCESS_SHADER_READ_BIT | |
| 238 | VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | |
| 239 | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | |
| 240 | VK_ACCESS_MEMORY_READ_BIT); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 241 | |
Chia-I Wu | 1f85191 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 242 | void Bind(VkCommandBuffer commandBuffer, VkDeviceSize offset, uint32_t binding); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 243 | |
Courtney Goeltzenleuchter | 34aa5c8 | 2015-10-23 13:38:14 -0600 | [diff] [blame] | 244 | VkDescriptorBufferInfo m_descriptorBufferInfo; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 245 | |
| 246 | protected: |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 247 | VkDeviceObj *m_device; |
| 248 | vk_testing::BufferView m_bufferView; |
| 249 | int m_numVertices; |
| 250 | int m_stride; |
Chia-I Wu | 1f85191 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 251 | vk_testing::CommandPool *m_commandPool; |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 252 | VkCommandBufferObj *m_commandBuffer; |
| 253 | vk_testing::Fence m_fence; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 254 | }; |
| 255 | |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 256 | class VkIndexBufferObj : public VkConstantBufferObj |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 257 | { |
| 258 | public: |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 259 | VkIndexBufferObj(VkDeviceObj *device); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 260 | void CreateAndInitBuffer(int numIndexes, VkIndexType dataFormat, const void* data); |
Chia-I Wu | 1f85191 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 261 | void Bind(VkCommandBuffer commandBuffer, VkDeviceSize offset); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 262 | VkIndexType GetIndexType(); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 263 | |
| 264 | protected: |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 265 | VkIndexType m_indexType; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 266 | }; |
| 267 | |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 268 | class VkImageObj : public vk_testing::Image |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 269 | { |
| 270 | public: |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 271 | VkImageObj(VkDeviceObj *dev); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 272 | bool IsCompatible(VkFlags usage, VkFlags features); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 273 | |
| 274 | public: |
| 275 | void init(uint32_t w, uint32_t h, |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 276 | VkFormat fmt, VkFlags usage, |
Tony Barbour | 9431056 | 2015-04-22 15:10:33 -0600 | [diff] [blame] | 277 | VkImageTiling tiling=VK_IMAGE_TILING_LINEAR, |
| 278 | VkMemoryPropertyFlags reqs=0); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 279 | |
| 280 | // void clear( CommandBuffer*, uint32_t[4] ); |
| 281 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 282 | void layout( VkImageLayout layout ) |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 283 | { |
Courtney Goeltzenleuchter | 34aa5c8 | 2015-10-23 13:38:14 -0600 | [diff] [blame] | 284 | m_descriptorImageInfo.imageLayout = layout; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 285 | } |
| 286 | |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 287 | VkDeviceMemory memory() const |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 288 | { |
Chia-I Wu | f4aed6c | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 289 | return Image::memory().handle(); |
| 290 | } |
| 291 | |
| 292 | void *MapMemory() |
| 293 | { |
| 294 | return Image::memory().map(); |
| 295 | } |
| 296 | |
| 297 | void UnmapMemory() |
| 298 | { |
| 299 | Image::memory().unmap(); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 300 | } |
| 301 | |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 302 | void ImageMemoryBarrier(VkCommandBufferObj *cmd, |
Courtney Goeltzenleuchter | ba11ebe | 2015-10-21 17:00:51 -0600 | [diff] [blame] | 303 | VkImageAspectFlags aspect, |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 304 | VkFlags output_mask, |
| 305 | VkFlags input_mask, |
| 306 | VkImageLayout image_layout); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 307 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 308 | VkResult CopyImage(VkImageObj &src_image); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 309 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 310 | VkImage image() const |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 311 | { |
Chia-I Wu | f4aed6c | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 312 | return handle(); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 313 | } |
| 314 | |
Courtney Goeltzenleuchter | 1856d6f | 2015-09-01 17:30:39 -0600 | [diff] [blame] | 315 | VkImageView targetView(VkFormat format) |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 316 | { |
| 317 | if (!m_targetView.initialized()) |
| 318 | { |
Courtney Goeltzenleuchter | 1856d6f | 2015-09-01 17:30:39 -0600 | [diff] [blame] | 319 | VkImageViewCreateInfo createView = {}; |
| 320 | createView.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; |
| 321 | createView.image = handle(); |
| 322 | createView.viewType = VK_IMAGE_VIEW_TYPE_2D; |
| 323 | createView.format = format; |
Chia-I Wu | 4291d88 | 2015-10-27 19:00:15 +0800 | [diff] [blame] | 324 | createView.components.r = VK_COMPONENT_SWIZZLE_R; |
| 325 | createView.components.g = VK_COMPONENT_SWIZZLE_G; |
| 326 | createView.components.b = VK_COMPONENT_SWIZZLE_B; |
| 327 | createView.components.a = VK_COMPONENT_SWIZZLE_A; |
Cody Northrop | 95b8bb3 | 2015-09-14 13:48:12 -0600 | [diff] [blame] | 328 | createView.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; |
Courtney Goeltzenleuchter | 1856d6f | 2015-09-01 17:30:39 -0600 | [diff] [blame] | 329 | createView.flags = 0; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 330 | m_targetView.init(*m_device, createView); |
| 331 | } |
Chia-I Wu | 76ab1ff | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 332 | return m_targetView.handle(); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 333 | } |
| 334 | |
Courtney Goeltzenleuchter | ba11ebe | 2015-10-21 17:00:51 -0600 | [diff] [blame] | 335 | void SetLayout(VkCommandBufferObj *cmd_buf, VkImageAspectFlagBits aspect, VkImageLayout image_layout); |
| 336 | void SetLayout(VkImageAspectFlagBits aspect, VkImageLayout image_layout); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 337 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 338 | VkImageLayout layout() const |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 339 | { |
Courtney Goeltzenleuchter | 34aa5c8 | 2015-10-23 13:38:14 -0600 | [diff] [blame] | 340 | return m_descriptorImageInfo.imageLayout; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 341 | } |
| 342 | uint32_t width() const |
| 343 | { |
| 344 | return extent().width; |
| 345 | } |
| 346 | uint32_t height() const |
| 347 | { |
| 348 | return extent().height; |
| 349 | } |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 350 | VkDeviceObj* device() const |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 351 | { |
| 352 | return m_device; |
| 353 | } |
| 354 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 355 | protected: |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 356 | VkDeviceObj *m_device; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 357 | |
Courtney Goeltzenleuchter | 1856d6f | 2015-09-01 17:30:39 -0600 | [diff] [blame] | 358 | vk_testing::ImageView m_targetView; |
Courtney Goeltzenleuchter | 34aa5c8 | 2015-10-23 13:38:14 -0600 | [diff] [blame] | 359 | VkDescriptorImageInfo m_descriptorImageInfo; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 360 | }; |
| 361 | |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 362 | class VkTextureObj : public VkImageObj |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 363 | { |
| 364 | public: |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 365 | VkTextureObj(VkDeviceObj *device, uint32_t *colors = NULL); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 366 | |
Courtney Goeltzenleuchter | 34aa5c8 | 2015-10-23 13:38:14 -0600 | [diff] [blame] | 367 | VkDescriptorImageInfo m_imageInfo; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 368 | |
| 369 | protected: |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 370 | VkDeviceObj *m_device; |
| 371 | vk_testing::ImageView m_textureView; |
| 372 | VkDeviceSize m_rowPitch; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 373 | }; |
| 374 | |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 375 | class VkSamplerObj : public vk_testing::Sampler |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 376 | { |
| 377 | public: |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 378 | VkSamplerObj(VkDeviceObj *device); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 379 | |
| 380 | protected: |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 381 | VkDeviceObj *m_device; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 382 | |
| 383 | }; |
| 384 | |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 385 | class VkDescriptorSetObj : public vk_testing::DescriptorPool |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 386 | { |
| 387 | public: |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 388 | VkDescriptorSetObj(VkDeviceObj *device); |
| 389 | ~VkDescriptorSetObj(); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 390 | |
| 391 | int AppendDummy(); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 392 | int AppendBuffer(VkDescriptorType type, VkConstantBufferObj &constantBuffer); |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 393 | int AppendSamplerTexture(VkSamplerObj* sampler, VkTextureObj* texture); |
Chia-I Wu | 1f85191 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 394 | void CreateVKDescriptorSet(VkCommandBufferObj *commandBuffer); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 395 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 396 | VkDescriptorSet GetDescriptorSetHandle() const; |
Mark Lobodzinski | 556f721 | 2015-04-17 14:11:39 -0500 | [diff] [blame] | 397 | VkPipelineLayout GetPipelineLayout() const; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 398 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 399 | protected: |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 400 | VkDeviceObj *m_device; |
Chia-I Wu | c51b121 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 401 | vector<VkDescriptorPoolSize> m_type_counts; |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 402 | int m_nextSlot; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 403 | |
Courtney Goeltzenleuchter | 34aa5c8 | 2015-10-23 13:38:14 -0600 | [diff] [blame] | 404 | vector<VkDescriptorImageInfo> m_imageSamplerDescriptors; |
Chia-I Wu | 8cd8ecd | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 405 | vector<VkWriteDescriptorSet> m_writes; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 406 | |
| 407 | vk_testing::DescriptorSetLayout m_layout; |
Mark Lobodzinski | 556f721 | 2015-04-17 14:11:39 -0500 | [diff] [blame] | 408 | vk_testing::PipelineLayout m_pipeline_layout; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 409 | vk_testing::DescriptorSet *m_set; |
| 410 | }; |
| 411 | |
| 412 | |
Chia-I Wu | 062ad15 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 413 | class VkShaderObj : public vk_testing::ShaderModule |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 414 | { |
| 415 | public: |
Courtney Goeltzenleuchter | 8e2f097 | 2015-10-21 17:08:06 -0600 | [diff] [blame] | 416 | VkShaderObj(VkDeviceObj *device, const char * shaderText, VkShaderStageFlagBits stage, VkRenderFramework *framework); |
Chia-I Wu | 062ad15 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 417 | VkPipelineShaderStageCreateInfo GetStageCreateInfo() const; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 418 | |
| 419 | protected: |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 420 | VkPipelineShaderStageCreateInfo stage_info; |
Courtney Goeltzenleuchter | 8e2f097 | 2015-10-21 17:08:06 -0600 | [diff] [blame] | 421 | VkShaderStageFlagBits m_stage; |
Courtney Goeltzenleuchter | ec69b9c | 2015-04-22 10:09:35 -0600 | [diff] [blame] | 422 | VkDeviceObj *m_device; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 423 | |
| 424 | }; |
| 425 | |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 426 | class VkPipelineObj : public vk_testing::Pipeline |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 427 | { |
| 428 | public: |
Tony Barbour | 0199918 | 2015-04-09 12:58:51 -0600 | [diff] [blame] | 429 | VkPipelineObj(VkDeviceObj *device); |
| 430 | void AddShader(VkShaderObj* shaderObj); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 431 | void AddVertexInputAttribs(VkVertexInputAttributeDescription* vi_attrib, int count); |
| 432 | void AddVertexInputBindings(VkVertexInputBindingDescription* vi_binding, int count); |
Tony Barbour | e307f58 | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 433 | void AddColorAttachment(uint32_t binding, const VkPipelineColorBlendAttachmentState *att); |
Courtney Goeltzenleuchter | 2f5deb5 | 2015-09-30 16:16:57 -0600 | [diff] [blame] | 434 | void MakeDynamic(VkDynamicState state); |
Chia-I Wu | c278df8 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 435 | |
| 436 | void AddColorAttachment() |
| 437 | { |
Tony Barbour | e307f58 | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 438 | VkPipelineColorBlendAttachmentState att = {}; |
Chia-I Wu | c278df8 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 439 | att.blendEnable = VK_FALSE; |
Chia-I Wu | c51b121 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 440 | att.colorWriteMask = 0xf; |
Chia-I Wu | c278df8 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 441 | AddColorAttachment(0, &att); |
| 442 | } |
| 443 | |
Tony Barbour | e307f58 | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 444 | void SetDepthStencil(VkPipelineDepthStencilStateCreateInfo *); |
Tony Barbour | 875e746 | 2015-08-06 09:27:11 -0600 | [diff] [blame] | 445 | void SetMSAA(VkPipelineMultisampleStateCreateInfo *ms_state); |
Tobin Ehlis | a88e2f5 | 2015-10-02 11:00:56 -0600 | [diff] [blame] | 446 | void SetViewport(vector<VkViewport> viewports); |
| 447 | void SetScissor(vector<VkRect2D> scissors); |
Tony Barbour | ed13243 | 2015-08-04 16:23:11 -0600 | [diff] [blame] | 448 | VkResult CreateVKPipeline(VkPipelineLayout layout, VkRenderPass render_pass); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 449 | |
| 450 | protected: |
Tony Barbour | e307f58 | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 451 | VkPipelineVertexInputStateCreateInfo m_vi_state; |
| 452 | VkPipelineInputAssemblyStateCreateInfo m_ia_state; |
Chia-I Wu | 1f85191 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 453 | VkPipelineRasterizationStateCreateInfo m_rs_state; |
Tony Barbour | e307f58 | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 454 | VkPipelineColorBlendStateCreateInfo m_cb_state; |
| 455 | VkPipelineDepthStencilStateCreateInfo m_ds_state; |
| 456 | VkPipelineViewportStateCreateInfo m_vp_state; |
| 457 | VkPipelineMultisampleStateCreateInfo m_ms_state; |
Courtney Goeltzenleuchter | 2f5deb5 | 2015-09-30 16:16:57 -0600 | [diff] [blame] | 458 | vector<VkDynamicState> m_dynamic_state_enables; |
| 459 | vector<VkViewport> m_viewports; |
| 460 | vector<VkRect2D> m_scissors; |
Tony Barbour | e307f58 | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 461 | VkDeviceObj *m_device; |
| 462 | vector<VkShaderObj*> m_shaderObjs; |
Tony Barbour | e307f58 | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 463 | vector<int> m_vertexBufferBindings; |
| 464 | vector<VkPipelineColorBlendAttachmentState> m_colorAttachments; |
| 465 | int m_vertexBufferCount; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 466 | }; |
| 467 | |
| 468 | #endif // VKRENDERFRAMEWORK_H |