asm_util.h revision 544dd4b11f7be76bb00fe29a60eaf2772dcc69ca
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 31static const char pass_through_depth_asm[] = 32 "FRAG1.1\n" 33 "DCL IN[0], POSITION, LINEAR\n" 34 "DCL OUT[0].z, POSITION, CONSTANT\n" 35 "0: MOV OUT[0].z, IN[0].zzzz\n" 36 "1: END\n"; 37 38 39 40/* μnew = μmask */ 41static const char set_mask_asm[] = 42 "FRAG1.1\n" 43 "DCL IN[0], GENERIC[0], PERSPECTIVE\n" 44 "DCL SAMP[0], CONSTANT\n" 45 "DCL OUT[0], COLOR, CONSTANT\n" 46 "0: TEX OUT[0], IN[0], SAMP[0], 2D\n"/*umask*/ 47 "1: END\n"; 48 49/* μnew = 1 – (1 – μmask)*(1 – μprev) */ 50static const char union_mask_asm[] = 51 "FRAG1.1\n" 52 "DCL IN[0], GENERIC[0], PERSPECTIVE\n" 53 "DCL IN[1], POSITION, LINEAR\n" 54 "DCL CONST[0], CONSTANT\n" 55 "DCL SAMP[0..1], CONSTANT\n" 56 "DCL TEMP[0..3], CONSTANT\n" 57 "DCL OUT[0], COLOR, CONSTANT\n" 58 "0: TEX TEMP[1], IN[0], SAMP[0], 2D\n"/*umask*/ 59 "1: TEX TEMP[0], IN[1], SAMP[1], 2D\n"/*uprev*/ 60 "2: SUB TEMP[2], CONST[0], TEMP[0]\n" 61 "3: SUB TEMP[3], CONST[0], TEMP[1]\n" 62 "4: MUL TEMP[0].w, TEMP[2].wwww, TEMP[3].wwww\n" 63 "5: SUB OUT[0], CONST[0], TEMP[0]\n" 64 "6: END\n"; 65 66/* μnew = μmask *μprev */ 67static const char intersect_mask_asm[] = 68 "FRAG1.1\n" 69 "DCL IN[0], GENERIC[0], PERSPECTIVE\n" 70 "DCL IN[1], POSITION, LINEAR\n" 71 "DCL CONST[0], CONSTANT\n" 72 "DCL SAMP[0..1], CONSTANT\n" 73 "DCL TEMP[0..1], CONSTANT\n" 74 "DCL OUT[0], COLOR, CONSTANT\n" 75 "0: TEX TEMP[0], IN[1], SAMP[1], 2D\n"/*uprev*/ 76 "1: TEX TEMP[1], IN[0], SAMP[0], 2D\n"/*umask*/ 77 "2: MUL OUT[0], TEMP[0].wwww, TEMP[1].wwww\n" 78 "3: END\n"; 79 80/* μnew = μprev*(1 – μmask) */ 81static const char subtract_mask_asm[] = 82 "FRAG1.1\n" 83 "DCL IN[0], GENERIC[0], PERSPECTIVE\n" 84 "DCL IN[1], POSITION, LINEAR\n" 85 "DCL CONST[0], CONSTANT\n" 86 "DCL SAMP[0..1], CONSTANT\n" 87 "DCL TEMP[0..2], CONSTANT\n" 88 "DCL OUT[0], COLOR, CONSTANT\n" 89 "0: TEX TEMP[1], IN[0], SAMP[0], 2D\n"/*umask*/ 90 "1: TEX TEMP[0], IN[1], SAMP[1], 2D\n"/*uprev*/ 91 "2: SUB TEMP[2], CONST[0], TEMP[1]\n" 92 "3: MUL OUT[0], TEMP[2].wwww, TEMP[0].wwww\n" 93 "4: END\n"; 94 95 96static const char vs_plain_asm[] = 97 "VERT1.1\n" 98 "DCL IN[0]\n" 99 "DCL OUT[0], POSITION\n" 100 "DCL TEMP[0]\n" 101 "DCL CONST[0..1]\n" 102 "0: MUL TEMP[0], IN[0], CONST[0]\n" 103 "1: ADD TEMP[0], TEMP[0], CONST[1]\n" 104 "2: MOV OUT[0], TEMP[0]\n" 105 "3: END\n"; 106 107static const char vs_clear_asm[] = 108 "VERT1.1\n" 109 "DCL IN[0]\n" 110 "DCL IN[1]\n" 111 "DCL OUT[0], POSITION\n" 112 "DCL OUT[1], COLOR\n" 113 "DCL TEMP[0]\n" 114 "DCL CONST[0..1]\n" 115 "0: MUL TEMP[0], IN[0], CONST[0]\n" 116 "1: ADD TEMP[0], TEMP[0], CONST[1]\n" 117 "2: MOV OUT[0], TEMP[0]\n" 118 "3: MOV OUT[1], IN[1]\n" 119 "4: END\n"; 120 121 122static const char vs_texture_asm[] = 123 "VERT1.1\n" 124 "DCL IN[0]\n" 125 "DCL IN[1]\n" 126 "DCL OUT[0], POSITION\n" 127 "DCL OUT[1], GENERIC\n" 128 "DCL TEMP[0]\n" 129 "DCL CONST[0..1]\n" 130 "0: MUL TEMP[0], IN[0], CONST[0]\n" 131 "1: ADD TEMP[0], TEMP[0], CONST[1]\n" 132 "2: MOV OUT[0], TEMP[0]\n" 133 "3: MOV OUT[1], IN[1]\n" 134 "4: END\n"; 135 136#endif 137