开发者

How expensive are OpenGL operations?

开发者 https://www.devze.com 2022-12-20 17:38 出处:网络
I\'m curious how expensive functions like: glViewPort glLoadIdentity glOrtho are in terms of both the work done on the CPU and the 开发者_StackOverflowwork done on the GPU.

I'm curious how expensive functions like:

glViewPort
glLoadIdentity
glOrtho

are in terms of both the work done on the CPU and the 开发者_StackOverflowwork done on the GPU.

Where is this documented?


This kind of thing is probably pretty dependent on your platform. Your best bet is probably to use a profiler yourself if you're worried about it.


As Alex O'Konski mentions, this is highly dependent on the platform.

That said, if you're interested in recent graphics cards of the PCs, You should know that most of them don't "do work" on the GPU. they set up state for future draw calls.

This is important because their cost is more related with how well the GPU can pipeline them between various draw calls that flow through the chip than how much time it takes to change a register from one value to the next.

Most platform vendors do not document at all what the costs of various state changes are. They don't document how OpenGL state maps to their hardware state, for that matter.

Last, state changes like matrix state (glLoadIdentity and glOrtho) are a remnant of the past. In modern graphics cards, they are simply helper (CPU) functions to set up uniforms (and this is why they are deprecated in core GL 3.1). And all the math they require (usually not much) is done on the CPU, inside the driver.

0

精彩评论

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