| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 108 } |
| 109 | 109 |
| 110 static bool D3DSemanticToCBSemantic( | 110 static bool D3DSemanticToCBSemantic( |
| 111 D3DDECLUSAGE semantic, | 111 D3DDECLUSAGE semantic, |
| 112 unsigned int semantic_index, | 112 unsigned int semantic_index, |
| 113 vertex_struct::Semantic *out_semantic, | 113 vertex_struct::Semantic *out_semantic, |
| 114 unsigned int *out_semantic_index) { | 114 unsigned int *out_semantic_index) { |
| 115 // TODO: what meaning do we really want to put to our semantics ? How | 115 // TODO: what meaning do we really want to put to our semantics ? How |
| 116 // do they match the semantics that are set in the effect ? What combination | 116 // do they match the semantics that are set in the effect ? What combination |
| 117 // of (semantic, index) are supposed to work ? | 117 // of (semantic, index) are supposed to work ? |
| 118 // TODO(gman): This is just plain wrong! Fix it. Converting binormal to |
| 119 // texcoord 7 means there will be conflicts if I have both a Binormal and a |
| 120 // texcoord 7 or 2 binormals both of which we have examples of already in O3D! |
| 118 switch (semantic) { | 121 switch (semantic) { |
| 119 case D3DDECLUSAGE_POSITION: | 122 case D3DDECLUSAGE_POSITION: |
| 120 if (semantic_index != 0) return false; | 123 if (semantic_index != 0) return false; |
| 121 *out_semantic = vertex_struct::POSITION; | 124 *out_semantic = vertex_struct::kPosition; |
| 122 *out_semantic_index = 0; | 125 *out_semantic_index = 0; |
| 123 return true; | 126 return true; |
| 124 case D3DDECLUSAGE_NORMAL: | 127 case D3DDECLUSAGE_NORMAL: |
| 125 if (semantic_index != 0) return false; | 128 if (semantic_index != 0) return false; |
| 126 *out_semantic = vertex_struct::NORMAL; | 129 *out_semantic = vertex_struct::kNormal; |
| 127 *out_semantic_index = 0; | 130 *out_semantic_index = 0; |
| 128 return true; | 131 return true; |
| 129 case D3DDECLUSAGE_TANGENT: | 132 case D3DDECLUSAGE_TANGENT: |
| 130 if (semantic_index != 0) return false; | 133 if (semantic_index != 0) return false; |
| 131 *out_semantic = vertex_struct::TEX_COORD; | 134 *out_semantic = vertex_struct::kTexCoord; |
| 132 *out_semantic_index = 6; | 135 *out_semantic_index = 6; |
| 133 return true; | 136 return true; |
| 134 case D3DDECLUSAGE_BINORMAL: | 137 case D3DDECLUSAGE_BINORMAL: |
| 135 if (semantic_index != 0) return false; | 138 if (semantic_index != 0) return false; |
| 136 *out_semantic = vertex_struct::TEX_COORD; | 139 *out_semantic = vertex_struct::kTexCoord; |
| 137 *out_semantic_index = 7; | 140 *out_semantic_index = 7; |
| 138 return true; | 141 return true; |
| 139 case D3DDECLUSAGE_COLOR: | 142 case D3DDECLUSAGE_COLOR: |
| 140 if (semantic_index > 1) return false; | 143 if (semantic_index > 1) return false; |
| 141 *out_semantic = vertex_struct::COLOR; | 144 *out_semantic = vertex_struct::kColor; |
| 142 *out_semantic_index = semantic_index; | 145 *out_semantic_index = semantic_index; |
| 143 return true; | 146 return true; |
| 144 case D3DDECLUSAGE_TEXCOORD: | 147 case D3DDECLUSAGE_TEXCOORD: |
| 145 *out_semantic = vertex_struct::TEX_COORD; | 148 *out_semantic = vertex_struct::kTexCoord; |
| 146 *out_semantic_index = semantic_index; | 149 *out_semantic_index = semantic_index; |
| 147 return true; | 150 return true; |
| 148 default: | 151 default: |
| 149 return false; | 152 return false; |
| 150 } | 153 } |
| 151 } | 154 } |
| 152 } // namespace command_buffer | 155 } // namespace command_buffer |
| 153 } // namespace o3d | 156 } // namespace o3d |
| 154 | 157 |
| 155 #endif // O3D_COMMAND_BUFFER_SERVICE_WIN_D3D9_D3D9_UTILS_H_ | 158 #endif // O3D_COMMAND_BUFFER_SERVICE_WIN_D3D9_D3D9_UTILS_H_ |
| OLD | NEW |