flibitijibibo / FNA-MGHistory

FNA - Accuracy-focused XNA4 reimplementation for open platforms
http://fna-xna.github.io/
246 stars 37 forks source link

[OpenGL] VMware/VBox Support? #309

Closed QuarkRobot closed 9 years ago

QuarkRobot commented 9 years ago

When running a programme on Ubuntu x64 (latest copy) with VirtualBox I get the following error when using Texture2D.FromStream AND New Texture overloads.

It appears similar to this issue: https://github.com/flibitijibibo/FNA/issues/296 but I can't fix it.

OpenGL Device: Gallium 0.4 on llvmpipe (LLVM 3.6, 128 bits) OpenGL Driver: 3.0 Mesa 10.5.2 OpenGL Vendor: VMware, Inc. MojoShader Profile: glsl120 FBO incomplete: no attachments [-1]

Source: GL_DEBUG_SOURCE_API_ARB
Type: GL_DEBUG_TYPE_OTHER_ARB
Severity: GL_DEBUG_SEVERITY_MEDIUM_ARB

EXT_swap_control_tear unsupported. Fall back to standard VSync. GL_INVALID_ENUM in glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT) Source: GL_DEBUG_SOURCE_API_ARB Type: GL_DEBUG_TYPE_ERROR_ARB Severity: GL_DEBUG_SEVERITY_HIGH_ARB

Unhandled Exception: System.Exception: ARB_debug_output found an error. at Microsoft.Xna.Framework.Graphics.OpenGLDevice.DebugCallback (GLenum source, GLenum type, UInt32 id, GLenum severity, Int32 length, IntPtr message, IntPtr userParam) [0x00000] in :0 at (wrapper native-to-managed) Microsoft.Xna.Framework.Graphics.OpenGLDevice:DebugCallback (Microsoft.Xna.Framework.Graphics.OpenGLDevice/GLenum,Microsoft.Xna.Framework.Graphics.OpenGLDevice/GLenum,uint,Microsoft.Xna.Framework.Graphics.OpenGLDevice/GLenum,int,intptr,intptr) at (wrapper managed-to-native) object:wrapper_native_0x7f75f1e58020 (Microsoft.Xna.Framework.Graphics.OpenGLDevice/GLenum,Microsoft.Xna.Framework.Graphics.OpenGLDevice/GLenum,single) at (wrapper delegate-invoke) :invoke_void__this_OpenGLDevice/GLenum_OpenGLDevice/GLenum_single (Microsoft.Xna.Framework.Graphics.OpenGLDevice/GLenum,Microsoft.Xna.Framework.Graphics.OpenGLDevice/GLenum,single) at Microsoft.Xna.Framework.Graphics.OpenGLDevice.CreateTexture (System.Type target, Int32 levelCount) [0x00000] in :0 at Microsoft.Xna.Framework.Graphics.OpenGLDevice+<>cDisplayClass19.b__18 () [0x00000] in :0 at Microsoft.Xna.Framework.Graphics.OpenGLDevice.ForceToMainThread (System.Action action) [0x00000] in :0 at Microsoft.Xna.Framework.Graphics.OpenGLDevice.CreateTexture2D (SurfaceFormat format, Int32 width, Int32 height, Int32 levelCount) [0x00000] in :0 at Microsoft.Xna.Framework.Graphics.Texture2D..ctor (Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice, Int32 width, Int32 height, Boolean mipMap, SurfaceFormat format) [0x00000] in :0 at Microsoft.Xna.Framework.Graphics.Texture2D..ctor (Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice, Int32 width, Int32 height) [0x00000] in :0 at Microsoft.Xna.Framework.Graphics.Texture2D.FromStream (Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice, System.IO.Stream stream) [0x00000] in :0 at WindowsGame3.Game1.LoadContent () [0x00000] in :0 at Microsoft.Xna.Framework.Game.Initialize () [0x00000] in :0 at WindowsGame3.Game1.Initialize () [0x00000] in :0 at Microsoft.Xna.Framework.Game.DoInitialize () [0x00000] in :0 at Microsoft.Xna.Framework.Game.Run () [0x00000] in :0 at WindowsGame3.Program.Main (System.String[] args) [0x00000]

