Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

[RFC] Toolkit for SharpDX 3.0 #3

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

[RFC] Toolkit for SharpDX 3.0 #3

wants to merge 22 commits into from

Conversation

tomba
Copy link

@tomba tomba commented Jan 17, 2016

Hi,

This isn't a real pull request, but a request-for-comments.

These patches change the Toolkit to compile with SharpDX 3.0, but it's far from ready. The changes include:

  • Remove unused files.
  • Use nuget to get SharpDX, AssimpNet, SharpYaml, NUnit.
  • Upgrade AssimpNet and SharpYaml to more recent versions.
  • Code changes for compiling with SharpDX 3.0.
  • Add HackTest for simple testing. Should be dropped later.

At this time I'm mainly looking for feedback on the three patches which change the Toolkit code:

  • "Trivial Toolkit code changes to make it compile with SharpDX 3.0". This I think should be fine.
  • "Use Utilities.Pin() instead of Interop.Fixed()". This is probably also fine, although it may cause some performance loss compared to the old implementation.
  • "HACK: unimplemented and hack Toolkit changes". These are hacks or commented out code, as I'm not sure how those pieces of code should be implemented.

Also nuget packaging is totally missing, but that can be left for later.

Tomi

@xoofx
Copy link
Member

xoofx commented Jan 17, 2016

Nice! I will be glad integrating your PR once it is ready.

@tridexanders
Copy link

Hi,

thanks for all the work you guys do with sharpdx!!! brilliant, noticed this possible update to Toolkit 3.0, I have upgraded my old project to use TOMBA brach of toolkit, all seems fine but i am getting an error while trying to use the spritebatch to render a texture or font the code runs into on debug NotImplementedException() I noticed there is an.. #if NOTIMPLEMENTED in the c# code, it his still been worked on? as everyting else seems fine in the conversion!!!! i tried to use the HACKTEST project TO test the sprite batch if that helps!!!! i would appeciate you help guys if there is a fix or update to this!!!

    private void DrawBatchPerTexture(ref TextureInfo texture, SpriteInfo[] sprites, int offset, int count)
    {
        var nativeShaderResourceViewPointer = texture.ShaderResourceView;

        if (customEffect != null)
        {
            var currentTechnique = customEffect.CurrentTechnique;

            int passCount = currentTechnique.Passes.Count;
            for (int i = 0; i < passCount; i++)
            {
                // Sets the texture on the custom effect if the parameter exist
                if (customEffectTexture != null)
                {
                    customEffectTexture.SetResourcePointer(nativeShaderResourceViewPointer);
                }

                var currentPass = currentTechnique.Passes[i];

                // Apply the current pass
                currentPass.Apply();

                // Draw the batch of sprites
                DrawBatchPerTextureAndPass(ref texture, sprites, offset, count);

                // unbind all pass resources as the texture can be used later as a render target
                currentPass.UnApply();
            }
        }
        else
        {
            throw new NotImplementedException();

#if NOTIMPLEMENTED
unsafe
{
// Sets the texture for this sprite effect.
// Use an optimized version in order to avoid to reapply the sprite effect here just to change texture
// We are calling directly the PixelShaderStage. We assume that the texture is on slot 0 as it is
// setup in the original BasicEffect.fx shader.
GraphicsDevice.PixelShaderStage.SetShaderResources(0, 1, new IntPtr(&nativeShaderResourceViewPointer));
}

            DrawBatchPerTextureAndPass(ref texture, sprites, offset, count);

            // unbind the texture from pass as it can be used later as a render target
            GraphicsDevice.PixelShaderStage.SetShaderResources(0, 1, GraphicsDevice.ResetSlotsPointers);

#endif
}
}

@tomba
Copy link
Author

tomba commented Jan 27, 2016

This is not ready, as I describe in the pull request. There are parts in the code which I don't know how to port to SharpDX 3.0, and haven't had time to start studying how they should be implemented.

@mklemarczyk
Copy link

@tomba I will check it after weekend, can you create issues for problems TODO in your repo?

@tomba
Copy link
Author

tomba commented Feb 6, 2016

@mklemarczyk I created a few issues to my repo. Those are the obvious ones.

@RobJellinghaus
Copy link

tomba, have you made any further progress with any of these? It looks like your repo at https://github.com/tomba/Toolkit has been inactive since January 1st.

xoofx, are there aspects of this PR that you think are essential in order for you to consider taking a 3.0.2 Toolkit? I am thinking the other PR is a better bet since it seems more fully implemented, but I want to understand clearly what your bar for acceptance is before putting in any real work. Thanks.

@tomba
Copy link
Author

tomba commented Sep 11, 2016

No, I haven't worked on this. I have the open items as issues in my Toolkit repo.

Making the missing ShardDX methods public will help, but there's at least the (probable) performance problem with Interop.Fixed().

And, in my opinion, Toolkit should be a separate project (in the sense that it shouldn't be part of ShardDX and using SharpDX's internal features) and, if I recall right, the other pull req was for a non-separated Toolkit. Then again, Toolkit with SharpDX is probably still better than no Toolkit, so... =)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants