| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 1 | /* | 
 | 2 |  * XGL Tests | 
 | 3 |  * | 
 | 4 |  * Copyright (C) 2014 LunarG, Inc. | 
 | 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 |  * | 
 | 24 |  * Authors: | 
 | 25 |  *   Courtney Goeltzenleuchter <courtney@lunarg.com> | 
 | 26 |  */ | 
 | 27 |  | 
 | 28 | #ifndef XGLRENDERFRAMEWORK_H | 
 | 29 | #define XGLRENDERFRAMEWORK_H | 
 | 30 |  | 
 | 31 | #include "xgltestframework.h" | 
 | 32 |  | 
 | 33 | class XglRenderFramework : public XglTestFramework | 
 | 34 | { | 
 | 35 | public: | 
 | 36 |     XglRenderFramework(); | 
 | 37 |     ~XglRenderFramework(); | 
 | 38 |  | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 39 |     XGL_DEVICE device() {return m_device->device();} | 
| Tobin Ehlis | ca91587 | 2014-11-18 11:28:33 -0700 | [diff] [blame] | 40 |     XGL_PHYSICAL_GPU gpu() {return objs[0];} | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 41 |     void InitViewport(float width, float height); | 
| Courtney Goeltzenleuchter | 02d33c1 | 2014-10-08 14:26:40 -0600 | [diff] [blame] | 42 |     void InitViewport(); | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 43 |     void InitRenderTarget(); | 
 | 44 |     void InitFramework(); | 
| Courtney Goeltzenleuchter | 53d8d89 | 2014-10-08 12:20:26 -0600 | [diff] [blame] | 45 |     void ShutdownFramework(); | 
 | 46 |     void InitState(); | 
| Courtney Goeltzenleuchter | 02d33c1 | 2014-10-08 14:26:40 -0600 | [diff] [blame] | 47 |     void GenerateClearAndPrepareBufferCmds(); | 
 | 48 |     void GenerateBindRenderTargetCmd(); | 
| Tony Barbour | e2c58df | 2014-11-25 13:18:32 -0700 | [diff] [blame] | 49 |     void GenerateBindStateAndPipelineCmds(); | 
 | 50 |  | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 51 |  | 
 | 52 | protected: | 
 | 53 |     XGL_APPLICATION_INFO            app_info; | 
| Chia-I Wu | af11d92 | 2014-12-28 14:37:25 +0800 | [diff] [blame] | 54 |     XGL_PHYSICAL_GPU                objs[XGL_MAX_PHYSICAL_GPUS]; | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 55 |     XGL_UINT                        gpu_count; | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 56 |     XglDevice                      *m_device; | 
 | 57 |     XGL_CMD_BUFFER                  m_cmdBuffer; | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 58 |     XGL_MEMORY_REF                  m_memRefs[5]; | 
 | 59 |     XGL_RASTER_STATE_OBJECT         m_stateRaster; | 
 | 60 |     XGL_COLOR_BLEND_STATE_OBJECT    m_colorBlend; | 
 | 61 |     XGL_VIEWPORT_STATE_OBJECT       m_stateViewport; | 
 | 62 |     XGL_DEPTH_STENCIL_STATE_OBJECT  m_stateDepthStencil; | 
 | 63 |     XGL_MSAA_STATE_OBJECT           m_stateMsaa; | 
| Chia-I Wu | ecebf75 | 2014-12-05 10:45:15 +0800 | [diff] [blame] | 64 |     XglImage                       *m_renderTargets[XGL_MAX_COLOR_ATTACHMENTS]; | 
 | 65 |     XGL_UINT                        m_renderTargetCount; | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 66 |     XGL_FLOAT                       m_width, m_height; | 
 | 67 |     XGL_FORMAT                      m_render_target_fmt; | 
| Chia-I Wu | ecebf75 | 2014-12-05 10:45:15 +0800 | [diff] [blame] | 68 |     XGL_COLOR_ATTACHMENT_BIND_INFO  m_colorBindings[XGL_MAX_COLOR_ATTACHMENTS]; | 
| Courtney Goeltzenleuchter | 32e486c | 2014-10-22 14:12:38 -0600 | [diff] [blame] | 69 |     XGL_DEPTH_STENCIL_BIND_INFO     m_depthStencilBinding; | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 70 |  | 
 | 71 |     /* | 
 | 72 |      * SetUp and TearDown are called by the Google Test framework | 
 | 73 |      * to initialize a test framework based on this class. | 
 | 74 |      */ | 
 | 75 |     virtual void SetUp() { | 
 | 76 |         XGL_RESULT err; | 
 | 77 |  | 
 | 78 |         this->app_info.sType = XGL_STRUCTURE_TYPE_APPLICATION_INFO; | 
 | 79 |         this->app_info.pNext = NULL; | 
| Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 80 |         this->app_info.pAppName = "base"; | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 81 |         this->app_info.appVersion = 1; | 
| Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 82 |         this->app_info.pEngineName = "unittest"; | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 83 |         this->app_info.engineVersion = 1; | 
 | 84 |         this->app_info.apiVersion = XGL_MAKE_VERSION(0, 22, 0); | 
 | 85 |  | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 86 |         err = xglInitAndEnumerateGpus(&app_info, NULL, | 
| Chia-I Wu | af11d92 | 2014-12-28 14:37:25 +0800 | [diff] [blame] | 87 |                                       XGL_MAX_PHYSICAL_GPUS, &this->gpu_count, objs); | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 88 |         ASSERT_XGL_SUCCESS(err); | 
| Jon Ashburn | bf843b2 | 2014-11-26 11:06:49 -0700 | [diff] [blame] | 89 |         ASSERT_GE(this->gpu_count, 1) << "No GPU available"; | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 90 |  | 
 | 91 |         m_device = new XglDevice(0, objs[0]); | 
 | 92 |         m_device->get_device_queue(); | 
 | 93 |     } | 
 | 94 |  | 
 | 95 |     virtual void TearDown() { | 
 | 96 |         xglInitAndEnumerateGpus(&this->app_info, XGL_NULL_HANDLE, 0, &gpu_count, XGL_NULL_HANDLE); | 
 | 97 |     } | 
 | 98 | }; | 
 | 99 |  | 
