Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Unified Diff: command_buffer/service/win/d3d9/d3d9_utils.h

Issue 147237: Adding GetStreamInfo functionality (and passing corresponding unit test). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: command_buffer/service/win/d3d9/d3d9_utils.h
===================================================================
--- command_buffer/service/win/d3d9/d3d9_utils.h (revision 19749)
+++ command_buffer/service/win/d3d9/d3d9_utils.h (working copy)
@@ -96,6 +96,59 @@
FloatToClampedByte(color.alpha));
}
+inline bool VerifyHResult(HRESULT hr, const char* file, int line,
+ const char* call) {
+ if (FAILED(hr)) {
+ DLOG(ERROR) << "DX Error in file " << file
+ << " line " << line << L": "
+ << DXGetErrorStringA(hr) << L": " << call;
+ return false;
+ }
+ return true;
+}
+
+static bool D3DSemanticToCBSemantic(
+ D3DDECLUSAGE semantic,
+ unsigned int semantic_index,
+ vertex_struct::Semantic *out_semantic,
+ unsigned int *out_semantic_index) {
+ // TODO: what meaning do we really want to put to our semantics ? How
+ // do they match the semantics that are set in the effect ? What combination
+ // of (semantic, index) are supposed to work ?
+ switch (semantic) {
+ case D3DDECLUSAGE_POSITION:
+ if (semantic_index != 0) return false;
+ *out_semantic = vertex_struct::POSITION;
+ *out_semantic_index = 0;
+ return true;
+ case D3DDECLUSAGE_NORMAL:
+ if (semantic_index != 0) return false;
+ *out_semantic = vertex_struct::NORMAL;
+ *out_semantic_index = 0;
+ return true;
+ case D3DDECLUSAGE_TANGENT:
+ if (semantic_index != 0) return false;
+ *out_semantic = vertex_struct::TEX_COORD;
+ *out_semantic_index = 6;
+ return true;
+ case D3DDECLUSAGE_BINORMAL:
+ if (semantic_index != 0) return false;
+ *out_semantic = vertex_struct::TEX_COORD;
+ *out_semantic_index = 7;
+ return true;
+ case D3DDECLUSAGE_COLOR:
+ if (semantic_index > 1) return false;
+ *out_semantic = vertex_struct::COLOR;
+ *out_semantic_index = semantic_index;
+ return true;
+ case D3DDECLUSAGE_TEXCOORD:
+ *out_semantic = vertex_struct::TEX_COORD;
+ *out_semantic_index = semantic_index;
+ return true;
+ default:
+ return false;
+ }
+}
} // namespace command_buffer
} // namespace o3d

Powered by Google App Engine
This is Rietveld 408576698