Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Crash in ChannelShader plugin

    Cinema 4D SDK
    s22 c++ macos
    2
    9
    775
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • fwilleke80F
      fwilleke80
      last edited by Manuel

      Hi,

      I have a channel shader, which reproducibly crashes when run in the debugger in S22 and R23. However, the crash does not occur in my code, though it looks like my shader has something to do with it. Interestingly, the very same code runs smoothly in R20 and R21, and does not cause any strange behaviour there. It happens only when the material that has the shader is applied to an object in the scene.

      The call stack shows this:
      Screenshot 2020-09-10 at 20.50.12.png

      And the output window in the debugger says:
      -[MTLDebugBlitCommandEncoder validateCopyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:options:]:718: failed assertion 'destinationLevel(1) must be < [destinationTexture mipmapLevelCount](1).'

      In Release mode, it doesn't crash, but tends to make the whole machine unresponsive and sometimes even tints the whole Cinema UI green. Wtf. Never had this before.

      Thanks for help,
      greetings,
      Frank

      1 Reply Last reply Reply Quote 0
      • fwilleke80F
        fwilleke80
        last edited by fwilleke80

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • fwilleke80F
          fwilleke80
          last edited by fwilleke80

          And one more piece of the puzzle: The crash only occurs if I set Preferences -> Viewport Hardware -> Texture Mode to "Mipmap". Then, it occurs even if my shader isn't even in the scene (I tried with the Brick shader). And yes, in 22.123 and also in 22.016.

          Therefore, however unsettling this is, I think I can just leave my Texture Mode on "Nearest", and leave the matter up to Maxon 😉
          Since no crash report is generated, I don't have more data to provide.

          My hardware is:
          iMac (Retina 5K, 27-inch, 2019)
          3,6 GHz 8-Core Intel Core i9
          16 GB 2667 MHz DDR4
          Radeon Pro 580X 8 GB

          OS:
          macOS 10.15.6 (19G2021)

          1 Reply Last reply Reply Quote 0
          • ManuelM
            Manuel
            last edited by

            hi,

            it's not really clear.
            can you reproduce the crash using only c4d shader ?
            can you provide a bit of your code if not all you code (even using our [email protected] mailbox ?

            Cheers
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

            fwilleke80F 1 Reply Last reply Reply Quote 0
            • fwilleke80F
              fwilleke80 @Manuel
              last edited by fwilleke80

              Hi Manuel,

              @m_magalhaes said in Crash in ChannelShader plugin:

              can you reproduce the crash using only c4d shader ?

              Yes, I can reproduce it with e.g. just a brick shader.

              can you provide a bit of your code if not all you code (even using our [email protected] mailbox ?

              I could, but since it's reproducible without any of my code participating, I don't think that will be necessary 😉

              Here is a screen recording:
              https://frankwilleke.de/misc/screen-recording_viewport-mipmap-crash_macos.mov

              I am starting Cinema in the debugger, then I create a plane and a material with a brick shader. Drag the material onto the plane... everything is still fine. Then open the Preferences and set the Texture Mode to "Mipmap".

              Note that, while my plugin project is loaded in Xcode, I am not using any of the plugin in this example. It's just to have a debugger.

              Cheers,
              Frank

              1 Reply Last reply Reply Quote 0
              • ManuelM
                Manuel
                last edited by

                hi,

                ok, reported in our bug database. But i don't have any issu on release mode.

                Cheers,
                Manuel

                MAXON SDK Specialist

                MAXON Registered Developer

                1 Reply Last reply Reply Quote 0
                • fwilleke80F
                  fwilleke80
                  last edited by

                  In release mode, it doesn’t crash, but after a while playing with the material, it makes my machine (not just Cinema) unresponsive and sometimes paints the Cinema UI bright green. When that happens, I get minutes of staring at the macOS beach ball, and I have to kill the Cinema process. Memory and CPU pressure is not very high though. Maybe thrashed memory?

                  1 Reply Last reply Reply Quote 0
                  • ManuelM
                    Manuel
                    last edited by

                    hi,

                    it only happen on osx, it's about Metal Framework. That's all what i can say. I've asked the dev to have a look at it.

                    Cheers,
                    Manuel

                    MAXON SDK Specialist

                    MAXON Registered Developer

                    1 Reply Last reply Reply Quote 0
                    • fwilleke80F
                      fwilleke80
                      last edited by

                      I’m confident they will find out 😉
                      Thanks for everything!

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post