New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Define a conditional compilation symbol: #monogame #393

Closed
bonesoul opened this Issue Mar 23, 2012 · 5 comments

Comments

Projects
None yet
3 participants
@bonesoul
Contributor

bonesoul commented Mar 23, 2012

So basically, I've ported my 3d block engine (http://www.voxeliq.org/) to monogame and with a few glitches, it's all great. The problem is that as monogame isn't 100% compatible with XNA 4.0 yet, I hit spots where i need that #monogame symbol. Let me explain in details;

As I'm working on a block engine with millions of blocks in memory, I'm using other threads to generate, lighten and build vertices.

So within the last step my code creates new VertexBuffer's in those off-threads which at the moment seems MonoGame/develop3d branch doesn't support and throws;

throw new NotImplementedException("Threaded creation of GPU resources is not currently supported on this platform");

So a solution I came with is adding #monogame symbol to my block engine's monogame version project and using as;

            #if !MONOGAME
                        if (!this.CacheThreadStarted)
                        {
                            var cacheThread = new Thread(CacheThread) { IsBackground = true };
                            cacheThread.Start();

                            this.CacheThreadStarted = true;
                        }
            #else
                        this.Process();
            #endif

So wouldn't it be better if monogame framework project's define #monogame symbol on their own so for project that targets XNA and monogame together can differentiate the underlying framework?

@KonajuGames

This comment has been minimized.

Show comment
Hide comment
@KonajuGames

KonajuGames Mar 23, 2012

Contributor

An assembly project cannot define a conditional that will affect
compilation of another project. Since the code you want/need to compile
differently is in your project, you will need to add the conditional to the
project properties yourself. There is nothing MonoGame can do to define
that conditional in your project.

And yes, creation of GPU resources on secondary threads is a
work-in-progress. What platform are you building for?

Sly

On 23 March 2012 21:37, raistlinthewiz <
reply@reply.github.com

wrote:

So basically, I've ported my 3d block engine (http://www.voxeliq.org/) to
monogame and with a few alternatives, it's all great. The problem is that
as monogame isn't 100% compatible with XNA 4.0 yet, I hit spots where i
need that #monogame symbol. Let me explain in details;

As I'm working on a block engine with millions of blocks in memory, I'm
using other threads to generate, lighten and build vertices.

So within the last step my code creates new VertexBuffer's in those
off-threads which at the moment seems MonoGame/develop3d branch doesn't
support and throws;