| Tony Barbour | 30cc9e8 | 2014-12-17 11:53:55 -0700 | [diff] [blame] | 100 | class XglIndexBufferObj; | 
 | 101 | class XglConstantBufferObj; | 
 | 102 |  | 
| Chia-I Wu | d28343c | 2014-12-28 15:12:48 +0800 | [diff] [blame] | 103 | class XglCommandBufferObj : xgl_testing::CmdBuffer | 
| Tony Barbour | 6d047bf | 2014-12-10 14:34:45 -0700 | [diff] [blame] | 104 | { | 
 | 105 | public: | 
 | 106 |     XglCommandBufferObj(XglDevice *device); | 
| Tony Barbour | 471338d | 2014-12-10 17:28:39 -0700 | [diff] [blame] | 107 |     XGL_CMD_BUFFER GetBufferHandle(); | 
 | 108 |     XGL_RESULT BeginCommandBuffer(XGL_FLAGS flags); | 
 | 109 |     XGL_RESULT EndCommandBuffer(); | 
 | 110 |     void PrepareMemoryRegions(int transitionCount, XGL_MEMORY_STATE_TRANSITION *transitionPtr); | 
| Tony Barbour | 30cc9e8 | 2014-12-17 11:53:55 -0700 | [diff] [blame] | 111 |     void AddRenderTarget(XglImage *renderTarget); | 
 | 112 |     void AddDepthStencil(); | 
 | 113 |     void ClearAllBuffers(); | 
 | 114 |     void ClearAllBuffers(XGL_DEPTH_STENCIL_BIND_INFO *depthStencilBinding, XGL_IMAGE depthStencilImage); | 
 | 115 |     void BindAttachments(XGL_DEPTH_STENCIL_BIND_INFO *depthStencilBinding); | 
 | 116 |     void BindAttachments(); | 
 | 117 |     void BindPipeline(XGL_PIPELINE pipeline); | 
 | 118 |     void BindDescriptorSet(XGL_DESCRIPTOR_SET descriptorSet); | 
 | 119 |     void BindVertexBuffer(XglConstantBufferObj *vertexBuffer, XGL_UINT offset, XGL_UINT binding); | 
 | 120 |     void BindIndexBuffer(XglIndexBufferObj *indexBuffer, XGL_UINT offset); | 
 | 121 |     void BindState(XGL_RASTER_STATE_OBJECT stateRaster, XGL_VIEWPORT_STATE_OBJECT stateViewport, | 
 | 122 |                    XGL_COLOR_BLEND_STATE_OBJECT colorBlend, XGL_DEPTH_STENCIL_STATE_OBJECT stateDepthStencil, | 
 | 123 |                    XGL_MSAA_STATE_OBJECT stateMsaa); | 
 | 124 |     void Draw(XGL_UINT firstVertex, XGL_UINT vertexCount, XGL_UINT firstInstance, XGL_UINT instanceCount); | 
 | 125 |     void DrawIndexed(XGL_UINT firstIndex, XGL_UINT indexCount, XGL_INT vertexOffset, XGL_UINT firstInstance, XGL_UINT instanceCount); | 
 | 126 |     void QueueCommandBuffer(XGL_MEMORY_REF *memRefs, XGL_UINT32 numMemRefs); | 
| Tony Barbour | 6d047bf | 2014-12-10 14:34:45 -0700 | [diff] [blame] | 127 |  | 
 | 128 | protected: | 
 | 129 |     XglDevice                      *m_device; | 
| Tony Barbour | 30cc9e8 | 2014-12-17 11:53:55 -0700 | [diff] [blame] | 130 |     vector<XglImage*>               m_renderTargets; | 
 | 131 |     XGL_UINT                        m_renderTargetCount; | 
| Tony Barbour | 6d047bf | 2014-12-10 14:34:45 -0700 | [diff] [blame] | 132 |  | 
 | 133 | }; | 
 | 134 |  | 
