├── DeferredMSAA_Transfer ├── Custom-DeferredReflections.shader ├── Custom-DeferredShading.shader ├── CustomDeferredLibrary.cginc ├── DeferredMSAA.cs ├── DeferredMSAAEditor.cs ├── ResolveAA.shader ├── ResolveAADepth.shader ├── SetGBufferPluginSource │ ├── PluginSource.meta │ └── PluginSource │ │ ├── build.meta │ │ ├── projects.meta │ │ ├── projects │ │ ├── VisualStudio2015.meta │ │ └── VisualStudio2015 │ │ │ ├── RenderingPlugin.sln │ │ │ ├── RenderingPlugin.sln.meta │ │ │ ├── RenderingPlugin.vcxproj │ │ │ ├── RenderingPlugin.vcxproj.filters │ │ │ ├── RenderingPlugin.vcxproj.filters.meta │ │ │ ├── RenderingPlugin.vcxproj.meta │ │ │ ├── RenderingPlugin.vcxproj.user │ │ │ └── RenderingPlugin.vcxproj.user.meta │ │ ├── source.meta │ │ └── source │ │ ├── GLEW.meta │ │ ├── GLEW │ │ ├── glew.c │ │ ├── glew.c.meta │ │ ├── glew.h │ │ ├── glew.h.meta │ │ ├── glxew.h │ │ ├── glxew.h.meta │ │ ├── wglew.h │ │ └── wglew.h.meta │ │ ├── PlatformBase.h │ │ ├── PlatformBase.h.meta │ │ ├── RenderAPI.cpp │ │ ├── RenderAPI.cpp.meta │ │ ├── RenderAPI.h │ │ ├── RenderAPI.h.meta │ │ ├── RenderAPI_D3D11.cpp │ │ ├── RenderAPI_D3D11.cpp.meta │ │ ├── RenderingPlugin.cpp │ │ ├── RenderingPlugin.cpp.meta │ │ ├── RenderingPlugin.def │ │ ├── RenderingPlugin.def.meta │ │ ├── Unity.meta │ │ └── Unity │ │ ├── IUnityGraphics.h │ │ ├── IUnityGraphics.h.meta │ │ ├── IUnityGraphicsD3D11.h │ │ ├── IUnityGraphicsD3D11.h.meta │ │ ├── IUnityGraphicsD3D12.h │ │ ├── IUnityGraphicsD3D12.h.meta │ │ ├── IUnityGraphicsD3D9.h │ │ ├── IUnityGraphicsD3D9.h.meta │ │ ├── IUnityGraphicsMetal.h │ │ ├── IUnityGraphicsMetal.h.meta │ │ ├── IUnityInterface.h │ │ └── IUnityInterface.h.meta ├── SetGBufferTarget.dll └── TransferAA.shader ├── LICENSE └── README.md /DeferredMSAA_Transfer/Custom-DeferredReflections.shader: -------------------------------------------------------------------------------- 1 | // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) 2 | 3 | Shader "Hidden/Custom-DeferredReflections" { 4 | Properties { 5 | _SrcBlend ("", Float) = 1 6 | _DstBlend ("", Float) = 1 7 | } 8 | SubShader { 9 | 10 | // Calculates reflection contribution from a single probe (rendered as cubes) or default reflection (rendered as full screen quad) 11 | Pass { 12 | ZWrite Off 13 | ZTest LEqual 14 | Blend [_SrcBlend] [_DstBlend] 15 | CGPROGRAM 16 | #pragma target 3.0 17 | #pragma vertex vert_deferred 18 | #pragma fragment frag 19 | 20 | #include "UnityCG.cginc" 21 | #include "UnityDeferredLibrary.cginc" 22 | #include "UnityStandardUtils.cginc" 23 | #include "UnityGBuffer.cginc" 24 | #include "UnityStandardBRDF.cginc" 25 | #include "UnityPBSLighting.cginc" 26 | 27 | sampler2D _CameraGBufferTexture0; 28 | sampler2D _CameraGBufferTexture1; 29 | sampler2D _CameraGBufferTexture2; 30 | 31 | // msaa targets 32 | Texture2DArray _GBuffer0; 33 | Texture2DArray _GBuffer1; 34 | Texture2DArray _GBuffer2; 35 | uint _MsaaFactor; 36 | float _MsaaThreshold; 37 | 38 | half3 distanceFromAABB(half3 p, half3 aabbMin, half3 aabbMax) 39 | { 40 | return max(max(p - aabbMax, aabbMin - p), half3(0.0, 0.0, 0.0)); 41 | } 42 | 43 | half4 DeferredReflection(UnityStandardData data, float3 worldPos) 44 | { 45 | float3 eyeVec = normalize(worldPos - _WorldSpaceCameraPos); 46 | half oneMinusReflectivity = 1 - SpecularStrength(data.specularColor); 47 | 48 | half3 worldNormalRefl = reflect(eyeVec, data.normalWorld); 49 | 50 | // Unused member don't need to be initialized 51 | UnityGIInput d; 52 | d.worldPos = worldPos; 53 | d.worldViewDir = -eyeVec; 54 | d.probeHDR[0] = unity_SpecCube0_HDR; 55 | d.boxMin[0].w = 1; // 1 in .w allow to disable blending in UnityGI_IndirectSpecular call since it doesn't work in Deferred 56 | 57 | float blendDistance = unity_SpecCube1_ProbePosition.w; // will be set to blend distance for this probe 58 | #ifdef UNITY_SPECCUBE_BOX_PROJECTION 59 | d.probePosition[0] = unity_SpecCube0_ProbePosition; 60 | d.boxMin[0].xyz = unity_SpecCube0_BoxMin - float4(blendDistance, blendDistance, blendDistance, 0); 61 | d.boxMax[0].xyz = unity_SpecCube0_BoxMax + float4(blendDistance, blendDistance, blendDistance, 0); 62 | #endif 63 | 64 | Unity_GlossyEnvironmentData g = UnityGlossyEnvironmentSetup(data.smoothness, d.worldViewDir, data.normalWorld, data.specularColor); 65 | 66 | half3 env0 = UnityGI_IndirectSpecular(d, data.occlusion, g); 67 | 68 | UnityLight light; 69 | light.color = half3(0, 0, 0); 70 | light.dir = half3(0, 1, 0); 71 | 72 | UnityIndirect ind; 73 | ind.diffuse = 0; 74 | ind.specular = env0; 75 | 76 | half3 rgb = UNITY_BRDF_PBS(0, data.specularColor, oneMinusReflectivity, data.smoothness, data.normalWorld, -eyeVec, light, ind).rgb; 77 | 78 | // Calculate falloff value, so reflections on the edges of the probe would gradually blend to previous reflection. 79 | // Also this ensures that pixels not located in the reflection probe AABB won't 80 | // accidentally pick up reflections from this probe. 81 | half3 distance = distanceFromAABB(worldPos, unity_SpecCube0_BoxMin.xyz, unity_SpecCube0_BoxMax.xyz); 82 | half falloff = saturate(1.0 - length(distance) / blendDistance); 83 | 84 | return half4(rgb, falloff); 85 | } 86 | 87 | half4 frag (unity_v2f_deferred i) : SV_Target 88 | { 89 | // Stripped from UnityDeferredCalculateLightParams, refactor into function ? 90 | i.ray = i.ray * (_ProjectionParams.z / i.ray.z); 91 | float2 uv = i.uv.xy / i.uv.w; 92 | 93 | // read depth and reconstruct world position 94 | float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); 95 | depth = Linear01Depth (depth); 96 | float4 viewPos = float4(i.ray * depth,1); 97 | float3 worldPos = mul (unity_CameraToWorld, viewPos).xyz; 98 | 99 | half4 gbuffer0 = tex2D (_CameraGBufferTexture0, uv); 100 | half4 gbuffer1 = tex2D (_CameraGBufferTexture1, uv); 101 | half4 gbuffer2 = tex2D (_CameraGBufferTexture2, uv); 102 | 103 | 104 | [branch] 105 | if (_MsaaFactor <= 1) 106 | { 107 | UnityStandardData data = UnityStandardDataFromGbuffer(gbuffer0, gbuffer1, gbuffer2); 108 | return DeferredReflection(data, worldPos); 109 | } 110 | else 111 | { 112 | // edge detect (color / normal difference) 113 | float3 c0 = _GBuffer0.Load(uint4(uv * _ScreenParams.xy, 0, 0)).rgb; 114 | float3 n0 = _GBuffer2.Load(uint4(uv * _ScreenParams.xy, 0, 0)).xyz; 115 | 116 | bool needMSAA = false; 117 | for (uint a = 1; a < _MsaaFactor; a++) 118 | { 119 | float3 c1 = _GBuffer0.Load(uint4(uv * _ScreenParams.xy, a, 0)).rgb; 120 | float3 n1 = _GBuffer2.Load(uint4(uv * _ScreenParams.xy, a, 0)).xyz; 121 | 122 | needMSAA = needMSAA 123 | || abs(dot(abs(c0.rgb - c1.rgb), float3(1, 1, 1))) > _MsaaThreshold 124 | || abs(dot(abs(n0.xyz - n1.xyz), float3(1, 1, 1))) > _MsaaThreshold; 125 | } 126 | uint msaaCount = lerp(1, _MsaaFactor, needMSAA); 127 | 128 | // use msaa resolve 129 | half4 col = 0; 130 | for (a = 0; a < msaaCount; a++) 131 | { 132 | gbuffer0 = _GBuffer0.Load(uint4(uv * _ScreenParams.xy, a, 0)); 133 | gbuffer1 = _GBuffer1.Load(uint4(uv * _ScreenParams.xy, a, 0)); 134 | gbuffer2 = _GBuffer2.Load(uint4(uv * _ScreenParams.xy, a, 0)); 135 | UnityStandardData data = UnityStandardDataFromGbuffer(gbuffer0, gbuffer1, gbuffer2); 136 | 137 | col += DeferredReflection(data, worldPos); 138 | } 139 | return col / msaaCount; 140 | } 141 | } 142 | 143 | ENDCG 144 | } 145 | 146 | // Adds reflection buffer to the lighting buffer 147 | Pass 148 | { 149 | ZWrite Off 150 | ZTest Always 151 | Blend [_SrcBlend] [_DstBlend] 152 | 153 | CGPROGRAM 154 | #pragma target 3.0 155 | #pragma vertex vert 156 | #pragma fragment frag 157 | #pragma multi_compile ___ UNITY_HDR_ON 158 | 159 | #include "UnityCG.cginc" 160 | 161 | sampler2D _CameraReflectionsTexture; 162 | 163 | struct v2f { 164 | float2 uv : TEXCOORD0; 165 | float4 pos : SV_POSITION; 166 | }; 167 | 168 | v2f vert (float4 vertex : POSITION) 169 | { 170 | v2f o; 171 | o.pos = UnityObjectToClipPos(vertex); 172 | o.uv = ComputeScreenPos (o.pos).xy; 173 | return o; 174 | } 175 | 176 | half4 frag (v2f i) : SV_Target 177 | { 178 | half4 c = tex2D (_CameraReflectionsTexture, i.uv); 179 | #ifdef UNITY_HDR_ON 180 | return float4(c.rgb, 0.0f); 181 | #else 182 | return float4(exp2(-c.rgb), 0.0f); 183 | #endif 184 | 185 | } 186 | ENDCG 187 | } 188 | 189 | } 190 | Fallback Off 191 | } 192 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/Custom-DeferredShading.shader: -------------------------------------------------------------------------------- 1 | // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) 2 | 3 | Shader "Hidden/Custom-DeferredShading" { 4 | Properties { 5 | _LightTexture0 ("", any) = "" {} 6 | _LightTextureB0 ("", 2D) = "" {} 7 | _ShadowMapTexture ("", any) = "" {} 8 | _SrcBlend ("", Float) = 1 9 | _DstBlend ("", Float) = 1 10 | } 11 | SubShader { 12 | 13 | // Pass 1: Lighting pass 14 | // LDR case - Lighting encoded into a subtractive ARGB8 buffer 15 | // HDR case - Lighting additively blended into floating point buffer 16 | Pass { 17 | ZWrite Off 18 | Blend [_SrcBlend] [_DstBlend] 19 | 20 | CGPROGRAM 21 | #pragma target 5.0 22 | #pragma vertex vert_deferred 23 | #pragma fragment frag 24 | #pragma multi_compile_lightpass 25 | #pragma multi_compile ___ UNITY_HDR_ON 26 | 27 | #pragma exclude_renderers nomrt 28 | 29 | #include "UnityCG.cginc" 30 | #include "CustomDeferredLibrary.cginc" 31 | #include "UnityPBSLighting.cginc" 32 | #include "UnityStandardUtils.cginc" 33 | #include "UnityGBuffer.cginc" 34 | #include "UnityStandardBRDF.cginc" 35 | 36 | sampler2D _CameraGBufferTexture0; 37 | sampler2D _CameraGBufferTexture1; 38 | sampler2D _CameraGBufferTexture2; 39 | 40 | Texture2DArray _GBuffer0; 41 | Texture2DArray _GBuffer1; 42 | Texture2DArray _GBuffer2; 43 | 44 | float _MsaaThreshold; 45 | float _DebugMsaa; 46 | 47 | half4 CalculateLight (unity_v2f_deferred i) 48 | { 49 | float3 wpos; 50 | float2 uv; 51 | float atten, fadeDist; 52 | UnityLight light; 53 | UNITY_INITIALIZE_OUTPUT(UnityLight, light); 54 | CustomDeferredCalculateLightParams (i, wpos, uv, light.dir, atten, fadeDist); 55 | 56 | light.color = _LightColor.rgb * atten; 57 | 58 | // unpack Gbuffer 59 | half4 gbuffer0 = tex2D(_CameraGBufferTexture0, uv); 60 | half4 gbuffer1 = tex2D(_CameraGBufferTexture1, uv); 61 | half4 gbuffer2 = tex2D(_CameraGBufferTexture2, uv); 62 | 63 | half4 col = 0; 64 | 65 | [branch] 66 | if (_MsaaFactor > 1) 67 | { 68 | // edge detect (color & normal difference) 69 | float3 c0 = _GBuffer0.Load(uint4(uv * _ScreenParams.xy, 0, 0)).rgb; 70 | float3 n0 = _GBuffer2.Load(uint4(uv * _ScreenParams.xy, 0, 0)).xyz; 71 | 72 | bool needMSAA = false; 73 | for (uint a = 1; a < _MsaaFactor; a++) 74 | { 75 | float3 c1 = _GBuffer0.Load(uint4(uv * _ScreenParams.xy, a, 0)).rgb; 76 | float3 n1 = _GBuffer2.Load(uint4(uv * _ScreenParams.xy, a, 0)).xyz; 77 | 78 | needMSAA = needMSAA 79 | || abs(dot(abs(c0.rgb - c1.rgb), float3(1, 1, 1))) > _MsaaThreshold 80 | || abs(dot(abs(n0.xyz - n1.xyz), float3(1, 1, 1))) > _MsaaThreshold; 81 | } 82 | uint msaaCount = lerp(1, _MsaaFactor, needMSAA); 83 | 84 | [branch] 85 | if (_DebugMsaa && needMSAA) 86 | return float4(1, 0, 0, 1); 87 | 88 | for (a = 0; a < msaaCount; a++) 89 | { 90 | // calc atten 91 | #if defined(SHADOWS_SHADOWMASK) 92 | CustomDeferredAtten(wpos, fadeDist, uv, a, atten); 93 | light.color = _LightColor.rgb * atten; 94 | #endif 95 | 96 | gbuffer0 = _GBuffer0.Load(uint4(uv * _ScreenParams.xy, a, 0)); 97 | gbuffer1 = _GBuffer1.Load(uint4(uv * _ScreenParams.xy, a, 0)); 98 | gbuffer2 = _GBuffer2.Load(uint4(uv * _ScreenParams.xy, a, 0)); 99 | UnityStandardData data = UnityStandardDataFromGbuffer(gbuffer0, gbuffer1, gbuffer2); 100 | 101 | float3 eyeVec = normalize(wpos - _WorldSpaceCameraPos); 102 | half oneMinusReflectivity = 1 - SpecularStrength(data.specularColor.rgb); 103 | 104 | UnityIndirect ind; 105 | UNITY_INITIALIZE_OUTPUT(UnityIndirect, ind); 106 | ind.diffuse = 0; 107 | ind.specular = 0; 108 | 109 | col += UNITY_BRDF_PBS(data.diffuseColor, data.specularColor, oneMinusReflectivity, data.smoothness, data.normalWorld, -eyeVec, light, ind); 110 | } 111 | col /= msaaCount; 112 | } 113 | else 114 | { 115 | UnityStandardData data = UnityStandardDataFromGbuffer(gbuffer0, gbuffer1, gbuffer2); 116 | 117 | float3 eyeVec = normalize(wpos - _WorldSpaceCameraPos); 118 | half oneMinusReflectivity = 1 - SpecularStrength(data.specularColor.rgb); 119 | 120 | UnityIndirect ind; 121 | UNITY_INITIALIZE_OUTPUT(UnityIndirect, ind); 122 | ind.diffuse = 0; 123 | ind.specular = 0; 124 | 125 | col = UNITY_BRDF_PBS(data.diffuseColor, data.specularColor, oneMinusReflectivity, data.smoothness, data.normalWorld, -eyeVec, light, ind); 126 | } 127 | 128 | return col; 129 | } 130 | 131 | #ifdef UNITY_HDR_ON 132 | half4 133 | #else 134 | fixed4 135 | #endif 136 | frag (unity_v2f_deferred i) : SV_Target 137 | { 138 | half4 c = CalculateLight(i); 139 | #ifdef UNITY_HDR_ON 140 | return c; 141 | #else 142 | return exp2(-c); 143 | #endif 144 | } 145 | 146 | ENDCG 147 | } 148 | 149 | 150 | // Pass 2: Final decode pass. 151 | // Used only with HDR off, to decode the logarithmic buffer into the main RT 152 | Pass { 153 | ZTest Always Cull Off ZWrite Off 154 | Stencil { 155 | ref [_StencilNonBackground] 156 | readmask [_StencilNonBackground] 157 | // Normally just comp would be sufficient, but there's a bug and only front face stencil state is set (case 583207) 158 | compback equal 159 | compfront equal 160 | } 161 | 162 | CGPROGRAM 163 | #pragma target 3.0 164 | #pragma vertex vert 165 | #pragma fragment frag 166 | #pragma exclude_renderers nomrt 167 | 168 | #include "UnityCG.cginc" 169 | 170 | sampler2D _LightBuffer; 171 | struct v2f { 172 | float4 vertex : SV_POSITION; 173 | float2 texcoord : TEXCOORD0; 174 | }; 175 | 176 | v2f vert (float4 vertex : POSITION, float2 texcoord : TEXCOORD0) 177 | { 178 | v2f o; 179 | o.vertex = UnityObjectToClipPos(vertex); 180 | o.texcoord = texcoord.xy; 181 | #ifdef UNITY_SINGLE_PASS_STEREO 182 | o.texcoord = TransformStereoScreenSpaceTex(o.texcoord, 1.0f); 183 | #endif 184 | return o; 185 | } 186 | 187 | fixed4 frag (v2f i) : SV_Target 188 | { 189 | return -log2(tex2D(_LightBuffer, i.texcoord)); 190 | } 191 | ENDCG 192 | } 193 | 194 | } 195 | Fallback Off 196 | } 197 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/CustomDeferredLibrary.cginc: -------------------------------------------------------------------------------- 1 | // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) 2 | 3 | #ifndef CUSTOM_DEFERRED_LIBRARY_INCLUDED 4 | #define CUSTOM_DEFERRED_LIBRARY_INCLUDED 5 | 6 | // Deferred lighting / shading helpers 7 | 8 | 9 | // -------------------------------------------------------- 10 | // Vertex shader 11 | 12 | struct unity_v2f_deferred { 13 | float4 pos : SV_POSITION; 14 | float4 uv : TEXCOORD0; 15 | float3 ray : TEXCOORD1; 16 | }; 17 | 18 | float _LightAsQuad; 19 | 20 | unity_v2f_deferred vert_deferred (float4 vertex : POSITION, float3 normal : NORMAL) 21 | { 22 | unity_v2f_deferred o; 23 | o.pos = UnityObjectToClipPos(vertex); 24 | o.uv = ComputeScreenPos(o.pos); 25 | o.ray = UnityObjectToViewPos(vertex) * float3(-1,-1,1); 26 | 27 | // normal contains a ray pointing from the camera to one of near plane's 28 | // corners in camera space when we are drawing a full screen quad. 29 | // Otherwise, when rendering 3D shapes, use the ray calculated here. 30 | o.ray = lerp(o.ray, normal, _LightAsQuad); 31 | 32 | return o; 33 | } 34 | 35 | 36 | // -------------------------------------------------------- 37 | // Shared uniforms 38 | 39 | 40 | UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); 41 | 42 | float4 _LightDir; 43 | float4 _LightPos; 44 | float4 _LightColor; 45 | float4 unity_LightmapFade; 46 | float4x4 unity_WorldToLight; 47 | sampler2D_float _LightTextureB0; 48 | uint _MsaaFactor; 49 | 50 | #if defined (POINT_COOKIE) 51 | samplerCUBE_float _LightTexture0; 52 | #else 53 | sampler2D_float _LightTexture0; 54 | #endif 55 | 56 | #if defined (SHADOWS_SCREEN) 57 | sampler2D _ShadowMapTexture; 58 | #endif 59 | 60 | #if defined (SHADOWS_SHADOWMASK) 61 | sampler2D _CameraGBufferTexture4; 62 | Texture2DArray _GBuffer4; 63 | #endif 64 | 65 | // -------------------------------------------------------- 66 | // Shadow/fade helpers 67 | 68 | // Receiver plane depth bias create artifacts when depth is retrieved from 69 | // the depth buffer. see UnityGetReceiverPlaneDepthBias in UnityShadowLibrary.cginc 70 | #ifdef UNITY_USE_RECEIVER_PLANE_BIAS 71 | #undef UNITY_USE_RECEIVER_PLANE_BIAS 72 | #endif 73 | 74 | #include "UnityShadowLibrary.cginc" 75 | 76 | 77 | //Note : 78 | // SHADOWS_SHADOWMASK + LIGHTMAP_SHADOW_MIXING -> ShadowMask mode 79 | // SHADOWS_SHADOWMASK only -> Distance shadowmask mode 80 | 81 | // -------------------------------------------------------- 82 | half UnityDeferredSampleShadowMask(float2 uv, uint sampleIndex) 83 | { 84 | half shadowMaskAttenuation = 1.0f; 85 | 86 | #if defined (SHADOWS_SHADOWMASK) 87 | half4 shadowMask = 1; 88 | 89 | [branch] 90 | if (_MsaaFactor == 1) 91 | { 92 | shadowMask = tex2D(_CameraGBufferTexture4, uv); 93 | } 94 | else 95 | { 96 | shadowMask = _GBuffer4.Load(uint4(uv * _ScreenParams.xy, sampleIndex, 0)); 97 | } 98 | 99 | shadowMaskAttenuation = saturate(dot(shadowMask, unity_OcclusionMaskSelector)); 100 | #endif 101 | 102 | return shadowMaskAttenuation; 103 | } 104 | 105 | // -------------------------------------------------------- 106 | half UnityDeferredSampleRealtimeShadow(half fade, float3 vec, float2 uv) 107 | { 108 | half shadowAttenuation = 1.0f; 109 | 110 | #if defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE) 111 | #if defined(SHADOWS_SCREEN) 112 | shadowAttenuation = tex2D(_ShadowMapTexture, uv).r; 113 | #endif 114 | #endif 115 | 116 | #if defined(UNITY_FAST_COHERENT_DYNAMIC_BRANCHING) && defined(SHADOWS_SOFT) && !defined(LIGHTMAP_SHADOW_MIXING) 117 | //avoid expensive shadows fetches in the distance where coherency will be good 118 | UNITY_BRANCH 119 | if (fade < (1.0f - 1e-2f)) 120 | { 121 | #endif 122 | 123 | #if defined(SPOT) 124 | #if defined(SHADOWS_DEPTH) 125 | float4 shadowCoord = mul(unity_WorldToShadow[0], float4(vec, 1)); 126 | shadowAttenuation = UnitySampleShadowmap(shadowCoord); 127 | #endif 128 | #endif 129 | 130 | #if defined (POINT) || defined (POINT_COOKIE) 131 | #if defined(SHADOWS_CUBE) 132 | shadowAttenuation = UnitySampleShadowmap(vec); 133 | #endif 134 | #endif 135 | 136 | #if defined(UNITY_FAST_COHERENT_DYNAMIC_BRANCHING) && defined(SHADOWS_SOFT) && !defined(LIGHTMAP_SHADOW_MIXING) 137 | } 138 | #endif 139 | 140 | return shadowAttenuation; 141 | } 142 | 143 | // -------------------------------------------------------- 144 | half UnityDeferredComputeShadow(float3 vec, float fadeDist, float2 uv, uint sampleIndex = 0) 145 | { 146 | half fade = UnityComputeShadowFade(fadeDist); 147 | half shadowMaskAttenuation = UnityDeferredSampleShadowMask(uv, sampleIndex); 148 | half realtimeShadowAttenuation = UnityDeferredSampleRealtimeShadow(fade, vec, uv); 149 | 150 | return UnityMixRealtimeAndBakedShadows(realtimeShadowAttenuation, shadowMaskAttenuation, fade); 151 | } 152 | 153 | // -------------------------------------------------------- 154 | // Common lighting data calculation (direction, attenuation, ...) 155 | void CustomDeferredCalculateLightParams ( 156 | unity_v2f_deferred i, 157 | out float3 outWorldPos, 158 | out float2 outUV, 159 | out half3 outLightDir, 160 | out float outAtten, 161 | out float outFadeDist) 162 | { 163 | i.ray = i.ray * (_ProjectionParams.z / i.ray.z); 164 | float2 uv = i.uv.xy / i.uv.w; 165 | 166 | // read depth and reconstruct world position 167 | float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); 168 | depth = Linear01Depth (depth); 169 | float4 vpos = float4(i.ray * depth,1); 170 | float3 wpos = mul (unity_CameraToWorld, vpos).xyz; 171 | 172 | float fadeDist = UnityComputeShadowFadeDistance(wpos, vpos.z); 173 | 174 | // spot light case 175 | #if defined (SPOT) 176 | float3 tolight = _LightPos.xyz - wpos; 177 | half3 lightDir = normalize (tolight); 178 | 179 | float4 uvCookie = mul (unity_WorldToLight, float4(wpos,1)); 180 | // negative bias because http://aras-p.info/blog/2010/01/07/screenspace-vs-mip-mapping/ 181 | float atten = tex2Dbias (_LightTexture0, float4(uvCookie.xy / uvCookie.w, 0, -8)).w; 182 | atten *= uvCookie.w < 0; 183 | float att = dot(tolight, tolight) * _LightPos.w; 184 | atten *= tex2D (_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL; 185 | 186 | atten *= UnityDeferredComputeShadow (wpos, fadeDist, uv); 187 | 188 | // directional light case 189 | #elif defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE) 190 | half3 lightDir = -_LightDir.xyz; 191 | float atten = 1.0; 192 | 193 | atten *= UnityDeferredComputeShadow (wpos, fadeDist, uv); 194 | 195 | #if defined (DIRECTIONAL_COOKIE) 196 | atten *= tex2Dbias (_LightTexture0, float4(mul(unity_WorldToLight, half4(wpos,1)).xy, 0, -8)).w; 197 | #endif //DIRECTIONAL_COOKIE 198 | 199 | // point light case 200 | #elif defined (POINT) || defined (POINT_COOKIE) 201 | float3 tolight = wpos - _LightPos.xyz; 202 | half3 lightDir = -normalize (tolight); 203 | 204 | float att = dot(tolight, tolight) * _LightPos.w; 205 | float atten = tex2D (_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL; 206 | 207 | atten *= UnityDeferredComputeShadow (tolight, fadeDist, uv); 208 | 209 | #if defined (POINT_COOKIE) 210 | atten *= texCUBEbias(_LightTexture0, float4(mul(unity_WorldToLight, half4(wpos,1)).xyz, -8)).w; 211 | #endif //POINT_COOKIE 212 | #else 213 | half3 lightDir = 0; 214 | float atten = 0; 215 | #endif 216 | 217 | outWorldPos = wpos; 218 | outUV = uv; 219 | outLightDir = lightDir; 220 | outAtten = atten; 221 | outFadeDist = fadeDist; 222 | } 223 | 224 | // get atten again 225 | void CustomDeferredAtten(float3 wpos, float fadeDist, float2 uv, uint sampleIndex, out float outAtten) 226 | { 227 | // spot light case 228 | #if defined (SPOT) 229 | float3 tolight = _LightPos.xyz - wpos; 230 | half3 lightDir = normalize(tolight); 231 | 232 | float4 uvCookie = mul(unity_WorldToLight, float4(wpos, 1)); 233 | // negative bias because http://aras-p.info/blog/2010/01/07/screenspace-vs-mip-mapping/ 234 | float atten = tex2Dbias(_LightTexture0, float4(uvCookie.xy / uvCookie.w, 0, -8)).w; 235 | atten *= uvCookie.w < 0; 236 | float att = dot(tolight, tolight) * _LightPos.w; 237 | atten *= tex2D(_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL; 238 | 239 | atten *= UnityDeferredComputeShadow(wpos, fadeDist, uv, sampleIndex); 240 | 241 | // directional light case 242 | #elif defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE) 243 | half3 lightDir = -_LightDir.xyz; 244 | float atten = 1.0; 245 | 246 | atten *= UnityDeferredComputeShadow(wpos, fadeDist, uv, sampleIndex); 247 | 248 | #if defined (DIRECTIONAL_COOKIE) 249 | atten *= tex2Dbias(_LightTexture0, float4(mul(unity_WorldToLight, half4(wpos, 1)).xy, 0, -8)).w; 250 | #endif //DIRECTIONAL_COOKIE 251 | 252 | // point light case 253 | #elif defined (POINT) || defined (POINT_COOKIE) 254 | float3 tolight = wpos - _LightPos.xyz; 255 | half3 lightDir = -normalize(tolight); 256 | 257 | float att = dot(tolight, tolight) * _LightPos.w; 258 | float atten = tex2D(_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL; 259 | 260 | atten *= UnityDeferredComputeShadow(tolight, fadeDist, uv, sampleIndex); 261 | 262 | #if defined (POINT_COOKIE) 263 | atten *= texCUBEbias(_LightTexture0, float4(mul(unity_WorldToLight, half4(wpos, 1)).xyz, -8)).w; 264 | #endif //POINT_COOKIE 265 | #else 266 | half3 lightDir = 0; 267 | float atten = 0; 268 | #endif 269 | 270 | outAtten = atten; 271 | } 272 | 273 | #endif // UNITY_DEFERRED_LIBRARY_INCLUDED 274 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/DeferredMSAA.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using UnityEngine; 4 | using UnityEngine.Rendering; 5 | 6 | /// 7 | /// deferred msaa 8 | /// 9 | [RequireComponent(typeof(Camera))] 10 | public class DeferredMSAA : MonoBehaviour 11 | { 12 | /// 13 | /// is scene view 14 | /// 15 | public static bool isSceneView = false; 16 | 17 | /// 18 | /// msaa sample 19 | /// 20 | public enum MSAASample 21 | { 22 | Msaa2X = 0, 23 | Msaa4X, 24 | Msaa8X 25 | } 26 | 27 | [DllImport("SetGBufferTarget")] 28 | static extern bool SetGBufferColor(int _index, int _msaaFactor, IntPtr _colorBuffer); 29 | 30 | [DllImport("SetGBufferTarget")] 31 | static extern bool SetGBufferDepth(int _msaaFactor, IntPtr _depthBuffer); 32 | 33 | [DllImport("SetGBufferTarget")] 34 | static extern void SetClearColor(float[] _color); 35 | 36 | [DllImport("SetGBufferTarget")] 37 | static extern void Release(); 38 | 39 | [DllImport("SetGBufferTarget")] 40 | static extern IntPtr GetRenderEventFunc(); 41 | 42 | /// 43 | /// msaa factor 44 | /// 45 | public MSAASample msaaFactor = MSAASample.Msaa2X; 46 | 47 | /// 48 | /// msaa threshold 49 | /// 50 | [Range(0, 1)] 51 | public float msaaThreshold = 0.1f; 52 | 53 | /// 54 | /// debug msaa 55 | /// 56 | public bool debugMsaa = false; 57 | 58 | /// 59 | /// resolve aa material 60 | /// 61 | public Material resolveAA; 62 | 63 | /// 64 | /// transfer aa instead resolve 65 | /// 66 | public Material transferAA; 67 | 68 | /// 69 | /// resolve aa depth material 70 | /// 71 | public Material resolveAADepth; 72 | 73 | RenderTexture diffuseRT; 74 | RenderTexture specularRT; 75 | RenderTexture normalRT; 76 | RenderTexture emissionRT; 77 | RenderTexture shadowMaskRT; 78 | RenderTexture depthRT; 79 | RenderTexture skyTexture; 80 | 81 | RenderTexture diffuseAry; 82 | RenderTexture specularAry; 83 | RenderTexture normalAry; 84 | RenderTexture shadowMaskAry; 85 | 86 | Camera attachedCam; 87 | CommandBuffer msGBuffer; 88 | CommandBuffer copyGBuffer; 89 | 90 | bool initSucceed = true; 91 | string[] texName = { "_MsaaTex_2X", "_MsaaTex_4X", "_MsaaTex_8X" }; 92 | 93 | int[] msaaFactors = { 2, 4, 8 }; 94 | int lastWidth; 95 | int lastHeight; 96 | int lastMsaa; 97 | 98 | void Awake() 99 | { 100 | attachedCam = GetComponent(); 101 | attachedCam.renderingPath = RenderingPath.DeferredShading; 102 | attachedCam.allowHDR = true; 103 | 104 | float[] bgColor = new float[4]; 105 | bgColor[0] = attachedCam.backgroundColor.linear.r; 106 | bgColor[1] = attachedCam.backgroundColor.linear.g; 107 | bgColor[2] = attachedCam.backgroundColor.linear.b; 108 | bgColor[3] = attachedCam.backgroundColor.linear.a; 109 | 110 | SetClearColor(bgColor); 111 | 112 | CreateMapAndColorBuffer("Custom diffuse", 0, RenderTextureFormat.ARGB32, 0, msaaFactors[(int)msaaFactor], ref diffuseRT); 113 | CreateMapAndColorBuffer("Custom specular", 0, RenderTextureFormat.ARGB32, 1, msaaFactors[(int)msaaFactor], ref specularRT); 114 | CreateMapAndColorBuffer("Custom normal", 0, RenderTextureFormat.ARGB2101010, 2, msaaFactors[(int)msaaFactor], ref normalRT); 115 | CreateMapAndColorBuffer("Custom emission", 0, RenderTextureFormat.ARGBHalf, 3, msaaFactors[(int)msaaFactor], ref emissionRT); 116 | CreateMapAndColorBuffer("Custom shadowmask", 0, RenderTextureFormat.ARGB32, 4, msaaFactors[(int)msaaFactor], ref shadowMaskRT); 117 | CreateMapAndColorBuffer("Cutsom depth", 32, RenderTextureFormat.Depth, -1, msaaFactors[(int)msaaFactor], ref depthRT); 118 | 119 | // sky tex, quarter res is enough 120 | skyTexture = new RenderTexture(Screen.width / 4, Screen.height / 4, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); 121 | skyTexture.name = "Sky Texture"; 122 | 123 | CreateAryMap("Diffuse Ary", RenderTextureFormat.ARGB32, ref diffuseAry); 124 | CreateAryMap("Specular Ary", RenderTextureFormat.ARGB32, ref specularAry); 125 | CreateAryMap("Normal Ary", RenderTextureFormat.ARGB2101010, ref normalAry); 126 | CreateAryMap("Shadowmask Ary", RenderTextureFormat.ARGB32, ref shadowMaskAry); 127 | 128 | initSucceed = initSucceed && SetGBufferDepth(msaaFactors[(int)msaaFactor], depthRT.GetNativeDepthBufferPtr()); 129 | 130 | if (!initSucceed) 131 | { 132 | Debug.Log("MainGraphic : [DeferredMSAA] detph native failed."); 133 | enabled = false; 134 | OnDestroy(); 135 | return; 136 | } 137 | 138 | msGBuffer = new CommandBuffer(); 139 | msGBuffer.name = "Bind MS GBuffer"; 140 | msGBuffer.IssuePluginEvent(GetRenderEventFunc(), 0); 141 | 142 | copyGBuffer = new CommandBuffer(); 143 | copyGBuffer.name = "Copy MS GBuffer"; 144 | 145 | 146 | copyGBuffer.SetGlobalFloat("_MsaaFactor", msaaFactors[(int)msaaFactor]); 147 | copyGBuffer.SetGlobalTexture("_SkyTextureForResolve", skyTexture); 148 | 149 | int texIdx = 0; 150 | texIdx = (msaaFactors[(int)msaaFactor] == 4) ? 1 : texIdx; 151 | texIdx = (msaaFactors[(int)msaaFactor] == 8) ? 2 : texIdx; 152 | 153 | copyGBuffer.SetGlobalTexture(texName[texIdx], emissionRT); 154 | copyGBuffer.Blit(null, BuiltinRenderTextureType.CameraTarget, resolveAA); 155 | 156 | copyGBuffer.SetGlobalTexture(texName[texIdx], diffuseRT); 157 | copyGBuffer.Blit(null, BuiltinRenderTextureType.GBuffer0, resolveAA); 158 | 159 | copyGBuffer.SetGlobalTexture(texName[texIdx], specularRT); 160 | copyGBuffer.Blit(null, BuiltinRenderTextureType.GBuffer1, resolveAA); 161 | 162 | copyGBuffer.SetGlobalTexture(texName[texIdx], normalRT); 163 | copyGBuffer.SetGlobalFloat("_IsNormal", 1f); 164 | copyGBuffer.Blit(null, BuiltinRenderTextureType.GBuffer2, resolveAA); 165 | copyGBuffer.SetGlobalFloat("_IsNormal", 0f); 166 | 167 | copyGBuffer.SetGlobalTexture(texName[texIdx], depthRT); 168 | copyGBuffer.Blit(null, BuiltinRenderTextureType.CameraTarget, resolveAADepth); 169 | 170 | for (int i = 0; i < msaaFactors[(int)msaaFactor]; i++) 171 | { 172 | copyGBuffer.SetGlobalFloat("_TransferAAIndex", i); 173 | 174 | copyGBuffer.SetRenderTarget(diffuseAry, 0, CubemapFace.Unknown, i); 175 | copyGBuffer.SetGlobalTexture("_MsaaTex", diffuseRT); 176 | copyGBuffer.Blit(null, BuiltinRenderTextureType.CurrentActive, transferAA); 177 | 178 | copyGBuffer.SetRenderTarget(specularAry, 0, CubemapFace.Unknown, i); 179 | copyGBuffer.SetGlobalTexture("_MsaaTex", specularRT); 180 | copyGBuffer.Blit(null, BuiltinRenderTextureType.CurrentActive, transferAA); 181 | 182 | copyGBuffer.SetRenderTarget(normalAry, 0, CubemapFace.Unknown, i); 183 | copyGBuffer.SetGlobalTexture("_MsaaTex", normalRT); 184 | copyGBuffer.Blit(null, BuiltinRenderTextureType.CurrentActive, transferAA); 185 | 186 | copyGBuffer.SetRenderTarget(shadowMaskAry, 0, CubemapFace.Unknown, i); 187 | copyGBuffer.SetGlobalTexture("_MsaaTex", shadowMaskRT); 188 | copyGBuffer.Blit(null, BuiltinRenderTextureType.CurrentActive, transferAA); 189 | } 190 | 191 | copyGBuffer.SetGlobalTexture("_GBuffer0", diffuseAry); 192 | copyGBuffer.SetGlobalTexture("_GBuffer1", specularAry); 193 | copyGBuffer.SetGlobalTexture("_GBuffer2", normalAry); 194 | copyGBuffer.SetGlobalTexture("_GBuffer4", shadowMaskAry); 195 | 196 | lastWidth = Screen.width; 197 | lastHeight = Screen.height; 198 | lastMsaa = msaaFactors[(int)msaaFactor]; 199 | } 200 | 201 | void OnEnable() 202 | { 203 | EnableDeferredAA(); 204 | } 205 | 206 | void OnDisable() 207 | { 208 | DisableDeferredAA(); 209 | } 210 | 211 | void OnDestroy() 212 | { 213 | if (msGBuffer != null) 214 | { 215 | attachedCam.RemoveCommandBuffer(CameraEvent.BeforeGBuffer, msGBuffer); 216 | msGBuffer.Release(); 217 | } 218 | 219 | if (copyGBuffer != null) 220 | { 221 | attachedCam.RemoveCommandBuffer(CameraEvent.AfterGBuffer, copyGBuffer); 222 | copyGBuffer.Release(); 223 | } 224 | 225 | DestroyMap(diffuseRT); 226 | DestroyMap(specularRT); 227 | DestroyMap(normalRT); 228 | DestroyMap(emissionRT); 229 | DestroyMap(shadowMaskRT); 230 | DestroyMap(depthRT); 231 | DestroyMap(skyTexture); 232 | 233 | DestroyMap(diffuseAry); 234 | DestroyMap(specularAry); 235 | DestroyMap(normalAry); 236 | DestroyMap(shadowMaskAry); 237 | 238 | Release(); 239 | 240 | Shader.SetGlobalFloat("_MsaaFactor", 1); 241 | } 242 | 243 | void OnPreCull() 244 | { 245 | Graphics.SetRenderTarget(skyTexture); 246 | if (attachedCam.clearFlags == CameraClearFlags.Skybox) 247 | { 248 | GL.ClearWithSkybox(false, attachedCam); 249 | } 250 | else 251 | { 252 | GL.Clear(false, true, attachedCam.backgroundColor); 253 | } 254 | Graphics.SetRenderTarget(null); 255 | } 256 | 257 | void Update() 258 | { 259 | #if DEBUG 260 | // resize check 261 | bool needResize = Screen.width != lastWidth || Screen.height != lastHeight || lastMsaa != msaaFactors[(int)msaaFactor]; 262 | if (needResize) 263 | { 264 | OnDestroy(); 265 | Awake(); 266 | OnEnable(); 267 | } 268 | 269 | lastWidth = Screen.width; 270 | lastHeight = Screen.height; 271 | lastMsaa = msaaFactors[(int)msaaFactor]; 272 | #endif 273 | 274 | #if UNITY_EDITOR 275 | DisableDeferredAA(); 276 | EnableDeferredAA(); 277 | 278 | // check scene view 279 | if (isSceneView) 280 | { 281 | DisableDeferredAA(); 282 | isSceneView = false; 283 | } 284 | #endif 285 | 286 | Shader.SetGlobalFloat("_MsaaThreshold", msaaThreshold); 287 | Shader.SetGlobalFloat("_DebugMsaa", (debugMsaa) ? 1f : 0f); 288 | } 289 | 290 | void EnableDeferredAA() 291 | { 292 | if (msGBuffer != null) 293 | { 294 | attachedCam.AddCommandBuffer(CameraEvent.BeforeGBuffer, msGBuffer); 295 | } 296 | 297 | if (copyGBuffer != null) 298 | { 299 | attachedCam.AddCommandBuffer(CameraEvent.AfterGBuffer, copyGBuffer); 300 | } 301 | 302 | Shader.SetGlobalFloat("_MsaaFactor", msaaFactors[(int)msaaFactor]); 303 | } 304 | 305 | void DisableDeferredAA() 306 | { 307 | if (msGBuffer != null) 308 | { 309 | attachedCam.RemoveCommandBuffer(CameraEvent.BeforeGBuffer, msGBuffer); 310 | } 311 | 312 | if (copyGBuffer != null) 313 | { 314 | attachedCam.RemoveCommandBuffer(CameraEvent.AfterGBuffer, copyGBuffer); 315 | } 316 | 317 | Shader.SetGlobalFloat("_MsaaFactor", 1); 318 | } 319 | 320 | void CreateMapAndColorBuffer(string _rtName, int _depth, RenderTextureFormat _format, int _gBufferIdx, int _msaaFactor, ref RenderTexture _rt) 321 | { 322 | _rt = new RenderTexture(Screen.width, Screen.height, _depth, _format, RenderTextureReadWrite.Linear); 323 | _rt.name = _rtName; 324 | _rt.antiAliasing = _msaaFactor; 325 | _rt.bindTextureMS = (_msaaFactor > 1); 326 | _rt.Create(); // create rt so that we have native ptr 327 | 328 | if (_gBufferIdx >= 0) 329 | { 330 | bool nativeSucceed = SetGBufferColor(_gBufferIdx, _msaaFactor, _rt.GetNativeTexturePtr()); 331 | if (!nativeSucceed) 332 | { 333 | Debug.Log("MainGraphic : [DeferredMSAA] " + _rtName + " native failed."); 334 | initSucceed = false; 335 | } 336 | } 337 | } 338 | 339 | void CreateAryMap(string _rtName, RenderTextureFormat _format, ref RenderTexture _rt) 340 | { 341 | _rt = new RenderTexture(Screen.width, Screen.height, 0, _format, RenderTextureReadWrite.Linear); 342 | _rt.name = _rtName; 343 | _rt.dimension = TextureDimension.Tex2DArray; 344 | _rt.volumeDepth = msaaFactors[(int)msaaFactor]; 345 | } 346 | 347 | void DestroyMap(RenderTexture _rt) 348 | { 349 | if (_rt) 350 | { 351 | _rt.Release(); 352 | DestroyImmediate(_rt); 353 | } 354 | } 355 | } 356 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/DeferredMSAAEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | /// 5 | /// deferred aa editor 6 | /// 7 | [CustomEditor(typeof(DeferredMSAA))] 8 | public class DeferredMSAAEditor : Editor 9 | { 10 | [DrawGizmo(GizmoType.NotInSelectionHierarchy)] 11 | static void RenderCustomGizmo(Transform objectTransform, GizmoType gizmoType) 12 | { 13 | DeferredMSAA.isSceneView = true; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/ResolveAA.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/ResolveAA" 2 | { 3 | Properties 4 | { 5 | 6 | } 7 | SubShader 8 | { 9 | // No culling or depth 10 | Cull Off ZWrite Off ZTest Always 11 | 12 | Pass 13 | { 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | #pragma target 5.0 18 | #include "UnityCG.cginc" 19 | 20 | struct appdata 21 | { 22 | float4 vertex : POSITION; 23 | float2 uv : TEXCOORD0; 24 | }; 25 | 26 | struct v2f 27 | { 28 | float2 uv : TEXCOORD0; 29 | float4 vertex : SV_POSITION; 30 | }; 31 | 32 | v2f vert (appdata v) 33 | { 34 | v2f o; 35 | o.vertex = UnityObjectToClipPos(v.vertex); 36 | o.uv = v.uv; 37 | return o; 38 | } 39 | 40 | Texture2DMS _MsaaTex_2X; 41 | Texture2DMS _MsaaTex_4X; 42 | Texture2DMS _MsaaTex_8X; 43 | float _MsaaFactor; 44 | sampler2D _SkyTextureForResolve; 45 | float _IsNormal; 46 | 47 | float4 Resolve2X(v2f i) 48 | { 49 | float4 col = 0; 50 | float4 skyColor = tex2D(_SkyTextureForResolve, i.uv); 51 | skyColor.a = 1; 52 | float subCount = 0; 53 | 54 | [unroll] 55 | for (uint a = 0; a < 2; a++) 56 | { 57 | float4 data = _MsaaTex_2X.Load(i.vertex.xy, a); 58 | subCount = lerp(subCount, subCount + 1, length(data) == 0 && _IsNormal); 59 | data = lerp(data, skyColor, data.a < 0); 60 | col += data; 61 | } 62 | col /= (_MsaaFactor - subCount); 63 | 64 | return col; 65 | } 66 | 67 | float4 Resolve4X(v2f i) 68 | { 69 | float4 col = 0; 70 | float4 skyColor = tex2D(_SkyTextureForResolve, i.uv); 71 | skyColor.a = 1; 72 | float subCount = 0; 73 | 74 | [unroll] 75 | for (uint a = 0; a < 4; a++) 76 | { 77 | float4 data = _MsaaTex_4X.Load(i.vertex.xy, a); 78 | subCount = lerp(subCount, subCount + 1, length(data) == 0 && _IsNormal); 79 | data = lerp(data, skyColor, data.a < 0); 80 | col += data; 81 | } 82 | col /= (_MsaaFactor - subCount); 83 | 84 | return col; 85 | } 86 | 87 | float4 Resolve8X(v2f i) 88 | { 89 | float4 col = 0; 90 | float4 skyColor = tex2D(_SkyTextureForResolve, i.uv); 91 | skyColor.a = 1; 92 | float subCount = 0; 93 | 94 | [unroll] 95 | for (uint a = 0; a < 8; a++) 96 | { 97 | float4 data = _MsaaTex_8X.Load(i.vertex.xy, a); 98 | subCount = lerp(subCount, subCount + 1, length(data) == 0 && _IsNormal); 99 | data = lerp(data, skyColor, data.a < 0); 100 | col += data; 101 | } 102 | col /= (_MsaaFactor - subCount); 103 | 104 | return col; 105 | } 106 | 107 | float4 frag (v2f i) : SV_Target 108 | { 109 | float4 col = 0; 110 | 111 | [branch] 112 | if (_MsaaFactor == 2) 113 | col = Resolve2X(i); 114 | else if (_MsaaFactor == 4) 115 | col = Resolve4X(i); 116 | else if (_MsaaFactor == 8) 117 | col = Resolve8X(i); 118 | 119 | return col; 120 | } 121 | ENDCG 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/ResolveAADepth.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/ResolveAADepth" 2 | { 3 | Properties 4 | { 5 | 6 | } 7 | SubShader 8 | { 9 | // No culling but need depth 10 | Cull Off ZWrite On ZTest Always 11 | ColorMask 0 12 | 13 | Pass 14 | { 15 | Stencil 16 | { 17 | Ref 128 18 | Comp always 19 | Pass replace 20 | } 21 | 22 | CGPROGRAM 23 | #pragma vertex vert 24 | #pragma fragment frag 25 | #pragma target 5.0 26 | #include "UnityCG.cginc" 27 | 28 | struct appdata 29 | { 30 | float4 vertex : POSITION; 31 | float2 uv : TEXCOORD0; 32 | }; 33 | 34 | struct v2f 35 | { 36 | float2 uv : TEXCOORD0; 37 | float4 vertex : SV_POSITION; 38 | }; 39 | 40 | v2f vert(appdata v) 41 | { 42 | v2f o; 43 | o.vertex = UnityObjectToClipPos(v.vertex); 44 | o.uv = v.uv; 45 | return o; 46 | } 47 | 48 | Texture2DMS _MsaaTex_2X; 49 | Texture2DMS _MsaaTex_4X; 50 | Texture2DMS _MsaaTex_8X; 51 | float _MsaaFactor; 52 | 53 | float Resolve2X(v2f i) 54 | { 55 | float col = 1; 56 | 57 | [unroll] 58 | float baseCol = _MsaaTex_2X.Load(i.vertex.xy, 0).r; 59 | for (uint a = 0; a < 2; a++) 60 | { 61 | float depth = _MsaaTex_2X.Load(i.vertex.xy, a).r; 62 | col = min(depth, col); 63 | baseCol = max(depth, baseCol); 64 | } 65 | 66 | col = lerp(col, baseCol, col == 0.0f); 67 | 68 | return col; 69 | } 70 | 71 | float Resolve4X(v2f i) 72 | { 73 | float col = 1; 74 | 75 | [unroll] 76 | float baseCol = _MsaaTex_4X.Load(i.vertex.xy, 0).r; 77 | for (uint a = 0; a < 4; a++) 78 | { 79 | float depth = _MsaaTex_4X.Load(i.vertex.xy, a).r; 80 | col = min(depth, col); 81 | baseCol = max(depth, baseCol); 82 | } 83 | 84 | col = lerp(col, baseCol, col == 0.0f); 85 | 86 | return col; 87 | } 88 | 89 | float Resolve8X(v2f i) 90 | { 91 | float col = 1; 92 | 93 | [unroll] 94 | float baseCol = _MsaaTex_8X.Load(i.vertex.xy, 0).r; 95 | for (uint a = 0; a < 8; a++) 96 | { 97 | float depth = _MsaaTex_8X.Load(i.vertex.xy, a).r; 98 | col = min(depth, col); 99 | baseCol = max(depth, baseCol); 100 | } 101 | 102 | col = lerp(col, baseCol, col == 0.0f); 103 | 104 | return col; 105 | } 106 | 107 | float frag(v2f i, out float oDepth : SV_Depth) : SV_Target 108 | { 109 | float col = 1; 110 | 111 | [branch] 112 | if (_MsaaFactor == 2) 113 | col = Resolve2X(i); 114 | else if (_MsaaFactor == 4) 115 | col = Resolve4X(i); 116 | else if (_MsaaFactor == 8) 117 | col = Resolve8X(i); 118 | 119 | oDepth = col; 120 | 121 | return col; 122 | } 123 | ENDCG 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 922f105b207460b48ab61097cde5261c 3 | folderAsset: yes 4 | timeCreated: 1556020323 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/build.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18c56301714123c4793117ac7093ce7f 3 | folderAsset: yes 4 | timeCreated: 1556020323 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/projects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01e75a1f15a21cc419f9bc3196e40150 3 | folderAsset: yes 4 | timeCreated: 1556020323 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/projects/VisualStudio2015.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9df4c070b6b3cf44fbcc2c3169540132 3 | folderAsset: yes 4 | timeCreated: 1556020324 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/projects/VisualStudio2015/RenderingPlugin.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40418.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderingPlugin", "RenderingPlugin.vcxproj", "{F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Debug|Win32.Build.0 = Debug|Win32 18 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Debug|x64.ActiveCfg = Debug|x64 19 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Debug|x64.Build.0 = Debug|x64 20 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Release|Win32.ActiveCfg = Release|Win32 21 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Release|Win32.Build.0 = Release|Win32 22 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Release|x64.ActiveCfg = Release|x64 23 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/projects/VisualStudio2015/RenderingPlugin.sln.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40dbec37fe2129b488bc7e93ec16b712 3 | timeCreated: 1556020324 4 | licenseType: Pro 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/projects/VisualStudio2015/RenderingPlugin.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C} 45 | RenderingPlugin 46 | Win32Proj 47 | 10.0.17134.0 48 | 49 | 50 | 51 | DynamicLibrary 52 | v141 53 | Unicode 54 | true 55 | 56 | 57 | DynamicLibrary 58 | v141 59 | Unicode 60 | true 61 | 62 | 63 | DynamicLibrary 64 | v141 65 | Unicode 66 | 67 | 68 | DynamicLibrary 69 | v141 70 | Unicode 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | <_ProjectFileVersion>12.0.30501.0 90 | 91 | 92 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 93 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 94 | true 95 | 96 | 97 | true 98 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 99 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 100 | 101 | 102 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 103 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 104 | false 105 | 106 | 107 | false 108 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 109 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 110 | SetGBufferTarget 111 | 112 | 113 | 114 | Disabled 115 | GLEW_STATIC;WIN32;_DEBUG;_WINDOWS;_USRDLL;RENDERINGPLUGIN_EXPORTS;%(PreprocessorDefinitions) 116 | true 117 | EnableFastChecks 118 | MultiThreadedDebug 119 | 120 | Level3 121 | EditAndContinue 122 | ../../ 123 | 124 | 125 | opengl32.lib;%(AdditionalDependencies) 126 | true 127 | Windows 128 | MachineX86 129 | ../../source/RenderingPlugin.def 130 | 131 | 132 | SETLOCAL 133 | 134 | if "$(PlatformShortName)" == "x86" ( 135 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86 136 | ) else ( 137 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86_64 138 | ) 139 | echo Target Plugin Path is %TARGET_PLUGIN_PATH% 140 | copy /Y "$(TargetPath)" "%TARGET_PLUGIN_PATH%\$(TargetFileName)" 141 | 142 | ENDLOCAL 143 | 144 | 145 | 146 | 147 | 148 | Disabled 149 | GLEW_STATIC;WIN32;_DEBUG;_WINDOWS;_USRDLL;RENDERINGPLUGIN_EXPORTS;%(PreprocessorDefinitions) 150 | EnableFastChecks 151 | MultiThreadedDebug 152 | 153 | 154 | Level3 155 | ProgramDatabase 156 | ../../ 157 | 158 | 159 | opengl32.lib;%(AdditionalDependencies) 160 | true 161 | Windows 162 | ../../source/RenderingPlugin.def 163 | 164 | 165 | SETLOCAL 166 | 167 | if "$(PlatformShortName)" == "x86" ( 168 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86 169 | ) else ( 170 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86_64 171 | ) 172 | echo Target Plugin Path is %TARGET_PLUGIN_PATH% 173 | copy /Y "$(TargetPath)" "%TARGET_PLUGIN_PATH%\$(TargetFileName)" 174 | 175 | ENDLOCAL 176 | 177 | 178 | 179 | 180 | 181 | MaxSpeed 182 | true 183 | GLEW_STATIC;WIN32;NDEBUG;_WINDOWS;_USRDLL;RENDERINGPLUGIN_EXPORTS;%(PreprocessorDefinitions) 184 | MultiThreaded 185 | true 186 | 187 | Level3 188 | ProgramDatabase 189 | ../../ 190 | 191 | 192 | opengl32.lib;%(AdditionalDependencies) 193 | true 194 | Windows 195 | true 196 | true 197 | MachineX86 198 | ../../source/RenderingPlugin.def 199 | 200 | 201 | SETLOCAL 202 | 203 | if "$(PlatformShortName)" == "x86" ( 204 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86 205 | ) else ( 206 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86_64 207 | ) 208 | echo Target Plugin Path is %TARGET_PLUGIN_PATH% 209 | copy /Y "$(TargetPath)" "%TARGET_PLUGIN_PATH%\$(TargetFileName)" 210 | 211 | ENDLOCAL 212 | 213 | 214 | 215 | 216 | 217 | MaxSpeed 218 | true 219 | GLEW_STATIC;WIN32;NDEBUG;_WINDOWS;_USRDLL;RENDERINGPLUGIN_EXPORTS;%(PreprocessorDefinitions) 220 | MultiThreaded 221 | true 222 | 223 | 224 | Level3 225 | ProgramDatabase 226 | ../../ 227 | 228 | 229 | opengl32.lib;%(AdditionalDependencies) 230 | true 231 | Windows 232 | true 233 | true 234 | ../../source/RenderingPlugin.def 235 | 236 | 237 | SETLOCAL 238 | 239 | if "$(PlatformShortName)" == "x86" ( 240 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86 241 | ) else ( 242 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86_64 243 | ) 244 | echo Target Plugin Path is %TARGET_PLUGIN_PATH% 245 | copy /Y "$(TargetPath)" "%TARGET_PLUGIN_PATH%\$(TargetFileName)" 246 | 247 | ENDLOCAL 248 | 249 | 250 | 251 | 252 | 253 | 254 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/projects/VisualStudio2015/RenderingPlugin.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | GLEW 8 | 9 | 10 | GLEW 11 | 12 | 13 | GLEW 14 | 15 | 16 | Unity 17 | 18 | 19 | Unity 20 | 21 | 22 | Unity 23 | 24 | 25 | Unity 26 | 27 | 28 | Unity 29 | 30 | 31 | Unity 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | GLEW 40 | 41 | 42 | 43 | 44 | {b44f992b-edcc-4980-b164-3dabfa390292} 45 | 46 | 47 | {c01468d4-90d4-4d19-9a9b-ee2f1b5e9083} 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/projects/VisualStudio2015/RenderingPlugin.vcxproj.filters.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95470ec0f3880eb4c89e0595968ae32f 3 | timeCreated: 1556020324 4 | licenseType: Pro 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/projects/VisualStudio2015/RenderingPlugin.vcxproj.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f6bf12be42696c499f896f3c88476cd 3 | timeCreated: 1556020324 4 | licenseType: Pro 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/projects/VisualStudio2015/RenderingPlugin.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/projects/VisualStudio2015/RenderingPlugin.vcxproj.user.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd74931e498c8ed47a040fb3b57e9123 3 | timeCreated: 1556020324 4 | licenseType: Pro 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d6a5bb4d5f5f944c9d417f450cdae24 3 | folderAsset: yes 4 | timeCreated: 1556020323 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/GLEW.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 649f2aabef2163d448258c28aa3f2f9a 3 | folderAsset: yes 4 | timeCreated: 1556020324 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/GLEW/glew.c.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e363ecf46cb95fc4180d8a0eefe3bdf1 3 | timeCreated: 1556020329 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/GLEW/glew.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4af000834695b8744ba210be31b9071a 3 | timeCreated: 1556020328 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/GLEW/glxew.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c01aa1c687fa3b45b532d56ebe88f5c 3 | timeCreated: 1556020328 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/GLEW/wglew.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** The OpenGL Extension Wrangler Library 3 | ** Copyright (C) 2008-2015, Nigel Stewart 4 | ** Copyright (C) 2002-2008, Milan Ikits 5 | ** Copyright (C) 2002-2008, Marcelo E. Magallon 6 | ** Copyright (C) 2002, Lev Povalahev 7 | ** All rights reserved. 8 | ** 9 | ** Redistribution and use in source and binary forms, with or without 10 | ** modification, are permitted provided that the following conditions are met: 11 | ** 12 | ** * Redistributions of source code must retain the above copyright notice, 13 | ** this list of conditions and the following disclaimer. 14 | ** * Redistributions in binary form must reproduce the above copyright notice, 15 | ** this list of conditions and the following disclaimer in the documentation 16 | ** and/or other materials provided with the distribution. 17 | ** * The name of the author may be used to endorse or promote products 18 | ** derived from this software without specific prior written permission. 19 | ** 20 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 | ** THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | ** Copyright (c) 2007 The Khronos Group Inc. 35 | ** 36 | ** Permission is hereby granted, free of charge, to any person obtaining a 37 | ** copy of this software and/or associated documentation files (the 38 | ** "Materials"), to deal in the Materials without restriction, including 39 | ** without limitation the rights to use, copy, modify, merge, publish, 40 | ** distribute, sublicense, and/or sell copies of the Materials, and to 41 | ** permit persons to whom the Materials are furnished to do so, subject to 42 | ** the following conditions: 43 | ** 44 | ** The above copyright notice and this permission notice shall be included 45 | ** in all copies or substantial portions of the Materials. 46 | ** 47 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 48 | ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 49 | ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 50 | ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 51 | ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 52 | ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 53 | ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 54 | */ 55 | 56 | #ifndef __wglew_h__ 57 | #define __wglew_h__ 58 | #define __WGLEW_H__ 59 | 60 | #ifdef __wglext_h_ 61 | #error wglext.h included before wglew.h 62 | #endif 63 | 64 | #define __wglext_h_ 65 | 66 | #if !defined(WINAPI) 67 | # ifndef WIN32_LEAN_AND_MEAN 68 | # define WIN32_LEAN_AND_MEAN 1 69 | # endif 70 | #include 71 | # undef WIN32_LEAN_AND_MEAN 72 | #endif 73 | 74 | /* 75 | * GLEW_STATIC needs to be set when using the static version. 76 | * GLEW_BUILD is set when building the DLL version. 77 | */ 78 | #ifdef GLEW_STATIC 79 | # define GLEWAPI extern 80 | #else 81 | # ifdef GLEW_BUILD 82 | # define GLEWAPI extern __declspec(dllexport) 83 | # else 84 | # define GLEWAPI extern __declspec(dllimport) 85 | # endif 86 | #endif 87 | 88 | #ifdef __cplusplus 89 | extern "C" { 90 | #endif 91 | 92 | /* -------------------------- WGL_3DFX_multisample ------------------------- */ 93 | 94 | #ifndef WGL_3DFX_multisample 95 | #define WGL_3DFX_multisample 1 96 | 97 | #define WGL_SAMPLE_BUFFERS_3DFX 0x2060 98 | #define WGL_SAMPLES_3DFX 0x2061 99 | 100 | #define WGLEW_3DFX_multisample WGLEW_GET_VAR(__WGLEW_3DFX_multisample) 101 | 102 | #endif /* WGL_3DFX_multisample */ 103 | 104 | /* ------------------------- WGL_3DL_stereo_control ------------------------ */ 105 | 106 | #ifndef WGL_3DL_stereo_control 107 | #define WGL_3DL_stereo_control 1 108 | 109 | #define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055 110 | #define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056 111 | #define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057 112 | #define WGL_STEREO_POLARITY_INVERT_3DL 0x2058 113 | 114 | typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState); 115 | 116 | #define wglSetStereoEmitterState3DL WGLEW_GET_FUN(__wglewSetStereoEmitterState3DL) 117 | 118 | #define WGLEW_3DL_stereo_control WGLEW_GET_VAR(__WGLEW_3DL_stereo_control) 119 | 120 | #endif /* WGL_3DL_stereo_control */ 121 | 122 | /* ------------------------ WGL_AMD_gpu_association ------------------------ */ 123 | 124 | #ifndef WGL_AMD_gpu_association 125 | #define WGL_AMD_gpu_association 1 126 | 127 | #define WGL_GPU_VENDOR_AMD 0x1F00 128 | #define WGL_GPU_RENDERER_STRING_AMD 0x1F01 129 | #define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 130 | #define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 131 | #define WGL_GPU_RAM_AMD 0x21A3 132 | #define WGL_GPU_CLOCK_AMD 0x21A4 133 | #define WGL_GPU_NUM_PIPES_AMD 0x21A5 134 | #define WGL_GPU_NUM_SIMD_AMD 0x21A6 135 | #define WGL_GPU_NUM_RB_AMD 0x21A7 136 | #define WGL_GPU_NUM_SPI_AMD 0x21A8 137 | 138 | typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); 139 | typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id); 140 | typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int* attribList); 141 | typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc); 142 | typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc); 143 | typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); 144 | typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT* ids); 145 | typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void* data); 146 | typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc); 147 | 148 | #define wglBlitContextFramebufferAMD WGLEW_GET_FUN(__wglewBlitContextFramebufferAMD) 149 | #define wglCreateAssociatedContextAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAMD) 150 | #define wglCreateAssociatedContextAttribsAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAttribsAMD) 151 | #define wglDeleteAssociatedContextAMD WGLEW_GET_FUN(__wglewDeleteAssociatedContextAMD) 152 | #define wglGetContextGPUIDAMD WGLEW_GET_FUN(__wglewGetContextGPUIDAMD) 153 | #define wglGetCurrentAssociatedContextAMD WGLEW_GET_FUN(__wglewGetCurrentAssociatedContextAMD) 154 | #define wglGetGPUIDsAMD WGLEW_GET_FUN(__wglewGetGPUIDsAMD) 155 | #define wglGetGPUInfoAMD WGLEW_GET_FUN(__wglewGetGPUInfoAMD) 156 | #define wglMakeAssociatedContextCurrentAMD WGLEW_GET_FUN(__wglewMakeAssociatedContextCurrentAMD) 157 | 158 | #define WGLEW_AMD_gpu_association WGLEW_GET_VAR(__WGLEW_AMD_gpu_association) 159 | 160 | #endif /* WGL_AMD_gpu_association */ 161 | 162 | /* ------------------------- WGL_ARB_buffer_region ------------------------- */ 163 | 164 | #ifndef WGL_ARB_buffer_region 165 | #define WGL_ARB_buffer_region 1 166 | 167 | #define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 168 | #define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 169 | #define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 170 | #define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 171 | 172 | typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); 173 | typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); 174 | typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); 175 | typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); 176 | 177 | #define wglCreateBufferRegionARB WGLEW_GET_FUN(__wglewCreateBufferRegionARB) 178 | #define wglDeleteBufferRegionARB WGLEW_GET_FUN(__wglewDeleteBufferRegionARB) 179 | #define wglRestoreBufferRegionARB WGLEW_GET_FUN(__wglewRestoreBufferRegionARB) 180 | #define wglSaveBufferRegionARB WGLEW_GET_FUN(__wglewSaveBufferRegionARB) 181 | 182 | #define WGLEW_ARB_buffer_region WGLEW_GET_VAR(__WGLEW_ARB_buffer_region) 183 | 184 | #endif /* WGL_ARB_buffer_region */ 185 | 186 | /* --------------------- WGL_ARB_context_flush_control --------------------- */ 187 | 188 | #ifndef WGL_ARB_context_flush_control 189 | #define WGL_ARB_context_flush_control 1 190 | 191 | #define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0x0000 192 | #define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 193 | #define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 194 | 195 | #define WGLEW_ARB_context_flush_control WGLEW_GET_VAR(__WGLEW_ARB_context_flush_control) 196 | 197 | #endif /* WGL_ARB_context_flush_control */ 198 | 199 | /* ------------------------- WGL_ARB_create_context ------------------------ */ 200 | 201 | #ifndef WGL_ARB_create_context 202 | #define WGL_ARB_create_context 1 203 | 204 | #define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 205 | #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 206 | #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 207 | #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 208 | #define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 209 | #define WGL_CONTEXT_FLAGS_ARB 0x2094 210 | #define ERROR_INVALID_VERSION_ARB 0x2095 211 | #define ERROR_INVALID_PROFILE_ARB 0x2096 212 | 213 | typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int* attribList); 214 | 215 | #define wglCreateContextAttribsARB WGLEW_GET_FUN(__wglewCreateContextAttribsARB) 216 | 217 | #define WGLEW_ARB_create_context WGLEW_GET_VAR(__WGLEW_ARB_create_context) 218 | 219 | #endif /* WGL_ARB_create_context */ 220 | 221 | /* --------------------- WGL_ARB_create_context_profile -------------------- */ 222 | 223 | #ifndef WGL_ARB_create_context_profile 224 | #define WGL_ARB_create_context_profile 1 225 | 226 | #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 227 | #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 228 | #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 229 | 230 | #define WGLEW_ARB_create_context_profile WGLEW_GET_VAR(__WGLEW_ARB_create_context_profile) 231 | 232 | #endif /* WGL_ARB_create_context_profile */ 233 | 234 | /* ------------------- WGL_ARB_create_context_robustness ------------------- */ 235 | 236 | #ifndef WGL_ARB_create_context_robustness 237 | #define WGL_ARB_create_context_robustness 1 238 | 239 | #define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 240 | #define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 241 | #define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 242 | #define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 243 | 244 | #define WGLEW_ARB_create_context_robustness WGLEW_GET_VAR(__WGLEW_ARB_create_context_robustness) 245 | 246 | #endif /* WGL_ARB_create_context_robustness */ 247 | 248 | /* ----------------------- WGL_ARB_extensions_string ----------------------- */ 249 | 250 | #ifndef WGL_ARB_extensions_string 251 | #define WGL_ARB_extensions_string 1 252 | 253 | typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); 254 | 255 | #define wglGetExtensionsStringARB WGLEW_GET_FUN(__wglewGetExtensionsStringARB) 256 | 257 | #define WGLEW_ARB_extensions_string WGLEW_GET_VAR(__WGLEW_ARB_extensions_string) 258 | 259 | #endif /* WGL_ARB_extensions_string */ 260 | 261 | /* ------------------------ WGL_ARB_framebuffer_sRGB ----------------------- */ 262 | 263 | #ifndef WGL_ARB_framebuffer_sRGB 264 | #define WGL_ARB_framebuffer_sRGB 1 265 | 266 | #define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 267 | 268 | #define WGLEW_ARB_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_ARB_framebuffer_sRGB) 269 | 270 | #endif /* WGL_ARB_framebuffer_sRGB */ 271 | 272 | /* ----------------------- WGL_ARB_make_current_read ----------------------- */ 273 | 274 | #ifndef WGL_ARB_make_current_read 275 | #define WGL_ARB_make_current_read 1 276 | 277 | #define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 278 | #define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 279 | 280 | typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID); 281 | typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); 282 | 283 | #define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB) 284 | #define wglMakeContextCurrentARB WGLEW_GET_FUN(__wglewMakeContextCurrentARB) 285 | 286 | #define WGLEW_ARB_make_current_read WGLEW_GET_VAR(__WGLEW_ARB_make_current_read) 287 | 288 | #endif /* WGL_ARB_make_current_read */ 289 | 290 | /* -------------------------- WGL_ARB_multisample -------------------------- */ 291 | 292 | #ifndef WGL_ARB_multisample 293 | #define WGL_ARB_multisample 1 294 | 295 | #define WGL_SAMPLE_BUFFERS_ARB 0x2041 296 | #define WGL_SAMPLES_ARB 0x2042 297 | 298 | #define WGLEW_ARB_multisample WGLEW_GET_VAR(__WGLEW_ARB_multisample) 299 | 300 | #endif /* WGL_ARB_multisample */ 301 | 302 | /* ---------------------------- WGL_ARB_pbuffer ---------------------------- */ 303 | 304 | #ifndef WGL_ARB_pbuffer 305 | #define WGL_ARB_pbuffer 1 306 | 307 | #define WGL_DRAW_TO_PBUFFER_ARB 0x202D 308 | #define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E 309 | #define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F 310 | #define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 311 | #define WGL_PBUFFER_LARGEST_ARB 0x2033 312 | #define WGL_PBUFFER_WIDTH_ARB 0x2034 313 | #define WGL_PBUFFER_HEIGHT_ARB 0x2035 314 | #define WGL_PBUFFER_LOST_ARB 0x2036 315 | 316 | DECLARE_HANDLE(HPBUFFERARB); 317 | 318 | typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList); 319 | typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); 320 | typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); 321 | typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue); 322 | typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); 323 | 324 | #define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB) 325 | #define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB) 326 | #define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB) 327 | #define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB) 328 | #define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB) 329 | 330 | #define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer) 331 | 332 | #endif /* WGL_ARB_pbuffer */ 333 | 334 | /* -------------------------- WGL_ARB_pixel_format ------------------------- */ 335 | 336 | #ifndef WGL_ARB_pixel_format 337 | #define WGL_ARB_pixel_format 1 338 | 339 | #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 340 | #define WGL_DRAW_TO_WINDOW_ARB 0x2001 341 | #define WGL_DRAW_TO_BITMAP_ARB 0x2002 342 | #define WGL_ACCELERATION_ARB 0x2003 343 | #define WGL_NEED_PALETTE_ARB 0x2004 344 | #define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 345 | #define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 346 | #define WGL_SWAP_METHOD_ARB 0x2007 347 | #define WGL_NUMBER_OVERLAYS_ARB 0x2008 348 | #define WGL_NUMBER_UNDERLAYS_ARB 0x2009 349 | #define WGL_TRANSPARENT_ARB 0x200A 350 | #define WGL_SHARE_DEPTH_ARB 0x200C 351 | #define WGL_SHARE_STENCIL_ARB 0x200D 352 | #define WGL_SHARE_ACCUM_ARB 0x200E 353 | #define WGL_SUPPORT_GDI_ARB 0x200F 354 | #define WGL_SUPPORT_OPENGL_ARB 0x2010 355 | #define WGL_DOUBLE_BUFFER_ARB 0x2011 356 | #define WGL_STEREO_ARB 0x2012 357 | #define WGL_PIXEL_TYPE_ARB 0x2013 358 | #define WGL_COLOR_BITS_ARB 0x2014 359 | #define WGL_RED_BITS_ARB 0x2015 360 | #define WGL_RED_SHIFT_ARB 0x2016 361 | #define WGL_GREEN_BITS_ARB 0x2017 362 | #define WGL_GREEN_SHIFT_ARB 0x2018 363 | #define WGL_BLUE_BITS_ARB 0x2019 364 | #define WGL_BLUE_SHIFT_ARB 0x201A 365 | #define WGL_ALPHA_BITS_ARB 0x201B 366 | #define WGL_ALPHA_SHIFT_ARB 0x201C 367 | #define WGL_ACCUM_BITS_ARB 0x201D 368 | #define WGL_ACCUM_RED_BITS_ARB 0x201E 369 | #define WGL_ACCUM_GREEN_BITS_ARB 0x201F 370 | #define WGL_ACCUM_BLUE_BITS_ARB 0x2020 371 | #define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 372 | #define WGL_DEPTH_BITS_ARB 0x2022 373 | #define WGL_STENCIL_BITS_ARB 0x2023 374 | #define WGL_AUX_BUFFERS_ARB 0x2024 375 | #define WGL_NO_ACCELERATION_ARB 0x2025 376 | #define WGL_GENERIC_ACCELERATION_ARB 0x2026 377 | #define WGL_FULL_ACCELERATION_ARB 0x2027 378 | #define WGL_SWAP_EXCHANGE_ARB 0x2028 379 | #define WGL_SWAP_COPY_ARB 0x2029 380 | #define WGL_SWAP_UNDEFINED_ARB 0x202A 381 | #define WGL_TYPE_RGBA_ARB 0x202B 382 | #define WGL_TYPE_COLORINDEX_ARB 0x202C 383 | #define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 384 | #define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 385 | #define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 386 | #define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A 387 | #define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B 388 | 389 | typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); 390 | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues); 391 | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues); 392 | 393 | #define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB) 394 | #define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB) 395 | #define wglGetPixelFormatAttribivARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribivARB) 396 | 397 | #define WGLEW_ARB_pixel_format WGLEW_GET_VAR(__WGLEW_ARB_pixel_format) 398 | 399 | #endif /* WGL_ARB_pixel_format */ 400 | 401 | /* ----------------------- WGL_ARB_pixel_format_float ---------------------- */ 402 | 403 | #ifndef WGL_ARB_pixel_format_float 404 | #define WGL_ARB_pixel_format_float 1 405 | 406 | #define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 407 | 408 | #define WGLEW_ARB_pixel_format_float WGLEW_GET_VAR(__WGLEW_ARB_pixel_format_float) 409 | 410 | #endif /* WGL_ARB_pixel_format_float */ 411 | 412 | /* ------------------------- WGL_ARB_render_texture ------------------------ */ 413 | 414 | #ifndef WGL_ARB_render_texture 415 | #define WGL_ARB_render_texture 1 416 | 417 | #define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 418 | #define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 419 | #define WGL_TEXTURE_FORMAT_ARB 0x2072 420 | #define WGL_TEXTURE_TARGET_ARB 0x2073 421 | #define WGL_MIPMAP_TEXTURE_ARB 0x2074 422 | #define WGL_TEXTURE_RGB_ARB 0x2075 423 | #define WGL_TEXTURE_RGBA_ARB 0x2076 424 | #define WGL_NO_TEXTURE_ARB 0x2077 425 | #define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 426 | #define WGL_TEXTURE_1D_ARB 0x2079 427 | #define WGL_TEXTURE_2D_ARB 0x207A 428 | #define WGL_MIPMAP_LEVEL_ARB 0x207B 429 | #define WGL_CUBE_MAP_FACE_ARB 0x207C 430 | #define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D 431 | #define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E 432 | #define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F 433 | #define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 434 | #define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 435 | #define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 436 | #define WGL_FRONT_LEFT_ARB 0x2083 437 | #define WGL_FRONT_RIGHT_ARB 0x2084 438 | #define WGL_BACK_LEFT_ARB 0x2085 439 | #define WGL_BACK_RIGHT_ARB 0x2086 440 | #define WGL_AUX0_ARB 0x2087 441 | #define WGL_AUX1_ARB 0x2088 442 | #define WGL_AUX2_ARB 0x2089 443 | #define WGL_AUX3_ARB 0x208A 444 | #define WGL_AUX4_ARB 0x208B 445 | #define WGL_AUX5_ARB 0x208C 446 | #define WGL_AUX6_ARB 0x208D 447 | #define WGL_AUX7_ARB 0x208E 448 | #define WGL_AUX8_ARB 0x208F 449 | #define WGL_AUX9_ARB 0x2090 450 | 451 | typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); 452 | typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); 453 | typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int* piAttribList); 454 | 455 | #define wglBindTexImageARB WGLEW_GET_FUN(__wglewBindTexImageARB) 456 | #define wglReleaseTexImageARB WGLEW_GET_FUN(__wglewReleaseTexImageARB) 457 | #define wglSetPbufferAttribARB WGLEW_GET_FUN(__wglewSetPbufferAttribARB) 458 | 459 | #define WGLEW_ARB_render_texture WGLEW_GET_VAR(__WGLEW_ARB_render_texture) 460 | 461 | #endif /* WGL_ARB_render_texture */ 462 | 463 | /* ---------------- WGL_ARB_robustness_application_isolation --------------- */ 464 | 465 | #ifndef WGL_ARB_robustness_application_isolation 466 | #define WGL_ARB_robustness_application_isolation 1 467 | 468 | #define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 469 | 470 | #define WGLEW_ARB_robustness_application_isolation WGLEW_GET_VAR(__WGLEW_ARB_robustness_application_isolation) 471 | 472 | #endif /* WGL_ARB_robustness_application_isolation */ 473 | 474 | /* ---------------- WGL_ARB_robustness_share_group_isolation --------------- */ 475 | 476 | #ifndef WGL_ARB_robustness_share_group_isolation 477 | #define WGL_ARB_robustness_share_group_isolation 1 478 | 479 | #define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 480 | 481 | #define WGLEW_ARB_robustness_share_group_isolation WGLEW_GET_VAR(__WGLEW_ARB_robustness_share_group_isolation) 482 | 483 | #endif /* WGL_ARB_robustness_share_group_isolation */ 484 | 485 | /* ----------------------- WGL_ATI_pixel_format_float ---------------------- */ 486 | 487 | #ifndef WGL_ATI_pixel_format_float 488 | #define WGL_ATI_pixel_format_float 1 489 | 490 | #define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 491 | #define GL_RGBA_FLOAT_MODE_ATI 0x8820 492 | #define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 493 | 494 | #define WGLEW_ATI_pixel_format_float WGLEW_GET_VAR(__WGLEW_ATI_pixel_format_float) 495 | 496 | #endif /* WGL_ATI_pixel_format_float */ 497 | 498 | /* -------------------- WGL_ATI_render_texture_rectangle ------------------- */ 499 | 500 | #ifndef WGL_ATI_render_texture_rectangle 501 | #define WGL_ATI_render_texture_rectangle 1 502 | 503 | #define WGL_TEXTURE_RECTANGLE_ATI 0x21A5 504 | 505 | #define WGLEW_ATI_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_ATI_render_texture_rectangle) 506 | 507 | #endif /* WGL_ATI_render_texture_rectangle */ 508 | 509 | /* ------------------- WGL_EXT_create_context_es2_profile ------------------ */ 510 | 511 | #ifndef WGL_EXT_create_context_es2_profile 512 | #define WGL_EXT_create_context_es2_profile 1 513 | 514 | #define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 515 | 516 | #define WGLEW_EXT_create_context_es2_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es2_profile) 517 | 518 | #endif /* WGL_EXT_create_context_es2_profile */ 519 | 520 | /* ------------------- WGL_EXT_create_context_es_profile ------------------- */ 521 | 522 | #ifndef WGL_EXT_create_context_es_profile 523 | #define WGL_EXT_create_context_es_profile 1 524 | 525 | #define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 526 | 527 | #define WGLEW_EXT_create_context_es_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es_profile) 528 | 529 | #endif /* WGL_EXT_create_context_es_profile */ 530 | 531 | /* -------------------------- WGL_EXT_depth_float -------------------------- */ 532 | 533 | #ifndef WGL_EXT_depth_float 534 | #define WGL_EXT_depth_float 1 535 | 536 | #define WGL_DEPTH_FLOAT_EXT 0x2040 537 | 538 | #define WGLEW_EXT_depth_float WGLEW_GET_VAR(__WGLEW_EXT_depth_float) 539 | 540 | #endif /* WGL_EXT_depth_float */ 541 | 542 | /* ---------------------- WGL_EXT_display_color_table ---------------------- */ 543 | 544 | #ifndef WGL_EXT_display_color_table 545 | #define WGL_EXT_display_color_table 1 546 | 547 | typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); 548 | typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); 549 | typedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); 550 | typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length); 551 | 552 | #define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT) 553 | #define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT) 554 | #define wglDestroyDisplayColorTableEXT WGLEW_GET_FUN(__wglewDestroyDisplayColorTableEXT) 555 | #define wglLoadDisplayColorTableEXT WGLEW_GET_FUN(__wglewLoadDisplayColorTableEXT) 556 | 557 | #define WGLEW_EXT_display_color_table WGLEW_GET_VAR(__WGLEW_EXT_display_color_table) 558 | 559 | #endif /* WGL_EXT_display_color_table */ 560 | 561 | /* ----------------------- WGL_EXT_extensions_string ----------------------- */ 562 | 563 | #ifndef WGL_EXT_extensions_string 564 | #define WGL_EXT_extensions_string 1 565 | 566 | typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); 567 | 568 | #define wglGetExtensionsStringEXT WGLEW_GET_FUN(__wglewGetExtensionsStringEXT) 569 | 570 | #define WGLEW_EXT_extensions_string WGLEW_GET_VAR(__WGLEW_EXT_extensions_string) 571 | 572 | #endif /* WGL_EXT_extensions_string */ 573 | 574 | /* ------------------------ WGL_EXT_framebuffer_sRGB ----------------------- */ 575 | 576 | #ifndef WGL_EXT_framebuffer_sRGB 577 | #define WGL_EXT_framebuffer_sRGB 1 578 | 579 | #define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9 580 | 581 | #define WGLEW_EXT_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_EXT_framebuffer_sRGB) 582 | 583 | #endif /* WGL_EXT_framebuffer_sRGB */ 584 | 585 | /* ----------------------- WGL_EXT_make_current_read ----------------------- */ 586 | 587 | #ifndef WGL_EXT_make_current_read 588 | #define WGL_EXT_make_current_read 1 589 | 590 | #define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 591 | 592 | typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID); 593 | typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); 594 | 595 | #define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT) 596 | #define wglMakeContextCurrentEXT WGLEW_GET_FUN(__wglewMakeContextCurrentEXT) 597 | 598 | #define WGLEW_EXT_make_current_read WGLEW_GET_VAR(__WGLEW_EXT_make_current_read) 599 | 600 | #endif /* WGL_EXT_make_current_read */ 601 | 602 | /* -------------------------- WGL_EXT_multisample -------------------------- */ 603 | 604 | #ifndef WGL_EXT_multisample 605 | #define WGL_EXT_multisample 1 606 | 607 | #define WGL_SAMPLE_BUFFERS_EXT 0x2041 608 | #define WGL_SAMPLES_EXT 0x2042 609 | 610 | #define WGLEW_EXT_multisample WGLEW_GET_VAR(__WGLEW_EXT_multisample) 611 | 612 | #endif /* WGL_EXT_multisample */ 613 | 614 | /* ---------------------------- WGL_EXT_pbuffer ---------------------------- */ 615 | 616 | #ifndef WGL_EXT_pbuffer 617 | #define WGL_EXT_pbuffer 1 618 | 619 | #define WGL_DRAW_TO_PBUFFER_EXT 0x202D 620 | #define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E 621 | #define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F 622 | #define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 623 | #define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 624 | #define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 625 | #define WGL_PBUFFER_LARGEST_EXT 0x2033 626 | #define WGL_PBUFFER_WIDTH_EXT 0x2034 627 | #define WGL_PBUFFER_HEIGHT_EXT 0x2035 628 | 629 | DECLARE_HANDLE(HPBUFFEREXT); 630 | 631 | typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList); 632 | typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); 633 | typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); 634 | typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int* piValue); 635 | typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); 636 | 637 | #define wglCreatePbufferEXT WGLEW_GET_FUN(__wglewCreatePbufferEXT) 638 | #define wglDestroyPbufferEXT WGLEW_GET_FUN(__wglewDestroyPbufferEXT) 639 | #define wglGetPbufferDCEXT WGLEW_GET_FUN(__wglewGetPbufferDCEXT) 640 | #define wglQueryPbufferEXT WGLEW_GET_FUN(__wglewQueryPbufferEXT) 641 | #define wglReleasePbufferDCEXT WGLEW_GET_FUN(__wglewReleasePbufferDCEXT) 642 | 643 | #define WGLEW_EXT_pbuffer WGLEW_GET_VAR(__WGLEW_EXT_pbuffer) 644 | 645 | #endif /* WGL_EXT_pbuffer */ 646 | 647 | /* -------------------------- WGL_EXT_pixel_format ------------------------- */ 648 | 649 | #ifndef WGL_EXT_pixel_format 650 | #define WGL_EXT_pixel_format 1 651 | 652 | #define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 653 | #define WGL_DRAW_TO_WINDOW_EXT 0x2001 654 | #define WGL_DRAW_TO_BITMAP_EXT 0x2002 655 | #define WGL_ACCELERATION_EXT 0x2003 656 | #define WGL_NEED_PALETTE_EXT 0x2004 657 | #define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 658 | #define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 659 | #define WGL_SWAP_METHOD_EXT 0x2007 660 | #define WGL_NUMBER_OVERLAYS_EXT 0x2008 661 | #define WGL_NUMBER_UNDERLAYS_EXT 0x2009 662 | #define WGL_TRANSPARENT_EXT 0x200A 663 | #define WGL_TRANSPARENT_VALUE_EXT 0x200B 664 | #define WGL_SHARE_DEPTH_EXT 0x200C 665 | #define WGL_SHARE_STENCIL_EXT 0x200D 666 | #define WGL_SHARE_ACCUM_EXT 0x200E 667 | #define WGL_SUPPORT_GDI_EXT 0x200F 668 | #define WGL_SUPPORT_OPENGL_EXT 0x2010 669 | #define WGL_DOUBLE_BUFFER_EXT 0x2011 670 | #define WGL_STEREO_EXT 0x2012 671 | #define WGL_PIXEL_TYPE_EXT 0x2013 672 | #define WGL_COLOR_BITS_EXT 0x2014 673 | #define WGL_RED_BITS_EXT 0x2015 674 | #define WGL_RED_SHIFT_EXT 0x2016 675 | #define WGL_GREEN_BITS_EXT 0x2017 676 | #define WGL_GREEN_SHIFT_EXT 0x2018 677 | #define WGL_BLUE_BITS_EXT 0x2019 678 | #define WGL_BLUE_SHIFT_EXT 0x201A 679 | #define WGL_ALPHA_BITS_EXT 0x201B 680 | #define WGL_ALPHA_SHIFT_EXT 0x201C 681 | #define WGL_ACCUM_BITS_EXT 0x201D 682 | #define WGL_ACCUM_RED_BITS_EXT 0x201E 683 | #define WGL_ACCUM_GREEN_BITS_EXT 0x201F 684 | #define WGL_ACCUM_BLUE_BITS_EXT 0x2020 685 | #define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 686 | #define WGL_DEPTH_BITS_EXT 0x2022 687 | #define WGL_STENCIL_BITS_EXT 0x2023 688 | #define WGL_AUX_BUFFERS_EXT 0x2024 689 | #define WGL_NO_ACCELERATION_EXT 0x2025 690 | #define WGL_GENERIC_ACCELERATION_EXT 0x2026 691 | #define WGL_FULL_ACCELERATION_EXT 0x2027 692 | #define WGL_SWAP_EXCHANGE_EXT 0x2028 693 | #define WGL_SWAP_COPY_EXT 0x2029 694 | #define WGL_SWAP_UNDEFINED_EXT 0x202A 695 | #define WGL_TYPE_RGBA_EXT 0x202B 696 | #define WGL_TYPE_COLORINDEX_EXT 0x202C 697 | 698 | typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); 699 | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues); 700 | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues); 701 | 702 | #define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT) 703 | #define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT) 704 | #define wglGetPixelFormatAttribivEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribivEXT) 705 | 706 | #define WGLEW_EXT_pixel_format WGLEW_GET_VAR(__WGLEW_EXT_pixel_format) 707 | 708 | #endif /* WGL_EXT_pixel_format */ 709 | 710 | /* ------------------- WGL_EXT_pixel_format_packed_float ------------------- */ 711 | 712 | #ifndef WGL_EXT_pixel_format_packed_float 713 | #define WGL_EXT_pixel_format_packed_float 1 714 | 715 | #define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 716 | 717 | #define WGLEW_EXT_pixel_format_packed_float WGLEW_GET_VAR(__WGLEW_EXT_pixel_format_packed_float) 718 | 719 | #endif /* WGL_EXT_pixel_format_packed_float */ 720 | 721 | /* -------------------------- WGL_EXT_swap_control ------------------------- */ 722 | 723 | #ifndef WGL_EXT_swap_control 724 | #define WGL_EXT_swap_control 1 725 | 726 | typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); 727 | typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); 728 | 729 | #define wglGetSwapIntervalEXT WGLEW_GET_FUN(__wglewGetSwapIntervalEXT) 730 | #define wglSwapIntervalEXT WGLEW_GET_FUN(__wglewSwapIntervalEXT) 731 | 732 | #define WGLEW_EXT_swap_control WGLEW_GET_VAR(__WGLEW_EXT_swap_control) 733 | 734 | #endif /* WGL_EXT_swap_control */ 735 | 736 | /* ----------------------- WGL_EXT_swap_control_tear ----------------------- */ 737 | 738 | #ifndef WGL_EXT_swap_control_tear 739 | #define WGL_EXT_swap_control_tear 1 740 | 741 | #define WGLEW_EXT_swap_control_tear WGLEW_GET_VAR(__WGLEW_EXT_swap_control_tear) 742 | 743 | #endif /* WGL_EXT_swap_control_tear */ 744 | 745 | /* --------------------- WGL_I3D_digital_video_control --------------------- */ 746 | 747 | #ifndef WGL_I3D_digital_video_control 748 | #define WGL_I3D_digital_video_control 1 749 | 750 | #define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 751 | #define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 752 | #define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 753 | #define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 754 | 755 | typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue); 756 | typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue); 757 | 758 | #define wglGetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewGetDigitalVideoParametersI3D) 759 | #define wglSetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewSetDigitalVideoParametersI3D) 760 | 761 | #define WGLEW_I3D_digital_video_control WGLEW_GET_VAR(__WGLEW_I3D_digital_video_control) 762 | 763 | #endif /* WGL_I3D_digital_video_control */ 764 | 765 | /* ----------------------------- WGL_I3D_gamma ----------------------------- */ 766 | 767 | #ifndef WGL_I3D_gamma 768 | #define WGL_I3D_gamma 1 769 | 770 | #define WGL_GAMMA_TABLE_SIZE_I3D 0x204E 771 | #define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F 772 | 773 | typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue); 774 | typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue); 775 | typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue); 776 | typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue); 777 | 778 | #define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D) 779 | #define wglGetGammaTableParametersI3D WGLEW_GET_FUN(__wglewGetGammaTableParametersI3D) 780 | #define wglSetGammaTableI3D WGLEW_GET_FUN(__wglewSetGammaTableI3D) 781 | #define wglSetGammaTableParametersI3D WGLEW_GET_FUN(__wglewSetGammaTableParametersI3D) 782 | 783 | #define WGLEW_I3D_gamma WGLEW_GET_VAR(__WGLEW_I3D_gamma) 784 | 785 | #endif /* WGL_I3D_gamma */ 786 | 787 | /* ---------------------------- WGL_I3D_genlock ---------------------------- */ 788 | 789 | #ifndef WGL_I3D_genlock 790 | #define WGL_I3D_genlock 1 791 | 792 | #define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 793 | #define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045 794 | #define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046 795 | #define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047 796 | #define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 797 | #define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 798 | #define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A 799 | #define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B 800 | #define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C 801 | 802 | typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); 803 | typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); 804 | typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); 805 | typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); 806 | typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); 807 | typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); 808 | typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT* uRate); 809 | typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDelay); 810 | typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge); 811 | typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource); 812 | typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag); 813 | typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay); 814 | 815 | #define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D) 816 | #define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D) 817 | #define wglGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGenlockSampleRateI3D) 818 | #define wglGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGenlockSourceDelayI3D) 819 | #define wglGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGenlockSourceEdgeI3D) 820 | #define wglGenlockSourceI3D WGLEW_GET_FUN(__wglewGenlockSourceI3D) 821 | #define wglGetGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGetGenlockSampleRateI3D) 822 | #define wglGetGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGetGenlockSourceDelayI3D) 823 | #define wglGetGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGetGenlockSourceEdgeI3D) 824 | #define wglGetGenlockSourceI3D WGLEW_GET_FUN(__wglewGetGenlockSourceI3D) 825 | #define wglIsEnabledGenlockI3D WGLEW_GET_FUN(__wglewIsEnabledGenlockI3D) 826 | #define wglQueryGenlockMaxSourceDelayI3D WGLEW_GET_FUN(__wglewQueryGenlockMaxSourceDelayI3D) 827 | 828 | #define WGLEW_I3D_genlock WGLEW_GET_VAR(__WGLEW_I3D_genlock) 829 | 830 | #endif /* WGL_I3D_genlock */ 831 | 832 | /* -------------------------- WGL_I3D_image_buffer ------------------------- */ 833 | 834 | #ifndef WGL_I3D_image_buffer 835 | #define WGL_I3D_image_buffer 1 836 | 837 | #define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 838 | #define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 839 | 840 | typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count); 841 | typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); 842 | typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); 843 | typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count); 844 | 845 | #define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D) 846 | #define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D) 847 | #define wglDestroyImageBufferI3D WGLEW_GET_FUN(__wglewDestroyImageBufferI3D) 848 | #define wglReleaseImageBufferEventsI3D WGLEW_GET_FUN(__wglewReleaseImageBufferEventsI3D) 849 | 850 | #define WGLEW_I3D_image_buffer WGLEW_GET_VAR(__WGLEW_I3D_image_buffer) 851 | 852 | #endif /* WGL_I3D_image_buffer */ 853 | 854 | /* ------------------------ WGL_I3D_swap_frame_lock ------------------------ */ 855 | 856 | #ifndef WGL_I3D_swap_frame_lock 857 | #define WGL_I3D_swap_frame_lock 1 858 | 859 | typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID); 860 | typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID); 861 | typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag); 862 | typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag); 863 | 864 | #define wglDisableFrameLockI3D WGLEW_GET_FUN(__wglewDisableFrameLockI3D) 865 | #define wglEnableFrameLockI3D WGLEW_GET_FUN(__wglewEnableFrameLockI3D) 866 | #define wglIsEnabledFrameLockI3D WGLEW_GET_FUN(__wglewIsEnabledFrameLockI3D) 867 | #define wglQueryFrameLockMasterI3D WGLEW_GET_FUN(__wglewQueryFrameLockMasterI3D) 868 | 869 | #define WGLEW_I3D_swap_frame_lock WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_lock) 870 | 871 | #endif /* WGL_I3D_swap_frame_lock */ 872 | 873 | /* ------------------------ WGL_I3D_swap_frame_usage ----------------------- */ 874 | 875 | #ifndef WGL_I3D_swap_frame_usage 876 | #define WGL_I3D_swap_frame_usage 1 877 | 878 | typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); 879 | typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); 880 | typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage); 881 | typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); 882 | 883 | #define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D) 884 | #define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D) 885 | #define wglGetFrameUsageI3D WGLEW_GET_FUN(__wglewGetFrameUsageI3D) 886 | #define wglQueryFrameTrackingI3D WGLEW_GET_FUN(__wglewQueryFrameTrackingI3D) 887 | 888 | #define WGLEW_I3D_swap_frame_usage WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_usage) 889 | 890 | #endif /* WGL_I3D_swap_frame_usage */ 891 | 892 | /* --------------------------- WGL_NV_DX_interop --------------------------- */ 893 | 894 | #ifndef WGL_NV_DX_interop 895 | #define WGL_NV_DX_interop 1 896 | 897 | #define WGL_ACCESS_READ_ONLY_NV 0x0000 898 | #define WGL_ACCESS_READ_WRITE_NV 0x0001 899 | #define WGL_ACCESS_WRITE_DISCARD_NV 0x0002 900 | 901 | typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice); 902 | typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects); 903 | typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access); 904 | typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void* dxDevice); 905 | typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void* dxObject, GLuint name, GLenum type, GLenum access); 906 | typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void* dxObject, HANDLE shareHandle); 907 | typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects); 908 | typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject); 909 | 910 | #define wglDXCloseDeviceNV WGLEW_GET_FUN(__wglewDXCloseDeviceNV) 911 | #define wglDXLockObjectsNV WGLEW_GET_FUN(__wglewDXLockObjectsNV) 912 | #define wglDXObjectAccessNV WGLEW_GET_FUN(__wglewDXObjectAccessNV) 913 | #define wglDXOpenDeviceNV WGLEW_GET_FUN(__wglewDXOpenDeviceNV) 914 | #define wglDXRegisterObjectNV WGLEW_GET_FUN(__wglewDXRegisterObjectNV) 915 | #define wglDXSetResourceShareHandleNV WGLEW_GET_FUN(__wglewDXSetResourceShareHandleNV) 916 | #define wglDXUnlockObjectsNV WGLEW_GET_FUN(__wglewDXUnlockObjectsNV) 917 | #define wglDXUnregisterObjectNV WGLEW_GET_FUN(__wglewDXUnregisterObjectNV) 918 | 919 | #define WGLEW_NV_DX_interop WGLEW_GET_VAR(__WGLEW_NV_DX_interop) 920 | 921 | #endif /* WGL_NV_DX_interop */ 922 | 923 | /* --------------------------- WGL_NV_DX_interop2 -------------------------- */ 924 | 925 | #ifndef WGL_NV_DX_interop2 926 | #define WGL_NV_DX_interop2 1 927 | 928 | #define WGLEW_NV_DX_interop2 WGLEW_GET_VAR(__WGLEW_NV_DX_interop2) 929 | 930 | #endif /* WGL_NV_DX_interop2 */ 931 | 932 | /* --------------------------- WGL_NV_copy_image --------------------------- */ 933 | 934 | #ifndef WGL_NV_copy_image 935 | #define WGL_NV_copy_image 1 936 | 937 | typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); 938 | 939 | #define wglCopyImageSubDataNV WGLEW_GET_FUN(__wglewCopyImageSubDataNV) 940 | 941 | #define WGLEW_NV_copy_image WGLEW_GET_VAR(__WGLEW_NV_copy_image) 942 | 943 | #endif /* WGL_NV_copy_image */ 944 | 945 | /* ------------------------ WGL_NV_delay_before_swap ----------------------- */ 946 | 947 | #ifndef WGL_NV_delay_before_swap 948 | #define WGL_NV_delay_before_swap 1 949 | 950 | typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds); 951 | 952 | #define wglDelayBeforeSwapNV WGLEW_GET_FUN(__wglewDelayBeforeSwapNV) 953 | 954 | #define WGLEW_NV_delay_before_swap WGLEW_GET_VAR(__WGLEW_NV_delay_before_swap) 955 | 956 | #endif /* WGL_NV_delay_before_swap */ 957 | 958 | /* -------------------------- WGL_NV_float_buffer -------------------------- */ 959 | 960 | #ifndef WGL_NV_float_buffer 961 | #define WGL_NV_float_buffer 1 962 | 963 | #define WGL_FLOAT_COMPONENTS_NV 0x20B0 964 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 965 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 966 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 967 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 968 | #define WGL_TEXTURE_FLOAT_R_NV 0x20B5 969 | #define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 970 | #define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 971 | #define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 972 | 973 | #define WGLEW_NV_float_buffer WGLEW_GET_VAR(__WGLEW_NV_float_buffer) 974 | 975 | #endif /* WGL_NV_float_buffer */ 976 | 977 | /* -------------------------- WGL_NV_gpu_affinity -------------------------- */ 978 | 979 | #ifndef WGL_NV_gpu_affinity 980 | #define WGL_NV_gpu_affinity 1 981 | 982 | #define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0 983 | #define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1 984 | 985 | DECLARE_HANDLE(HGPUNV); 986 | typedef struct _GPU_DEVICE { 987 | DWORD cb; 988 | CHAR DeviceName[32]; 989 | CHAR DeviceString[128]; 990 | DWORD Flags; 991 | RECT rcVirtualScreen; 992 | } GPU_DEVICE, *PGPU_DEVICE; 993 | 994 | typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList); 995 | typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc); 996 | typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); 997 | typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); 998 | typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu); 999 | 1000 | #define wglCreateAffinityDCNV WGLEW_GET_FUN(__wglewCreateAffinityDCNV) 1001 | #define wglDeleteDCNV WGLEW_GET_FUN(__wglewDeleteDCNV) 1002 | #define wglEnumGpuDevicesNV WGLEW_GET_FUN(__wglewEnumGpuDevicesNV) 1003 | #define wglEnumGpusFromAffinityDCNV WGLEW_GET_FUN(__wglewEnumGpusFromAffinityDCNV) 1004 | #define wglEnumGpusNV WGLEW_GET_FUN(__wglewEnumGpusNV) 1005 | 1006 | #define WGLEW_NV_gpu_affinity WGLEW_GET_VAR(__WGLEW_NV_gpu_affinity) 1007 | 1008 | #endif /* WGL_NV_gpu_affinity */ 1009 | 1010 | /* ---------------------- WGL_NV_multisample_coverage ---------------------- */ 1011 | 1012 | #ifndef WGL_NV_multisample_coverage 1013 | #define WGL_NV_multisample_coverage 1 1014 | 1015 | #define WGL_COVERAGE_SAMPLES_NV 0x2042 1016 | #define WGL_COLOR_SAMPLES_NV 0x20B9 1017 | 1018 | #define WGLEW_NV_multisample_coverage WGLEW_GET_VAR(__WGLEW_NV_multisample_coverage) 1019 | 1020 | #endif /* WGL_NV_multisample_coverage */ 1021 | 1022 | /* -------------------------- WGL_NV_present_video ------------------------- */ 1023 | 1024 | #ifndef WGL_NV_present_video 1025 | #define WGL_NV_present_video 1 1026 | 1027 | #define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 1028 | 1029 | DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); 1030 | 1031 | typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int* piAttribList); 1032 | typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV* phDeviceList); 1033 | typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int* piValue); 1034 | 1035 | #define wglBindVideoDeviceNV WGLEW_GET_FUN(__wglewBindVideoDeviceNV) 1036 | #define wglEnumerateVideoDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoDevicesNV) 1037 | #define wglQueryCurrentContextNV WGLEW_GET_FUN(__wglewQueryCurrentContextNV) 1038 | 1039 | #define WGLEW_NV_present_video WGLEW_GET_VAR(__WGLEW_NV_present_video) 1040 | 1041 | #endif /* WGL_NV_present_video */ 1042 | 1043 | /* ---------------------- WGL_NV_render_depth_texture ---------------------- */ 1044 | 1045 | #ifndef WGL_NV_render_depth_texture 1046 | #define WGL_NV_render_depth_texture 1 1047 | 1048 | #define WGL_NO_TEXTURE_ARB 0x2077 1049 | #define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 1050 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 1051 | #define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 1052 | #define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 1053 | #define WGL_DEPTH_COMPONENT_NV 0x20A7 1054 | 1055 | #define WGLEW_NV_render_depth_texture WGLEW_GET_VAR(__WGLEW_NV_render_depth_texture) 1056 | 1057 | #endif /* WGL_NV_render_depth_texture */ 1058 | 1059 | /* -------------------- WGL_NV_render_texture_rectangle -------------------- */ 1060 | 1061 | #ifndef WGL_NV_render_texture_rectangle 1062 | #define WGL_NV_render_texture_rectangle 1 1063 | 1064 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 1065 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 1066 | #define WGL_TEXTURE_RECTANGLE_NV 0x20A2 1067 | 1068 | #define WGLEW_NV_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_NV_render_texture_rectangle) 1069 | 1070 | #endif /* WGL_NV_render_texture_rectangle */ 1071 | 1072 | /* --------------------------- WGL_NV_swap_group --------------------------- */ 1073 | 1074 | #ifndef WGL_NV_swap_group 1075 | #define WGL_NV_swap_group 1 1076 | 1077 | typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier); 1078 | typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group); 1079 | typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint* count); 1080 | typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint* maxGroups, GLuint *maxBarriers); 1081 | typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint* group, GLuint *barrier); 1082 | typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC); 1083 | 1084 | #define wglBindSwapBarrierNV WGLEW_GET_FUN(__wglewBindSwapBarrierNV) 1085 | #define wglJoinSwapGroupNV WGLEW_GET_FUN(__wglewJoinSwapGroupNV) 1086 | #define wglQueryFrameCountNV WGLEW_GET_FUN(__wglewQueryFrameCountNV) 1087 | #define wglQueryMaxSwapGroupsNV WGLEW_GET_FUN(__wglewQueryMaxSwapGroupsNV) 1088 | #define wglQuerySwapGroupNV WGLEW_GET_FUN(__wglewQuerySwapGroupNV) 1089 | #define wglResetFrameCountNV WGLEW_GET_FUN(__wglewResetFrameCountNV) 1090 | 1091 | #define WGLEW_NV_swap_group WGLEW_GET_VAR(__WGLEW_NV_swap_group) 1092 | 1093 | #endif /* WGL_NV_swap_group */ 1094 | 1095 | /* ----------------------- WGL_NV_vertex_array_range ----------------------- */ 1096 | 1097 | #ifndef WGL_NV_vertex_array_range 1098 | #define WGL_NV_vertex_array_range 1 1099 | 1100 | typedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority); 1101 | typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); 1102 | 1103 | #define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV) 1104 | #define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV) 1105 | 1106 | #define WGLEW_NV_vertex_array_range WGLEW_GET_VAR(__WGLEW_NV_vertex_array_range) 1107 | 1108 | #endif /* WGL_NV_vertex_array_range */ 1109 | 1110 | /* -------------------------- WGL_NV_video_capture ------------------------- */ 1111 | 1112 | #ifndef WGL_NV_video_capture 1113 | #define WGL_NV_video_capture 1 1114 | 1115 | #define WGL_UNIQUE_ID_NV 0x20CE 1116 | #define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF 1117 | 1118 | DECLARE_HANDLE(HVIDEOINPUTDEVICENV); 1119 | 1120 | typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); 1121 | typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV* phDeviceList); 1122 | typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); 1123 | typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int* piValue); 1124 | typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); 1125 | 1126 | #define wglBindVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewBindVideoCaptureDeviceNV) 1127 | #define wglEnumerateVideoCaptureDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoCaptureDevicesNV) 1128 | #define wglLockVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewLockVideoCaptureDeviceNV) 1129 | #define wglQueryVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewQueryVideoCaptureDeviceNV) 1130 | #define wglReleaseVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoCaptureDeviceNV) 1131 | 1132 | #define WGLEW_NV_video_capture WGLEW_GET_VAR(__WGLEW_NV_video_capture) 1133 | 1134 | #endif /* WGL_NV_video_capture */ 1135 | 1136 | /* -------------------------- WGL_NV_video_output -------------------------- */ 1137 | 1138 | #ifndef WGL_NV_video_output 1139 | #define WGL_NV_video_output 1 1140 | 1141 | #define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0 1142 | #define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1 1143 | #define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2 1144 | #define WGL_VIDEO_OUT_COLOR_NV 0x20C3 1145 | #define WGL_VIDEO_OUT_ALPHA_NV 0x20C4 1146 | #define WGL_VIDEO_OUT_DEPTH_NV 0x20C5 1147 | #define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 1148 | #define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 1149 | #define WGL_VIDEO_OUT_FRAME 0x20C8 1150 | #define WGL_VIDEO_OUT_FIELD_1 0x20C9 1151 | #define WGL_VIDEO_OUT_FIELD_2 0x20CA 1152 | #define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB 1153 | #define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC 1154 | 1155 | DECLARE_HANDLE(HPVIDEODEV); 1156 | 1157 | typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); 1158 | typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV* hVideoDevice); 1159 | typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); 1160 | typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice); 1161 | typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer); 1162 | typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long* pulCounterPbuffer, BOOL bBlock); 1163 | 1164 | #define wglBindVideoImageNV WGLEW_GET_FUN(__wglewBindVideoImageNV) 1165 | #define wglGetVideoDeviceNV WGLEW_GET_FUN(__wglewGetVideoDeviceNV) 1166 | #define wglGetVideoInfoNV WGLEW_GET_FUN(__wglewGetVideoInfoNV) 1167 | #define wglReleaseVideoDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoDeviceNV) 1168 | #define wglReleaseVideoImageNV WGLEW_GET_FUN(__wglewReleaseVideoImageNV) 1169 | #define wglSendPbufferToVideoNV WGLEW_GET_FUN(__wglewSendPbufferToVideoNV) 1170 | 1171 | #define WGLEW_NV_video_output WGLEW_GET_VAR(__WGLEW_NV_video_output) 1172 | 1173 | #endif /* WGL_NV_video_output */ 1174 | 1175 | /* -------------------------- WGL_OML_sync_control ------------------------- */ 1176 | 1177 | #ifndef WGL_OML_sync_control 1178 | #define WGL_OML_sync_control 1 1179 | 1180 | typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator); 1181 | typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc); 1182 | typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); 1183 | typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); 1184 | typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc); 1185 | typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc); 1186 | 1187 | #define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML) 1188 | #define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML) 1189 | #define wglSwapBuffersMscOML WGLEW_GET_FUN(__wglewSwapBuffersMscOML) 1190 | #define wglSwapLayerBuffersMscOML WGLEW_GET_FUN(__wglewSwapLayerBuffersMscOML) 1191 | #define wglWaitForMscOML WGLEW_GET_FUN(__wglewWaitForMscOML) 1192 | #define wglWaitForSbcOML WGLEW_GET_FUN(__wglewWaitForSbcOML) 1193 | 1194 | #define WGLEW_OML_sync_control WGLEW_GET_VAR(__WGLEW_OML_sync_control) 1195 | 1196 | #endif /* WGL_OML_sync_control */ 1197 | 1198 | /* ------------------------------------------------------------------------- */ 1199 | 1200 | #ifdef GLEW_MX 1201 | #define WGLEW_FUN_EXPORT 1202 | #define WGLEW_VAR_EXPORT 1203 | #else 1204 | #define WGLEW_FUN_EXPORT GLEW_FUN_EXPORT 1205 | #define WGLEW_VAR_EXPORT GLEW_VAR_EXPORT 1206 | #endif /* GLEW_MX */ 1207 | 1208 | #ifdef GLEW_MX 1209 | struct WGLEWContextStruct 1210 | { 1211 | #endif /* GLEW_MX */ 1212 | 1213 | WGLEW_FUN_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL; 1214 | 1215 | WGLEW_FUN_EXPORT PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD; 1216 | WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD; 1217 | WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD; 1218 | WGLEW_FUN_EXPORT PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD; 1219 | WGLEW_FUN_EXPORT PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD; 1220 | WGLEW_FUN_EXPORT PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD; 1221 | WGLEW_FUN_EXPORT PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD; 1222 | WGLEW_FUN_EXPORT PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD; 1223 | WGLEW_FUN_EXPORT PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD; 1224 | 1225 | WGLEW_FUN_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB; 1226 | WGLEW_FUN_EXPORT PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB; 1227 | WGLEW_FUN_EXPORT PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB; 1228 | WGLEW_FUN_EXPORT PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB; 1229 | 1230 | WGLEW_FUN_EXPORT PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB; 1231 | 1232 | WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB; 1233 | 1234 | WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB; 1235 | WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB; 1236 | 1237 | WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB; 1238 | WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB; 1239 | WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB; 1240 | WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB; 1241 | WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB; 1242 | 1243 | WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB; 1244 | WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB; 1245 | WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB; 1246 | 1247 | WGLEW_FUN_EXPORT PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB; 1248 | WGLEW_FUN_EXPORT PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB; 1249 | WGLEW_FUN_EXPORT PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB; 1250 | 1251 | WGLEW_FUN_EXPORT PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT; 1252 | WGLEW_FUN_EXPORT PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT; 1253 | WGLEW_FUN_EXPORT PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT; 1254 | WGLEW_FUN_EXPORT PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT; 1255 | 1256 | WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT; 1257 | 1258 | WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT; 1259 | WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT; 1260 | 1261 | WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT; 1262 | WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT; 1263 | WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT; 1264 | WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT; 1265 | WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT; 1266 | 1267 | WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT; 1268 | WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT; 1269 | WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT; 1270 | 1271 | WGLEW_FUN_EXPORT PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT; 1272 | WGLEW_FUN_EXPORT PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT; 1273 | 1274 | WGLEW_FUN_EXPORT PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D; 1275 | WGLEW_FUN_EXPORT PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D; 1276 | 1277 | WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D; 1278 | WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D; 1279 | WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D; 1280 | WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D; 1281 | 1282 | WGLEW_FUN_EXPORT PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D; 1283 | WGLEW_FUN_EXPORT PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D; 1284 | WGLEW_FUN_EXPORT PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D; 1285 | WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D; 1286 | WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D; 1287 | WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D; 1288 | WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D; 1289 | WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D; 1290 | WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D; 1291 | WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D; 1292 | WGLEW_FUN_EXPORT PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D; 1293 | WGLEW_FUN_EXPORT PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D; 1294 | 1295 | WGLEW_FUN_EXPORT PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D; 1296 | WGLEW_FUN_EXPORT PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D; 1297 | WGLEW_FUN_EXPORT PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D; 1298 | WGLEW_FUN_EXPORT PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D; 1299 | 1300 | WGLEW_FUN_EXPORT PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D; 1301 | WGLEW_FUN_EXPORT PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D; 1302 | WGLEW_FUN_EXPORT PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D; 1303 | WGLEW_FUN_EXPORT PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D; 1304 | 1305 | WGLEW_FUN_EXPORT PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D; 1306 | WGLEW_FUN_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D; 1307 | WGLEW_FUN_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D; 1308 | WGLEW_FUN_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D; 1309 | 1310 | WGLEW_FUN_EXPORT PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV; 1311 | WGLEW_FUN_EXPORT PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV; 1312 | WGLEW_FUN_EXPORT PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV; 1313 | WGLEW_FUN_EXPORT PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV; 1314 | WGLEW_FUN_EXPORT PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV; 1315 | WGLEW_FUN_EXPORT PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV; 1316 | WGLEW_FUN_EXPORT PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV; 1317 | WGLEW_FUN_EXPORT PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV; 1318 | 1319 | WGLEW_FUN_EXPORT PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV; 1320 | 1321 | WGLEW_FUN_EXPORT PFNWGLDELAYBEFORESWAPNVPROC __wglewDelayBeforeSwapNV; 1322 | 1323 | WGLEW_FUN_EXPORT PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV; 1324 | WGLEW_FUN_EXPORT PFNWGLDELETEDCNVPROC __wglewDeleteDCNV; 1325 | WGLEW_FUN_EXPORT PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV; 1326 | WGLEW_FUN_EXPORT PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV; 1327 | WGLEW_FUN_EXPORT PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV; 1328 | 1329 | WGLEW_FUN_EXPORT PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV; 1330 | WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV; 1331 | WGLEW_FUN_EXPORT PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV; 1332 | 1333 | WGLEW_FUN_EXPORT PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV; 1334 | WGLEW_FUN_EXPORT PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV; 1335 | WGLEW_FUN_EXPORT PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV; 1336 | WGLEW_FUN_EXPORT PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV; 1337 | WGLEW_FUN_EXPORT PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV; 1338 | WGLEW_FUN_EXPORT PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV; 1339 | 1340 | WGLEW_FUN_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV; 1341 | WGLEW_FUN_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV; 1342 | 1343 | WGLEW_FUN_EXPORT PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV; 1344 | WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV; 1345 | WGLEW_FUN_EXPORT PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV; 1346 | WGLEW_FUN_EXPORT PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV; 1347 | WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV; 1348 | 1349 | WGLEW_FUN_EXPORT PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV; 1350 | WGLEW_FUN_EXPORT PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV; 1351 | WGLEW_FUN_EXPORT PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV; 1352 | WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV; 1353 | WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV; 1354 | WGLEW_FUN_EXPORT PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV; 1355 | 1356 | WGLEW_FUN_EXPORT PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML; 1357 | WGLEW_FUN_EXPORT PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML; 1358 | WGLEW_FUN_EXPORT PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML; 1359 | WGLEW_FUN_EXPORT PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML; 1360 | WGLEW_FUN_EXPORT PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML; 1361 | WGLEW_FUN_EXPORT PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML; 1362 | WGLEW_VAR_EXPORT GLboolean __WGLEW_3DFX_multisample; 1363 | WGLEW_VAR_EXPORT GLboolean __WGLEW_3DL_stereo_control; 1364 | WGLEW_VAR_EXPORT GLboolean __WGLEW_AMD_gpu_association; 1365 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_buffer_region; 1366 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_context_flush_control; 1367 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context; 1368 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_profile; 1369 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_robustness; 1370 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_extensions_string; 1371 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_framebuffer_sRGB; 1372 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_make_current_read; 1373 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_multisample; 1374 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pbuffer; 1375 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format; 1376 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format_float; 1377 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_render_texture; 1378 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_robustness_application_isolation; 1379 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_robustness_share_group_isolation; 1380 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_pixel_format_float; 1381 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_render_texture_rectangle; 1382 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es2_profile; 1383 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es_profile; 1384 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_depth_float; 1385 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_display_color_table; 1386 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_extensions_string; 1387 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_framebuffer_sRGB; 1388 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_make_current_read; 1389 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_multisample; 1390 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pbuffer; 1391 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format; 1392 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format_packed_float; 1393 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control; 1394 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control_tear; 1395 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_digital_video_control; 1396 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_gamma; 1397 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_genlock; 1398 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_image_buffer; 1399 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock; 1400 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage; 1401 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop; 1402 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop2; 1403 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_copy_image; 1404 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_delay_before_swap; 1405 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_float_buffer; 1406 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_gpu_affinity; 1407 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_multisample_coverage; 1408 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_present_video; 1409 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_depth_texture; 1410 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle; 1411 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_swap_group; 1412 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_vertex_array_range; 1413 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_capture; 1414 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_output; 1415 | WGLEW_VAR_EXPORT GLboolean __WGLEW_OML_sync_control; 1416 | 1417 | #ifdef GLEW_MX 1418 | }; /* WGLEWContextStruct */ 1419 | #endif /* GLEW_MX */ 1420 | 1421 | /* ------------------------------------------------------------------------- */ 1422 | 1423 | #ifdef GLEW_MX 1424 | 1425 | typedef struct WGLEWContextStruct WGLEWContext; 1426 | GLEWAPI GLenum GLEWAPIENTRY wglewContextInit (WGLEWContext *ctx); 1427 | GLEWAPI GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext *ctx, const char *name); 1428 | 1429 | #define wglewInit() wglewContextInit(wglewGetContext()) 1430 | #define wglewIsSupported(x) wglewContextIsSupported(wglewGetContext(), x) 1431 | 1432 | #define WGLEW_GET_VAR(x) (*(const GLboolean*)&(wglewGetContext()->x)) 1433 | #define WGLEW_GET_FUN(x) wglewGetContext()->x 1434 | 1435 | #else /* GLEW_MX */ 1436 | 1437 | GLEWAPI GLenum GLEWAPIENTRY wglewInit (); 1438 | GLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name); 1439 | 1440 | #define WGLEW_GET_VAR(x) (*(const GLboolean*)&x) 1441 | #define WGLEW_GET_FUN(x) x 1442 | 1443 | #endif /* GLEW_MX */ 1444 | 1445 | GLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name); 1446 | 1447 | #ifdef __cplusplus 1448 | } 1449 | #endif 1450 | 1451 | #undef GLEWAPI 1452 | 1453 | #endif /* __wglew_h__ */ 1454 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/GLEW/wglew.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 190b183067fb7fe47b6c0fa7d0cf144e 3 | timeCreated: 1556020328 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/PlatformBase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Standard base includes, defines that indicate our current platform, etc. 4 | 5 | #include 6 | 7 | 8 | // Which platform we are on? 9 | // UNITY_WIN - Windows (regular win32) 10 | // UNITY_OSX - Mac OS X 11 | // UNITY_LINUX - Linux 12 | // UNITY_IPHONE - iOS 13 | // UNITY_ANDROID - Android 14 | // UNITY_METRO - WSA or UWP 15 | // UNITY_WEBGL - WebGL 16 | #if _MSC_VER 17 | #define UNITY_WIN 1 18 | #elif defined(__APPLE__) 19 | #if defined(__arm__) || defined(__arm64__) 20 | #define UNITY_IPHONE 1 21 | #else 22 | #define UNITY_OSX 1 23 | #endif 24 | #elif defined(UNITY_METRO) || defined(UNITY_ANDROID) || defined(UNITY_LINUX) || defined(UNITY_WEBGL) 25 | // these are defined externally 26 | #elif defined(__EMSCRIPTEN__) 27 | // this is already defined in Unity 5.6 28 | #define UNITY_WEBGL 1 29 | #else 30 | #error "Unknown platform!" 31 | #endif 32 | 33 | 34 | 35 | // Which graphics device APIs we possibly support? 36 | #if UNITY_METRO 37 | #define SUPPORT_D3D11 1 38 | #if WINDOWS_UWP 39 | #define SUPPORT_D3D12 1 40 | #endif 41 | #elif UNITY_WIN 42 | #define SUPPORT_D3D11 1 // comment this out if you don't have D3D11 header/library files 43 | #define SUPPORT_D3D12 0 //@TODO: enable by default? comment this out if you don't have D3D12 header/library files 44 | #define SUPPORT_OPENGL_UNIFIED 1 45 | #define SUPPORT_OPENGL_CORE 1 46 | #elif UNITY_IPHONE || UNITY_ANDROID || UNITY_WEBGL 47 | #define SUPPORT_OPENGL_UNIFIED 1 48 | #define SUPPORT_OPENGL_ES 1 49 | #elif UNITY_OSX || UNITY_LINUX 50 | #define SUPPORT_OPENGL_UNIFIED 1 51 | #define SUPPORT_OPENGL_CORE 1 52 | #endif 53 | 54 | #if UNITY_IPHONE || UNITY_OSX 55 | #define SUPPORT_METAL 1 56 | #endif 57 | 58 | 59 | 60 | // COM-like Release macro 61 | #ifndef SAFE_RELEASE 62 | #define SAFE_RELEASE(a) if (a) { a->Release(); a = NULL; } 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/PlatformBase.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8405a5842884a7c49901a176eef694fe 3 | timeCreated: 1556020329 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/RenderAPI.cpp: -------------------------------------------------------------------------------- 1 | #include "RenderAPI.h" 2 | #include "PlatformBase.h" 3 | #include "Unity/IUnityGraphics.h" 4 | 5 | 6 | RenderAPI* CreateRenderAPI(UnityGfxRenderer apiType) 7 | { 8 | # if SUPPORT_D3D11 9 | if (apiType == kUnityGfxRendererD3D11) 10 | { 11 | extern RenderAPI* CreateRenderAPI_D3D11(); 12 | return CreateRenderAPI_D3D11(); 13 | } 14 | # endif // if SUPPORT_D3D11 15 | 16 | 17 | // Unknown or unsupported graphics API 18 | return NULL; 19 | } 20 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/RenderAPI.cpp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c72b5c4b35364241b369078aa48bc53 3 | timeCreated: 1556020328 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/RenderAPI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Unity/IUnityGraphics.h" 4 | 5 | #include 6 | 7 | struct IUnityInterfaces; 8 | 9 | 10 | // Super-simple "graphics abstraction". This is nothing like how a proper platform abstraction layer would look like; 11 | // all this does is a base interface for whatever our plugin sample needs. Which is only "draw some triangles" 12 | // and "modify a texture" at this point. 13 | // 14 | // There are implementations of this base class for D3D9, D3D11, OpenGL etc.; see individual RenderAPI_* files. 15 | class RenderAPI 16 | { 17 | public: 18 | virtual ~RenderAPI() { } 19 | 20 | 21 | // Process general event like initialization, shutdown, device loss/reset etc. 22 | virtual void ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces) = 0; 23 | virtual void Release() = 0; 24 | 25 | virtual bool SetGBufferColor(int _index, int _msaaFactor, void *_colorBuffer) = 0; 26 | virtual bool SetGBufferDepth(int _msaaFactor, void *_depthBuffer) = 0; 27 | virtual void SetClearColor(float *_colorRGBA) = 0; 28 | virtual void SetGBufferTarget() = 0; 29 | }; 30 | 31 | 32 | // Create a graphics API implementation instance for the given API type. 33 | RenderAPI* CreateRenderAPI(UnityGfxRenderer apiType); 34 | 35 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/RenderAPI.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 005c6f99bb4ef6b489d85d12e6ad39f7 3 | timeCreated: 1556020328 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/RenderAPI_D3D11.cpp: -------------------------------------------------------------------------------- 1 | #include "RenderAPI.h" 2 | #include "PlatformBase.h" 3 | 4 | // Direct3D 11 implementation of RenderAPI. 5 | 6 | #if SUPPORT_D3D11 7 | 8 | #include 9 | #include 10 | #include "Unity/IUnityGraphicsD3D11.h" 11 | #include 12 | using namespace std; 13 | 14 | class RenderAPI_D3D11 : public RenderAPI 15 | { 16 | public: 17 | RenderAPI_D3D11(); 18 | virtual ~RenderAPI_D3D11() { } 19 | 20 | virtual void ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces); 21 | virtual void Release(); 22 | 23 | virtual bool SetGBufferColor(int _index, int _msaaFactor, void *_colorBuffer); 24 | virtual bool SetGBufferDepth(int _msaaFactor, void *_depthBuffer); 25 | virtual void SetClearColor(float *_colorRGBA); 26 | virtual void SetGBufferTarget(); 27 | 28 | private: 29 | void CreateResources(); 30 | void ReleaseResources(); 31 | DXGI_FORMAT ConvertTypelessFormat(DXGI_FORMAT _typelessFormat); 32 | 33 | private: 34 | static const int numGBuffer = 5; 35 | 36 | ID3D11Device* m_Device; 37 | ID3D11Texture2D* gBufferColor[numGBuffer]; 38 | ID3D11Texture2D* gBufferDepth; 39 | ID3D11RenderTargetView* gBufferColorView[numGBuffer]; 40 | ID3D11DepthStencilView* gBufferDepthView; 41 | FLOAT emissionClear[4]; 42 | }; 43 | 44 | 45 | RenderAPI* CreateRenderAPI_D3D11() 46 | { 47 | return new RenderAPI_D3D11(); 48 | } 49 | 50 | RenderAPI_D3D11::RenderAPI_D3D11() 51 | { 52 | } 53 | 54 | void RenderAPI_D3D11::ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces) 55 | { 56 | switch (type) 57 | { 58 | case kUnityGfxDeviceEventInitialize: 59 | { 60 | IUnityGraphicsD3D11* d3d = interfaces->Get(); 61 | m_Device = d3d->GetDevice(); 62 | CreateResources(); 63 | break; 64 | } 65 | case kUnityGfxDeviceEventShutdown: 66 | ReleaseResources(); 67 | break; 68 | } 69 | } 70 | 71 | void RenderAPI_D3D11::Release() 72 | { 73 | ReleaseResources(); 74 | } 75 | 76 | bool RenderAPI_D3D11::SetGBufferColor(int _index, int _msaaFactor, void * _colorBuffer) 77 | { 78 | gBufferColor[_index] = (ID3D11Texture2D*)_colorBuffer; 79 | 80 | if (gBufferColor[_index] == nullptr) 81 | { 82 | return false; 83 | } 84 | 85 | D3D11_TEXTURE2D_DESC texDesc; 86 | gBufferColor[_index]->GetDesc(&texDesc); 87 | 88 | D3D11_RENDER_TARGET_VIEW_DESC rtvDesc; 89 | ZeroMemory(&rtvDesc, sizeof(rtvDesc)); 90 | rtvDesc.Format = ConvertTypelessFormat(texDesc.Format); 91 | rtvDesc.ViewDimension = (_msaaFactor > 1) ? D3D11_RTV_DIMENSION_TEXTURE2DMS : D3D11_RTV_DIMENSION_TEXTURE2D; 92 | rtvDesc.Texture2D.MipSlice = 0; 93 | 94 | HRESULT rtvResult = m_Device->CreateRenderTargetView(gBufferColor[_index], &rtvDesc, &gBufferColorView[_index]); 95 | 96 | if (FAILED(rtvResult)) 97 | { 98 | ofstream out("GBufferRTV.txt", ios::out); 99 | out << "Error Code:" << rtvResult << endl; 100 | out << "Tex format:" << texDesc.Format; 101 | out.close(); 102 | } 103 | 104 | return SUCCEEDED(rtvResult); 105 | } 106 | 107 | bool RenderAPI_D3D11::SetGBufferDepth(int _msaaFactor, void * _depthBuffer) 108 | { 109 | gBufferDepth = (ID3D11Texture2D*)_depthBuffer; 110 | 111 | if (gBufferDepth == nullptr) 112 | { 113 | return false; 114 | } 115 | 116 | D3D11_TEXTURE2D_DESC texDesc; 117 | gBufferDepth->GetDesc(&texDesc); 118 | 119 | D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc; 120 | ZeroMemory(&dsvDesc, sizeof(dsvDesc)); 121 | dsvDesc.Format = ConvertTypelessFormat(texDesc.Format); 122 | dsvDesc.ViewDimension = (_msaaFactor > 1) ? D3D11_DSV_DIMENSION_TEXTURE2DMS : D3D11_DSV_DIMENSION_TEXTURE2D; 123 | dsvDesc.Texture2D.MipSlice = 0; 124 | 125 | HRESULT dsvResult = m_Device->CreateDepthStencilView(gBufferDepth, &dsvDesc, &gBufferDepthView); 126 | 127 | if (FAILED(dsvResult)) 128 | { 129 | ofstream out("GBufferDSV.txt", ios::out); 130 | out << "Error Code:" << dsvResult << endl; 131 | out << "Tex format:" << texDesc.Format; 132 | out.close(); 133 | } 134 | 135 | return SUCCEEDED(dsvResult); 136 | } 137 | 138 | void RenderAPI_D3D11::SetClearColor(float * _colorRGBA) 139 | { 140 | for (int i = 0; i < 4; i++) 141 | { 142 | emissionClear[i] = _colorRGBA[i]; 143 | } 144 | } 145 | 146 | void RenderAPI_D3D11::SetGBufferTarget() 147 | { 148 | if (m_Device == nullptr) 149 | { 150 | return; 151 | } 152 | 153 | ID3D11DeviceContext *immediateContext = nullptr; 154 | m_Device->GetImmediateContext(&immediateContext); 155 | 156 | if (immediateContext == nullptr) 157 | { 158 | return; 159 | } 160 | 161 | // set gbuffer target 162 | FLOAT clearColor[4] = { 0,0,0,-1 }; 163 | FLOAT shadowMaskClear[4] = { 1,1,1,1 }; 164 | for (int i = 0; i < numGBuffer; i++) 165 | { 166 | if (i == 3) 167 | { 168 | immediateContext->ClearRenderTargetView(gBufferColorView[i], emissionClear); 169 | } 170 | else if (i == 4) 171 | { 172 | immediateContext->ClearRenderTargetView(gBufferColorView[i], shadowMaskClear); 173 | } 174 | else 175 | { 176 | immediateContext->ClearRenderTargetView(gBufferColorView[i], clearColor); 177 | } 178 | } 179 | 180 | // replace om binding with custom targets 181 | immediateContext->ClearDepthStencilView(gBufferDepthView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 0.0f, 0); 182 | immediateContext->OMSetRenderTargets(numGBuffer, gBufferColorView, gBufferDepthView); 183 | 184 | immediateContext->Release(); 185 | } 186 | 187 | void RenderAPI_D3D11::CreateResources() 188 | { 189 | 190 | } 191 | 192 | void RenderAPI_D3D11::ReleaseResources() 193 | { 194 | for (int i = 0; i < numGBuffer; i++) 195 | { 196 | SAFE_RELEASE(gBufferColorView[i]); 197 | } 198 | SAFE_RELEASE(gBufferDepthView); 199 | } 200 | 201 | DXGI_FORMAT RenderAPI_D3D11::ConvertTypelessFormat(DXGI_FORMAT _typelessFormat) 202 | { 203 | switch (_typelessFormat) 204 | { 205 | case DXGI_FORMAT_R8G8B8A8_TYPELESS: 206 | return DXGI_FORMAT_R8G8B8A8_UNORM; 207 | 208 | case DXGI_FORMAT_R10G10B10A2_TYPELESS: 209 | return DXGI_FORMAT_R10G10B10A2_UNORM; 210 | 211 | case DXGI_FORMAT_R16G16B16A16_TYPELESS: 212 | return DXGI_FORMAT_R16G16B16A16_FLOAT; 213 | 214 | case DXGI_FORMAT_R32G8X24_TYPELESS: 215 | return DXGI_FORMAT_D32_FLOAT_S8X24_UINT; 216 | 217 | default: 218 | return DXGI_FORMAT_UNKNOWN; 219 | } 220 | } 221 | 222 | #endif // #if SUPPORT_D3D11 223 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/RenderAPI_D3D11.cpp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb05bd139291b274697fe667819869cb 3 | timeCreated: 1556020329 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/RenderingPlugin.cpp: -------------------------------------------------------------------------------- 1 | // Example low level rendering Unity plugin 2 | 3 | #include "PlatformBase.h" 4 | #include "RenderAPI.h" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | static RenderAPI* s_CurrentAPI = NULL; 11 | 12 | // custom definition ================================================================================================================== 13 | extern "C" bool UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API SetGBufferColor(int _index, int _msaaFactor, void *_colorBuffer) 14 | { 15 | return s_CurrentAPI->SetGBufferColor(_index, _msaaFactor, _colorBuffer); 16 | } 17 | 18 | extern "C" bool UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API SetGBufferDepth(int _msaaFactor, void *_depthBuffer) 19 | { 20 | return s_CurrentAPI->SetGBufferDepth(_msaaFactor, _depthBuffer); 21 | } 22 | 23 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API SetClearColor(float *clearColor) 24 | { 25 | s_CurrentAPI->SetClearColor(clearColor); 26 | } 27 | 28 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API Release() 29 | { 30 | s_CurrentAPI->Release(); 31 | } 32 | 33 | // unity definition ================================================================================================================== 34 | // -------------------------------------------------------------------------- 35 | // UnitySetInterfaces 36 | 37 | static void UNITY_INTERFACE_API OnGraphicsDeviceEvent(UnityGfxDeviceEventType eventType); 38 | 39 | static IUnityInterfaces* s_UnityInterfaces = NULL; 40 | static IUnityGraphics* s_Graphics = NULL; 41 | 42 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces) 43 | { 44 | s_UnityInterfaces = unityInterfaces; 45 | s_Graphics = s_UnityInterfaces->Get(); 46 | s_Graphics->RegisterDeviceEventCallback(OnGraphicsDeviceEvent); 47 | 48 | // Run OnGraphicsDeviceEvent(initialize) manually on plugin load 49 | OnGraphicsDeviceEvent(kUnityGfxDeviceEventInitialize); 50 | } 51 | 52 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload() 53 | { 54 | s_Graphics->UnregisterDeviceEventCallback(OnGraphicsDeviceEvent); 55 | } 56 | 57 | #if UNITY_WEBGL 58 | typedef void (UNITY_INTERFACE_API * PluginLoadFunc)(IUnityInterfaces* unityInterfaces); 59 | typedef void (UNITY_INTERFACE_API * PluginUnloadFunc)(); 60 | 61 | extern "C" void UnityRegisterRenderingPlugin(PluginLoadFunc loadPlugin, PluginUnloadFunc unloadPlugin); 62 | 63 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API RegisterPlugin() 64 | { 65 | UnityRegisterRenderingPlugin(UnityPluginLoad, UnityPluginUnload); 66 | } 67 | #endif 68 | 69 | // -------------------------------------------------------------------------- 70 | // GraphicsDeviceEvent 71 | 72 | static UnityGfxRenderer s_DeviceType = kUnityGfxRendererNull; 73 | 74 | 75 | static void UNITY_INTERFACE_API OnGraphicsDeviceEvent(UnityGfxDeviceEventType eventType) 76 | { 77 | // Create graphics API implementation upon initialization 78 | if (eventType == kUnityGfxDeviceEventInitialize) 79 | { 80 | assert(s_CurrentAPI == NULL); 81 | s_DeviceType = s_Graphics->GetRenderer(); 82 | s_CurrentAPI = CreateRenderAPI(s_DeviceType); 83 | } 84 | 85 | // Let the implementation process the device related events 86 | if (s_CurrentAPI) 87 | { 88 | s_CurrentAPI->ProcessDeviceEvent(eventType, s_UnityInterfaces); 89 | } 90 | 91 | // Cleanup graphics API implementation upon shutdown 92 | if (eventType == kUnityGfxDeviceEventShutdown) 93 | { 94 | delete s_CurrentAPI; 95 | s_CurrentAPI = NULL; 96 | s_DeviceType = kUnityGfxRendererNull; 97 | } 98 | } 99 | 100 | 101 | 102 | // -------------------------------------------------------------------------- 103 | // OnRenderEvent 104 | // This will be called for GL.IssuePluginEvent script calls; eventID will 105 | // be the integer passed to IssuePluginEvent. In this example, we just ignore 106 | // that value. 107 | 108 | 109 | static void UNITY_INTERFACE_API OnRenderEvent(int eventID) 110 | { 111 | // Unknown / unsupported graphics device type? Do nothing 112 | if (s_CurrentAPI == NULL) 113 | return; 114 | 115 | if (eventID == 0) 116 | { 117 | s_CurrentAPI->SetGBufferTarget(); 118 | } 119 | } 120 | 121 | 122 | // -------------------------------------------------------------------------- 123 | // GetRenderEventFunc, an example function we export which is used to get a rendering event callback function. 124 | 125 | extern "C" UnityRenderingEvent UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API GetRenderEventFunc() 126 | { 127 | return OnRenderEvent; 128 | } 129 | 130 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/RenderingPlugin.cpp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19bf446d144d4634294f98fd39b90007 3 | timeCreated: 1556020328 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/RenderingPlugin.def: -------------------------------------------------------------------------------- 1 | ; file used by Visual Studio plugin builds, mostly for 32-bit 2 | ; to stop mangling our exported function names 3 | 4 | LIBRARY 5 | 6 | EXPORTS 7 | UnityPluginLoad 8 | UnityPluginUnload 9 | GetRenderEventFunc 10 | Release 11 | SetGBufferColor 12 | SetGBufferDepth 13 | SetClearColor -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/RenderingPlugin.def.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2e40bff05eb5fad458ef59eda1f535ef 3 | timeCreated: 1556020324 4 | licenseType: Pro 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/Unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1276dce72df39f8448d680d6c6a09e84 3 | folderAsset: yes 4 | timeCreated: 1556020324 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/Unity/IUnityGraphics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | typedef enum UnityGfxRenderer 5 | { 6 | //kUnityGfxRendererOpenGL = 0, // Legacy OpenGL, removed 7 | //kUnityGfxRendererD3D9 = 1, // Direct3D 9, removed 8 | kUnityGfxRendererD3D11 = 2, // Direct3D 11 9 | kUnityGfxRendererGCM = 3, // PlayStation 3 10 | kUnityGfxRendererNull = 4, // "null" device (used in batch mode) 11 | kUnityGfxRendererOpenGLES20 = 8, // OpenGL ES 2.0 12 | kUnityGfxRendererOpenGLES30 = 11, // OpenGL ES 3.0 13 | kUnityGfxRendererGXM = 12, // PlayStation Vita 14 | kUnityGfxRendererPS4 = 13, // PlayStation 4 15 | kUnityGfxRendererXboxOne = 14, // Xbox One 16 | kUnityGfxRendererMetal = 16, // iOS Metal 17 | kUnityGfxRendererOpenGLCore = 17, // OpenGL core 18 | kUnityGfxRendererD3D12 = 18, // Direct3D 12 19 | kUnityGfxRendererVulkan = 21, // Vulkan 20 | kUnityGfxRendererNvn = 22, // Nintendo Switch NVN API 21 | kUnityGfxRendererXboxOneD3D12 = 23 // MS XboxOne Direct3D 12 22 | } UnityGfxRenderer; 23 | 24 | typedef enum UnityGfxDeviceEventType 25 | { 26 | kUnityGfxDeviceEventInitialize = 0, 27 | kUnityGfxDeviceEventShutdown = 1, 28 | kUnityGfxDeviceEventBeforeReset = 2, 29 | kUnityGfxDeviceEventAfterReset = 3, 30 | } UnityGfxDeviceEventType; 31 | 32 | typedef void (UNITY_INTERFACE_API * IUnityGraphicsDeviceEventCallback)(UnityGfxDeviceEventType eventType); 33 | 34 | // Should only be used on the rendering thread unless noted otherwise. 35 | UNITY_DECLARE_INTERFACE(IUnityGraphics) 36 | { 37 | UnityGfxRenderer(UNITY_INTERFACE_API * GetRenderer)(); // Thread safe 38 | 39 | // This callback will be called when graphics device is created, destroyed, reset, etc. 40 | // It is possible to miss the kUnityGfxDeviceEventInitialize event in case plugin is loaded at a later time, 41 | // when the graphics device is already created. 42 | void(UNITY_INTERFACE_API * RegisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 43 | void(UNITY_INTERFACE_API * UnregisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 44 | int(UNITY_INTERFACE_API * ReserveEventIDRange)(int count); // reserves 'count' event IDs. Plugins should use the result as a base index when issuing events back and forth to avoid event id clashes. 45 | }; 46 | UNITY_REGISTER_INTERFACE_GUID(0x7CBA0A9CA4DDB544ULL, 0x8C5AD4926EB17B11ULL, IUnityGraphics) 47 | 48 | 49 | // Certain Unity APIs (GL.IssuePluginEvent, CommandBuffer.IssuePluginEvent) can callback into native plugins. 50 | // Provide them with an address to a function of this signature. 51 | typedef void (UNITY_INTERFACE_API * UnityRenderingEvent)(int eventId); 52 | typedef void (UNITY_INTERFACE_API * UnityRenderingEventAndData)(int eventId, void* data); 53 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/Unity/IUnityGraphics.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8eb4955dbac896e408beab437c5c3b28 3 | timeCreated: 1556020329 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/Unity/IUnityGraphicsD3D11.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | 5 | // Should only be used on the rendering thread unless noted otherwise. 6 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D11) 7 | { 8 | ID3D11Device* (UNITY_INTERFACE_API * GetDevice)(); 9 | 10 | ID3D11Resource* (UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer buffer); 11 | ID3D11Resource* (UNITY_INTERFACE_API * TextureFromNativeTexture)(UnityTextureID texture); 12 | 13 | ID3D11RenderTargetView* (UNITY_INTERFACE_API * RTVFromRenderBuffer)(UnityRenderBuffer surface); 14 | ID3D11ShaderResourceView* (UNITY_INTERFACE_API * SRVFromNativeTexture)(UnityTextureID texture); 15 | }; 16 | 17 | UNITY_REGISTER_INTERFACE_GUID(0xAAB37EF87A87D748ULL, 0xBF76967F07EFB177ULL, IUnityGraphicsD3D11) 18 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/Unity/IUnityGraphicsD3D11.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4d0fa2ea835b9845ab6a1df9802e8ca 3 | timeCreated: 1556020329 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/Unity/IUnityGraphicsD3D12.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | #ifndef __cplusplus 4 | #include 5 | #endif 6 | 7 | struct RenderSurfaceBase; 8 | typedef struct RenderSurfaceBase* UnityRenderBuffer; 9 | 10 | typedef struct UnityGraphicsD3D12ResourceState UnityGraphicsD3D12ResourceState; 11 | struct UnityGraphicsD3D12ResourceState 12 | { 13 | ID3D12Resource* resource; // Resource to barrier. 14 | D3D12_RESOURCE_STATES expected; // Expected resource state before this command list is executed. 15 | D3D12_RESOURCE_STATES current; // State this resource will be in after this command list is executed. 16 | }; 17 | 18 | typedef struct UnityGraphicsD3D12PhysicalVideoMemoryControlValues UnityGraphicsD3D12PhysicalVideoMemoryControlValues; 19 | struct UnityGraphicsD3D12PhysicalVideoMemoryControlValues // all values in bytes 20 | { 21 | UINT64 reservation; // Minimum required physical memory for an application [default = 64MB]. 22 | UINT64 systemMemoryThreshold; // If free physical video memory drops below this threshold, resources will be allocated in system memory. [default = 64MB] 23 | UINT64 residencyThreshold; // Minimum free physical video memory needed to start bringing evicted resources back after shrunken video memory budget expands again. [default = 128MB] 24 | }; 25 | 26 | // Should only be used on the rendering/submission thread. 27 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v5) 28 | { 29 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 30 | 31 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 32 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 33 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 34 | 35 | // Executes a given command list on a worker thread. 36 | // [Optional] Declares expected and post-execution resource states. 37 | // Returns the fence value. 38 | UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList * commandList, int stateCount, UnityGraphicsD3D12ResourceState * states); 39 | 40 | void(UNITY_INTERFACE_API * SetPhysicalVideoMemoryControlValues)(const UnityGraphicsD3D12PhysicalVideoMemoryControlValues * memInfo); 41 | 42 | ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); 43 | 44 | ID3D12Resource* (UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer * rb); 45 | }; 46 | UNITY_REGISTER_INTERFACE_GUID(0xF5C8D8A37D37BC42ULL, 0xB02DFE93B5064A27ULL, IUnityGraphicsD3D12v5) 47 | 48 | // Should only be used on the rendering/submission thread. 49 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v4) 50 | { 51 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 52 | 53 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 54 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 55 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 56 | 57 | // Executes a given command list on a worker thread. 58 | // [Optional] Declares expected and post-execution resource states. 59 | // Returns the fence value. 60 | UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList * commandList, int stateCount, UnityGraphicsD3D12ResourceState * states); 61 | 62 | void(UNITY_INTERFACE_API * SetPhysicalVideoMemoryControlValues)(const UnityGraphicsD3D12PhysicalVideoMemoryControlValues * memInfo); 63 | 64 | ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); 65 | }; 66 | UNITY_REGISTER_INTERFACE_GUID(0X498FFCC13EC94006ULL, 0XB18F8B0FF67778C8ULL, IUnityGraphicsD3D12v4) 67 | 68 | // Should only be used on the rendering/submission thread. 69 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v3) 70 | { 71 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 72 | 73 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 74 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 75 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 76 | 77 | // Executes a given command list on a worker thread. 78 | // [Optional] Declares expected and post-execution resource states. 79 | // Returns the fence value. 80 | UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList * commandList, int stateCount, UnityGraphicsD3D12ResourceState * states); 81 | 82 | void(UNITY_INTERFACE_API * SetPhysicalVideoMemoryControlValues)(const UnityGraphicsD3D12PhysicalVideoMemoryControlValues * memInfo); 83 | }; 84 | UNITY_REGISTER_INTERFACE_GUID(0x57C3FAFE59E5E843ULL, 0xBF4F5998474BB600ULL, IUnityGraphicsD3D12v3) 85 | 86 | // Should only be used on the rendering/submission thread. 87 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v2) 88 | { 89 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 90 | 91 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 92 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 93 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 94 | 95 | // Executes a given command list on a worker thread. 96 | // [Optional] Declares expected and post-execution resource states. 97 | // Returns the fence value. 98 | UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList * commandList, int stateCount, UnityGraphicsD3D12ResourceState * states); 99 | }; 100 | UNITY_REGISTER_INTERFACE_GUID(0xEC39D2F18446C745ULL, 0xB1A2626641D6B11FULL, IUnityGraphicsD3D12v2) 101 | 102 | 103 | // Obsolete 104 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12) 105 | { 106 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 107 | ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); 108 | 109 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 110 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 111 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 112 | 113 | // Returns the state a resource will be in after the last command list is executed 114 | bool(UNITY_INTERFACE_API * GetResourceState)(ID3D12Resource * resource, D3D12_RESOURCE_STATES * outState); 115 | // Specifies the state a resource will be in after a plugin command list with resource barriers is executed 116 | void(UNITY_INTERFACE_API * SetResourceState)(ID3D12Resource * resource, D3D12_RESOURCE_STATES state); 117 | }; 118 | UNITY_REGISTER_INTERFACE_GUID(0xEF4CEC88A45F4C4CULL, 0xBD295B6F2A38D9DEULL, IUnityGraphicsD3D12) 119 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/Unity/IUnityGraphicsD3D12.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13bb6059fd42899409bdf0d74216ee39 3 | timeCreated: 1556020328 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/Unity/IUnityGraphicsD3D9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | // Should only be used on the rendering thread unless noted otherwise. 5 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D9) 6 | { 7 | IDirect3D9* (UNITY_INTERFACE_API * GetD3D)(); 8 | IDirect3DDevice9* (UNITY_INTERFACE_API * GetDevice)(); 9 | }; 10 | UNITY_REGISTER_INTERFACE_GUID(0xE90746A523D53C4CULL, 0xAC825B19B6F82AC3ULL, IUnityGraphicsD3D9) 11 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/Unity/IUnityGraphicsD3D9.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f16dfc048c875984ea24004bf0f232c1 3 | timeCreated: 1556020329 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/Unity/IUnityGraphicsMetal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | #ifndef __OBJC__ 5 | #error metal plugin is objc code. 6 | #endif 7 | #ifndef __clang__ 8 | #error only clang compiler is supported. 9 | #endif 10 | 11 | @class NSBundle; 12 | @protocol MTLDevice; 13 | @protocol MTLCommandBuffer; 14 | @protocol MTLCommandEncoder; 15 | @protocol MTLTexture; 16 | @class MTLRenderPassDescriptor; 17 | 18 | // Should only be used on the rendering thread unless noted otherwise. 19 | UNITY_DECLARE_INTERFACE(IUnityGraphicsMetal) 20 | { 21 | NSBundle* (UNITY_INTERFACE_API * MetalBundle)(); 22 | id(UNITY_INTERFACE_API * MetalDevice)(); 23 | 24 | id(UNITY_INTERFACE_API * CurrentCommandBuffer)(); 25 | 26 | // for custom rendering support there are two scenarios: 27 | // you want to use current in-flight MTLCommandEncoder (NB: it might be nil) 28 | id(UNITY_INTERFACE_API * CurrentCommandEncoder)(); 29 | // or you might want to create your own encoder. 30 | // In that case you should end unity's encoder before creating your own and end yours before returning control to unity 31 | void(UNITY_INTERFACE_API * EndCurrentCommandEncoder)(); 32 | 33 | // returns MTLRenderPassDescriptor used to create current MTLCommandEncoder 34 | MTLRenderPassDescriptor* (UNITY_INTERFACE_API * CurrentRenderPassDescriptor)(); 35 | 36 | // converting trampoline UnityRenderBufferHandle into native RenderBuffer 37 | UnityRenderBuffer(UNITY_INTERFACE_API * RenderBufferFromHandle)(void* bufferHandle); 38 | 39 | // access to RenderBuffer's texure 40 | // NB: you pass here *native* RenderBuffer, acquired by calling (C#) RenderBuffer.GetNativeRenderBufferPtr 41 | // AAResolvedTextureFromRenderBuffer will return nil in case of non-AA RenderBuffer or if called for depth RenderBuffer 42 | // StencilTextureFromRenderBuffer will return nil in case of no-stencil RenderBuffer or if called for color RenderBuffer 43 | id(UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer buffer); 44 | id(UNITY_INTERFACE_API * AAResolvedTextureFromRenderBuffer)(UnityRenderBuffer buffer); 45 | id(UNITY_INTERFACE_API * StencilTextureFromRenderBuffer)(UnityRenderBuffer buffer); 46 | }; 47 | UNITY_REGISTER_INTERFACE_GUID(0x992C8EAEA95811E5ULL, 0x9A62C4B5B9876117ULL, IUnityGraphicsMetal) 48 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/Unity/IUnityGraphicsMetal.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a83768be078eafa4588e2830158c2f2f 3 | timeCreated: 1556020329 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/Unity/IUnityInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Unity native plugin API 4 | // Compatible with C99 5 | 6 | #if defined(__CYGWIN32__) 7 | #define UNITY_INTERFACE_API __stdcall 8 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 9 | #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WINAPI_FAMILY) 10 | #define UNITY_INTERFACE_API __stdcall 11 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 12 | #elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) 13 | #define UNITY_INTERFACE_API 14 | #define UNITY_INTERFACE_EXPORT 15 | #else 16 | #define UNITY_INTERFACE_API 17 | #define UNITY_INTERFACE_EXPORT 18 | #endif 19 | 20 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 21 | // IUnityInterface is a registry of interfaces we choose to expose to plugins. 22 | // 23 | // USAGE: 24 | // --------- 25 | // To retrieve an interface a user can do the following from a plugin, assuming they have the header file for the interface: 26 | // 27 | // IMyInterface * ptr = registry->Get(); 28 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 29 | 30 | // Unity Interface GUID 31 | // Ensures global uniqueness. 32 | // 33 | // Template specialization is used to produce a means of looking up a GUID from its interface type at compile time. 34 | // The net result should compile down to passing around the GUID. 35 | // 36 | // UNITY_REGISTER_INTERFACE_GUID should be placed in the header file of any interface definition outside of all namespaces. 37 | // The interface structure and the registration GUID are all that is required to expose the interface to other systems. 38 | struct UnityInterfaceGUID 39 | { 40 | #ifdef __cplusplus 41 | UnityInterfaceGUID(unsigned long long high, unsigned long long low) 42 | : m_GUIDHigh(high) 43 | , m_GUIDLow(low) 44 | { 45 | } 46 | 47 | UnityInterfaceGUID(const UnityInterfaceGUID& other) 48 | { 49 | m_GUIDHigh = other.m_GUIDHigh; 50 | m_GUIDLow = other.m_GUIDLow; 51 | } 52 | 53 | UnityInterfaceGUID& operator=(const UnityInterfaceGUID& other) 54 | { 55 | m_GUIDHigh = other.m_GUIDHigh; 56 | m_GUIDLow = other.m_GUIDLow; 57 | return *this; 58 | } 59 | 60 | bool Equals(const UnityInterfaceGUID& other) const { return m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow == other.m_GUIDLow; } 61 | bool LessThan(const UnityInterfaceGUID& other) const { return m_GUIDHigh < other.m_GUIDHigh || (m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow < other.m_GUIDLow); } 62 | #endif 63 | unsigned long long m_GUIDHigh; 64 | unsigned long long m_GUIDLow; 65 | }; 66 | #ifdef __cplusplus 67 | inline bool operator==(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.Equals(right); } 68 | inline bool operator!=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !left.Equals(right); } 69 | inline bool operator<(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.LessThan(right); } 70 | inline bool operator>(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return right.LessThan(left); } 71 | inline bool operator>=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator<(left, right); } 72 | inline bool operator<=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator>(left, right); } 73 | #else 74 | typedef struct UnityInterfaceGUID UnityInterfaceGUID; 75 | #endif 76 | 77 | 78 | #ifdef __cplusplus 79 | #define UNITY_DECLARE_INTERFACE(NAME) \ 80 | struct NAME : IUnityInterface 81 | 82 | // Generic version of GetUnityInterfaceGUID to allow us to specialize it 83 | // per interface below. The generic version has no actual implementation 84 | // on purpose. 85 | // 86 | // If you get errors about return values related to this method then 87 | // you have forgotten to include UNITY_REGISTER_INTERFACE_GUID with 88 | // your interface, or it is not visible at some point when you are 89 | // trying to retrieve or add an interface. 90 | template 91 | inline const UnityInterfaceGUID GetUnityInterfaceGUID(); 92 | 93 | // This is the macro you provide in your public interface header 94 | // outside of a namespace to allow us to map between type and GUID 95 | // without the user having to worry about it when attempting to 96 | // add or retrieve and interface from the registry. 97 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 98 | template<> \ 99 | inline const UnityInterfaceGUID GetUnityInterfaceGUID() \ 100 | { \ 101 | return UnityInterfaceGUID(HASHH,HASHL); \ 102 | } 103 | 104 | // Same as UNITY_REGISTER_INTERFACE_GUID but allows the interface to live in 105 | // a particular namespace. As long as the namespace is visible at the time you call 106 | // GetUnityInterfaceGUID< INTERFACETYPE >() or you explicitly qualify it in the template 107 | // calls this will work fine, only the macro here needs to have the additional parameter 108 | #define UNITY_REGISTER_INTERFACE_GUID_IN_NAMESPACE(HASHH, HASHL, TYPE, NAMESPACE) \ 109 | const UnityInterfaceGUID TYPE##_GUID(HASHH, HASHL); \ 110 | template<> \ 111 | inline const UnityInterfaceGUID GetUnityInterfaceGUID< NAMESPACE :: TYPE >() \ 112 | { \ 113 | return UnityInterfaceGUID(HASHH,HASHL); \ 114 | } 115 | 116 | // These macros allow for C compatibility in user code. 117 | #define UNITY_GET_INTERFACE_GUID(TYPE) GetUnityInterfaceGUID< TYPE >() 118 | 119 | 120 | #else 121 | #define UNITY_DECLARE_INTERFACE(NAME) \ 122 | typedef struct NAME NAME; \ 123 | struct NAME 124 | 125 | // NOTE: This has the downside that one some compilers it will not get stripped from all compilation units that 126 | // can see a header containing this constant. However, it's only for C compatibility and thus should have 127 | // minimal impact. 128 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 129 | const UnityInterfaceGUID TYPE##_GUID = {HASHH, HASHL}; 130 | 131 | // In general namespaces are going to be a problem for C code any interfaces we expose in a namespace are 132 | // not going to be usable from C. 133 | #define UNITY_REGISTER_INTERFACE_GUID_IN_NAMESPACE(HASHH, HASHL, TYPE, NAMESPACE) 134 | 135 | // These macros allow for C compatibility in user code. 136 | #define UNITY_GET_INTERFACE_GUID(TYPE) TYPE##_GUID 137 | #endif 138 | 139 | // Using this in user code rather than INTERFACES->Get() will be C compatible for those places in plugins where 140 | // this may be needed. Unity code itself does not need this. 141 | #define UNITY_GET_INTERFACE(INTERFACES, TYPE) (TYPE*)INTERFACES->GetInterfaceSplit (UNITY_GET_INTERFACE_GUID(TYPE).m_GUIDHigh, UNITY_GET_INTERFACE_GUID(TYPE).m_GUIDLow); 142 | 143 | 144 | #ifdef __cplusplus 145 | struct IUnityInterface 146 | { 147 | }; 148 | #else 149 | typedef void IUnityInterface; 150 | #endif 151 | 152 | 153 | typedef struct IUnityInterfaces 154 | { 155 | // Returns an interface matching the guid. 156 | // Returns nullptr if the given interface is unavailable in the active Unity runtime. 157 | IUnityInterface* (UNITY_INTERFACE_API * GetInterface)(UnityInterfaceGUID guid); 158 | 159 | // Registers a new interface. 160 | void(UNITY_INTERFACE_API * RegisterInterface)(UnityInterfaceGUID guid, IUnityInterface * ptr); 161 | 162 | // Split APIs for C 163 | IUnityInterface* (UNITY_INTERFACE_API * GetInterfaceSplit)(unsigned long long guidHigh, unsigned long long guidLow); 164 | void(UNITY_INTERFACE_API * RegisterInterfaceSplit)(unsigned long long guidHigh, unsigned long long guidLow, IUnityInterface * ptr); 165 | 166 | #ifdef __cplusplus 167 | // Helper for GetInterface. 168 | template 169 | INTERFACE* Get() 170 | { 171 | return static_cast(GetInterface(GetUnityInterfaceGUID())); 172 | } 173 | 174 | // Helper for RegisterInterface. 175 | template 176 | void Register(IUnityInterface* ptr) 177 | { 178 | RegisterInterface(GetUnityInterfaceGUID(), ptr); 179 | } 180 | 181 | #endif 182 | } IUnityInterfaces; 183 | 184 | 185 | #ifdef __cplusplus 186 | extern "C" { 187 | #endif 188 | 189 | // If exported by a plugin, this function will be called when the plugin is loaded. 190 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces); 191 | // If exported by a plugin, this function will be called when the plugin is about to be unloaded. 192 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload(); 193 | 194 | #ifdef __cplusplus 195 | } 196 | #endif 197 | 198 | struct RenderSurfaceBase; 199 | typedef struct RenderSurfaceBase* UnityRenderBuffer; 200 | typedef unsigned int UnityTextureID; 201 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferPluginSource/PluginSource/source/Unity/IUnityInterface.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21feecff412cf35449ecf313d0fa16d2 3 | timeCreated: 1556020328 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | userData: 25 | assetBundleName: 26 | assetBundleVariant: 27 | -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/SetGBufferTarget.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EasyJellySniper/Unity-Deferred-MSAA/70809ea6b0370d24489322a9e8d64ea09ca06489/DeferredMSAA_Transfer/SetGBufferTarget.dll -------------------------------------------------------------------------------- /DeferredMSAA_Transfer/TransferAA.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/TransferAA" 2 | { 3 | Properties 4 | { 5 | 6 | } 7 | SubShader 8 | { 9 | // No culling or depth 10 | Cull Off ZWrite Off ZTest Always 11 | 12 | Pass 13 | { 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | #pragma target 5.0 18 | #include "UnityCG.cginc" 19 | 20 | struct appdata 21 | { 22 | float4 vertex : POSITION; 23 | float2 uv : TEXCOORD0; 24 | }; 25 | 26 | struct v2f 27 | { 28 | float2 uv : TEXCOORD0; 29 | float4 vertex : SV_POSITION; 30 | }; 31 | 32 | v2f vert (appdata v) 33 | { 34 | v2f o; 35 | o.vertex = UnityObjectToClipPos(v.vertex); 36 | o.uv = v.uv; 37 | return o; 38 | } 39 | 40 | Texture2DMS _MsaaTex; 41 | uint _TransferAAIndex; 42 | 43 | float4 frag (v2f i) : SV_Target 44 | { 45 | return _MsaaTex.Load(i.vertex.xy, _TransferAAIndex); 46 | } 47 | ENDCG 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Chieh Hung Liu (Squall Liu) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity-Deferred-MSAA 2 | Test on Unity 2017.4.3f1 PRO
3 | 4 | Limits:
5 | No AA on transparent objects and emission objects (using posteffect aa for them)
6 | Light culling mask only works with "Everything"
7 | 8 | Code Setup:
9 | 1. Copy [SetGBufferTarget.dll] to Plugins/x86_64 10 | 2. Attach [DeferredMSAA.cs] to your camera, and it will set rendering path to deferred shading. 11 | 3. Create materials for [ResolveAA]、[ResolveAADepth]、[TransferAA shaders], and set them to DeferredMSAA inspector. 12 | 4. Select msaa factor. 13 | 5. In GraphicsSettings, set deferred shading shader to [Custom-DeferredShading] or imitate the modification in [Custom-DeferredShading] shader. 14 | 6. In GraphicsSettings, set deferred shading shader to [Custom-DeferredReflections] or imitate the modification in [Custom-DeferredReflections] shader. 15 |

16 | --------------------------------------------------------------------------------