What I mean by “state of graphics” is, how polygons, textures, lighting and any other scene elements are stored and computed for any particular frame.
The closest to what you are asking and that I know of is RenderDoc. I have not tested it myself so far, but some features they list in their documentation that are related to your question are:
- Full graphics pipeline state display
- Shader source display
- Flexible resource inspector
- Mesh buffer inspection and visualisation
- ‘Raw’ buffer inspection for buffers
- Texture/render target viewer
I’m looking to somehow programmatically query the state of graphics during a PC gameplay session.
...
Is there any need to be game engine specific in this matter, or will all games be drawn to the screen in the same way?
I am not sure here if you are asking to dissect the graphics state of a commercial game or software that is not written by yourself. If so, there is no guarantee that RenderDoc can capture data but it is possible. See for example this issue on their GitHub page, where the author says:
However I want to be clear that I cannot and do not support capturing 3rd party programs that you do not control. It generally works but for obvious reasons I don't provide any help with problems...
As stated in this section of their documentation, RenderDoc uses a "man-in-the-middle" approach to get the data. So it intercepts any calls to the graphics API (OpenGL, DirectX, Vulkan) of the executed program, gathers the data it needs, and passes it along to the API afterward.