| Tony Barbour | ac3692c | 2014-11-20 15:06:56 -0700 | [diff] [blame] | 135 | class XglConstantBufferObj | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 136 | { | 
 | 137 | public: | 
| Courtney Goeltzenleuchter | 3b0a815 | 2014-12-04 15:18:47 -0700 | [diff] [blame] | 138 |     XglConstantBufferObj(XglDevice *device); | 
| Tony Barbour | ac3692c | 2014-11-20 15:06:56 -0700 | [diff] [blame] | 139 |     XglConstantBufferObj(XglDevice *device, int constantCount, int constantSize, const void* data); | 
| Tony Barbour | 07e80dc | 2014-12-03 16:23:43 -0700 | [diff] [blame] | 140 |     ~XglConstantBufferObj(); | 
| Tony Barbour | 099a9eb | 2014-12-10 17:40:15 -0700 | [diff] [blame] | 141 |     void SetMemoryState(XGL_MEMORY_STATE newState); | 
| Courtney Goeltzenleuchter | 3764030 | 2014-12-04 15:26:56 -0700 | [diff] [blame] | 142 |     void Bind(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_SIZE offset, XGL_UINT binding); | 
| Tony Barbour | ac3692c | 2014-11-20 15:06:56 -0700 | [diff] [blame] | 143 |     XGL_MEMORY_VIEW_ATTACH_INFO     m_constantBufferView; | 
 | 144 |     XGL_GPU_MEMORY                  m_constantBufferMem; | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 145 |  | 
 | 146 | protected: | 
| Tony Barbour | ac3692c | 2014-11-20 15:06:56 -0700 | [diff] [blame] | 147 |     XglDevice                      *m_device; | 
 | 148 |     int                             m_numVertices; | 
 | 149 |     int                             m_stride; | 
| Tony Barbour | 3842280 | 2014-12-10 14:36:31 -0700 | [diff] [blame] | 150 |     XglCommandBufferObj             *m_commandBuffer; | 
 | 151 |     XGL_FENCE                       m_fence; | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 152 | }; | 
