Implement comparison samplers for Direct3D and OpenGL #3628

Merged
merged 3 commits into from Mar 19, 2015

Conversation

Projects
None yet
3 participants
@tgjones
Contributor

tgjones commented Mar 18, 2015

Adds SamplerState.ComparisonFunction, and hooks it up for Direct3D and OpenGL.

I wasn't sure whether to call the new property ComparisonFunction or CompareFunction - I decided to go with the former, because that's how both Direct3D and OpenGL refer to it, even if it doesn't match the XNA / MG enum name.

Replaces #2088 (I'd have liked to cherry-pick those commits, but it was easier just to start from scratch).

This seems like a good use-case for GraphicsProfile - comparison samplers aren't supported by OpenGL ES 2.0 (without an extension), nor, I believe, Direct3D 11 feature level 9.x. We could throw an runtime exception if you try to use a comparison sampler. But I guess that is for the future - MG doesn't really use graphics profiles much yet, and whether it should or not is a whole separate discussion.

(This will conflict with my other PR, #3626 - I'll just do a rebase on whichever one isn't merged first.)

@mgbot

This comment has been minimized.

Show comment
Hide comment
@mgbot

mgbot Mar 18, 2015

Member

TeamCity MonoGame :: Develop (Win) Build 3.4.0.30 is now running

Member

mgbot commented on 3624b2d Mar 18, 2015

TeamCity MonoGame :: Develop (Win) Build 3.4.0.30 is now running

This comment has been minimized.

Show comment
Hide comment
@mgbot

mgbot Mar 18, 2015

Member

TeamCity MonoGame :: Develop (Win) Build 3.4.0.30 outcome was SUCCESS
Summary: Tests passed: 460, ignored: 6 Build time: 00:14:57

Member

mgbot replied Mar 18, 2015

TeamCity MonoGame :: Develop (Win) Build 3.4.0.30 outcome was SUCCESS
Summary: Tests passed: 460, ignored: 6 Build time: 00:14:57

@tomspilman

This comment has been minimized.

Show comment
Hide comment
@tomspilman

tomspilman Mar 19, 2015

Member

This seems safe. From what I can tell from DX11 this seems to be a feature that works on all PC GPU hardware which is basically the same as all Mac and Linux hardware.

The question will be if we run into mobile hardware or weird console hardware that doesn't. What do we do then?

Probably an issue to leave to #1941.

Member

tomspilman commented Mar 19, 2015

This seems safe. From what I can tell from DX11 this seems to be a feature that works on all PC GPU hardware which is basically the same as all Mac and Linux hardware.

The question will be if we run into mobile hardware or weird console hardware that doesn't. What do we do then?

Probably an issue to leave to #1941.

tomspilman added a commit that referenced this pull request Mar 19, 2015

Merge pull request #3628 from tgjones/sampler-comparison
Implement comparison samplers for Direct3D and OpenGL

@tomspilman tomspilman merged commit b0c10e2 into MonoGame:develop Mar 19, 2015

1 check passed

default Finished TeamCity Build MonoGame :: Develop (Win) : Tests passed: 460, ignored: 6
Details
@tomspilman

This comment has been minimized.

Show comment
Hide comment
@tomspilman

tomspilman Mar 19, 2015

Member

Oh... totally forgot. We do need some unit test that ensures this feature works.

Member

tomspilman commented Mar 19, 2015

Oh... totally forgot. We do need some unit test that ensures this feature works.

@tgjones tgjones deleted the tgjones:sampler-comparison branch Mar 19, 2015

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