Jump to content
The Dark Mod Forums

Shadersystem / Texturescache


Recommended Posts

The ShaderLibrary is the one that holds all the named ShaderDefinitions and named Shader objects. It gets populated by the ShaderFileParser during startup or when the user requests a shader refresh.

 

I first assumed that the Library is the only class holding a strong ShaderPtr, but I didn't think of the OpenGLShader (I haven't touched that one, you know that one probably better).

Link to comment
Share on other sites

Ah yes, now I remember. The OpenGLShaders I think are retained by the OpenGLShaderCache and handle all of the rendering stuff.

 

I think you might need to refresh both caches in this case, since there is no obvious candidate for a weak_ptr.

Link to comment
Share on other sites

Ok, will look into that if it's possible, because the ShaderLibrary is contained within the shaders plugin and the OpenGLShader is part of the DarkRadiant core.

Link to comment
Share on other sites

Yeah, just noticed that. I'm just trying if this works out:

 

GlobalShaderCache().unrealise();
GlobalShaderSystem().refresh();
GlobalShaderCache().realise();

 

Hopefully this lets the reference count actually reach 0, so that the textures get reloaded.

Link to comment
Share on other sites

Got it. Additionally to the above lines, I also had to clear the IShaderPtr in the OpenGLShader::destroy() method in order to decrease the reference count. Now the textures are actually reloaded.

Link to comment
Share on other sites

Got it. Additionally to the above lines, I also had to clear the IShaderPtr in the OpenGLShader::destroy() method in order to decrease the reference count. Now the textures are actually reloaded.

 

That's a bit daft, destroying the OpenGLShader should automatically release the IShaderPtr, that's the whole point. I'll have to look at this and see if there is any refactoring that can be done (explicit destroy methods are usually an indicator of bad design).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 0 replies
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
×
×
  • Create New...