| Courtney Goeltzenleuchter | 8a78593 | 2014-12-04 15:24:05 -0700 | [diff] [blame] | 153 |  | 
 | 154 | class XglIndexBufferObj : public XglConstantBufferObj | 
 | 155 | { | 
 | 156 | public: | 
 | 157 |     XglIndexBufferObj(XglDevice *device); | 
 | 158 |     void CreateAndInitBuffer(int numIndexes, XGL_INDEX_TYPE dataFormat, const void* data); | 
 | 159 |     void Bind(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_SIZE offset); | 
| Tony Barbour | af1f919 | 2014-12-17 10:57:58 -0700 | [diff] [blame] | 160 |     XGL_INDEX_TYPE GetIndexType(); | 
| Courtney Goeltzenleuchter | 8a78593 | 2014-12-04 15:24:05 -0700 | [diff] [blame] | 161 |  | 
 | 162 | protected: | 
 | 163 |     XGL_INDEX_TYPE  m_indexType; | 
 | 164 | }; | 
 | 165 |  | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 166 | class XglTextureObj | 
 | 167 | { | 
 | 168 | public: | 
 | 169 |     XglTextureObj(XglDevice *device); | 
| Tony Barbour | f325bf1 | 2014-12-03 15:59:38 -0700 | [diff] [blame] | 170 |     ~XglTextureObj(); | 
| Tony Barbour | d1b1bd1 | 2014-11-21 17:17:49 -0700 | [diff] [blame] | 171 |     void ChangeColors(uint32_t color1, uint32_t color2); | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 172 |     XGL_IMAGE                  m_texture; | 
 | 173 |     XGL_IMAGE_VIEW_ATTACH_INFO m_textureViewInfo; | 
 | 174 |     XGL_GPU_MEMORY             m_textureMem; | 
 | 175 |  | 
 | 176 | protected: | 
 | 177 |     XglDevice                 *m_device; | 
 | 178 |     XGL_IMAGE_VIEW             m_textureView; | 
| Tony Barbour | d1b1bd1 | 2014-11-21 17:17:49 -0700 | [diff] [blame] | 179 |     int                        m_texHeight; | 
 | 180 |     int                        m_texWidth; | 
 | 181 |     int                        m_rowPitch; | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 182 |  | 
 | 183 | }; | 
 | 184 |  | 
 | 185 | class XglSamplerObj | 
 | 186 | { | 
 | 187 | public: | 
 | 188 |     XglSamplerObj(XglDevice *device); | 
| Tony Barbour | f325bf1 | 2014-12-03 15:59:38 -0700 | [diff] [blame] | 189 |     ~XglSamplerObj(); | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 190 |     XGL_SAMPLER m_sampler; | 
 | 191 |  | 
 | 192 | protected: | 
 | 193 |      XGL_SAMPLER_CREATE_INFO m_samplerCreateInfo; | 
 | 194 |      XglDevice *m_device; | 
 | 195 |  | 
 | 196 | }; | 
 | 197 |  | 
