{"id":878,"date":"2020-01-03T14:45:43","date_gmt":"2020-01-03T06:45:43","guid":{"rendered":"http:\/\/blog.coolcoding.cn\/?p=878"},"modified":"2020-12-17T21:33:53","modified_gmt":"2020-12-17T13:33:53","slug":"unity%e9%94%99%e8%af%af%ef%bc%9adrawmesh-requires-material-setpass-before","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=878","title":{"rendered":"[Unity]\u9519\u8bef\uff1aDrawMesh requires material.SetPass before!"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>    private int GetScore()\n    {\n        var mMatObj = Resources.Load(\"Benchmark\/Mat\") as Material;\n        if (mMatObj.SetPass(0))\n        {\n            for(uint i=0; i&lt;1000; ++i)\n            {\n                Graphics.DrawMeshNow(mMeshObj, m);\n            }\n        }\n        return 0;\n    }<\/code><\/pre>\n\n\n\n<p>\u7531\u4e8eMaterial\u4e2d\u7684Shader\u5931\u6548\uff0c\u4f1a\u5bfc\u81f4SetPass0\u6210\u529f\uff0c\u4f46\u662f\u5728DrawMeshNow\u4e2d\u62a5\u9519\uff1aDrawMesh requires material.SetPass before!<\/p>\n\n\n\n<p>\u628aShader\u4fee\u6b63\u5373\u53ef<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7531\u4e8eMaterial\u4e2d\u7684Shader\u5931\u6548\uff0c\u4f1a\u5bfc\u81f4SetPass0\u6210\u529f\uff0c\u4f46\u662f\u5728DrawMeshNow\u4e2d\u62a5\u9519\uff1aDr [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[18],"_links":{"self":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/878"}],"collection":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=878"}],"version-history":[{"count":1,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/878\/revisions"}],"predecessor-version":[{"id":879,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/878\/revisions\/879"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}