开发者

Using OpenGL draw_indirect with OpenCL

开发者 https://www.devze.com 2023-02-15 06:17 出处:网络
I don\'t quite have a 100% clear picture how the Draw Instanced/Draw Indirect family of functions all the way down to glDrawElementsInstancedBaseVertexBaseInstance work together.

I don't quite have a 100% clear picture how the Draw Instanced/Draw Indirect family of functions all the way down to glDrawElementsInstancedBaseVertexBaseInstance work together.

Using OpenGL 4.0+ & OpenCL interop capable hardware and drivers, how (if possible) can we leverage tools like draw indirect (now also multi draw indirect) to draw an instanced geometry across multiple frames while changing geometry on the GPU?

For example, could one tessellate a shape then apply some filter to the shape via opencl all while referring to geometries the CPU will only need to cull out when needed?

*Or开发者_如何学Goiginal post has been heavily edited


It's not clear what you're asking here. The CL/GL interop defined by Khronos is thus far limited to shared buffers/textures and some event handling stuff, none of which seems related to tessellation. Since tessellation is a task specific to rasterization of polygon-based models, it is unlikely to ever be relevant enough to warrant a mention in the CL spec. If you're wondering whether tessellation hardware will be used by a CL implementation, then that depends entirely on the specific hardware capabilities and the CL implementation.

Update:

There are two kinds of tessellation shaders. Tessellation Control Shaders take in a patch (collection of triangles or quads) and compute some per-vertex attributes, most importantly, a number that controls the amount of subdivision that should be performed.

After the tessellation control shader runs, the resulting patch is passed to a fixed-function hardware unit that performs the actual subdivision to generate a new patch with more polygons.

After the subdivision, a Tessellation Evaluation Shader can compute attributes for each of the vertices in the patch generated by the subdivision process. This is the step in the process where you would, for example, lookup information in a displacement map stored as a texture.

Since the CL/GL interop only allows for buffer-based data exchange, in order to use CL for tessellation you would have to implement the entire tessellation process as essentially a preprocessor for your vertex data, and you would not be able to access from CL any dedicated hardware for the subdivision step. Since current hardware does (as far as I know) include a fixed-function subdivider instead of using general-purpose compute units, a tessellator implemented in CL would almost certainly be at a disadvantage for performance.

0

精彩评论

暂无评论...
验证码 换一张
取 消