| Tony Barbour | ac3692c | 2014-11-20 15:06:56 -0700 | [diff] [blame] | 198 | class XglDescriptorSetObj | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 199 | { | 
 | 200 | public: | 
| Tony Barbour | ac3692c | 2014-11-20 15:06:56 -0700 | [diff] [blame] | 201 |     XglDescriptorSetObj(XglDevice *device); | 
| Tony Barbour | 25ef8a6 | 2014-12-03 13:59:18 -0700 | [diff] [blame] | 202 |     ~XglDescriptorSetObj(); | 
| Tony Barbour | ac3692c | 2014-11-20 15:06:56 -0700 | [diff] [blame] | 203 |     void AttachMemoryView(XglConstantBufferObj* constantBuffer); | 
 | 204 |     void AttachSampler( XglSamplerObj* sampler); | 
 | 205 |     void AttachImageView( XglTextureObj* texture); | 
 | 206 |     void BindCommandBuffer(XGL_CMD_BUFFER commandBuffer); | 
| Tony Barbour | b5f4d08 | 2014-12-17 10:54:03 -0700 | [diff] [blame] | 207 |     void CreateXGLDescriptorSet(); | 
 | 208 |     XGL_DESCRIPTOR_SET GetDescriptorSetHandle(); | 
| Tony Barbour | 824b771 | 2014-12-18 17:06:21 -0700 | [diff] [blame] | 209 |     int GetTotalSlots(); | 
| Tony Barbour | ac3692c | 2014-11-20 15:06:56 -0700 | [diff] [blame] | 210 |     XGL_DESCRIPTOR_SLOT_INFO * GetSlotInfo(vector<int>slots, vector<XGL_DESCRIPTOR_SET_SLOT_TYPE>types, vector<XGL_OBJECT>objs ); | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 211 |  | 
 | 212 | protected: | 
| Tony Barbour | ac3692c | 2014-11-20 15:06:56 -0700 | [diff] [blame] | 213 |     XGL_DESCRIPTOR_SET_CREATE_INFO       m_descriptorInfo; | 
 | 214 |     XGL_DESCRIPTOR_SET                   m_rsrcDescSet; | 
 | 215 |     XGL_GPU_MEMORY                       m_descriptor_set_mem; | 
 | 216 |     XglDevice                           *m_device; | 
 | 217 |     XGL_DESCRIPTOR_SLOT_INFO            *m_slotInfo; | 
 | 218 |     int                                  m_nextSlot; | 
 | 219 |     vector<int>                          m_memorySlots; | 
 | 220 |     vector<XGL_MEMORY_VIEW_ATTACH_INFO*> m_memoryViews; | 
 | 221 |     vector<int>                          m_samplerSlots; | 
 | 222 |     vector<XGL_SAMPLER*>                 m_samplers; | 
 | 223 |     vector<int>                          m_imageSlots; | 
 | 224 |     vector<XGL_IMAGE_VIEW_ATTACH_INFO*>  m_imageViews; | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 225 | }; | 
