Advertisement

d3d11: draw several rectangles with a single drawIndexed*() call for performance ?

Started by August 01, 2022 06:34 PM
12 comments, last by Aerodactyl55 2 years, 6 months ago

Aerodactyl55 said:

vtorri said:

I get a “page not found” when I click on that link.

Call DrawIndex with the IndexCount parameter set to the number of required indices (for 2 rectangles it should be 12), the rest can be set to zero.

then try to copy the address `https://git.enlightenment.org/vtorri/Direct3D/src/branch/master/src/d3d_5.c​`​ and paste it in the browser. It works for me

Still doesn't work. Maybe you should post the relevant code.

https://pastebin.com/C3Fv0Qfr

@vtorri 

3DGraphics,Direct3D12,Vulkan,OpenCL,Algorithms

Advertisement

@vtorri You are creating one vertex/index buffer for each rectangle. You should create one vertex buffer large enough for all rectangles you want to draw, generate the vertices for each rectangle and copy to the vertex buffer, then you can draw all the rectangles with a single draw call. The index buffer can be static (with pre-generated indices), since you want to draw rectangles only.

This topic is closed to new replies.

Advertisement