| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 | 32 |
| 33 // This file contains the interface class for the low-level graphics API | 33 // This file contains the interface class for the low-level graphics API |
| 34 // (GAPI). | 34 // (GAPI). |
| 35 | 35 |
| 36 #ifndef O3D_COMMAND_BUFFER_COMMON_CROSS_GAPI_INTERFACE_H_ | 36 #ifndef O3D_COMMAND_BUFFER_COMMON_CROSS_GAPI_INTERFACE_H_ |
| 37 #define O3D_COMMAND_BUFFER_COMMON_CROSS_GAPI_INTERFACE_H_ | 37 #define O3D_COMMAND_BUFFER_COMMON_CROSS_GAPI_INTERFACE_H_ |
| 38 | 38 |
| 39 #include "command_buffer/common/cross/buffer_sync_api.h" | 39 #include "command_buffer/common/cross/buffer_sync_api.h" |
| 40 #include "command_buffer/common/cross/resource.h" | 40 #include "command_buffer/common/cross/resource.h" |
| 41 #include "command_buffer/common/cross/cmd_buffer_format.h" |
| 41 | 42 |
| 42 namespace o3d { | 43 namespace o3d { |
| 43 namespace command_buffer { | 44 namespace command_buffer { |
| 44 | 45 |
| 45 // RBGA color definition. | 46 // RBGA color definition. |
| 46 struct RGBA { | 47 struct RGBA { |
| 47 float red; | 48 float red; |
| 48 float green; | 49 float green; |
| 49 float blue; | 50 float blue; |
| 50 float alpha; | 51 float alpha; |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 // This class defines the low-level graphics API, as a pure interface class. | 54 // This class defines the low-level graphics API, as a pure interface class. |
| 54 class GAPIInterface { | 55 class GAPIInterface { |
| 55 public: | 56 public: |
| 56 typedef BufferSyncInterface::ParseError ParseError; | 57 typedef BufferSyncInterface::ParseError ParseError; |
| 57 | 58 |
| 58 GAPIInterface() {} | 59 GAPIInterface() {} |
| 59 virtual ~GAPIInterface() {} | 60 virtual ~GAPIInterface() {} |
| 60 | 61 |
| 61 // Initializes the graphics context. | 62 // Initializes the graphics context. |
| 62 // Returns: | 63 // Returns: |
| 63 // true if successful. | 64 // true if successful. |
| 64 virtual bool Initialize() = 0; | 65 virtual bool Initialize() = 0; |
| 65 | 66 |
| 66 // Destroys the graphics context. | 67 // Destroys the graphics context. |
| 67 virtual void Destroy() = 0; | 68 virtual void Destroy() = 0; |
| 68 | 69 |
| 69 // Bit definitions for buffers to clear. | |
| 70 enum ClearBuffer { | |
| 71 COLOR = 0x1, | |
| 72 DEPTH = 0x2, | |
| 73 STENCIL = 0x4, | |
| 74 ALL_BUFFERS = COLOR | DEPTH | STENCIL | |
| 75 }; | |
| 76 | |
| 77 // Primitive type for Draw and DrawIndexed. | |
| 78 enum PrimitiveType { | |
| 79 POINTS, | |
| 80 LINES, | |
| 81 LINE_STRIPS, | |
| 82 TRIANGLES, | |
| 83 TRIANGLE_STRIPS, | |
| 84 TRIANGLE_FANS, | |
| 85 MAX_PRIMITIVE_TYPE | |
| 86 }; | |
| 87 | |
| 88 // Polygon mode for SetPolygonRaster | |
| 89 enum PolygonMode { | |
| 90 POLYGON_MODE_POINTS, | |
| 91 POLYGON_MODE_LINES, | |
| 92 POLYGON_MODE_FILL, | |
| 93 NUM_POLYGON_MODE | |
| 94 }; | |
| 95 | |
| 96 // Face culling mode for SetPolygonRaster | |
| 97 enum FaceCullMode { | |
| 98 CULL_NONE, | |
| 99 CULL_CW, | |
| 100 CULL_CCW, | |
| 101 NUM_FACE_CULL_MODE | |
| 102 }; | |
| 103 | |
| 104 // Comparison function for alpha or depth test | |
| 105 enum Comparison { | |
| 106 NEVER, | |
| 107 LESS, | |
| 108 EQUAL, | |
| 109 LEQUAL, | |
| 110 GREATER, | |
| 111 NOT_EQUAL, | |
| 112 GEQUAL, | |
| 113 ALWAYS, | |
| 114 NUM_COMPARISON | |
| 115 }; | |
| 116 | |
| 117 // Stencil operation | |
| 118 enum StencilOp { | |
| 119 KEEP, | |
| 120 ZERO, | |
| 121 REPLACE, | |
| 122 INC_NO_WRAP, | |
| 123 DEC_NO_WRAP, | |
| 124 INVERT, | |
| 125 INC_WRAP, | |
| 126 DEC_WRAP, | |
| 127 NUM_STENCIL_OP | |
| 128 }; | |
| 129 | |
| 130 // Blend Equation | |
| 131 enum BlendEq { | |
| 132 BLEND_EQ_ADD, | |
| 133 BLEND_EQ_SUB, | |
| 134 BLEND_EQ_REV_SUB, | |
| 135 BLEND_EQ_MIN, | |
| 136 BLEND_EQ_MAX, | |
| 137 NUM_BLEND_EQ | |
| 138 }; | |
| 139 | |
| 140 // Blend Funtion | |
| 141 enum BlendFunc { | |
| 142 BLEND_FUNC_ZERO, | |
| 143 BLEND_FUNC_ONE, | |
| 144 BLEND_FUNC_SRC_COLOR, | |
| 145 BLEND_FUNC_INV_SRC_COLOR, | |
| 146 BLEND_FUNC_SRC_ALPHA, | |
| 147 BLEND_FUNC_INV_SRC_ALPHA, | |
| 148 BLEND_FUNC_DST_ALPHA, | |
| 149 BLEND_FUNC_INV_DST_ALPHA, | |
| 150 BLEND_FUNC_DST_COLOR, | |
| 151 BLEND_FUNC_INV_DST_COLOR, | |
| 152 BLEND_FUNC_SRC_ALPHA_SATUTRATE, | |
| 153 BLEND_FUNC_BLEND_COLOR, | |
| 154 BLEND_FUNC_INV_BLEND_COLOR, | |
| 155 NUM_BLEND_FUNC | |
| 156 }; | |
| 157 | |
| 158 // Starts a frame. Rendering should occur between BeginFrame and EndFrame. | 70 // Starts a frame. Rendering should occur between BeginFrame and EndFrame. |
| 159 virtual void BeginFrame() = 0; | 71 virtual void BeginFrame() = 0; |
| 160 | 72 |
| 161 // Ends the frame, and bring the back buffer to front. Rendering should occur | 73 // Ends the frame, and bring the back buffer to front. Rendering should occur |
| 162 // between BeginFrame and EndFrame. | 74 // between BeginFrame and EndFrame. |
| 163 virtual void EndFrame() = 0; | 75 virtual void EndFrame() = 0; |
| 164 | 76 |
| 165 // Clear buffers, filling them with a constant value. | 77 // Clear buffers, filling them with a constant value. |
| 166 // Parameters: | 78 // Parameters: |
| 167 // buffers: which buffers to clear. Can be a combination (bitwise or) of | 79 // buffers: which buffers to clear. Can be a combination (bitwise or) of |
| 168 // values from ClearBuffer. | 80 // values from ClearBuffer. |
| 169 // color: the RGBA color to clear the color target with. | 81 // color: the RGBA color to clear the color target with. |
| 170 // depth: the depth to clear the depth buffer with. | 82 // depth: the depth to clear the depth buffer with. |
| 171 // stencil: the stencil value to clear the stencil buffer with. | 83 // stencil: the stencil value to clear the stencil buffer with. |
| 172 virtual void Clear(unsigned int buffers, | 84 virtual void Clear(unsigned int buffers, |
| 173 const RGBA &color, | 85 const RGBA &color, |
| 174 float depth, | 86 float depth, |
| 175 unsigned int stencil) = 0; | 87 unsigned int stencil) = 0; |
| 176 | 88 |
| 177 // Creates a vertex buffer. | 89 // Creates a vertex buffer. |
| 178 // Parameters: | 90 // Parameters: |
| 179 // id: the resource ID for the new vertex buffer. | 91 // id: the resource ID for the new vertex buffer. |
| 180 // size: the size of the vertex buffer, in bytes. | 92 // size: the size of the vertex buffer, in bytes. |
| 181 // flags: the vertex buffer flags, as a combination of vertex_buffer::Flags | 93 // flags: the vertex buffer flags, as a combination of vertex_buffer::Flags |
| 182 // Returns: | 94 // Returns: |
| 183 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 95 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 184 // passed, BufferSyncInterface::kParseNoError otherwise. | 96 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 185 virtual ParseError CreateVertexBuffer(ResourceID id, | 97 virtual ParseError CreateVertexBuffer(ResourceId id, |
| 186 unsigned int size, | 98 unsigned int size, |
| 187 unsigned int flags) = 0; | 99 unsigned int flags) = 0; |
| 188 | 100 |
| 189 // Destroys a vertex buffer. | 101 // Destroys a vertex buffer. |
| 190 // Parameters: | 102 // Parameters: |
| 191 // id: the resource ID of the vertex buffer. | 103 // id: the resource ID of the vertex buffer. |
| 192 // Returns: | 104 // Returns: |
| 193 // BufferSyncInterface::kParseInvalidArguments if an invalid vertex buffer | 105 // BufferSyncInterface::kParseInvalidArguments if an invalid vertex buffer |
| 194 // ID was passed, BufferSyncInterface::kParseNoError otherwise. | 106 // ID was passed, BufferSyncInterface::kParseNoError otherwise. |
| 195 virtual ParseError DestroyVertexBuffer(ResourceID id) = 0; | 107 virtual ParseError DestroyVertexBuffer(ResourceId id) = 0; |
| 196 | 108 |
| 197 // Sets data into a vertex buffer. | 109 // Sets data into a vertex buffer. |
| 198 // Parameters: | 110 // Parameters: |
| 199 // id: the resource ID of the vertex buffer. | 111 // id: the resource ID of the vertex buffer. |
| 200 // offset: the offset into the vertex buffer where to place the data. | 112 // offset: the offset into the vertex buffer where to place the data. |
| 201 // size: the size of the data. | 113 // size: the size of the data. |
| 202 // data: the source data. | 114 // data: the source data. |
| 203 // Returns: | 115 // Returns: |
| 204 // BufferSyncInterface::kParseInvalidArguments if invalid arguments were | 116 // BufferSyncInterface::kParseInvalidArguments if invalid arguments were |
| 205 // passed: invalid resource ID, or offset or size out of range. | 117 // passed: invalid resource ID, or offset or size out of range. |
| 206 // BufferSyncInterface::kParseNoError otherwise. | 118 // BufferSyncInterface::kParseNoError otherwise. |
| 207 virtual ParseError SetVertexBufferData(ResourceID id, | 119 virtual ParseError SetVertexBufferData(ResourceId id, |
| 208 unsigned int offset, | 120 unsigned int offset, |
| 209 unsigned int size, | 121 unsigned int size, |
| 210 const void *data) = 0; | 122 const void *data) = 0; |
| 211 | 123 |
| 212 // Gets data from a vertex buffer. | 124 // Gets data from a vertex buffer. |
| 213 // Parameters: | 125 // Parameters: |
| 214 // id: the resource ID of the vertex buffer. | 126 // id: the resource ID of the vertex buffer. |
| 215 // offset: the offset into the vertex buffer where to get the data. | 127 // offset: the offset into the vertex buffer where to get the data. |
| 216 // size: the size of the data. | 128 // size: the size of the data. |
| 217 // data: the destination buffer. | 129 // data: the destination buffer. |
| 218 // Returns: | 130 // Returns: |
| 219 // BufferSyncInterface::kParseInvalidArguments if invalid arguments were | 131 // BufferSyncInterface::kParseInvalidArguments if invalid arguments were |
| 220 // passed: invalid resource ID, or offset or size out of range. | 132 // passed: invalid resource ID, or offset or size out of range. |
| 221 // BufferSyncInterface::kParseNoError otherwise. | 133 // BufferSyncInterface::kParseNoError otherwise. |
| 222 virtual ParseError GetVertexBufferData(ResourceID id, | 134 virtual ParseError GetVertexBufferData(ResourceId id, |
| 223 unsigned int offset, | 135 unsigned int offset, |
| 224 unsigned int size, | 136 unsigned int size, |
| 225 void *data) = 0; | 137 void *data) = 0; |
| 226 | 138 |
| 227 // Creates an index buffer. | 139 // Creates an index buffer. |
| 228 // Parameters: | 140 // Parameters: |
| 229 // id: the resource ID for the new index buffer. | 141 // id: the resource ID for the new index buffer. |
| 230 // size: the size of the index buffer, in bytes. | 142 // size: the size of the index buffer, in bytes. |
| 231 // flags: the index buffer flags, as a combination of index_buffer::Flags. | 143 // flags: the index buffer flags, as a combination of index_buffer::Flags. |
| 232 // Note that indices are 16 bits unless the index_buffer::INDEX_32BIT | 144 // Note that indices are 16 bits unless the index_buffer::INDEX_32BIT |
| 233 // flag is specified. | 145 // flag is specified. |
| 234 // Returns: | 146 // Returns: |
| 235 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 147 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 236 // passed, BufferSyncInterface::kParseNoError otherwise. | 148 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 237 virtual ParseError CreateIndexBuffer(ResourceID id, | 149 virtual ParseError CreateIndexBuffer(ResourceId id, |
| 238 unsigned int size, | 150 unsigned int size, |
| 239 unsigned int flags) = 0; | 151 unsigned int flags) = 0; |
| 240 | 152 |
| 241 // Destroys an index buffer. | 153 // Destroys an index buffer. |
| 242 // Parameters: | 154 // Parameters: |
| 243 // id: the resource ID of the index buffer. | 155 // id: the resource ID of the index buffer. |
| 244 // Returns: | 156 // Returns: |
| 245 // BufferSyncInterface::kParseInvalidArguments if an invalid index buffer | 157 // BufferSyncInterface::kParseInvalidArguments if an invalid index buffer |
| 246 // ID was passed, BufferSyncInterface::kParseNoError otherwise. | 158 // ID was passed, BufferSyncInterface::kParseNoError otherwise. |
| 247 virtual ParseError DestroyIndexBuffer(ResourceID id) = 0; | 159 virtual ParseError DestroyIndexBuffer(ResourceId id) = 0; |
| 248 | 160 |
| 249 // Sets data into an index buffer. | 161 // Sets data into an index buffer. |
| 250 // Parameters: | 162 // Parameters: |
| 251 // id: the resource ID of the index buffer. | 163 // id: the resource ID of the index buffer. |
| 252 // offset: the offset into the index buffer where to place the data. | 164 // offset: the offset into the index buffer where to place the data. |
| 253 // size: the size of the data. | 165 // size: the size of the data. |
| 254 // data: the source data. | 166 // data: the source data. |
| 255 // Returns: | 167 // Returns: |
| 256 // BufferSyncInterface::kParseInvalidArguments if invalid arguments were | 168 // BufferSyncInterface::kParseInvalidArguments if invalid arguments were |
| 257 // passed: invalid resource ID, or offset or size out of range. | 169 // passed: invalid resource ID, or offset or size out of range. |
| 258 // BufferSyncInterface::kParseNoError otherwise. | 170 // BufferSyncInterface::kParseNoError otherwise. |
| 259 virtual ParseError SetIndexBufferData(ResourceID id, | 171 virtual ParseError SetIndexBufferData(ResourceId id, |
| 260 unsigned int offset, | 172 unsigned int offset, |
| 261 unsigned int size, | 173 unsigned int size, |
| 262 const void *data) = 0; | 174 const void *data) = 0; |
| 263 | 175 |
| 264 // Gets data from an index buffer. | 176 // Gets data from an index buffer. |
| 265 // Parameters: | 177 // Parameters: |
| 266 // id: the resource ID of the index buffer. | 178 // id: the resource ID of the index buffer. |
| 267 // offset: the offset into the index buffer where to get the data. | 179 // offset: the offset into the index buffer where to get the data. |
| 268 // size: the size of the data. | 180 // size: the size of the data. |
| 269 // data: the destination buffer. | 181 // data: the destination buffer. |
| 270 // Returns: | 182 // Returns: |
| 271 // BufferSyncInterface::kParseInvalidArguments if invalid arguments were | 183 // BufferSyncInterface::kParseInvalidArguments if invalid arguments were |
| 272 // passed: invalid resource ID, or offset or size out of range. | 184 // passed: invalid resource ID, or offset or size out of range. |
| 273 // BufferSyncInterface::kParseNoError otherwise. | 185 // BufferSyncInterface::kParseNoError otherwise. |
| 274 virtual ParseError GetIndexBufferData(ResourceID id, | 186 virtual ParseError GetIndexBufferData(ResourceId id, |
| 275 unsigned int offset, | 187 unsigned int offset, |
| 276 unsigned int size, | 188 unsigned int size, |
| 277 void *data) = 0; | 189 void *data) = 0; |
| 278 | 190 |
| 279 // Creates a vertex struct. A vertex struct describes the input vertex | 191 // Creates a vertex struct. A vertex struct describes the input vertex |
| 280 // attribute streams. | 192 // attribute streams. |
| 281 // Parameters: | 193 // Parameters: |
| 282 // id: the resource ID of the vertex struct. | 194 // id: the resource ID of the vertex struct. |
| 283 // input_count: the number of input vertex attributes. | 195 // input_count: the number of input vertex attributes. |
| 284 // returns: | 196 // returns: |
| 285 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 197 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 286 // passed, BufferSyncInterface::kParseNoError otherwise. | 198 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 287 virtual ParseError CreateVertexStruct(ResourceID id, | 199 virtual ParseError CreateVertexStruct(ResourceId id, |
| 288 unsigned int input_count) = 0; | 200 unsigned int input_count) = 0; |
| 289 | 201 |
| 290 // Destroys a vertex struct. | 202 // Destroys a vertex struct. |
| 291 // Parameters: | 203 // Parameters: |
| 292 // id: the resource ID of the vertex struct. | 204 // id: the resource ID of the vertex struct. |
| 293 // Returns: | 205 // Returns: |
| 294 // BufferSyncInterface::kParseInvalidArguments if an invalid vertex struct | 206 // BufferSyncInterface::kParseInvalidArguments if an invalid vertex struct |
| 295 // ID was passed, BufferSyncInterface::kParseNoError otherwise. | 207 // ID was passed, BufferSyncInterface::kParseNoError otherwise. |
| 296 virtual ParseError DestroyVertexStruct(ResourceID id) = 0; | 208 virtual ParseError DestroyVertexStruct(ResourceId id) = 0; |
| 297 | 209 |
| 298 // Sets an input into a vertex struct. | 210 // Sets an input into a vertex struct. |
| 299 // Parameters: | 211 // Parameters: |
| 300 // vertex_struct_id: the resource ID of the vertex struct. | 212 // vertex_struct_id: the resource ID of the vertex struct. |
| 301 // input_index: the index of the input being set. | 213 // input_index: the index of the input being set. |
| 302 // vertex_buffer_id: the resource ID of the vertex buffer containing the | 214 // vertex_buffer_id: the resource ID of the vertex buffer containing the |
| 303 // data. | 215 // data. |
| 304 // offset: the offset into the vertex buffer of the input data, in bytes. | 216 // offset: the offset into the vertex buffer of the input data, in bytes. |
| 305 // stride: the stride of the input data, in bytes. | 217 // stride: the stride of the input data, in bytes. |
| 306 // type: the type of the input data. | 218 // type: the type of the input data. |
| 307 // semantic: the semantic of the input. | 219 // semantic: the semantic of the input. |
| 308 // semantic_index: the semantic index of the input. | 220 // semantic_index: the semantic index of the input. |
| 309 // Returns: | 221 // Returns: |
| 310 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 222 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 311 // passed, BufferSyncInterface::kParseNoError otherwise. | 223 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 312 virtual ParseError SetVertexInput(ResourceID vertex_struct_id, | 224 virtual ParseError SetVertexInput(ResourceId vertex_struct_id, |
| 313 unsigned int input_index, | 225 unsigned int input_index, |
| 314 ResourceID vertex_buffer_id, | 226 ResourceId vertex_buffer_id, |
| 315 unsigned int offset, | 227 unsigned int offset, |
| 316 unsigned int stride, | 228 unsigned int stride, |
| 317 vertex_struct::Type type, | 229 vertex_struct::Type type, |
| 318 vertex_struct::Semantic semantic, | 230 vertex_struct::Semantic semantic, |
| 319 unsigned int semantic_index) = 0; | 231 unsigned int semantic_index) = 0; |
| 320 | 232 |
| 321 // Sets the current vertex struct for drawing. | 233 // Sets the current vertex struct for drawing. |
| 322 // Parameters: | 234 // Parameters: |
| 323 // id: the resource ID of the vertex struct. | 235 // id: the resource ID of the vertex struct. |
| 324 // Returns: | 236 // Returns: |
| 325 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 237 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 326 // passed (invalid vertex struct), BufferSyncInterface::kParseNoError | 238 // passed (invalid vertex struct), BufferSyncInterface::kParseNoError |
| 327 // otherwise. | 239 // otherwise. |
| 328 virtual ParseError SetVertexStruct(ResourceID id) = 0; | 240 virtual ParseError SetVertexStruct(ResourceId id) = 0; |
| 329 | 241 |
| 330 // Draws primitives, using the current vertex struct and the current effect. | 242 // Draws primitives, using the current vertex struct and the current effect. |
| 331 // Parameters: | 243 // Parameters: |
| 332 // primitive_type: the type of primitive to draw. | 244 // primitive_type: the type of primitive to draw. |
| 333 // first: the index of the first vertex. | 245 // first: the index of the first vertex. |
| 334 // count: the number of primitives to draw. | 246 // count: the number of primitives to draw. |
| 335 // Returns: | 247 // Returns: |
| 336 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 248 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 337 // passed, BufferSyncInterface::kParseNoError otherwise. | 249 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 338 virtual ParseError Draw(PrimitiveType primitive_type, | 250 virtual ParseError Draw(PrimitiveType primitive_type, |
| 339 unsigned int first, | 251 unsigned int first, |
| 340 unsigned int count) = 0; | 252 unsigned int count) = 0; |
| 341 | 253 |
| 342 // Draws primitives, using the current vertex struct and the current effect, | 254 // Draws primitives, using the current vertex struct and the current effect, |
| 343 // as well as an index buffer. | 255 // as well as an index buffer. |
| 344 // Parameters: | 256 // Parameters: |
| 345 // primitive_type: the type of primitive to draw. | 257 // primitive_type: the type of primitive to draw. |
| 346 // index_buffer_id: the resource ID of the index buffer. | 258 // index_buffer_id: the resource ID of the index buffer. |
| 347 // first: the index into the index buffer of the first index to draw. | 259 // first: the index into the index buffer of the first index to draw. |
| 348 // count: the number of primitives to draw. | 260 // count: the number of primitives to draw. |
| 349 // min_index: the lowest index being drawn. | 261 // min_index: the lowest index being drawn. |
| 350 // max_index: the highest index being drawn. | 262 // max_index: the highest index being drawn. |
| 351 // Returns: | 263 // Returns: |
| 352 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 264 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 353 // passed, BufferSyncInterface::kParseNoError otherwise. | 265 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 354 virtual ParseError DrawIndexed(PrimitiveType primitive_type, | 266 virtual ParseError DrawIndexed(PrimitiveType primitive_type, |
| 355 ResourceID index_buffer_id, | 267 ResourceId index_buffer_id, |
| 356 unsigned int first, | 268 unsigned int first, |
| 357 unsigned int count, | 269 unsigned int count, |
| 358 unsigned int min_index, | 270 unsigned int min_index, |
| 359 unsigned int max_index) = 0; | 271 unsigned int max_index) = 0; |
| 360 | 272 |
| 361 // Creates an effect, from source code. | 273 // Creates an effect, from source code. |
| 362 // Parameters: | 274 // Parameters: |
| 363 // id: the resource ID of the effect. | 275 // id: the resource ID of the effect. |
| 364 // size: the size of data. | 276 // size: the size of data. |
| 365 // data: the source code for the effect. | 277 // data: the source code for the effect. |
| 366 // Returns: | 278 // Returns: |
| 367 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 279 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 368 // passed or the effect failed to compile, | 280 // passed or the effect failed to compile, |
| 369 // BufferSyncInterface::kParseNoError otherwise. | 281 // BufferSyncInterface::kParseNoError otherwise. |
| 370 virtual ParseError CreateEffect(ResourceID id, | 282 virtual ParseError CreateEffect(ResourceId id, |
| 371 unsigned int size, | 283 unsigned int size, |
| 372 const void *data) = 0; | 284 const void *data) = 0; |
| 373 | 285 |
| 374 // Destroys an effect. | 286 // Destroys an effect. |
| 375 // Parameters: | 287 // Parameters: |
| 376 // id: the resource ID of the effect. | 288 // id: the resource ID of the effect. |
| 377 // Returns: | 289 // Returns: |
| 378 // BufferSyncInterface::kParseInvalidArguments if an invalid effect ID | 290 // BufferSyncInterface::kParseInvalidArguments if an invalid effect ID |
| 379 // was passed, BufferSyncInterface::kParseNoError otherwise. | 291 // was passed, BufferSyncInterface::kParseNoError otherwise. |
| 380 virtual ParseError DestroyEffect(ResourceID id) = 0; | 292 virtual ParseError DestroyEffect(ResourceId id) = 0; |
| 381 | 293 |
| 382 // Sets the active effect for drawing. | 294 // Sets the active effect for drawing. |
| 383 // Parameters: | 295 // Parameters: |
| 384 // id: the resource ID of the effect. | 296 // id: the resource ID of the effect. |
| 385 // Returns: | 297 // Returns: |
| 386 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 298 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 387 // passed, BufferSyncInterface::kParseNoError otherwise. | 299 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 388 virtual ParseError SetEffect(ResourceID id) = 0; | 300 virtual ParseError SetEffect(ResourceId id) = 0; |
| 389 | 301 |
| 390 // Gets the number of parameters in an effect, returning it in a memory | 302 // Gets the number of parameters in an effect, returning it in a memory |
| 391 // buffer as a Uint32. | 303 // buffer as a Uint32. |
| 392 // Parameters: | 304 // Parameters: |
| 393 // id: the resource ID of the effect. | 305 // id: the resource ID of the effect. |
| 394 // size: the size of the data buffer. Must be at least 4 (the size of the | 306 // size: the size of the data buffer. Must be at least 4 (the size of the |
| 395 // Uint32). | 307 // Uint32). |
| 396 // data: the buffer receiving the data. | 308 // data: the buffer receiving the data. |
| 397 // Returns: | 309 // Returns: |
| 398 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 310 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 399 // passed, BufferSyncInterface::kParseNoError otherwise. | 311 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 400 virtual ParseError GetParamCount(ResourceID id, | 312 virtual ParseError GetParamCount(ResourceId id, |
| 401 unsigned int size, | 313 unsigned int size, |
| 402 void *data) = 0; | 314 void *data) = 0; |
| 403 | 315 |
| 404 // Creates an effect parameter by index. | 316 // Creates an effect parameter by index. |
| 405 // Parameters: | 317 // Parameters: |
| 406 // param_id: the resource ID of the parameter being created. | 318 // param_id: the resource ID of the parameter being created. |
| 407 // effect_id: the resource ID of the effect containing the parameter. | 319 // effect_id: the resource ID of the effect containing the parameter. |
| 408 // data_type: the data type for the parameter. Must match the data type in | 320 // data_type: the data type for the parameter. Must match the data type in |
| 409 // the effect source. | 321 // the effect source. |
| 410 // index: the index of the parameter. | 322 // index: the index of the parameter. |
| 411 // Returns: | 323 // Returns: |
| 412 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 324 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 413 // passed, such as invalid effect ID, unmatching data type or invalid | 325 // passed, such as invalid effect ID, unmatching data type or invalid |
| 414 // index, BufferSyncInterface::kParseNoError otherwise. | 326 // index, BufferSyncInterface::kParseNoError otherwise. |
| 415 virtual ParseError CreateParam(ResourceID param_id, | 327 virtual ParseError CreateParam(ResourceId param_id, |
| 416 ResourceID effect_id, | 328 ResourceId effect_id, |
| 417 unsigned int index) = 0; | 329 unsigned int index) = 0; |
| 418 | 330 |
| 419 // Creates an effect parameter by name. | 331 // Creates an effect parameter by name. |
| 420 // Parameters: | 332 // Parameters: |
| 421 // param_id: the resource ID of the parameter being created. | 333 // param_id: the resource ID of the parameter being created. |
| 422 // effect_id: the resource ID of the effect containing the parameter. | 334 // effect_id: the resource ID of the effect containing the parameter. |
| 423 // data_type: the data type for the parameter. Must match the data type in | 335 // data_type: the data type for the parameter. Must match the data type in |
| 424 // the effect source. | 336 // the effect source. |
| 425 // size: the size of the parameter name. | 337 // size: the size of the parameter name. |
| 426 // name: the parameter name, as an array of char. Doesn't have to be | 338 // name: the parameter name, as an array of char. Doesn't have to be |
| 427 // nul-terminated (though nul will terminate the string). | 339 // nul-terminated (though nul will terminate the string). |
| 428 // Returns: | 340 // Returns: |
| 429 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 341 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 430 // passed, such as invalid effect ID, unmatching data type or no parameter | 342 // passed, such as invalid effect ID, unmatching data type or no parameter |
| 431 // was found with this name, BufferSyncInterface::kParseNoError otherwise. | 343 // was found with this name, BufferSyncInterface::kParseNoError otherwise. |
| 432 virtual ParseError CreateParamByName(ResourceID param_id, | 344 virtual ParseError CreateParamByName(ResourceId param_id, |
| 433 ResourceID effect_id, | 345 ResourceId effect_id, |
| 434 unsigned int size, | 346 unsigned int size, |
| 435 const void *name) = 0; | 347 const void *name) = 0; |
| 436 | 348 |
| 437 // Destroys an effect parameter. | 349 // Destroys an effect parameter. |
| 438 // Parameters: | 350 // Parameters: |
| 439 // id: the resource ID of the parameter. | 351 // id: the resource ID of the parameter. |
| 440 // Returns: | 352 // Returns: |
| 441 // BufferSyncInterface::kParseInvalidArguments if an invalid parameter ID | 353 // BufferSyncInterface::kParseInvalidArguments if an invalid parameter ID |
| 442 // was passed, BufferSyncInterface::kParseNoError otherwise. | 354 // was passed, BufferSyncInterface::kParseNoError otherwise. |
| 443 virtual ParseError DestroyParam(ResourceID id) = 0; | 355 virtual ParseError DestroyParam(ResourceId id) = 0; |
| 444 | 356 |
| 445 // Sets the effect parameter data. | 357 // Sets the effect parameter data. |
| 446 // Parameters: | 358 // Parameters: |
| 447 // id: the resource ID of the parameter. | 359 // id: the resource ID of the parameter. |
| 448 // size: the size of the data. Must be at least the size of the parameter | 360 // size: the size of the data. Must be at least the size of the parameter |
| 449 // as described by its type. | 361 // as described by its type. |
| 450 // data: the parameter data. | 362 // data: the parameter data. |
| 451 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 363 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 452 // passed, such as invalid parameter ID, or unmatching data size, | 364 // passed, such as invalid parameter ID, or unmatching data size, |
| 453 // BufferSyncInterface::kParseNoError otherwise. | 365 // BufferSyncInterface::kParseNoError otherwise. |
| 454 virtual ParseError SetParamData(ResourceID id, | 366 virtual ParseError SetParamData(ResourceId id, |
| 455 unsigned int size, | 367 unsigned int size, |
| 456 const void *data) = 0; | 368 const void *data) = 0; |
| 457 | 369 |
| 458 // Gets the parameter description, storing it into a memory buffer. The | 370 // Gets the parameter description, storing it into a memory buffer. The |
| 459 // parameter is described by a effect_param::Desc structure. The size must be | 371 // parameter is described by a effect_param::Desc structure. The size must be |
| 460 // at least the size of that structure. The name and semantic fields are only | 372 // at least the size of that structure. The name and semantic fields are only |
| 461 // filled if the character strings fit into the memory buffer. In any case, | 373 // filled if the character strings fit into the memory buffer. In any case, |
| 462 // the size field (in the effect_param::Desc) is filled with the size needed | 374 // the size field (in the effect_param::Desc) is filled with the size needed |
| 463 // to fill in the structure, the name and the semantic (if any). Thus to get | 375 // to fill in the structure, the name and the semantic (if any). Thus to get |
| 464 // the complete information, GetParamDesc can be called twice, once to get | 376 // the complete information, GetParamDesc can be called twice, once to get |
| 465 // the size, and, after allocating a big enough buffer, again to fill in the | 377 // the size, and, after allocating a big enough buffer, again to fill in the |
| 466 // complete information including the text strings. | 378 // complete information including the text strings. |
| 467 // Parameters: | 379 // Parameters: |
| 468 // id: the resource ID of the parameter. | 380 // id: the resource ID of the parameter. |
| 469 // size: the size of the memory buffer that wil receive the parameter | 381 // size: the size of the memory buffer that wil receive the parameter |
| 470 // description. Must be at least sizeof(effect_param::Desc). | 382 // description. Must be at least sizeof(effect_param::Desc). |
| 471 // data: the memory buffer. | 383 // data: the memory buffer. |
| 472 // Returns: | 384 // Returns: |
| 473 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 385 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 474 // passed, such as invalid parameter ID, or unsufficient data size, | 386 // passed, such as invalid parameter ID, or unsufficient data size, |
| 475 // BufferSyncInterface::kParseNoError otherwise. Note that | 387 // BufferSyncInterface::kParseNoError otherwise. Note that |
| 476 // BufferSyncInterface::kParseNoError will be returned if the structure | 388 // BufferSyncInterface::kParseNoError will be returned if the structure |
| 477 // itself fits, not necessarily the names. To make sure all the information | 389 // itself fits, not necessarily the names. To make sure all the information |
| 478 // is available, the caller should compare the returned size member of the | 390 // is available, the caller should compare the returned size member of the |
| 479 // effect_param::Desc structure to the size parameter passed in. | 391 // effect_param::Desc structure to the size parameter passed in. |
| 480 virtual ParseError GetParamDesc(ResourceID id, | 392 virtual ParseError GetParamDesc(ResourceId id, |
| 481 unsigned int size, | 393 unsigned int size, |
| 482 void *data) = 0; | 394 void *data) = 0; |
| 483 | 395 |
| 484 // Gets the number of input streams for an effect, returning it in a memory | 396 // Gets the number of input streams for an effect, returning it in a memory |
| 485 // buffer as a Uint32. | 397 // buffer as a Uint32. |
| 486 // Parameters: | 398 // Parameters: |
| 487 // id: the resource ID of the effect. | 399 // id: the resource ID of the effect. |
| 488 // size: the size of the data buffer. Must be at least 4 (the size of the | 400 // size: the size of the data buffer. Must be at least 4 (the size of the |
| 489 // Uint32). | 401 // Uint32). |
| 490 // data: the buffer receiving the data. | 402 // data: the buffer receiving the data. |
| 491 // Returns: | 403 // Returns: |
| 492 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 404 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 493 // passed, BufferSyncInterface::kParseNoError otherwise. | 405 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 494 virtual ParseError GetStreamCount(ResourceID id, | 406 virtual ParseError GetStreamCount(ResourceId id, |
| 495 unsigned int size, | 407 unsigned int size, |
| 496 void *data) = 0; | 408 void *data) = 0; |
| 497 | 409 |
| 498 // Gets the stream semantics, storing them in the data buffer. The stream | 410 // Gets the stream semantics, storing them in the data buffer. The stream |
| 499 // is described by an effect_stream::Desc structure which contains a | 411 // is described by an effect_stream::Desc structure which contains a |
| 500 // semantic type and a semantic index. | 412 // semantic type and a semantic index. |
| 501 // Parameters: | 413 // Parameters: |
| 502 // id: the resource ID of the effect. | 414 // id: the resource ID of the effect. |
| 503 // index: which stream semantic to get | 415 // index: which stream semantic to get |
| 504 // size: the size of the data buffer. Must be at least 8 (the size of two | 416 // size: the size of the data buffer. Must be at least 8 (the size of two |
| 505 // Uint32). | 417 // Uint32). |
| 506 // data: the buffer receiving the data. | 418 // data: the buffer receiving the data. |
| 507 virtual ParseError GetStreamDesc(ResourceID id, | 419 virtual ParseError GetStreamDesc(ResourceId id, |
| 508 unsigned int index, | 420 unsigned int index, |
| 509 unsigned int size, | 421 unsigned int size, |
| 510 void *data) = 0; | 422 void *data) = 0; |
| 511 | 423 |
| 512 // Creates a 2D texture resource. | 424 // Creates a 2D texture resource. |
| 513 // Parameters: | 425 // Parameters: |
| 514 // id: the resource ID of the texture. | 426 // id: the resource ID of the texture. |
| 515 // width: the texture width. Must be positive. | 427 // width: the texture width. Must be positive. |
| 516 // height: the texture height. Must be positive. | 428 // height: the texture height. Must be positive. |
| 517 // levels: the number of mipmap levels in the texture, or 0 to use the | 429 // levels: the number of mipmap levels in the texture, or 0 to use the |
| 518 // maximum. | 430 // maximum. |
| 519 // format: the format of the texels in the texture. | 431 // format: the format of the texels in the texture. |
| 520 // flags: the texture flags, as a combination of texture::Flags. | 432 // flags: the texture flags, as a combination of texture::Flags. |
| 521 // enable_render_surfaces: bool for whether to enable render surfaces | 433 // enable_render_surfaces: bool for whether to enable render surfaces |
| 522 // Returns: | 434 // Returns: |
| 523 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 435 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 524 // passed, BufferSyncInterface::kParseNoError otherwise. | 436 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 525 virtual ParseError CreateTexture2D(ResourceID id, | 437 virtual ParseError CreateTexture2D(ResourceId id, |
| 526 unsigned int width, | 438 unsigned int width, |
| 527 unsigned int height, | 439 unsigned int height, |
| 528 unsigned int levels, | 440 unsigned int levels, |
| 529 texture::Format format, | 441 texture::Format format, |
| 530 unsigned int flags, | 442 unsigned int flags, |
| 531 bool enable_render_surfaces) = 0; | 443 bool enable_render_surfaces) = 0; |
| 532 | 444 |
| 533 // Creates a 3D texture resource. | 445 // Creates a 3D texture resource. |
| 534 // Parameters: | 446 // Parameters: |
| 535 // id: the resource ID of the texture. | 447 // id: the resource ID of the texture. |
| 536 // width: the texture width. Must be positive. | 448 // width: the texture width. Must be positive. |
| 537 // height: the texture height. Must be positive. | 449 // height: the texture height. Must be positive. |
| 538 // depth: the texture depth. Must be positive. | 450 // depth: the texture depth. Must be positive. |
| 539 // levels: the number of mipmap levels in the texture, or 0 to use the | 451 // levels: the number of mipmap levels in the texture, or 0 to use the |
| 540 // maximum. | 452 // maximum. |
| 541 // format: the format of the pixels in the texture. | 453 // format: the format of the pixels in the texture. |
| 542 // flags: the texture flags, as a combination of texture::Flags. | 454 // flags: the texture flags, as a combination of texture::Flags. |
| 543 // enable_render_surfaces: bool for whether to enable render surfaces | 455 // enable_render_surfaces: bool for whether to enable render surfaces |
| 544 // Returns: | 456 // Returns: |
| 545 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 457 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 546 // passed, BufferSyncInterface::kParseNoError otherwise. | 458 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 547 virtual ParseError CreateTexture3D(ResourceID id, | 459 virtual ParseError CreateTexture3D(ResourceId id, |
| 548 unsigned int width, | 460 unsigned int width, |
| 549 unsigned int height, | 461 unsigned int height, |
| 550 unsigned int depth, | 462 unsigned int depth, |
| 551 unsigned int levels, | 463 unsigned int levels, |
| 552 texture::Format format, | 464 texture::Format format, |
| 553 unsigned int flags, | 465 unsigned int flags, |
| 554 bool enable_render_surfaces) = 0; | 466 bool enable_render_surfaces) = 0; |
| 555 | 467 |
| 556 // Creates a cube map texture resource. | 468 // Creates a cube map texture resource. |
| 557 // Parameters: | 469 // Parameters: |
| 558 // id: the resource ID of the texture. | 470 // id: the resource ID of the texture. |
| 559 // side: the texture side length. Must be positive. | 471 // side: the texture side length. Must be positive. |
| 560 // levels: the number of mipmap levels in the texture, or 0 to use the | 472 // levels: the number of mipmap levels in the texture, or 0 to use the |
| 561 // maximum. | 473 // maximum. |
| 562 // format: the format of the pixels in the texture. | 474 // format: the format of the pixels in the texture. |
| 563 // flags: the texture flags, as a combination of texture::Flags. | 475 // flags: the texture flags, as a combination of texture::Flags. |
| 564 // enable_render_surfaces: bool for whether to enable render surfaces | 476 // enable_render_surfaces: bool for whether to enable render surfaces |
| 565 // Returns: | 477 // Returns: |
| 566 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 478 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 567 // passed, BufferSyncInterface::kParseNoError otherwise. | 479 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 568 virtual ParseError CreateTextureCube(ResourceID id, | 480 virtual ParseError CreateTextureCube(ResourceId id, |
| 569 unsigned int side, | 481 unsigned int side, |
| 570 unsigned int levels, | 482 unsigned int levels, |
| 571 texture::Format format, | 483 texture::Format format, |
| 572 unsigned int flags, | 484 unsigned int flags, |
| 573 bool enable_render_surfaces) = 0; | 485 bool enable_render_surfaces) = 0; |
| 574 | 486 |
| 575 // Sets texel data into a texture resource. This is a common function for | 487 // Sets texel data into a texture resource. This is a common function for |
| 576 // each of the texture types, but some restrictions exist based on the | 488 // each of the texture types, but some restrictions exist based on the |
| 577 // texture type. The specified rectangle or volume of data, defined by x, y, | 489 // texture type. The specified rectangle or volume of data, defined by x, y, |
| 578 // width, height and possibly z and depth must fit into the selected mimmap | 490 // width, height and possibly z and depth must fit into the selected mimmap |
| (...skipping 16 matching lines...) Expand all Loading... |
| 595 // row_pitch: the number of bytes between two consecutive rows of blocks, | 507 // row_pitch: the number of bytes between two consecutive rows of blocks, |
| 596 // in the source data. | 508 // in the source data. |
| 597 // slice_pitch: the number of bytes between two consecutive slices of | 509 // slice_pitch: the number of bytes between two consecutive slices of |
| 598 // blocks, in the source data. Is ignored for non-3D textures. | 510 // blocks, in the source data. Is ignored for non-3D textures. |
| 599 // size: the size of the data. | 511 // size: the size of the data. |
| 600 // data: the texel data. | 512 // data: the texel data. |
| 601 // Returns: | 513 // Returns: |
| 602 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 514 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 603 // passed, for example invalid size, or out-of-bounds rectangle/volume, | 515 // passed, for example invalid size, or out-of-bounds rectangle/volume, |
| 604 // BufferSyncInterface::kParseNoError otherwise. | 516 // BufferSyncInterface::kParseNoError otherwise. |
| 605 virtual ParseError SetTextureData(ResourceID id, | 517 virtual ParseError SetTextureData(ResourceId id, |
| 606 unsigned int x, | 518 unsigned int x, |
| 607 unsigned int y, | 519 unsigned int y, |
| 608 unsigned int z, | 520 unsigned int z, |
| 609 unsigned int width, | 521 unsigned int width, |
| 610 unsigned int height, | 522 unsigned int height, |
| 611 unsigned int depth, | 523 unsigned int depth, |
| 612 unsigned int level, | 524 unsigned int level, |
| 613 texture::Face face, | 525 texture::Face face, |
| 614 unsigned int pitch, | 526 unsigned int pitch, |
| 615 unsigned int slice_pitch, | 527 unsigned int slice_pitch, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 639 // row_pitch: the number of bytes between two consecutive rows of blocks, | 551 // row_pitch: the number of bytes between two consecutive rows of blocks, |
| 640 // in the destination buffer. | 552 // in the destination buffer. |
| 641 // slice_pitch: the number of bytes between two consecutive slices of | 553 // slice_pitch: the number of bytes between two consecutive slices of |
| 642 // blocks, in the destination buffer. Is ignored for non-3D textures. | 554 // blocks, in the destination buffer. Is ignored for non-3D textures. |
| 643 // size: the size of the data. | 555 // size: the size of the data. |
| 644 // data: the destination buffer. | 556 // data: the destination buffer. |
| 645 // Returns: | 557 // Returns: |
| 646 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 558 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 647 // passed, for example invalid size, or out-of-bounds rectangle/volume, | 559 // passed, for example invalid size, or out-of-bounds rectangle/volume, |
| 648 // BufferSyncInterface::kParseNoError otherwise. | 560 // BufferSyncInterface::kParseNoError otherwise. |
| 649 virtual ParseError GetTextureData(ResourceID id, | 561 virtual ParseError GetTextureData(ResourceId id, |
| 650 unsigned int x, | 562 unsigned int x, |
| 651 unsigned int y, | 563 unsigned int y, |
| 652 unsigned int z, | 564 unsigned int z, |
| 653 unsigned int width, | 565 unsigned int width, |
| 654 unsigned int height, | 566 unsigned int height, |
| 655 unsigned int depth, | 567 unsigned int depth, |
| 656 unsigned int level, | 568 unsigned int level, |
| 657 texture::Face face, | 569 texture::Face face, |
| 658 unsigned int pitch, | 570 unsigned int pitch, |
| 659 unsigned int slice_pitch, | 571 unsigned int slice_pitch, |
| 660 unsigned int size, | 572 unsigned int size, |
| 661 void *data) = 0; | 573 void *data) = 0; |
| 662 | 574 |
| 663 // Destroys a texture resource. | 575 // Destroys a texture resource. |
| 664 // Parameters: | 576 // Parameters: |
| 665 // id: the resource ID of the texture. | 577 // id: the resource ID of the texture. |
| 666 // Returns: | 578 // Returns: |
| 667 // BufferSyncInterface::kParseInvalidArguments if an invalid texture | 579 // BufferSyncInterface::kParseInvalidArguments if an invalid texture |
| 668 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. | 580 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. |
| 669 virtual ParseError DestroyTexture(ResourceID id) = 0; | 581 virtual ParseError DestroyTexture(ResourceId id) = 0; |
| 670 | 582 |
| 671 // Creates a sampler resource. | 583 // Creates a sampler resource. |
| 672 // Parameters: | 584 // Parameters: |
| 673 // id: the resource ID of the sampler. | 585 // id: the resource ID of the sampler. |
| 674 // Returns: | 586 // Returns: |
| 675 // BufferSyncInterface::kParseNoError. | 587 // BufferSyncInterface::kParseNoError. |
| 676 virtual ParseError CreateSampler(ResourceID id) = 0; | 588 virtual ParseError CreateSampler(ResourceId id) = 0; |
| 677 | 589 |
| 678 // Destroys a sampler resource. | 590 // Destroys a sampler resource. |
| 679 // Parameters: | 591 // Parameters: |
| 680 // id: the resource ID of the sampler. | 592 // id: the resource ID of the sampler. |
| 681 // Returns: | 593 // Returns: |
| 682 // BufferSyncInterface::kParseInvalidArguments if an invalid sampler | 594 // BufferSyncInterface::kParseInvalidArguments if an invalid sampler |
| 683 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. | 595 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. |
| 684 virtual ParseError DestroySampler(ResourceID id) = 0; | 596 virtual ParseError DestroySampler(ResourceId id) = 0; |
| 685 | 597 |
| 686 // Sets the states in a sampler resource. | 598 // Sets the states in a sampler resource. |
| 687 // Parameters: | 599 // Parameters: |
| 688 // id: the resource ID of the sampler. | 600 // id: the resource ID of the sampler. |
| 689 // addressing_u: the addressing mode for the U coordinate. | 601 // addressing_u: the addressing mode for the U coordinate. |
| 690 // addressing_v: the addressing mode for the V coordinate. | 602 // addressing_v: the addressing mode for the V coordinate. |
| 691 // addressing_w: the addressing mode for the W coordinate. | 603 // addressing_w: the addressing mode for the W coordinate. |
| 692 // mag_filter: the filtering mode when magnifying textures. | 604 // mag_filter: the filtering mode when magnifying textures. |
| 693 // min_filter: the filtering mode when minifying textures. | 605 // min_filter: the filtering mode when minifying textures. |
| 694 // mip_filter: the filtering mode for mip-map interpolation textures. | 606 // mip_filter: the filtering mode for mip-map interpolation textures. |
| 695 // max_anisotropy: the maximum anisotropy. | 607 // max_anisotropy: the maximum anisotropy. |
| 696 // Returns: | 608 // Returns: |
| 697 // BufferSyncInterface::kParseInvalidArguments if an invalid sampler | 609 // BufferSyncInterface::kParseInvalidArguments if an invalid sampler |
| 698 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. | 610 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. |
| 699 virtual ParseError SetSamplerStates(ResourceID id, | 611 virtual ParseError SetSamplerStates(ResourceId id, |
| 700 sampler::AddressingMode addressing_u, | 612 sampler::AddressingMode addressing_u, |
| 701 sampler::AddressingMode addressing_v, | 613 sampler::AddressingMode addressing_v, |
| 702 sampler::AddressingMode addressing_w, | 614 sampler::AddressingMode addressing_w, |
| 703 sampler::FilteringMode mag_filter, | 615 sampler::FilteringMode mag_filter, |
| 704 sampler::FilteringMode min_filter, | 616 sampler::FilteringMode min_filter, |
| 705 sampler::FilteringMode mip_filter, | 617 sampler::FilteringMode mip_filter, |
| 706 unsigned int max_anisotropy) = 0; | 618 unsigned int max_anisotropy) = 0; |
| 707 | 619 |
| 708 // Sets the color of border pixels. | 620 // Sets the color of border pixels. |
| 709 // Parameters: | 621 // Parameters: |
| 710 // id: the resource ID of the sampler. | 622 // id: the resource ID of the sampler. |
| 711 // color: the border color. | 623 // color: the border color. |
| 712 // Returns: | 624 // Returns: |
| 713 // BufferSyncInterface::kParseInvalidArguments if an invalid sampler | 625 // BufferSyncInterface::kParseInvalidArguments if an invalid sampler |
| 714 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. | 626 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. |
| 715 virtual ParseError SetSamplerBorderColor(ResourceID id, | 627 virtual ParseError SetSamplerBorderColor(ResourceId id, |
| 716 const RGBA &color) = 0; | 628 const RGBA &color) = 0; |
| 717 | 629 |
| 718 // Sets the texture resource used by a sampler resource. | 630 // Sets the texture resource used by a sampler resource. |
| 719 // Parameters: | 631 // Parameters: |
| 720 // id: the resource ID of the sampler. | 632 // id: the resource ID of the sampler. |
| 721 // texture_id: the resource id of the texture. | 633 // texture_id: the resource id of the texture. |
| 722 // Returns: | 634 // Returns: |
| 723 // BufferSyncInterface::kParseInvalidArguments if an invalid sampler | 635 // BufferSyncInterface::kParseInvalidArguments if an invalid sampler |
| 724 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. | 636 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. |
| 725 virtual ParseError SetSamplerTexture(ResourceID id, | 637 virtual ParseError SetSamplerTexture(ResourceId id, |
| 726 ResourceID texture_id) = 0; | 638 ResourceId texture_id) = 0; |
| 727 | 639 |
| 728 // Sets the viewport, and depth range. | 640 // Sets the viewport, and depth range. |
| 729 // Parameters: | 641 // Parameters: |
| 730 // x, y: upper left corner of the viewport. | 642 // x, y: upper left corner of the viewport. |
| 731 // width, height: dimensions of the viewport. | 643 // width, height: dimensions of the viewport. |
| 732 // z_min, z_max: depth range. | 644 // z_min, z_max: depth range. |
| 733 virtual void SetViewport(unsigned int x, | 645 virtual void SetViewport(unsigned int x, |
| 734 unsigned int y, | 646 unsigned int y, |
| 735 unsigned int width, | 647 unsigned int width, |
| 736 unsigned int height, | 648 unsigned int height, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 // Parameters: | 691 // Parameters: |
| 780 // enable: alpha test enable state. | 692 // enable: alpha test enable state. |
| 781 // reference: reference value for comparison. | 693 // reference: reference value for comparison. |
| 782 // comp: alpha comparison function. | 694 // comp: alpha comparison function. |
| 783 virtual void SetAlphaTest(bool enable, | 695 virtual void SetAlphaTest(bool enable, |
| 784 float reference, | 696 float reference, |
| 785 Comparison comp) = 0; | 697 Comparison comp) = 0; |
| 786 | 698 |
| 787 // Sets the depth test states. | 699 // Sets the depth test states. |
| 788 // Note: if the depth test is disabled, z values are not written to the z | 700 // Note: if the depth test is disabled, z values are not written to the z |
| 789 // buffer (i.e enable/ALWAYS is different from disable/*). | 701 // buffer (i.e enable/kAlways is different from disable/*). |
| 790 // Parameters: | 702 // Parameters: |
| 791 // enable: depth test enable state. | 703 // enable: depth test enable state. |
| 792 // write_enable: depth write enable state. | 704 // write_enable: depth write enable state. |
| 793 // comp: depth comparison function. | 705 // comp: depth comparison function. |
| 794 virtual void SetDepthTest(bool enable, | 706 virtual void SetDepthTest(bool enable, |
| 795 bool write_enable, | 707 bool write_enable, |
| 796 Comparison comp) = 0; | 708 Comparison comp) = 0; |
| 797 | 709 |
| 798 // Sets the stencil test states. | 710 // Sets the stencil test states. |
| 799 // Parameters: | 711 // Parameters: |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 | 767 |
| 856 // Creates a render surface resource. | 768 // Creates a render surface resource. |
| 857 // Parameters: | 769 // Parameters: |
| 858 // id: the resource ID of the render surface. | 770 // id: the resource ID of the render surface. |
| 859 // width: the texture width. Must be positive. | 771 // width: the texture width. Must be positive. |
| 860 // height: the texture height. Must be positive. | 772 // height: the texture height. Must be positive. |
| 861 // texture_id: the resource id of the texture. | 773 // texture_id: the resource id of the texture. |
| 862 // Returns: | 774 // Returns: |
| 863 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 775 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 864 // passed, BufferSyncInterface::kParseNoError otherwise. | 776 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 865 virtual ParseError CreateRenderSurface(ResourceID id, | 777 virtual ParseError CreateRenderSurface(ResourceId id, |
| 866 unsigned int width, | 778 unsigned int width, |
| 867 unsigned int height, | 779 unsigned int height, |
| 868 unsigned int mip_level, | 780 unsigned int mip_level, |
| 869 unsigned int side, | 781 unsigned int side, |
| 870 ResourceID texture_id) = 0; | 782 ResourceId texture_id) = 0; |
| 871 | 783 |
| 872 // Destroys a render surface resource. | 784 // Destroys a render surface resource. |
| 873 // Parameters: | 785 // Parameters: |
| 874 // id: the resource ID of the render surface. | 786 // id: the resource ID of the render surface. |
| 875 // Returns: | 787 // Returns: |
| 876 // BufferSyncInterface::kParseInvalidArguments if an invalid render | 788 // BufferSyncInterface::kParseInvalidArguments if an invalid render |
| 877 // surface | 789 // surface |
| 878 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. | 790 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. |
| 879 virtual ParseError DestroyRenderSurface(ResourceID id) = 0; | 791 virtual ParseError DestroyRenderSurface(ResourceId id) = 0; |
| 880 | 792 |
| 881 // Creates a depth stencil surface resource. | 793 // Creates a depth stencil surface resource. |
| 882 // Parameters: | 794 // Parameters: |
| 883 // id: the resource ID of the depth stencil surface. | 795 // id: the resource ID of the depth stencil surface. |
| 884 // width: the texture width. Must be positive. | 796 // width: the texture width. Must be positive. |
| 885 // height: the texture height. Must be positive. | 797 // height: the texture height. Must be positive. |
| 886 // Returns: | 798 // Returns: |
| 887 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 799 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 888 // passed, BufferSyncInterface::kParseNoError otherwise. | 800 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 889 virtual ParseError CreateDepthSurface(ResourceID id, | 801 virtual ParseError CreateDepthSurface(ResourceId id, |
| 890 unsigned int width, | 802 unsigned int width, |
| 891 unsigned int height) = 0; | 803 unsigned int height) = 0; |
| 892 | 804 |
| 893 // Destroys a depth stencil surface resource. | 805 // Destroys a depth stencil surface resource. |
| 894 // Parameters: | 806 // Parameters: |
| 895 // id: the resource ID of the depth stencil surface. | 807 // id: the resource ID of the depth stencil surface. |
| 896 // Returns: | 808 // Returns: |
| 897 // BufferSyncInterface::kParseInvalidArguments if an invalid render | 809 // BufferSyncInterface::kParseInvalidArguments if an invalid render |
| 898 // surface | 810 // surface |
| 899 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. | 811 // resource ID was passed, BufferSyncInterface::kParseNoError otherwise. |
| 900 virtual ParseError DestroyDepthSurface(ResourceID id) = 0; | 812 virtual ParseError DestroyDepthSurface(ResourceId id) = 0; |
| 901 | 813 |
| 902 // Switches the render surface and depth stencil surface to those | 814 // Switches the render surface and depth stencil surface to those |
| 903 // corresponding to the passed in IDs. | 815 // corresponding to the passed in IDs. |
| 904 // Parameters: | 816 // Parameters: |
| 905 // render_surface_id: the resource ID of the render surface. | 817 // render_surface_id: the resource ID of the render surface. |
| 906 // depth_stencil_id: the resource ID of the render depth stencil surface. | 818 // depth_stencil_id: the resource ID of the render depth stencil surface. |
| 907 // Returns: | 819 // Returns: |
| 908 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are | 820 // BufferSyncInterface::kParseInvalidArguments if invalid arguments are |
| 909 // passed, BufferSyncInterface::kParseNoError otherwise. | 821 // passed, BufferSyncInterface::kParseNoError otherwise. |
| 910 virtual ParseError SetRenderSurface(ResourceID render_surface_id, | 822 virtual ParseError SetRenderSurface(ResourceId render_surface_id, |
| 911 ResourceID depth_stencil_id) = 0; | 823 ResourceId depth_stencil_id) = 0; |
| 912 | 824 |
| 913 // Switch the render surface and depth stencil surface back to the main | 825 // Switch the render surface and depth stencil surface back to the main |
| 914 // surfaces stored in the render | 826 // surfaces stored in the render |
| 915 virtual void SetBackSurfaces() = 0; | 827 virtual void SetBackSurfaces() = 0; |
| 916 }; | 828 }; |
| 917 | 829 |
| 918 } // namespace command_buffer | 830 } // namespace command_buffer |
| 919 } // namespace o3d | 831 } // namespace o3d |
| 920 | 832 |
| 921 #endif // O3D_COMMAND_BUFFER_COMMON_CROSS_GAPI_INTERFACE_H_ | 833 #endif // O3D_COMMAND_BUFFER_COMMON_CROSS_GAPI_INTERFACE_H_ |
| OLD | NEW |