Changes to make CEGUI 0.8 compatible with Ogre 2.1.

#150 Merged at 77086e8
  1. Jeremy Richert

Changes to make CEGUI 0.8 compatible with Ogre 2.1.
For now, only works with the OpenGL 3+ Ogre rendersytem. Shaders need to be updated to be compatible with D3D11 Ogre rendersystem.

Comments (23)

  1. Lukas Meindl

    Lucebac already made some excellent comments which fully covered anything I would have had to comment.

    It might be best to make a separate Ogre2Renderer for 2.0 and 2.1 compatibility. You can go crazy there and remove everything thats not necessary for 2.0+. We can add it to v0-8 and package it with future 0.8.X Releases. You can use all code changes you did and just copy paste them to "RendererModules/Ogre2"
    The main difficulty then would be to make CMake ready for that. I think this should not be difficult though, you can use some Grep tool to find all occurances of Ogre in CMAKE files and add a line for Ogre2Renderer where necessary. Also it would be great if you can simply re-use all classes that do not need any changes.

  2. Lukas Meindl

    Martin Preisler said it is ok to break ABI as long as you use macros to only break it for Ogre 2.0 and 2.1. So forget about my last message and go with the Macro approach. This will definitely save us a lot of duplicate code so that's great. I wasn't aware of that this is a legitimate way to avoid ABI-breakage, so sorry for initially misadvising you, I hope you haven't wasted any time on my false suggestions.

  3. Jeremy Richert author

    OK, good news! :)
    I had not started the Ogre2Renderer yet, so yes, this will save me a lot of time!
    I will make a new commit to take the other comments into account as soon as I have some time.

  4. Jeremy Richert author

    Pull request updated!
    Sorry for the multiple updates, I kept forgotting 1 or 2 lines to change in each commit / update... -_-'

    I hope it will be okay now!

  5. Lukas Meindl

    Overall looks pretty good.

    Did you introduce "CEGUI_USE_OGRE_COMPOSITOR2" as new variable to this branch? If yes, where does the user define it? Same question for "CEGUI_USE_OGRE_HLMS"

  6. Jeremy Richert author

    The 2 variables are defined automatically depending on the version of Ogre at the beginning of Renderer.h (lines 67-79).

    These 2 variables shall not be modified by the user.

    They ensure that the code builds with any version of Ogre without changing any build option.

    1. Lukas Meindl

      Ah, I had accidentally skipped over that part. Thats a pretty optimal solution then.

  7. Jeremy Richert author

    I have removed the duplicate new lines.
    Please tell me if there is any other change I have to make :)

    1. Lukas Meindl

      Looks good. As far as I see all the old code is preserved in the old versions of Ogre and the new code is only added inside the macros.

  8. Jeremy Richert author

    Unfortunately I do not have a project on Ogre 1.9, but I have just tested it on Ogre 1.8 and it builds and works perfectly :)

    1. Lukas Meindl

      Sounds good. I will look over it again this weekend in case you are done by then with your cleanup. If i dont find any issues i will approve of the merge. Since the changes are quite big I will pass it on to some other dev team member to look at one final time before I merge it ;)

      1. Lukas Meindl

        Seems like no on had time. I am merging it. Thanks a lot for your PR, it seems to me that this is a very useful contribution. if any further changes are needed please make a new PR.

  9. Lukas Meindl

    I tried to merge the changes into default branch but it is not trivial enough to do it blindly. So in the end I didnt take any of your changes over to default branch. I currently dont have the capacities to apply your changes manually and test them, if you would like to do it then this would be great.

  10. Jeremy Richert author

    It seems that the Ogre renderer has been deeply refactored recently in the default branch. I will see if I manage to port my changes to this branch when I get some time.

    But before, I still have to finish the porting to Ogre 2.1 by making the D3D11 renderer work as well.

    Also, it seems that Ogre 2.1 works best with the gamma correction enabled, which is not supported by CEGUI yet. This is also on my todo list :)

    I will keep you informed on my progress.

  11. kohedlo

    there is time update to PSO finall OGRE 2.1 and cegui have errors as unported unexsisting methods throught changing ORGE.

    //@@@@@@@@@@@@@@@@@@@@@@@@   d_pimpl->d_renderSystem->_setHlmsBlendblock(d_pimpl->d_hlmsBlendblock);
    //@@@@@@@@@@@@@@@@@@@@@@@@ d_pimpl->d_renderSystem->_setHlmsMacroblock(d_pimpl->d_hlmsMacroblock);
    void OgreRenderer::bindShaders()
        if (isUsingShaders())
            Ogre::HlmsCache hlmsCache;
          hlmsCache.vertexShader = d_pimpl->d_vertexShader;
            hlmsCache.pixelShader = d_pimpl->d_pixelShader;
    //@@@@@@@@@@@@@@@@@@@   d_pimpl->d_renderSystem->__setProgramsFromHlms(&hlmsCache);
            if (Ogre::GpuProgram* prog = d_pimpl->d_vertexShader->_getBindingDelegate())
            if (Ogre::GpuProgram* prog = d_pimpl->d_pixelShader->_getBindingDelegate())
      //@@@@@@@@@@@@@@@@@@@@@@     d_pimpl->d_renderSystem->unbindGpuProgram(Ogre::GPT_VERTEX_PROGRAM);
      //@@@@@@@@@@@@@@@@@@     d_pimpl->d_renderSystem->unbindGpuProgram(Ogre::GPT_FRAGMENT_PROGRAM);

    i think porting this available:

    Ogre::HlmsCache hlmsCache;
          hlmsCache.vertexShader = d_pimpl->d_vertexShader;
            hlmsCache.pixelShader = d_pimpl->d_pixelShader;


    Ogre::HlmsCache hlmsCache;
          hlmsCache.pso.vertexShader = d_pimpl->d_vertexShader;
            hlmsCache.pso.pixelShader = d_pimpl->d_pixelShader;

    how to fix,?

    1. Lukas Meindl

      Have you checked the Ogre changes? They must have documented the changes and that should give an indication on what to do to fix it. I personally do not know because I have not looked into it and dont use Ogre 2.1.

      Btw you are replying to a two year old pull request, maybe a conversation about your problem would be better done in a new bug ticket or on forum, what do you think?

      1. kohedlo

        i think for this place good is complete current thread by some strokes of OGRE 2.1 pso modification.
        I try to port, if i find.
        Is need connect GEGUI shader that loads throught unported methods.
        On ogre forum i also i write appropriate replying.

            1. Lukas Meindl

              Okay, in any case I find it difficult to understand what you are saying.

              If you find a solution for this please report it. At the moment I can't help with Ogre 2.1. Also feel free to make a bug report.