flibitijibibo commented 9 years ago

To be honest I'm a bit hesitant to try and debug a VBox instance because VBox totally blows to the point where even the kernel devs don't accept bugs for it anymore. Do you have a VMware Player setup to test with instead?

If I were to take this report at face value I would say that it doesn't like this call here...

https://github.com/flibitijibibo/FNA/blob/master/src/Graphics/OpenGLDevice.cs#L1392 https://github.com/flibitijibibo/FNA/blob/master/src/Graphics/OpenGLDevice.cs#L2069

... but again, it's VBox. This is probably one of many things it doesn't correctly support.

QuarkRobot commented 9 years ago

Yep, VirtualBox is nowhere near as good. The game launches now with VMware Player but crashes soon afterwards when loading a shader.

Here is the shader http://media.quarkrobot.com/downloads/shader.Fxc which was compiled and works on Mac and Windows as per https://github.com/flibitijibibo/FNA/issues/302 Here is the error details from the terminal:

OpenGL Device: Gallium 0.4 on SVGA3D; build: RELEASE;
OpenGL Driver: 2.1 Mesa 10.5.2 OpenGL Vendor: VMware, Inc. MojoShader Profile: glsl120 FBO incomplete: no attachments [-1]

Source: GL_DEBUG_SOURCE_API_ARB
Type: GL_DEBUG_TYPE_OTHER_ARB
Severity: GL_DEBUG_SEVERITY_MEDIUM_ARB

EXT_swap_control_tear unsupported. Fall back to standard VSync. LODERUNN.bin.x86_64: /home/flibitijibibo/Programming/reProjects/MojoShader/mojoshader_opengl.c:2302: MOJOSHADER_glSetVertexAttribDivisor: Assertion `ctx->have_GL_ARB_instanced_arrays' failed. Stacktrace:

at (wrapper managed-to-native) MojoShader.MOJOSHADER_glSetVertexAttribDivisor (MojoShader/MOJOSHADER_usage,int,uint) <0xffffffff> at Microsoft.Xna.Framework.Graphics.OpenGLDevice.ApplyVertexAttributes (Microsoft.Xna.Framework.Graphics.VertexBufferBinding[],int,bool,int) <0x002ff> at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawIndexedPrimitives (Microsoft.Xna.Framework.Graphics.PrimitiveType,int,int,int,int,int) <0x00050> at Microsoft.Xna.Framework.Graphics.SpriteBatch.RenderBatch (int,int) <0x00b53> at Microsoft.Xna.Framework.Graphics.SpriteBatch.FlushBatch () <0x0018b> at Microsoft.Xna.Framework.Graphics.SpriteBatch.End () <0x0004b> at MMR.LR.Draw (Microsoft.Xna.Framework.GameTime) <0x000f7> at Microsoft.Xna.Framework.Game.DoDraw (Microsoft.Xna.Framework.GameTime) <0x00071> at Microsoft.Xna.Framework.Game.Tick () <0x005eb> at Microsoft.Xna.Framework.SDL2_GamePlatform.RunLoop () <0x00aab> at Microsoft.Xna.Framework.Game.Run () <0x00093> at MMR.Program.Main (string[]) <0x0007f> at (wrapper runtime-invoke) .runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

/home/quark/Desktop/LODERUNN Linux/lib64/libmono-2.0.so.1(+0xab388) [0x7f8d01ee9388]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10d10) [0x7f8d0151cd10]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37) [0x7f8d01177267]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f8d01178eca]
/lib/x86_64-linux-gnu/libc.so.6(+0x2e03d) [0x7f8d0117003d]
/lib/x86_64-linux-gnu/libc.so.6(+0x2e0f2) [0x7f8d011700f2]
/home/quark/Desktop/LODERUNN Linux/lib64/libmojoshader.so(+0x22ad9) [0x7f8ceae9bad9]
[0x406a84d1]

Debug info from gdb:

Could not attach to process. If your uid matches the uid of the target process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf ptrace: Operation not permitted. No threads.

Got a SIGABRT while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.

flibitijibibo commented 9 years ago

Your FNA revision is out of date, update and that assert shouldn't be reached.

Though even then, the FBO incomplete message is probably going to hit you next. What's the host's GPU? Should this just be tested on a real box instead...?

QuarkRobot commented 9 years ago

I've added the mod from this issue: https://github.com/flibitijibibo/FNA/issues/310 Would you like me to update FNA? I've made quite a few mods to Song and MediaPlayer to add streaming from archive support and I'm not sure whether Git will keep them - sorry, total Git newbie here.

Host GPU is a Nvidia 770M MXM laptop card.

flibitijibibo commented 9 years ago

If the VertexAttribDivisor fix is there you should be left with whatever that FBO issue is... though why that's just in stderr/stdout and not an ARB_debug_output error I'm not sure.

In any case, try to keep up with FNA at all times. Falling behind is a really, REALLY bad idea. You can ask any FNA dev other than me about that!

QuarkRobot commented 9 years ago

Okay, FNA updated with a slightly different error location: /home/flibitijibibo/Programming/reProjects/MojoShader/mojoshader_opengl.c:2302: MOJOSHADER_glSetVertexAttribDivisor: Assertion `ctx->have_GL_ARB_instanced_arrays' failed.

