{"action":"created","comment":{"url":"https://api.github.com/repos/mono/MonoGame/pulls/comments/23797217","id":23797217,"diff_hunk":"@@ -262,6 +278,35 @@ public DepthStencilState DepthStencilState\n             }\r\n         }\r\n \r\n+        internal void ApplyState(bool applyShaders)\r\n+        {\r\n+            PlatformBeginApplyState();\r\n+\r\n+            if (_blendStateDirty)\r\n+            {\r\n+                // Static state properties never actually get bound;\r\n+                // instead we use our GraphicsDevice-specific version of them.\r\n+                var newBlendState = _blendState;\r\n+                if (ReferenceEquals(_blendState, BlendState.Additive))\r\n+                    newBlendState = BlendStateAdditive;\r\n+                else if (ReferenceEquals(_blendState, BlendState.AlphaBlend))\r\n+                    newBlendState = BlendStateAlphaBlend;\r\n+                else if (ReferenceEquals(_blendState, BlendState.NonPremultiplied))\r\n+                    newBlendState = BlendStateNonPremultiplied;\r\n+                else if (ReferenceEquals(_blendState, BlendState.Opaque))\r\n+                    newBlendState = BlendStateOpaque;\r\n+\r\n+                // Blend state is now bound to a device... no one should\r\n+                // be changing the state of the blend state object now!\r\n+                newBlendState.BindToGraphicsDevice(this);\r\n+\r\n+                newBlendState.PlatformApplyState(this);\r","path":"MonoGame.Framework/Graphics/GraphicsDevice.cs","position":74,"original_position":74,"commit_id":"ba01d6cbc832ac3a1b82713fe9dd4b1c2e6fa3a1","original_commit_id":"ba01d6cbc832ac3a1b82713fe9dd4b1c2e6fa3a1","user":{"login":"tomspilman","id":103522,"avatar_url":"https://avatars.githubusercontent.com/u/103522?v=3","gravatar_id":"","url":"https://api.github.com/users/tomspilman","html_url":"https://github.com/tomspilman","followers_url":"https://api.github.com/users/tomspilman/followers","following_url":"https://api.github.com/users/tomspilman/following{/other_user}","gists_url":"https://api.github.com/users/tomspilman/gists{/gist_id}","starred_url":"https://api.github.com/users/tomspilman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomspilman/subscriptions","organizations_url":"https://api.github.com/users/tomspilman/orgs","repos_url":"https://api.github.com/users/tomspilman/repos","events_url":"https://api.github.com/users/tomspilman/events{/privacy}","received_events_url":"https://api.github.com/users/tomspilman/received_events","type":"User","site_admin":false},"body":"What is the benefit of separating the `BindToGraphicsDevice` and `PlatformApplyState`?","created_at":"2015-01-29T19:53:46Z","updated_at":"2015-01-29T19:53:46Z","html_url":"https://github.com/mono/MonoGame/pull/3472#discussion_r23797217","pull_request_url":"https://api.github.com/repos/mono/MonoGame/pulls/3472","_links":{"self":{"href":"https://api.github.com/repos/mono/MonoGame/pulls/comments/23797217"},"html":{"href":"https://github.com/mono/MonoGame/pull/3472#discussion_r23797217"},"pull_request":{"href":"https://api.github.com/repos/mono/MonoGame/pulls/3472"}}},"pull_request":{"url":"https://api.github.com/repos/mono/MonoGame/pulls/3472","id":28281770,"html_url":"https://github.com/mono/MonoGame/pull/3472","diff_url":"https://github.com/mono/MonoGame/pull/3472.diff","patch_url":"https://github.com/mono/MonoGame/pull/3472.patch","issue_url":"https://api.github.com/repos/mono/MonoGame/issues/3472","number":3472,"state":"open","locked":false,"title":"Move EffectCache and default render states into GraphicsDevice [WIP]","user":{"login":"tgjones","id":102049,"avatar_url":"https://avatars.githubusercontent.com/u/102049?v=3","gravatar_id":"","url":"https://api.github.com/users/tgjones","html_url":"https://github.com/tgjones","followers_url":"https://api.github.com/users/tgjones/followers","following_url":"https://api.github.com/users/tgjones/following{/other_user}","gists_url":"https://api.github.com/users/tgjones/gists{/gist_id}","starred_url":"https://api.github.com/users/tgjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgjones/subscriptions","organizations_url":"https://api.github.com/users/tgjones/orgs","repos_url":"https://api.github.com/users/tgjones/repos","events_url":"https://api.github.com/users/tgjones/events{/privacy}","received_events_url":"https://api.github.com/users/tgjones/received_events","type":"User","site_admin":false},"body":"When this PR is finished, it will provide a fix for #3449.\r\n\r\nThis first batch of commits only affects `BlendState` - if this looks good, then I'll carry on with the other render states, and finally the effect cache.\r\n\r\nI have added some tests and tightened up `BlendState` mutability.\r\n\r\nI have refactored how blend states get applied, which required some changes to the platform-specific `GraphicsDevice` files. This allows us to centralise the handling of `GraphicsDevice`-specific clones of render states. (I actually wanted to have a `BlendState.Apply` method, which had the `if`/`else` for default blend states, and then called `BlendState.PlatformApply`, but this broke when compiled in 2MGFX, since there are no platform-specific files there. So for now, that code is in `GraphicsDevice.Apply`.)","created_at":"2015-01-29T14:20:06Z","updated_at":"2015-01-29T19:53:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"46c4b1d981cbe91feea2c2ead598b5073ca3e840","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mono/MonoGame/pulls/3472/commits","review_comments_url":"https://api.github.com/repos/mono/MonoGame/pulls/3472/comments","review_comment_url":"https://api.github.com/repos/mono/MonoGame/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mono/MonoGame/issues/3472/comments","statuses_url":"https://api.github.com/repos/mono/MonoGame/statuses/ba01d6cbc832ac3a1b82713fe9dd4b1c2e6fa3a1","head":{"label":"tgjones:graphicsdevice-state","ref":"graphicsdevice-state","sha":"ba01d6cbc832ac3a1b82713fe9dd4b1c2e6fa3a1","user":{"login":"tgjones","id":102049,"avatar_url":"https://avatars.githubusercontent.com/u/102049?v=3","gravatar_id":"","url":"https://api.github.com/users/tgjones","html_url":"https://github.com/tgjones","followers_url":"https://api.github.com/users/tgjones/followers","following_url":"https://api.github.com/users/tgjones/following{/other_user}","gists_url":"https://api.github.com/users/tgjones/gists{/gist_id}","starred_url":"https://api.github.com/users/tgjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgjones/subscriptions","organizations_url":"https://api.github.com/users/tgjones/orgs","repos_url":"https://api.github.com/users/tgjones/repos","events_url":"https://api.github.com/users/tgjones/events{/privacy}","received_events_url":"https://api.github.com/users/tgjones/received_events","type":"User","site_admin":false},"repo":{"id":28746421,"name":"MonoGame","full_name":"tgjones/MonoGame","owner":{"login":"tgjones","id":102049,"avatar_url":"https://avatars.githubusercontent.com/u/102049?v=3","gravatar_id":"","url":"https://api.github.com/users/tgjones","html_url":"https://github.com/tgjones","followers_url":"https://api.github.com/users/tgjones/followers","following_url":"https://api.github.com/users/tgjones/following{/other_user}","gists_url":"https://api.github.com/users/tgjones/gists{/gist_id}","starred_url":"https://api.github.com/users/tgjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgjones/subscriptions","organizations_url":"https://api.github.com/users/tgjones/orgs","repos_url":"https://api.github.com/users/tgjones/repos","events_url":"https://api.github.com/users/tgjones/events{/privacy}","received_events_url":"https://api.github.com/users/tgjones/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tgjones/MonoGame","description":"One framework for creating powerful cross-platform games.","fork":true,"url":"https://api.github.com/repos/tgjones/MonoGame","forks_url":"https://api.github.com/repos/tgjones/MonoGame/forks","keys_url":"https://api.github.com/repos/tgjones/MonoGame/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tgjones/MonoGame/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tgjones/MonoGame/teams","hooks_url":"https://api.github.com/repos/tgjones/MonoGame/hooks","issue_events_url":"https://api.github.com/repos/tgjones/MonoGame/issues/events{/number}","events_url":"https://api.github.com/repos/tgjones/MonoGame/events","assignees_url":"https://api.github.com/repos/tgjones/MonoGame/assignees{/user}","branches_url":"https://api.github.com/repos/tgjones/MonoGame/branches{/branch}","tags_url":"https://api.github.com/repos/tgjones/MonoGame/tags","blobs_url":"https://api.github.com/repos/tgjones/MonoGame/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tgjones/MonoGame/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tgjones/MonoGame/git/refs{/sha}","trees_url":"https://api.github.com/repos/tgjones/MonoGame/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tgjones/MonoGame/statuses/{sha}","languages_url":"https://api.github.com/repos/tgjones/MonoGame/languages","stargazers_url":"https://api.github.com/repos/tgjones/MonoGame/stargazers","contributors_url":"https://api.github.com/repos/tgjones/MonoGame/contributors","subscribers_url":"https://api.github.com/repos/tgjones/MonoGame/subscribers","subscription_url":"https://api.github.com/repos/tgjones/MonoGame/subscription","commits_url":"https://api.github.com/repos/tgjones/MonoGame/commits{/sha}","git_commits_url":"https://api.github.com/repos/tgjones/MonoGame/git/commits{/sha}","comments_url":"https://api.github.com/repos/tgjones/MonoGame/comments{/number}","issue_comment_url":"https://api.github.com/repos/tgjones/MonoGame/issues/comments/{number}","contents_url":"https://api.github.com/repos/tgjones/MonoGame/contents/{+path}","compare_url":"https://api.github.com/repos/tgjones/MonoGame/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tgjones/MonoGame/merges","archive_url":"https://api.github.com/repos/tgjones/MonoGame/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tgjones/MonoGame/downloads","issues_url":"https://api.github.com/repos/tgjones/MonoGame/issues{/number}","pulls_url":"https://api.github.com/repos/tgjones/MonoGame/pulls{/number}","milestones_url":"https://api.github.com/repos/tgjones/MonoGame/milestones{/number}","notifications_url":"https://api.github.com/repos/tgjones/MonoGame/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tgjones/MonoGame/labels{/name}","releases_url":"https://api.github.com/repos/tgjones/MonoGame/releases{/id}","created_at":"2015-01-03T14:58:28Z","updated_at":"2015-01-28T15:15:30Z","pushed_at":"2015-01-29T14:29:27Z","git_url":"git://github.com/tgjones/MonoGame.git","ssh_url":"git@github.com:tgjones/MonoGame.git","clone_url":"https://github.com/tgjones/MonoGame.git","svn_url":"https://github.com/tgjones/MonoGame","homepage":"http://www.monogame.net","size":48863,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"mono:develop","ref":"develop","sha":"5f8835b576463f89ecb489774a6c2a5523ab11ad","user":{"login":"mono","id":53395,"avatar_url":"https://avatars.githubusercontent.com/u/53395?v=3","gravatar_id":"","url":"https://api.github.com/users/mono","html_url":"https://github.com/mono","followers_url":"https://api.github.com/users/mono/followers","following_url":"https://api.github.com/users/mono/following{/other_user}","gists_url":"https://api.github.com/users/mono/gists{/gist_id}","starred_url":"https://api.github.com/users/mono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mono/subscriptions","organizations_url":"https://api.github.com/users/mono/orgs","repos_url":"https://api.github.com/users/mono/repos","events_url":"https://api.github.com/users/mono/events{/privacy}","received_events_url":"https://api.github.com/users/mono/received_events","type":"Organization","site_admin":false},"repo":{"id":1579990,"name":"MonoGame","full_name":"mono/MonoGame","owner":{"login":"mono","id":53395,"avatar_url":"https://avatars.githubusercontent.com/u/53395?v=3","gravatar_id":"","url":"https://api.github.com/users/mono","html_url":"https://github.com/mono","followers_url":"https://api.github.com/users/mono/followers","following_url":"https://api.github.com/users/mono/following{/other_user}","gists_url":"https://api.github.com/users/mono/gists{/gist_id}","starred_url":"https://api.github.com/users/mono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mono/subscriptions","organizations_url":"https://api.github.com/users/mono/orgs","repos_url":"https://api.github.com/users/mono/repos","events_url":"https://api.github.com/users/mono/events{/privacy}","received_events_url":"https://api.github.com/users/mono/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mono/MonoGame","description":"One framework for creating powerful cross-platform games.","fork":false,"url":"https://api.github.com/repos/mono/MonoGame","forks_url":"https://api.github.com/repos/mono/MonoGame/forks","keys_url":"https://api.github.com/repos/mono/MonoGame/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mono/MonoGame/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mono/MonoGame/teams","hooks_url":"https://api.github.com/repos/mono/MonoGame/hooks","issue_events_url":"https://api.github.com/repos/mono/MonoGame/issues/events{/number}","events_url":"https://api.github.com/repos/mono/MonoGame/events","assignees_url":"https://api.github.com/repos/mono/MonoGame/assignees{/user}","branches_url":"https://api.github.com/repos/mono/MonoGame/branches{/branch}","tags_url":"https://api.github.com/repos/mono/MonoGame/tags","blobs_url":"https://api.github.com/repos/mono/MonoGame/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mono/MonoGame/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mono/MonoGame/git/refs{/sha}","trees_url":"https://api.github.com/repos/mono/MonoGame/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mono/MonoGame/statuses/{sha}","languages_url":"https://api.github.com/repos/mono/MonoGame/languages","stargazers_url":"https://api.github.com/repos/mono/MonoGame/stargazers","contributors_url":"https://api.github.com/repos/mono/MonoGame/contributors","subscribers_url":"https://api.github.com/repos/mono/MonoGame/subscribers","subscription_url":"https://api.github.com/repos/mono/MonoGame/subscription","commits_url":"https://api.github.com/repos/mono/MonoGame/commits{/sha}","git_commits_url":"https://api.github.com/repos/mono/MonoGame/git/commits{/sha}","comments_url":"https://api.github.com/repos/mono/MonoGame/comments{/number}","issue_comment_url":"https://api.github.com/repos/mono/MonoGame/issues/comments/{number}","contents_url":"https://api.github.com/repos/mono/MonoGame/contents/{+path}","compare_url":"https://api.github.com/repos/mono/MonoGame/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mono/MonoGame/merges","archive_url":"https://api.github.com/repos/mono/MonoGame/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mono/MonoGame/downloads","issues_url":"https://api.github.com/repos/mono/MonoGame/issues{/number}","pulls_url":"https://api.github.com/repos/mono/MonoGame/pulls{/number}","milestones_url":"https://api.github.com/repos/mono/MonoGame/milestones{/number}","notifications_url":"https://api.github.com/repos/mono/MonoGame/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mono/MonoGame/labels{/name}","releases_url":"https://api.github.com/repos/mono/MonoGame/releases{/id}","created_at":"2011-04-07T00:23:40Z","updated_at":"2015-01-29T16:22:52Z","pushed_at":"2015-01-28T00:06:22Z","git_url":"git://github.com/mono/MonoGame.git","ssh_url":"git@github.com:mono/MonoGame.git","clone_url":"https://github.com/mono/MonoGame.git","svn_url":"https://github.com/mono/MonoGame","homepage":"http://www.monogame.net","size":311998,"stargazers_count":2523,"watchers_count":2523,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1450,"mirror_url":null,"open_issues_count":590,"forks":1450,"open_issues":590,"watchers":2523,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/mono/MonoGame/pulls/3472"},"html":{"href":"https://github.com/mono/MonoGame/pull/3472"},"issue":{"href":"https://api.github.com/repos/mono/MonoGame/issues/3472"},"comments":{"href":"https://api.github.com/repos/mono/MonoGame/issues/3472/comments"},"review_comments":{"href":"https://api.github.com/repos/mono/MonoGame/pulls/3472/comments"},"review_comment":{"href":"https://api.github.com/repos/mono/MonoGame/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mono/MonoGame/pulls/3472/commits"},"statuses":{"href":"https://api.github.com/repos/mono/MonoGame/statuses/ba01d6cbc832ac3a1b82713fe9dd4b1c2e6fa3a1"}}}}