| Tony Barbour | ac3692c | 2014-11-20 15:06:56 -0700 | [diff] [blame] | 226 |  | 
 | 227 |  | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 228 | class XglShaderObj | 
 | 229 | { | 
 | 230 | public: | 
| Tony Barbour | e2c58df | 2014-11-25 13:18:32 -0700 | [diff] [blame] | 231 |     XglShaderObj(XglDevice *device, const char * shaderText, XGL_PIPELINE_SHADER_STAGE stage, XglRenderFramework *framework); | 
| Tony Barbour | f325bf1 | 2014-12-03 15:59:38 -0700 | [diff] [blame] | 232 |     ~XglShaderObj(); | 
| Tony Barbour | 5420af0 | 2014-12-03 13:58:15 -0700 | [diff] [blame] | 233 |     XGL_PIPELINE_SHADER_STAGE_CREATE_INFO* GetStageCreateInfo(XglDescriptorSetObj *descriptorSet); | 
| Tony Barbour | ac3692c | 2014-11-20 15:06:56 -0700 | [diff] [blame] | 234 |     void BindShaderEntitySlotToMemory(int slot, XGL_DESCRIPTOR_SET_SLOT_TYPE type, XglConstantBufferObj *constantBuffer); | 
 | 235 |     void BindShaderEntitySlotToImage(int slot, XGL_DESCRIPTOR_SET_SLOT_TYPE type, XglTextureObj *texture); | 
 | 236 |     void BindShaderEntitySlotToSampler(int slot, XglSamplerObj *sampler); | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 237 |  | 
 | 238 | protected: | 
 | 239 |     XGL_PIPELINE_SHADER_STAGE_CREATE_INFO stage_info; | 
 | 240 |     XGL_SHADER m_shader; | 
 | 241 |     XGL_PIPELINE_SHADER_STAGE m_stage; | 
 | 242 |     XglDevice *m_device; | 
 | 243 |     vector<int>    m_memSlots; | 
 | 244 |     vector<XGL_DESCRIPTOR_SET_SLOT_TYPE> m_memTypes; | 
 | 245 |     vector<XGL_OBJECT> m_memObjs; | 
 | 246 |     vector<int>    m_samplerSlots; | 
 | 247 |     vector<XGL_DESCRIPTOR_SET_SLOT_TYPE> m_samplerTypes; | 
 | 248 |     vector<XGL_OBJECT> m_samplerObjs; | 
 | 249 |     vector<int>    m_imageSlots; | 
 | 250 |     vector<XGL_DESCRIPTOR_SET_SLOT_TYPE> m_imageTypes; | 
 | 251 |     vector<XGL_OBJECT> m_imageObjs; | 
 | 252 |  | 
 | 253 | }; | 
 | 254 |  | 
 | 255 | class XglPipelineObj | 
 | 256 | { | 
 | 257 | public: | 
 | 258 |     XglPipelineObj(XglDevice *device); | 
| Tony Barbour | f325bf1 | 2014-12-03 15:59:38 -0700 | [diff] [blame] | 259 |     ~XglPipelineObj(); | 
| Tony Barbour | 5420af0 | 2014-12-03 13:58:15 -0700 | [diff] [blame] | 260 |     void BindPipelineCommandBuffer(XGL_CMD_BUFFER m_cmdBuffer, XglDescriptorSetObj *descriptorSet); | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 261 |     void AddShader(XglShaderObj* shaderObj); | 
 | 262 |     void AddVertexInputAttribs(XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION* vi_attrib, int count); | 
 | 263 |     void AddVertexInputBindings(XGL_VERTEX_INPUT_BINDING_DESCRIPTION* vi_binding, int count); | 
 | 264 |     void AddVertexDataBuffer(XglConstantBufferObj* vertexDataBuffer, int binding); | 
| Chia-I Wu | ecebf75 | 2014-12-05 10:45:15 +0800 | [diff] [blame] | 265 |     void SetColorAttachment(XGL_UINT binding, const XGL_PIPELINE_CB_ATTACHMENT_STATE *att); | 
| Tony Barbour | 976e1cf | 2014-12-17 11:57:31 -0700 | [diff] [blame] | 266 |     void CreateXGLPipeline(XglDescriptorSetObj *descriptorSet); | 
 | 267 |     XGL_PIPELINE GetPipelineHandle(); | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 268 |  | 
 | 269 | protected: | 
 | 270 |     XGL_PIPELINE m_pipeline; | 
 | 271 |     XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO m_vi_state; | 
 | 272 |     XGL_PIPELINE_IA_STATE_CREATE_INFO m_ia_state; | 
 | 273 |     XGL_PIPELINE_RS_STATE_CREATE_INFO m_rs_state; | 
 | 274 |     XGL_PIPELINE_CB_STATE m_cb_state; | 
 | 275 |     XGL_PIPELINE_DB_STATE_CREATE_INFO m_db_state; | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 276 |     XGL_GPU_MEMORY m_pipe_mem; | 
 | 277 |     XglDevice *m_device; | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 278 |     vector<XglShaderObj*> m_shaderObjs; | 
 | 279 |     vector<XglConstantBufferObj*> m_vertexBufferObjs; | 
 | 280 |     vector<int> m_vertexBufferBindings; | 
 | 281 |     int m_vertexBufferCount; | 
 | 282 |  | 
 | 283 | }; | 
 | 284 | class XglMemoryRefManager{ | 
 | 285 | public: | 
 | 286 |     XglMemoryRefManager(); | 
| Tony Barbour | ac3692c | 2014-11-20 15:06:56 -0700 | [diff] [blame] | 287 |     void AddMemoryRef(XglConstantBufferObj* constantBuffer); | 
 | 288 |     void AddMemoryRef(XglTextureObj *texture); | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 289 |     XGL_MEMORY_REF* GetMemoryRefList(); | 
 | 290 |     int GetNumRefs(); | 
 | 291 |  | 
 | 292 | protected: | 
 | 293 |     int m_numRefs; | 
| Chia-I Wu | 283d7a6 | 2014-12-28 15:43:42 +0800 | [diff] [blame^] | 294 |     vector<XGL_GPU_MEMORY> m_bufferObjs; | 
| Tony Barbour | 9d951a0 | 2014-11-19 16:33:11 -0700 | [diff] [blame] | 295 |  | 
 | 296 | }; | 
 | 297 |  | 
 | 298 |  | 
| Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 299 | #endif // XGLRENDERFRAMEWORK_H |