{"id":2820,"date":"2014-05-04T16:21:28","date_gmt":"2014-05-04T15:21:28","guid":{"rendered":"http:\/\/positech.co.uk\/cliffsblog\/?p=2820"},"modified":"2014-08-04T15:40:10","modified_gmt":"2014-08-04T14:40:10","slug":"my-big-slowdown-function","status":"publish","type":"post","link":"https:\/\/www.positech.co.uk\/cliffsblog\/2014\/05\/04\/my-big-slowdown-function\/","title":{"rendered":"My big slowdown function"},"content":{"rendered":"<p>Well I feared as much when I wrote this:<a href=\"http:\/\/positech.co.uk\/cliffsblog\/2014\/04\/14\/reading-back-from-gpu-memory-in-directx9\"> http:\/\/positech.co.uk\/cliffsblog\/2014\/04\/14\/reading-back-from-gpu-memory-in-directx9<\/a> but it turns out that, yup, that function is the slowest in the entire engine, at least until battle is joined. I really need to fix it.<\/p>\n<p>Essentially what I&#8217;m doing there is maintaining a depth buffer for objects in the game. I then do some fancy processing on that buffer (all taking place in video card memory. I then really badly need to know the values of the depth buffer for about 100 different points, and based on the outcome of that, I either don&#8217;t draw, draw some stuff quite small, or draw it really big. In short, I&#8217;m scaling an object based on specific values of the depth buffer.<\/p>\n<p>Right now, my engine does not use vertex shaders at all. I just use pixel shaders, and have vertex shaders as NULL. I&#8217;m pretty sure the solution to my problem is easy if I go to draw all of these objects, then write a vertex shader that can scale the object accordingly. the thing is, I&#8217;m using directx9 and therefore I really do have separate vertex and pixel; shaders. This is going to involve me reading up on the most undocumented stuff ever, which how vertex shaders and pixel shaders can be used in a 2D game under directx9.<\/p>\n<p>Bah.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well I feared as much when I wrote this: http:\/\/positech.co.uk\/cliffsblog\/2014\/04\/14\/reading-back-from-gpu-memory-in-directx9 but it turns out that, yup, that function is the slowest in the entire engine, at least until battle is joined. I really need to fix it. Essentially what I&#8217;m doing there is maintaining a depth buffer for objects in the game. I then do<\/p>\n<p class=\"text-right\"><span class=\"screen-reader-text\">Continue Reading&#8230; My big slowdown function<\/span><a class=\"btn btn-secondary continue-reading\" href=\"https:\/\/www.positech.co.uk\/cliffsblog\/2014\/05\/04\/my-big-slowdown-function\/\">Continue Reading&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[119,4],"tags":[],"class_list":["post-2820","post","type-post","status-publish","format-standard","hentry","category-gsb2","category-programming"],"_links":{"self":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/2820","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/comments?post=2820"}],"version-history":[{"count":3,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/2820\/revisions"}],"predecessor-version":[{"id":2951,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/2820\/revisions\/2951"}],"wp:attachment":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/media?parent=2820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/categories?post=2820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/tags?post=2820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}