I think I'll get someone to test on an actual machine and not a virtual one...

Here is the full terminal output:

Stacktrace:

at (wrapper managed-to-native) MojoShader.MOJOSHADER_glSetVertexAttribDivisor (MojoShader/MOJOSHADER_usage,int,uint) <0xffffffff> at Microsoft.Xna.Framework.Graphics.OpenGLDevice.ApplyVertexAttributes (Microsoft.Xna.Framework.Graphics.VertexBufferBinding[],int,bool,int) <0x002ff> at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawIndexedPrimitives (Microsoft.Xna.Framework.Graphics.PrimitiveType,int,int,int,int,int) <0x00050> at Microsoft.Xna.Framework.Graphics.SpriteBatch.RenderBatch (int,int) <0x00b53> at Microsoft.Xna.Framework.Graphics.SpriteBatch.FlushBatch () <0x0018b> at Microsoft.Xna.Framework.Graphics.SpriteBatch.End () <0x0004b> at MMR.LR.Draw (Microsoft.Xna.Framework.GameTime) <0x000f7> at Microsoft.Xna.Framework.Game.Tick () <0x0062f> at Microsoft.Xna.Framework.SDL2_GamePlatform.RunLoop () <0x00af3> at Microsoft.Xna.Framework.Game.Run () <0x00093> at MMR.Program.Main (string[]) <0x0007f> at (wrapper runtime-invoke) .runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

/home/quark/Desktop/LODERUNN Linux/lib64/libmono-2.0.so.1(+0xab388) [0x7f8de4cf7388]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10d10) [0x7f8de432ad10]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37) [0x7f8de3f85267]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f8de3f86eca]
/lib/x86_64-linux-gnu/libc.so.6(+0x2e03d) [0x7f8de3f7e03d]
/lib/x86_64-linux-gnu/libc.so.6(+0x2e0f2) [0x7f8de3f7e0f2]
/home/quark/Desktop/LODERUNN Linux/lib64/libmojoshader.so(+0x22ad9) [0x7f8dcdd43ad9]
[0x417d7431]
QuarkRobot commented 9 years ago

Update: it does sort of work on a proper Linux machine although not very well. Loading shaders appear to not work either. I'll close this because it is unrelated to a virtual copy of Linux.