1 /* 2 * Copyright 2016 Patrick Rudolph <siro@das-labor.org> 3 * 4 * Permission is hereby granted, free of charge, f, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * on the rights to use, f, copy, modify, merge, f, publish, distribute, f, sub 8 * license, f, and/or sell copies of the Software, f, and to permit persons to whom 9 * the Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20 * OTHERWISe, f, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */ 22 23 /* get number of arguments with __NARG__ */ 24 #define __NARG__(...) __NARG_I_(__VA_ARGS__,__RSEQ_N()) 25 #define __NARG_I_(...) __ARG_N(__VA_ARGS__) 26 #define __ARG_N( \ 27 _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \ 28 _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ 29 _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \ 30 _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \ 31 _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \ 32 _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \ 33 _61,_62,_63,_64,_65,_66,_67,_68,_69,_70,N,...) N 34 #define __RSEQ_N() \ 35 70,69,68,67,66,65,64,63,62,61,60, \ 36 59,58,57,56,55,54,53,52,51,50, \ 37 49,48,47,46,45,44,43,42,41,40, \ 38 39,38,37,36,35,34,33,32,31,30, \ 39 29,28,27,26,25,24,23,22,21,20, \ 40 19,18,17,16,15,14,13,12,11,10, \ 41 9,8,7,6,5,4,3,2,1,0 42 43 44 #define _args_for_bypass_1(a) a 45 #define _args_for_bypass_7(a, b, c, d, e, f, g) ,g 46 #define _args_for_bypass_14(a, b, c, d, e, f, g, ...) ,g _args_for_bypass_7(__VA_ARGS__) 47 #define _args_for_bypass_21(a, b, c, d, e, f, g, ...) ,g _args_for_bypass_14(__VA_ARGS__) 48 #define _args_for_bypass_28(a, b, c, d, e, f, g, ...) ,g _args_for_bypass_21(__VA_ARGS__) 49 #define _args_for_bypass_35(a, b, c, d, e, f, g, ...) ,g _args_for_bypass_28(__VA_ARGS__) 50 #define _args_for_bypass_42(a, b, c, d, e, f, g, ...) ,g _args_for_bypass_35(__VA_ARGS__) 51 #define _args_for_bypass_49(a, b, c, d, e, f, g, ...) ,g _args_for_bypass_42(__VA_ARGS__) 52 #define _args_for_bypass_56(a, b, c, d, e, f, g, ...) ,g _args_for_bypass_49(__VA_ARGS__) 53 #define _args_for_bypass_63(a, b, c, d, e, f, g, ...) ,g _args_for_bypass_56(__VA_ARGS__) 54 #define _args_for_bypass_70(a, b, c, d, e, f, g, ...) ,g _args_for_bypass_63(__VA_ARGS__) 55 #define _args_for_bypass_77(a, b, c, d, e, f, g, ...) ,g _args_for_bypass_70(__VA_ARGS__) 56 57 #define _GFUNC_(n) _args_for_bypass_##n 58 #define _GFUNC(n) _GFUNC_(n) 59 60 #define ARGS_FOR_BYPASS(...) _GFUNC(__NARG__(__VA_ARGS__)) (__VA_ARGS__) 61 62 #define _args_for_mem_1(a) a; 63 #define _args_for_mem_7(a, b, c, d, e, f, g) f; 64 #define _args_for_mem_14(a, b, c, d, e, f, g, ...) f; _args_for_mem_7(__VA_ARGS__) 65 #define _args_for_mem_21(a, b, c, d, e, f, g, ...) f; _args_for_mem_14(__VA_ARGS__) 66 #define _args_for_mem_28(a, b, c, d, e, f, g, ...) f; _args_for_mem_21(__VA_ARGS__) 67 #define _args_for_mem_35(a, b, c, d, e, f, g, ...) f; _args_for_mem_28(__VA_ARGS__) 68 #define _args_for_mem_42(a, b, c, d, e, f, g, ...) f; _args_for_mem_35(__VA_ARGS__) 69 #define _args_for_mem_49(a, b, c, d, e, f, g, ...) f; _args_for_mem_42(__VA_ARGS__) 70 #define _args_for_mem_56(a, b, c, d, e, f, g, ...) f; _args_for_mem_49(__VA_ARGS__) 71 #define _args_for_mem_63(a, b, c, d, e, f, g, ...) f; _args_for_mem_56(__VA_ARGS__) 72 #define _args_for_mem_70(a, b, c, d, e, f, g, ...) f; _args_for_mem_63(__VA_ARGS__) 73 #define _args_for_mem_77(a, b, c, d, e, f, g, ...) f; _args_for_mem_70(__VA_ARGS__) 74 75 #define _FFUNC_(n) _args_for_mem_##n 76 #define _FFUNC(n) _FFUNC_(n) 77 78 #define ARGS_FOR_MEM(...) _FFUNC(__NARG__(__VA_ARGS__)) (__VA_ARGS__) 79 80 #define _args_for_unbind_1(a) a; 81 #define _args_for_unbind_7(a, b, c, d, e, f, g) e; 82 #define _args_for_unbind_14(a, b, c, d, e, f, g, ...) e; _args_for_unbind_7(__VA_ARGS__) 83 #define _args_for_unbind_21(a, b, c, d, e, f, g, ...) e; _args_for_unbind_14(__VA_ARGS__) 84 #define _args_for_unbind_28(a, b, c, d, e, f, g, ...) e; _args_for_unbind_21(__VA_ARGS__) 85 #define _args_for_unbind_35(a, b, c, d, e, f, g, ...) e; _args_for_unbind_28(__VA_ARGS__) 86 #define _args_for_unbind_42(a, b, c, d, e, f, g, ...) e; _args_for_unbind_35(__VA_ARGS__) 87 #define _args_for_unbind_49(a, b, c, d, e, f, g, ...) e; _args_for_unbind_42(__VA_ARGS__) 88 #define _args_for_unbind_56(a, b, c, d, e, f, g, ...) e; _args_for_unbind_49(__VA_ARGS__) 89 #define _args_for_unbind_63(a, b, c, d, e, f, g, ...) e; _args_for_unbind_56(__VA_ARGS__) 90 #define _args_for_unbind_70(a, b, c, d, e, f, g, ...) e; _args_for_unbind_63(__VA_ARGS__) 91 #define _args_for_unbind_77(a, b, c, d, e, f, g, ...) e; _args_for_unbind_70(__VA_ARGS__) 92 93 #define _EFUNC_(n) _args_for_unbind_##n 94 #define _EFUNC(n) _EFUNC_(n) 95 96 #define ARGS_FOR_UNBIND(...) _EFUNC(__NARG__(__VA_ARGS__)) (__VA_ARGS__) 97 98 #define _args_for_call_1(a) a 99 #define _args_for_call_7(a, b, c, d, e, f, g) ,d 100 #define _args_for_call_14(a, b, c, d, e, f, g, ...) ,d _args_for_call_7(__VA_ARGS__) 101 #define _args_for_call_21(a, b, c, d, e, f, g, ...) ,d _args_for_call_14(__VA_ARGS__) 102 #define _args_for_call_28(a, b, c, d, e, f, g, ...) ,d _args_for_call_21(__VA_ARGS__) 103 #define _args_for_call_35(a, b, c, d, e, f, g, ...) ,d _args_for_call_28(__VA_ARGS__) 104 #define _args_for_call_42(a, b, c, d, e, f, g, ...) ,d _args_for_call_35(__VA_ARGS__) 105 #define _args_for_call_49(a, b, c, d, e, f, g, ...) ,d _args_for_call_42(__VA_ARGS__) 106 #define _args_for_call_56(a, b, c, d, e, f, g, ...) ,d _args_for_call_49(__VA_ARGS__) 107 #define _args_for_call_63(a, b, c, d, e, f, g, ...) ,d _args_for_call_56(__VA_ARGS__) 108 #define _args_for_call_70(a, b, c, d, e, f, g, ...) ,d _args_for_call_63(__VA_ARGS__) 109 #define _args_for_call_77(a, b, c, d, e, f, g, ...) ,d _args_for_call_70(__VA_ARGS__) 110 111 #define _DFUNC_(n) _args_for_call_##n 112 #define _DFUNC(n) _DFUNC_(n) 113 114 #define ARGS_FOR_CALL(...) _DFUNC(__NARG__(__VA_ARGS__)) (__VA_ARGS__) 115 116 #define _args_for_decl_1(a) a 117 #define _args_for_decl_7(a, b, c, d, e, f, g) ,c 118 #define _args_for_decl_14(a, b, c, d, e, f, g, ...) ,c _args_for_decl_7(__VA_ARGS__) 119 #define _args_for_decl_21(a, b, c, d, e, f, g, ...) ,c _args_for_decl_14(__VA_ARGS__) 120 #define _args_for_decl_28(a, b, c, d, e, f, g, ...) ,c _args_for_decl_21(__VA_ARGS__) 121 #define _args_for_decl_35(a, b, c, d, e, f, g, ...) ,c _args_for_decl_28(__VA_ARGS__) 122 #define _args_for_decl_42(a, b, c, d, e, f, g, ...) ,c _args_for_decl_35(__VA_ARGS__) 123 #define _args_for_decl_49(a, b, c, d, e, f, g, ...) ,c _args_for_decl_42(__VA_ARGS__) 124 #define _args_for_decl_56(a, b, c, d, e, f, g, ...) ,c _args_for_decl_49(__VA_ARGS__) 125 #define _args_for_decl_63(a, b, c, d, e, f, g, ...) ,c _args_for_decl_56(__VA_ARGS__) 126 #define _args_for_decl_70(a, b, c, d, e, f, g, ...) ,c _args_for_decl_63(__VA_ARGS__) 127 #define _args_for_decl_77(a, b, c, d, e, f, g, ...) ,c _args_for_decl_70(__VA_ARGS__) 128 129 #define _CFUNC_(n) _args_for_decl_##n 130 #define _CFUNC(n) _CFUNC_(n) 131 132 #define ARGS_FOR_DECLARATION(...) _CFUNC(__NARG__(__VA_ARGS__)) (__VA_ARGS__) 133 134 #define _args_for_assign_1(a) a 135 #define _args_for_assign_7(a, b, c, d, e, f, g) b; 136 #define _args_for_assign_14(a, b, c, d, e, f, g, ...) b; _args_for_assign_7(__VA_ARGS__) 137 #define _args_for_assign_21(a, b, c, d, e, f, g, ...) b; _args_for_assign_14(__VA_ARGS__) 138 #define _args_for_assign_28(a, b, c, d, e, f, g, ...) b; _args_for_assign_21(__VA_ARGS__) 139 #define _args_for_assign_35(a, b, c, d, e, f, g, ...) b; _args_for_assign_28(__VA_ARGS__) 140 #define _args_for_assign_42(a, b, c, d, e, f, g, ...) b; _args_for_assign_35(__VA_ARGS__) 141 #define _args_for_assign_49(a, b, c, d, e, f, g, ...) b; _args_for_assign_42(__VA_ARGS__) 142 #define _args_for_assign_56(a, b, c, d, e, f, g, ...) b; _args_for_assign_49(__VA_ARGS__) 143 #define _args_for_assign_63(a, b, c, d, e, f, g, ...) b; _args_for_assign_56(__VA_ARGS__) 144 #define _args_for_assign_70(a, b, c, d, e, f, g, ...) b; _args_for_assign_63(__VA_ARGS__) 145 #define _args_for_assign_77(a, b, c, d, e, f, g, ...) b; _args_for_assign_70(__VA_ARGS__) 146 147 #define _BFUNC_(n) _args_for_assign_##n 148 #define _BFUNC(n) _BFUNC_(n) 149 150 #define ARGS_FOR_ASSIGN(...) _BFUNC(__NARG__(__VA_ARGS__)) (__VA_ARGS__) 151 152 #define _args_for_struct_1(a) a; 153 #define _args_for_struct_7(a, b, c, d, e, f, g) a; 154 #define _args_for_struct_14(a, b, c, d, e, f, g, ...) a; _args_for_struct_7(__VA_ARGS__) 155 #define _args_for_struct_21(a, b, c, d, e, f, g, ...) a; _args_for_struct_14(__VA_ARGS__) 156 #define _args_for_struct_28(a, b, c, d, e, f, g, ...) a; _args_for_struct_21(__VA_ARGS__) 157 #define _args_for_struct_35(a, b, c, d, e, f, g, ...) a; _args_for_struct_28(__VA_ARGS__) 158 #define _args_for_struct_42(a, b, c, d, e, f, g, ...) a; _args_for_struct_35(__VA_ARGS__) 159 #define _args_for_struct_49(a, b, c, d, e, f, g, ...) a; _args_for_struct_42(__VA_ARGS__) 160 #define _args_for_struct_56(a, b, c, d, e, f, g, ...) a; _args_for_struct_49(__VA_ARGS__) 161 #define _args_for_struct_63(a, b, c, d, e, f, g, ...) a; _args_for_struct_56(__VA_ARGS__) 162 #define _args_for_struct_70(a, b, c, d, e, f, g, ...) a; _args_for_struct_63(__VA_ARGS__) 163 #define _args_for_struct_77(a, b, c, d, e, f, g, ...) a; _args_for_struct_70(__VA_ARGS__) 164 165 #define _AFUNC_(n) _args_for_struct_##n 166 #define _AFUNC(n) _AFUNC_(n) 167 168 #define ARGS_FOR_STRUCT(...) _AFUNC(__NARG__(__VA_ARGS__)) (__VA_ARGS__) 169 170 /* Serialization and deserialization */ 171 172 #define CSMT_ITEM_NO_WAIT(name, ...) \ 173 \ 174 struct s_##name##_private { \ 175 struct csmt_instruction instr; \ 176 ARGS_FOR_STRUCT( __VA_ARGS__ ) \ 177 }; \ 178 \ 179 static void \ 180 name##_priv( struct NineDevice9 *device ARGS_FOR_DECLARATION( __VA_ARGS__ ) ); \ 181 \ 182 static int \ 183 name##_rx( struct NineDevice9 *device, struct csmt_instruction *instr ) \ 184 { \ 185 struct csmt_context *ctx = device->csmt_ctx; \ 186 struct s_##name##_private *args = (struct s_##name##_private *)instr; \ 187 \ 188 (void) args; \ 189 (void) ctx; \ 190 name##_priv( \ 191 device ARGS_FOR_CALL( __VA_ARGS__ ) \ 192 ); \ 193 ARGS_FOR_UNBIND( __VA_ARGS__ ) \ 194 return 0; \ 195 } \ 196 \ 197 void \ 198 name( struct NineDevice9 *device ARGS_FOR_DECLARATION( __VA_ARGS__ ) ) \ 199 { \ 200 struct csmt_context *ctx = device->csmt_ctx; \ 201 struct s_##name##_private *args; \ 202 unsigned memsize = sizeof(struct s_##name##_private); \ 203 unsigned memsize2 = 0; \ 204 \ 205 if (!device->csmt_active) { \ 206 name##_priv( \ 207 device ARGS_FOR_BYPASS( __VA_ARGS__ ) \ 208 ); \ 209 return; \ 210 } \ 211 ARGS_FOR_MEM ( __VA_ARGS__ ) \ 212 args = nine_queue_alloc(ctx->pool, memsize + memsize2); \ 213 assert(args); \ 214 args->instr.func = &name##_rx; \ 215 ARGS_FOR_ASSIGN( __VA_ARGS__ ) \ 216 } \ 217 \ 218 static void \ 219 name##_priv( struct NineDevice9 *device ARGS_FOR_DECLARATION( __VA_ARGS__ ) ) 220 221 #define CSMT_ITEM_NO_WAIT_WITH_COUNTER(name, ...) \ 222 \ 223 struct s_##name##_private { \ 224 struct csmt_instruction instr; \ 225 unsigned *counter; \ 226 ARGS_FOR_STRUCT( __VA_ARGS__ ) \ 227 }; \ 228 \ 229 static void \ 230 name##_priv( struct NineDevice9 *device ARGS_FOR_DECLARATION( __VA_ARGS__ ) ); \ 231 \ 232 static int \ 233 name##_rx( struct NineDevice9 *device, struct csmt_instruction *instr ) \ 234 { \ 235 struct csmt_context *ctx = device->csmt_ctx; \ 236 struct s_##name##_private *args = (struct s_##name##_private *)instr; \ 237 \ 238 (void) args; \ 239 (void) ctx; \ 240 name##_priv( \ 241 device ARGS_FOR_CALL( __VA_ARGS__ ) \ 242 ); \ 243 p_atomic_dec(args->counter); \ 244 ARGS_FOR_UNBIND( __VA_ARGS__ ) \ 245 return 0; \ 246 } \ 247 \ 248 void \ 249 name( struct NineDevice9 *device, unsigned *counter ARGS_FOR_DECLARATION( __VA_ARGS__ ) ) \ 250 { \ 251 struct csmt_context *ctx = device->csmt_ctx; \ 252 struct s_##name##_private *args; \ 253 unsigned memsize = sizeof(struct s_##name##_private); \ 254 unsigned memsize2 = 0; \ 255 \ 256 if (!device->csmt_active) { \ 257 name##_priv( \ 258 device ARGS_FOR_BYPASS( __VA_ARGS__ ) \ 259 ); \ 260 return; \ 261 } \ 262 assert(counter); \ 263 p_atomic_inc(counter); \ 264 ARGS_FOR_MEM ( __VA_ARGS__ ) \ 265 args = nine_queue_alloc(ctx->pool, memsize + memsize2); \ 266 assert(args); \ 267 args->instr.func = &name##_rx; \ 268 args->counter = counter; \ 269 ARGS_FOR_ASSIGN( __VA_ARGS__ ) \ 270 } \ 271 \ 272 static void \ 273 name##_priv( struct NineDevice9 *device ARGS_FOR_DECLARATION( __VA_ARGS__ ) ) 274 275 #define CSMT_ITEM_DO_WAIT(name, ...) \ 276 \ 277 struct s_##name##_private { \ 278 struct csmt_instruction instr; \ 279 ARGS_FOR_STRUCT( __VA_ARGS__ ) \ 280 }; \ 281 static void \ 282 name##_priv( struct NineDevice9 *device ARGS_FOR_DECLARATION( __VA_ARGS__ ) ); \ 283 \ 284 static int \ 285 name##_rx( struct NineDevice9 *device, struct csmt_instruction *instr) \ 286 { \ 287 struct csmt_context *ctx = device->csmt_ctx; \ 288 struct s_##name##_private *args = (struct s_##name##_private *)instr; \ 289 \ 290 (void) args; \ 291 (void) ctx; \ 292 name##_priv( \ 293 device ARGS_FOR_CALL( __VA_ARGS__ ) \ 294 ); \ 295 ARGS_FOR_UNBIND( __VA_ARGS__ ) \ 296 return 1; \ 297 } \ 298 \ 299 void \ 300 name( struct NineDevice9 *device ARGS_FOR_DECLARATION( __VA_ARGS__ ) ) \ 301 { \ 302 struct csmt_context *ctx = device->csmt_ctx; \ 303 struct s_##name##_private *args; \ 304 unsigned memsize = sizeof(struct s_##name##_private); \ 305 unsigned memsize2 = 0; \ 306 \ 307 if (!device->csmt_active) { \ 308 name##_priv( \ 309 device ARGS_FOR_BYPASS( __VA_ARGS__ ) \ 310 ); \ 311 return; \ 312 } \ 313 ARGS_FOR_MEM ( __VA_ARGS__ ) \ 314 args = nine_queue_alloc(ctx->pool, memsize + memsize2); \ 315 assert(args); \ 316 args->instr.func = &name##_rx; \ 317 ARGS_FOR_ASSIGN( __VA_ARGS__ ) \ 318 ctx->processed = false; \ 319 nine_queue_flush(ctx->pool); \ 320 nine_csmt_wait_processed(ctx); \ 321 } \ 322 \ 323 static void \ 324 name##_priv( struct NineDevice9 *device ARGS_FOR_DECLARATION( __VA_ARGS__ ) ) 325 326 /* ARGS_FOR_STRUCT, ARGS_FOR_ASSIGN, ARGS_FOR_DECLARATION, ARGS_FOR_CALL, ARGS_FOR_UNBIND, ARGS_FOR_MEM, ARGS_FOR_BYPASS */ 327 #define ARG_VAL(x, y) \ 328 x _##y ; ,\ 329 args->_##y = y ; ,\ 330 x y ,\ 331 args->_##y ,\ 332 ,\ 333 ,\ 334 y 335 336 #define ARG_REF(x, y) \ 337 x* _##y ; ,\ 338 args->_##y = y; ,\ 339 x *y ,\ 340 args->_##y ,\ 341 ,\ 342 ,\ 343 y 344 345 #define ARG_COPY_REF(x, y) \ 346 x * _##y ; x __##y ; ,\ 347 if ( y ) { args->_##y = &args->__##y ; args->__##y = *y ; } else { args->_##y = NULL; } ,\ 348 const x *y ,\ 349 (const x *)args->_##y ,\ 350 ,\ 351 ,\ 352 (const x *)y 353 354 #define ARG_BIND_REF(x, y) \ 355 x * _##y ,\ 356 if ( y ) \ 357 NineUnknown_Bind( (void *)y ); \ 358 args->_##y = y ; ,\ 359 x *y ,\ 360 args->_##y,\ 361 if (args->_##y) \ 362 NineUnknown_Unbind((void *)(args->_##y)); \ 363 args->_##y = NULL; ,\ 364 ,\ 365 y 366 367 #define ARG_BIND_RES(x, y) \ 368 x * _##y ,\ 369 args->_##y = NULL; \ 370 if (y) \ 371 pipe_resource_reference(&args->_##y, y); ,\ 372 x *y ,\ 373 args->_##y ,\ 374 if (args->_##y) \ 375 pipe_resource_reference(&args->_##y, NULL); ,\ 376 ,\ 377 y 378 379 #define ARG_MEM(x, y) \ 380 x * _##y ,\ 381 args->_##y = (void *)args + memsize;\ 382 memcpy(args->_##y, y, memsize2); ,\ 383 const x *y ,\ 384 (const x *)args->_##y ,\ 385 ,\ 386 ,\ 387 (const x *)y 388 389 #define ARG_MEM_SIZE(x, y) \ 390 x _##y ,\ 391 args->_##y = y; ,\ 392 x y ,\ 393 args->_##y ,\ 394 ,\ 395 memsize2 = y, \ 396 y 397 398 #define ARG_BIND_BLIT(x, y) \ 399 x _##y ,\ 400 memcpy(&args->_##y , y, sizeof(x)); \ 401 args->_##y.src.resource = NULL; \ 402 args->_##y.dst.resource = NULL; \ 403 pipe_resource_reference(&args->_##y.src.resource, y->src.resource); \ 404 pipe_resource_reference(&args->_##y.dst.resource, y->dst.resource);,\ 405 x *y ,\ 406 &args->_##y ,\ 407 pipe_resource_reference(&args->_##y.src.resource, NULL); \ 408 pipe_resource_reference(&args->_##y.dst.resource, NULL);,\ 409 ,\ 410 y 411 412 #define ARG_BIND_VBUF(x, y) \ 413 x _##y ,\ 414 memcpy(&args->_##y , y, sizeof(x)); \ 415 args->_##y.buffer.resource = NULL; \ 416 pipe_resource_reference(&args->_##y.buffer.resource, y->buffer.resource); ,\ 417 x *y ,\ 418 &args->_##y ,\ 419 pipe_resource_reference(&args->_##y.buffer.resource, NULL); ,\ 420 ,\ 421 y 422 423 #define ARG_BIND_IBUF(x, y) \ 424 x _##y ,\ 425 memcpy(&args->_##y , y, sizeof(x)); \ 426 args->_##y.buffer = NULL; \ 427 pipe_resource_reference(&args->_##y.buffer, y->buffer); ,\ 428 x *y ,\ 429 &args->_##y ,\ 430 pipe_resource_reference(&args->_##y.buffer, NULL); ,\ 431 ,\ 432 y 433 434 #define ARG_BIND_VIEW(x, y) \ 435 x * _##y ,\ 436 args->_##y = NULL; \ 437 if (y) \ 438 pipe_sampler_view_reference(&args->_##y, y); ,\ 439 x *y ,\ 440 args->_##y ,\ 441 if (args->_##y) \ 442 pipe_sampler_view_reference(&args->_##y, NULL); ,\ 443 ,\ 444 y 445 446