1 /************************************************************************** 2 * 3 * Copyright 2009 VMware, Inc. All Rights Reserved. 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the 7 * "Software"), to deal in the Software without restriction, including 8 * without limitation the rights to use, copy, modify, merge, publish, 9 * distribute, sub license, and/or sell copies of the Software, and to 10 * permit persons to whom the Software is furnished to do so, subject to 11 * the following conditions: 12 * 13 * The above copyright notice and this permission notice (including the 14 * next paragraph) shall be included in all copies or substantial portions 15 * of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 * 25 **************************************************************************/ 26 27 #ifndef ASM_UTIL_H 28 #define ASM_UTIL_H 29 30 /* μnew = μmask */ 31 static const char set_mask_asm[] = 32 "FRAG\n" 33 "DCL IN[0], GENERIC[0], PERSPECTIVE\n" 34 "DCL SAMP[0], CONSTANT\n" 35 "DCL OUT[0], COLOR, CONSTANT\n" 36 "0: TEX OUT[0], IN[0], SAMP[0], 2D\n"/*umask*/ 37 "1: END\n"; 38 39 /* μnew = 1 – (1 – μmask)*(1 – μprev) */ 40 static const char union_mask_asm[] = 41 "FRAG\n" 42 "DCL IN[0], GENERIC[0], PERSPECTIVE\n" 43 "DCL IN[1], POSITION, LINEAR\n" 44 "DCL CONST[0], CONSTANT\n" 45 "DCL SAMP[0..1], CONSTANT\n" 46 "DCL TEMP[0..3], CONSTANT\n" 47 "DCL OUT[0], COLOR, CONSTANT\n" 48 "0: TEX TEMP[1], IN[0], SAMP[0], 2D\n"/*umask*/ 49 "1: TEX TEMP[0], IN[1], SAMP[1], 2D\n"/*uprev*/ 50 "2: SUB TEMP[2], CONST[0], TEMP[0]\n" 51 "3: SUB TEMP[3], CONST[0], TEMP[1]\n" 52 "4: MUL TEMP[0].w, TEMP[2].wwww, TEMP[3].wwww\n" 53 "5: SUB OUT[0], CONST[0], TEMP[0]\n" 54 "6: END\n"; 55 56 /* μnew = μmask *μprev */ 57 static const char intersect_mask_asm[] = 58 "FRAG\n" 59 "DCL IN[0], GENERIC[0], PERSPECTIVE\n" 60 "DCL IN[1], POSITION, LINEAR\n" 61 "DCL CONST[0], CONSTANT\n" 62 "DCL SAMP[0..1], CONSTANT\n" 63 "DCL TEMP[0..1], CONSTANT\n" 64 "DCL OUT[0], COLOR, CONSTANT\n" 65 "0: TEX TEMP[0], IN[1], SAMP[1], 2D\n"/*uprev*/ 66 "1: TEX TEMP[1], IN[0], SAMP[0], 2D\n"/*umask*/ 67 "2: MUL OUT[0], TEMP[0].wwww, TEMP[1].wwww\n" 68 "3: END\n"; 69 70 /* μnew = μprev*(1 – μmask) */ 71 static const char subtract_mask_asm[] = 72 "FRAG\n" 73 "DCL IN[0], GENERIC[0], PERSPECTIVE\n" 74 "DCL IN[1], POSITION, LINEAR\n" 75 "DCL CONST[0], CONSTANT\n" 76 "DCL SAMP[0..1], CONSTANT\n" 77 "DCL TEMP[0..2], CONSTANT\n" 78 "DCL OUT[0], COLOR, CONSTANT\n" 79 "0: TEX TEMP[1], IN[0], SAMP[0], 2D\n"/*umask*/ 80 "1: TEX TEMP[0], IN[1], SAMP[1], 2D\n"/*uprev*/ 81 "2: SUB TEMP[2], CONST[0], TEMP[1]\n" 82 "3: MUL OUT[0], TEMP[2].wwww, TEMP[0].wwww\n" 83 "4: END\n"; 84 85 #endif 86