Chia-I Wu | b275556 | 2014-08-20 13:38:52 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * XGL |
| 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 | |
| 25 | #include "dset.h" |
| 26 | #include "mem.h" |
| 27 | #include "state.h" |
| 28 | #include "view.h" |
| 29 | #include "cmd_priv.h" |
| 30 | |
| 31 | XGL_VOID XGLAPI intelCmdBindPipeline( |
| 32 | XGL_CMD_BUFFER cmdBuffer, |
| 33 | XGL_PIPELINE_BIND_POINT pipelineBindPoint, |
| 34 | XGL_PIPELINE pipeline) |
| 35 | { |
| 36 | struct intel_cmd *cmd = intel_cmd(cmdBuffer); |
| 37 | |
| 38 | switch (pipelineBindPoint) { |
| 39 | case XGL_PIPELINE_BIND_POINT_COMPUTE: |
| 40 | cmd->bind.pipeline.compute = pipeline; |
| 41 | break; |
| 42 | case XGL_PIPELINE_BIND_POINT_GRAPHICS: |
| 43 | cmd->bind.pipeline.graphics = pipeline; |
| 44 | break; |
| 45 | default: |
| 46 | break; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | XGL_VOID XGLAPI intelCmdBindPipelineDelta( |
| 51 | XGL_CMD_BUFFER cmdBuffer, |
| 52 | XGL_PIPELINE_BIND_POINT pipelineBindPoint, |
| 53 | XGL_PIPELINE_DELTA delta) |
| 54 | { |
| 55 | struct intel_cmd *cmd = intel_cmd(cmdBuffer); |
| 56 | |
| 57 | switch (pipelineBindPoint) { |
| 58 | case XGL_PIPELINE_BIND_POINT_COMPUTE: |
| 59 | cmd->bind.pipeline.compute_delta = delta; |
| 60 | break; |
| 61 | case XGL_PIPELINE_BIND_POINT_GRAPHICS: |
| 62 | cmd->bind.pipeline.graphics_delta = delta; |
| 63 | break; |
| 64 | default: |
| 65 | break; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | XGL_VOID XGLAPI intelCmdBindStateObject( |
| 70 | XGL_CMD_BUFFER cmdBuffer, |
| 71 | XGL_STATE_BIND_POINT stateBindPoint, |
| 72 | XGL_STATE_OBJECT state) |
| 73 | { |
| 74 | struct intel_cmd *cmd = intel_cmd(cmdBuffer); |
| 75 | |
| 76 | switch (stateBindPoint) { |
| 77 | case XGL_STATE_BIND_VIEWPORT: |
| 78 | cmd->bind.state.viewport = |
| 79 | intel_viewport_state((XGL_VIEWPORT_STATE_OBJECT) state); |
| 80 | break; |
| 81 | case XGL_STATE_BIND_RASTER: |
| 82 | cmd->bind.state.raster = |
| 83 | intel_raster_state((XGL_RASTER_STATE_OBJECT) state); |
| 84 | break; |
| 85 | case XGL_STATE_BIND_DEPTH_STENCIL: |
| 86 | cmd->bind.state.ds = |
| 87 | intel_ds_state((XGL_DEPTH_STENCIL_STATE_OBJECT) state); |
| 88 | break; |
| 89 | case XGL_STATE_BIND_COLOR_BLEND: |
| 90 | cmd->bind.state.blend = |
| 91 | intel_blend_state((XGL_COLOR_BLEND_STATE_OBJECT) state); |
| 92 | break; |
| 93 | case XGL_STATE_BIND_MSAA: |
| 94 | cmd->bind.state.msaa = |
| 95 | intel_msaa_state((XGL_MSAA_STATE_OBJECT) state); |
| 96 | break; |
| 97 | default: |
| 98 | break; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | XGL_VOID XGLAPI intelCmdBindDescriptorSet( |
| 103 | XGL_CMD_BUFFER cmdBuffer, |
| 104 | XGL_PIPELINE_BIND_POINT pipelineBindPoint, |
| 105 | XGL_UINT index, |
| 106 | XGL_DESCRIPTOR_SET descriptorSet, |
| 107 | XGL_UINT slotOffset) |
| 108 | { |
| 109 | struct intel_cmd *cmd = intel_cmd(cmdBuffer); |
| 110 | struct intel_dset *dset = intel_dset(descriptorSet); |
| 111 | |
| 112 | assert(!index); |
| 113 | |
| 114 | switch (pipelineBindPoint) { |
| 115 | case XGL_PIPELINE_BIND_POINT_COMPUTE: |
| 116 | cmd->bind.dset.compute = dset; |
| 117 | cmd->bind.dset.compute_offset = slotOffset; |
| 118 | break; |
| 119 | case XGL_PIPELINE_BIND_POINT_GRAPHICS: |
| 120 | cmd->bind.dset.graphics = dset; |
| 121 | cmd->bind.dset.graphics_offset = slotOffset; |
| 122 | break; |
| 123 | default: |
| 124 | break; |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | XGL_VOID XGLAPI intelCmdBindDynamicMemoryView( |
| 129 | XGL_CMD_BUFFER cmdBuffer, |
| 130 | XGL_PIPELINE_BIND_POINT pipelineBindPoint, |
| 131 | const XGL_MEMORY_VIEW_ATTACH_INFO* pMemView) |
| 132 | { |
| 133 | struct intel_cmd *cmd = intel_cmd(cmdBuffer); |
| 134 | |
| 135 | switch (pipelineBindPoint) { |
| 136 | case XGL_PIPELINE_BIND_POINT_COMPUTE: |
| 137 | intel_mem_view_init(&cmd->bind.mem_view.compute, cmd->dev, pMemView); |
| 138 | break; |
| 139 | case XGL_PIPELINE_BIND_POINT_GRAPHICS: |
| 140 | intel_mem_view_init(&cmd->bind.mem_view.graphics, cmd->dev, pMemView); |
| 141 | break; |
| 142 | default: |
| 143 | break; |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | XGL_VOID XGLAPI intelCmdBindIndexData( |
| 148 | XGL_CMD_BUFFER cmdBuffer, |
| 149 | XGL_GPU_MEMORY mem_, |
| 150 | XGL_GPU_SIZE offset, |
| 151 | XGL_INDEX_TYPE indexType) |
| 152 | { |
| 153 | struct intel_cmd *cmd = intel_cmd(cmdBuffer); |
| 154 | struct intel_mem *mem = intel_mem(mem_); |
| 155 | |
| 156 | cmd->bind.index.mem = mem; |
| 157 | cmd->bind.index.offset = offset; |
| 158 | cmd->bind.index.type = indexType; |
| 159 | } |
| 160 | |
| 161 | XGL_VOID XGLAPI intelCmdBindAttachments( |
| 162 | XGL_CMD_BUFFER cmdBuffer, |
| 163 | XGL_UINT colorAttachmentCount, |
| 164 | const XGL_COLOR_ATTACHMENT_BIND_INFO* pColorAttachments, |
| 165 | const XGL_DEPTH_STENCIL_BIND_INFO* pDepthStencilAttachment) |
| 166 | { |
| 167 | struct intel_cmd *cmd = intel_cmd(cmdBuffer); |
| 168 | XGL_UINT i; |
| 169 | |
| 170 | for (i = 0; i < colorAttachmentCount; i++) { |
| 171 | const XGL_COLOR_ATTACHMENT_BIND_INFO *att = &pColorAttachments[i]; |
| 172 | struct intel_rt_view *rt = intel_rt_view(att->view); |
| 173 | |
| 174 | cmd->bind.att.rt[i] = rt; |
| 175 | } |
| 176 | |
| 177 | cmd->bind.att.rt_count = colorAttachmentCount; |
| 178 | |
| 179 | if (pDepthStencilAttachment) { |
| 180 | struct intel_ds_view *ds = intel_ds_view(pDepthStencilAttachment->view); |
| 181 | cmd->bind.att.ds = ds; |
| 182 | } else { |
| 183 | cmd->bind.att.ds = NULL; |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | XGL_VOID XGLAPI intelCmdDraw( |
| 188 | XGL_CMD_BUFFER cmdBuffer, |
| 189 | XGL_UINT firstVertex, |
| 190 | XGL_UINT vertexCount, |
| 191 | XGL_UINT firstInstance, |
| 192 | XGL_UINT instanceCount) |
| 193 | { |
| 194 | } |
| 195 | |
| 196 | XGL_VOID XGLAPI intelCmdDrawIndexed( |
| 197 | XGL_CMD_BUFFER cmdBuffer, |
| 198 | XGL_UINT firstIndex, |
| 199 | XGL_UINT indexCount, |
| 200 | XGL_INT vertexOffset, |
| 201 | XGL_UINT firstInstance, |
| 202 | XGL_UINT instanceCount) |
| 203 | { |
| 204 | } |
| 205 | |
| 206 | XGL_VOID XGLAPI intelCmdDrawIndirect( |
| 207 | XGL_CMD_BUFFER cmdBuffer, |
| 208 | XGL_GPU_MEMORY mem, |
| 209 | XGL_GPU_SIZE offset, |
| 210 | XGL_UINT32 count, |
| 211 | XGL_UINT32 stride) |
| 212 | { |
| 213 | } |
| 214 | |
| 215 | XGL_VOID XGLAPI intelCmdDrawIndexedIndirect( |
| 216 | XGL_CMD_BUFFER cmdBuffer, |
| 217 | XGL_GPU_MEMORY mem, |
| 218 | XGL_GPU_SIZE offset, |
| 219 | XGL_UINT32 count, |
| 220 | XGL_UINT32 stride) |
| 221 | { |
| 222 | } |
| 223 | |
| 224 | XGL_VOID XGLAPI intelCmdDispatch( |
| 225 | XGL_CMD_BUFFER cmdBuffer, |
| 226 | XGL_UINT x, |
| 227 | XGL_UINT y, |
| 228 | XGL_UINT z) |
| 229 | { |
| 230 | } |
| 231 | |
| 232 | XGL_VOID XGLAPI intelCmdDispatchIndirect( |
| 233 | XGL_CMD_BUFFER cmdBuffer, |
| 234 | XGL_GPU_MEMORY mem, |
| 235 | XGL_GPU_SIZE offset) |
| 236 | { |
| 237 | } |