throw new NotImplementedException("Threaded creation of GPU resources is
not currently supported on this platform");

So a solution I came with is adding #monogame symbol to my block engine's
monogame version project and using as;

           #if !MONOGAME
                       if (!this.CacheThreadStarted)
                       {
                           var cacheThread = new Thread(CacheThread) {

IsBackground = true };
cacheThread.Start();

                           this.CacheThreadStarted = true;
                       }
           #else
                       this.Process();
           #endif

So wouldn't it be better if monogame framework project's define #monogame
symbol on their own so for project that targets XNA and monogame together
can differentiate the underlying framework?


Reply to this email directly or view it on GitHub:
#393

Contributor

KonajuGames commented Mar 23, 2012

An assembly project cannot define a conditional that will affect
compilation of another project. Since the code you want/need to compile
differently is in your project, you will need to add the conditional to the
project properties yourself. There is nothing MonoGame can do to define
that conditional in your project.

And yes, creation of GPU resources on secondary threads is a
work-in-progress. What platform are you building for?

Sly

On 23 March 2012 21:37, raistlinthewiz <
reply@reply.github.com

wrote:

So basically, I've ported my 3d block engine (http://www.voxeliq.org/) to
monogame and with a few alternatives, it's all great. The problem is that
as monogame isn't 100% compatible with XNA 4.0 yet, I hit spots where i
need that #monogame symbol. Let me explain in details;

As I'm working on a block engine with millions of blocks in memory, I'm
using other threads to generate, lighten and build vertices.

So within the last step my code creates new VertexBuffer's in those
off-threads which at the moment seems MonoGame/develop3d branch doesn't
support and throws;

throw new NotImplementedException("Threaded creation of GPU resources is
not currently supported on this platform");

So a solution I came with is adding #monogame symbol to my block engine's
monogame version project and using as;

           #if !MONOGAME
                       if (!this.CacheThreadStarted)
                       {
                           var cacheThread = new Thread(CacheThread) {

IsBackground = true };
cacheThread.Start();

                           this.CacheThreadStarted = true;
                       }
           #else
                       this.Process();
           #endif

So wouldn't it be better if monogame framework project's define #monogame
symbol on their own so for project that targets XNA and monogame together
can differentiate the underlying framework?


Reply to this email directly or view it on GitHub:
#393

@bonesoul

This comment has been minimized.

Show comment
Hide comment
@bonesoul

bonesoul Mar 23, 2012

Contributor

Oh sorry, I missed that part then. Closing the issue.

Right now building for win.

Contributor

bonesoul commented Mar 23, 2012

Oh sorry, I missed that part then. Closing the issue.

Right now building for win.

@bonesoul bonesoul closed this Mar 23, 2012

@KonajuGames

This comment has been minimized.

Show comment
Hide comment
@KonajuGames

KonajuGames Mar 23, 2012

Contributor

I see now from your pull request that you are building for Windows. As
soon as I or someone adds the support for shared GLContext on Windows, you
won't need the different code path.

Sly

On 23 March 2012 22:23, raistlinthewiz <
reply@reply.github.com

wrote:

Oh sorry, I missed that part then. Closing the issue.

Right now building for win.


Reply to this email directly or view it on GitHub:
#393 (comment)

Contributor

KonajuGames commented Mar 23, 2012

I see now from your pull request that you are building for Windows. As
soon as I or someone adds the support for shared GLContext on Windows, you
won't need the different code path.

Sly

On 23 March 2012 22:23, raistlinthewiz <
reply@reply.github.com

wrote:

Oh sorry, I missed that part then. Closing the issue.

Right now building for win.


Reply to this email directly or view it on GitHub:
#393 (comment)

@bonesoul

This comment has been minimized.

Show comment
Hide comment
@bonesoul

bonesoul Mar 23, 2012

Contributor

Okay will looking for that.

Contributor

bonesoul commented Mar 23, 2012

Okay will looking for that.

@sdancer

This comment has been minimized.

Show comment
Hide comment
@sdancer

sdancer Mar 23, 2012

Contributor

I'm pretty sure that precompiler tags are only for that project. So, a
precompiler tag in the Monogame assembly wouldn't help you. You'll have to
add one yourself.

On Fri, Mar 23, 2012 at 6:37 AM, raistlinthewiz <
reply@reply.github.com

wrote:

So basically, I've ported my 3d block engine (http://www.voxeliq.org/) to
monogame and with a few alternatives, it's all great. The problem is that
as monogame isn't 100% compatible with XNA 4.0 yet, I hit spots where i
need that #monogame symbol. Let me explain in details;

As I'm working on a block engine with millions of blocks in memory, I'm
using other threads to generate, lighten and build vertices.

So within the last step my code creates new VertexBuffer's in those
off-threads which at the moment seems MonoGame/develop3d branch doesn't
support and throws;

throw new NotImplementedException("Threaded creation of GPU resources is
not currently supported on this platform");

So a solution I came with is adding #monogame symbol to my block engine's
monogame version project and using as;

           #if !MONOGAME
                       if (!this.CacheThreadStarted)
                       {
                           var cacheThread = new Thread(CacheThread) {

IsBackground = true };
cacheThread.Start();

                           this.CacheThreadStarted = true;
                       }
           #else
                       this.Process();
           #endif

So wouldn't it be better if monogame framework project's define #monogame
symbol on their own so for project that targets XNA and monogame together
can differentiate the underlying framework?


Reply to this email directly or view it on GitHub:
#393

Contributor

sdancer commented Mar 23, 2012

I'm pretty sure that precompiler tags are only for that project. So, a
precompiler tag in the Monogame assembly wouldn't help you. You'll have to
add one yourself.

On Fri, Mar 23, 2012 at 6:37 AM, raistlinthewiz <
reply@reply.github.com

wrote:

So basically, I've ported my 3d block engine (http://www.voxeliq.org/) to
monogame and with a few alternatives, it's all great. The problem is that
as monogame isn't 100% compatible with XNA 4.0 yet, I hit spots where i
need that #monogame symbol. Let me explain in details;

As I'm working on a block engine with millions of blocks in memory, I'm
using other threads to generate, lighten and build vertices.

So within the last step my code creates new VertexBuffer's in those
off-threads which at the moment seems MonoGame/develop3d branch doesn't
support and throws;

throw new NotImplementedException("Threaded creation of GPU resources is
not currently supported on this platform");

So a solution I came with is adding #monogame symbol to my block engine's
monogame version project and using as;

           #if !MONOGAME
                       if (!this.CacheThreadStarted)
                       {
                           var cacheThread = new Thread(CacheThread) {

IsBackground = true };
cacheThread.Start();

                           this.CacheThreadStarted = true;
                       }
           #else
                       this.Process();
           #endif

So wouldn't it be better if monogame framework project's define #monogame
symbol on their own so for project that targets XNA and monogame together
can differentiate the underlying framework?


Reply to this email directly or view it on GitHub:
#393

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment