Skip to content
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

Fixed issue #2010 and #1966 #2016

Merged
merged 9 commits into from
Nov 8, 2013
Merged

Fixed issue #2010 and #1966 #2016

merged 9 commits into from
Nov 8, 2013

Conversation

kfazi
Copy link
Contributor

@kfazi kfazi commented Sep 22, 2013

Added GetData methods to Texture3D for Windows (SharpDX).
Implementations for other platforms are not provided.

While adding GetData to Texture3D I found out that implementation of the same method in Texture2D doesn't support row pitches. This is now fixed.

@mgbot
Copy link
Member

mgbot commented Sep 22, 2013

Can one of the admins verify this patch?

1 similar comment
@mgbot
Copy link
Member

mgbot commented Sep 22, 2013

Can one of the admins verify this patch?

@KonajuGames
Copy link
Contributor

@mgbot test

@mgbot
Copy link
Member

mgbot commented Sep 30, 2013

Test FAILed.
Refer to this link for build results: http://build.monogame.net/job/PullRequestTester/447/

@@ -1,4 +1,7 @@
#define DIRECTX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't define DIRECTX in a source file. These are declared in the project properties. This is causing non-DirectX platforms to fail to build.

Also, why does it need "using System.IO"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I added DIRECTX define as a dirty hack to force my debugger to recognize conditional parts when the file was open in different solution. I forgot to remove it.
The System.IO is used by Seek() method (specifically SeekOrigin enum).

@KonajuGames
Copy link
Contributor

@mgbot test

@mgbot
Copy link
Member

mgbot commented Oct 3, 2013

Test PASSed.
Refer to this link for build results: http://build.monogame.net/job/PullRequestTester/456/

@brainchest
Copy link

After figuring out that Texture2D.GetData doesn't return the correct color values for WP8, W8 (always returns R=0,G=0,B=0,A=0) I found this fork and tried it in my app. Unfortunately, I still have the same issues. The correct color value is not returned. Here is how I use it (see the ContainsPointForArbitrary method (last one in the file)):

https://github.com/brainchest/CraftworkGames/blob/master/Source/CraftworkGames.Gui/Controls/Shape.cs

Using MonoGame for WindowsGL it works perfectly (even without this fix here). Do I need to prepare something on WP8, W8 side in order to get this working?

@kfazi
Copy link
Contributor Author

kfazi commented Oct 14, 2013

@brainchest Your problem should be fixed now.
It was hardware dependent issue and not everybody was affected.

@KonajuGames I hope it is OK that I included this fix in this push request.

@kfazi
Copy link
Contributor Author

kfazi commented Oct 14, 2013

I just implemented OpenGL version of Texture3D.GetData(), but I can't find how to test it.
For now I just copied MonoGame.Tests.Windows project and changed it's references to include MonoGame.Framework.WindowsGL instead of MonoGame.Framework.Windows.
Does WindowsGL test project exists? I would prefer to add texture test files to it.

Also could somebody point me to some information how to do testing on Android?

@brainchest
Copy link

@kfazi Thanks. This fixed the issue :)

@KonajuGames
Copy link
Contributor

@kfazi can you update this PR? There have been some other changes merged that affect the same files.

@kfazi
Copy link
Contributor Author

kfazi commented Oct 30, 2013

@KonajuGames Is this PR ok to be merged? I have few other fixes ready that depend on this one.

@tomspilman
Copy link
Member

It looks good to me.

@Knight219
Copy link

Can I get data from the dxt1 sprite in the same way?

@KonajuGames
Copy link
Contributor

@mgbot test

@KonajuGames
Copy link
Contributor

@Knight219 GetData will return the compressed DXT1 data if the texture is compressed as DXT1.

@Knight219
Copy link

Ok. Can I decompress DXT1 data after I get it with GetData method?

@KonajuGames
Copy link
Contributor

If you write the DXT decompression, sure.​

@Knight219
Copy link

What about a standard method for this?

@KonajuGames
Copy link
Contributor

There are no plans to provide decompression routines for the many different
texture compression methods.​ There is an internal class
in MonoGame.Framework/Graphics/DxtUtil.cs for compatibility with existing
XNA compiled content, but the intention is to remove that once we have full
texture compression support.

@Knight219
Copy link

Thanks

@mgbot
Copy link
Member

mgbot commented Nov 7, 2013

Test PASSed.
Refer to this link for build results: http://build.monogame.net/job/PullRequestTester/512/

KonajuGames added a commit that referenced this pull request Nov 8, 2013
@KonajuGames KonajuGames merged commit ff2b6fa into MonoGame:develop Nov 8, 2013
@romanov
Copy link

romanov commented Nov 10, 2013

Finally. Good work.

@Knight219
Copy link

When I use getdata method for dxt1 texture I have AccessViolationException. Exception throws because method trying to read count of rows and elementsinrow for not compressed texture.
I changed getdata method for dxt1 texture. It's return all data without loop.

var databox = d3dContext.MapSubresource(stagingTex, 0, SharpDX.Direct3D11.MapMode.Read, SharpDX.Direct3D11.MapFlags.None, out stream);

// Some drivers may add pitch to rows.
// We need to copy each row separatly and skip trailing zeros.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change GetData doesn't work correctly on Windows Phone 8 anymore. @kfazi @tomspilman do you have an idea how this can be fixed (without reverting)?
Textures with even widths have four small squares on the top. Textures with uneven widths have four small squares on the top, where the first one is greyish, second is blue, third is green and the fourth red.

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

Successfully merging this pull request may close these issues.

8 participants