ValveSoftware / source-sdk-2013

The 2013 edition of the Source SDK
https://developer.valvesoftware.com/wiki/SDK2013_GettingStarted
Other
3.76k stars 2k forks source link

IMaterialSystem::SetRenderContext quirks - how to use properly? #326

Closed dtugend closed 9 years ago

dtugend commented 9 years ago

It seems that IMaterialSystem::SetRenderContext:

Is that correct?

I am asking since I am wondering about the correct usage pattern of SetRenderContext.

What I am trying to do: I am adding code at the end of IBaseClientDLL::View_Render as follows: 1) switch to a different context using SetRenderContext 2) basically call IBaseClientDLL::WriteSaveGameScreenshotOfSize 3) switch back to old context

I guess that is not the correct usage pattern, since it will lead to a crash as soon as the thread is going to be re-used for View_Render?

dtugend commented 9 years ago

It should me noted, that the crash only occurs for cvar mat_queue_mode != 0

dtugend commented 9 years ago

Well I found a solution for myself, it is to let the render context be attached and not re-use it before the before the same old context comes in again (for one of the next View_Render calls) (and not set another context of course). Additional context switching can be emulated by using a wrapper context as first context set, that does the switching internally.

I am closing this, because I think Valve has other problems at the moment than quirks in a feature in Source 1 engine no one else seems to use.