• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisiónd8e83d6c3af9eaec14cdbe1eaa7f993aec7a282c (tree)
Tiempo2019-09-16 12:52:40
AutorMatias N. Goldberg <dark_ <sylinc@yaho...>
CommiterMatias N. Goldberg <dark_

Log Message

Ported radial density mask to D3D11
Bugfix: RdmMedium quality behaving like RdmLow

Cambiar Resumen

Diferencia incremental

diff -r ff49d8a38e01 -r d8e83d6c3af9 OgreMain/src/OgreRadialDensityMask.cpp
--- a/OgreMain/src/OgreRadialDensityMask.cpp Mon Sep 16 00:09:07 2019 -0300
+++ b/OgreMain/src/OgreRadialDensityMask.cpp Mon Sep 16 00:52:40 2019 -0300
@@ -240,7 +240,7 @@
240240 mReconstructJob->setPiece( "Quality", qualityStr[quality] );
241241 for( int32 i = 0; i < 3; ++i )
242242 mReconstructJob->setProperty( qualityProp[i], i + 1 );
243- mReconstructJob->setProperty( "quality", static_cast<int32>( quality ) );
243+ mReconstructJob->setProperty( "quality", static_cast<int32>( quality ) + 1 );
244244 }
245245 //-------------------------------------------------------------------------
246246 void RadialDensityMask::setEyesCenter( const Vector2 &leftEyeCenter, const Vector2 &rightEyeCenter )
diff -r ff49d8a38e01 -r d8e83d6c3af9 Samples/2.0/Tutorials/Tutorial_OpenVR/Tutorial_OpenVR.cpp
--- a/Samples/2.0/Tutorials/Tutorial_OpenVR/Tutorial_OpenVR.cpp Mon Sep 16 00:09:07 2019 -0300
+++ b/Samples/2.0/Tutorials/Tutorial_OpenVR/Tutorial_OpenVR.cpp Mon Sep 16 00:52:40 2019 -0300
@@ -140,9 +140,11 @@
140140 mHMD->GetRecommendedRenderTargetSize( &width, &height );
141141
142142 Ogre::TextureGpuManager *textureManager = mRoot->getRenderSystem()->getTextureGpuManager();
143+ //Radial Density Mask requires the VR texture to be UAV & reinterpretable
143144 mVrTexture = textureManager->createOrRetrieveTexture( "OpenVR Both Eyes",
144145 Ogre::GpuPageOutStrategy::Discard,
145146 Ogre::TextureFlags::RenderToTexture |
147+ Ogre::TextureFlags::Uav |
146148 Ogre::TextureFlags::Reinterpretable,
147149 Ogre::TextureTypes::Type2D );
148150 mVrTexture->setResolution( width << 1u, height );
diff -r ff49d8a38e01 -r d8e83d6c3af9 Samples/Media/2.0/scripts/materials/Common/GLSL/RadialDensityMask_ps.glsl
--- a/Samples/Media/2.0/scripts/materials/Common/GLSL/RadialDensityMask_ps.glsl Mon Sep 16 00:09:07 2019 -0300
+++ b/Samples/Media/2.0/scripts/materials/Common/GLSL/RadialDensityMask_ps.glsl Mon Sep 16 00:52:40 2019 -0300
@@ -35,5 +35,5 @@
3535 else if( !((iFragCoordHalf.x & 0x03u) != 0u || (iFragCoordHalf.y & 0x03u) != 0u) )
3636 discard;
3737
38- fragColour = vec4( 0 );
38+ fragColour = float4( 0, 0, 0, 0 );
3939 }
diff -r ff49d8a38e01 -r d8e83d6c3af9 Samples/Media/2.0/scripts/materials/Common/HLSL/RadialDensityMask_ps.hlsl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Samples/Media/2.0/scripts/materials/Common/HLSL/RadialDensityMask_ps.hlsl Mon Sep 16 00:52:40 2019 -0300
@@ -0,0 +1,35 @@
1+
2+#define p_leftEyeCenter leftEyeCenter_rightEyeCenter.xy
3+#define p_rightEyeCenter leftEyeCenter_rightEyeCenter.zw
4+#define p_rightEyeStart rightEyeStart_radius.x
5+#define p_radius rightEyeStart_radius.yzw
6+#define p_invBlockResolution invBlockResolution
7+
8+float4 main
9+(
10+ float4 gl_FragCoord : SV_Position,
11+
12+ uniform float4 rightEyeStart_radius,
13+ uniform float4 leftEyeCenter_rightEyeCenter,
14+ uniform float2 invBlockResolution
15+) : SV_Target
16+{
17+ float2 eyeCenter = gl_FragCoord.x >= p_rightEyeStart ? p_rightEyeCenter : p_leftEyeCenter;
18+
19+ //We must work in blocks so the reconstruction filter can work properly
20+ float2 toCenter = trunc(gl_FragCoord.xy * 0.125f) * p_invBlockResolution.xy - eyeCenter;
21+ toCenter.x *= 2.0f; //Twice because of stereo (each eye is half the size of the full res)
22+ float distToCenter = length( toCenter );
23+
24+ uint2 iFragCoordHalf = uint2( gl_FragCoord.xy * 0.5f );
25+ if( distToCenter < p_radius.x )
26+ discard;
27+ else if( (iFragCoordHalf.x & 0x01u) == (iFragCoordHalf.y & 0x01u) && distToCenter < p_radius.y )
28+ discard;
29+ else if( !((iFragCoordHalf.x & 0x01u) != 0u || (iFragCoordHalf.y & 0x01u) != 0u) && distToCenter < p_radius.z )
30+ discard;
31+ else if( !((iFragCoordHalf.x & 0x03u) != 0u || (iFragCoordHalf.y & 0x03u) != 0u) )
32+ discard;
33+
34+ return float4( 0, 0, 0, 0 );
35+}
diff -r ff49d8a38e01 -r d8e83d6c3af9 Samples/Media/2.0/scripts/materials/Common/HLSL/RadialDensityMask_vs.hlsl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Samples/Media/2.0/scripts/materials/Common/HLSL/RadialDensityMask_vs.hlsl Mon Sep 16 00:52:40 2019 -0300
@@ -0,0 +1,31 @@
1+struct VS_INPUT
2+{
3+ float2 vertex : POSITION;
4+ uint vertexId : SV_VertexID;
5+ #define gl_VertexID input.vertexId
6+};
7+
8+struct PS_INPUT
9+{
10+ float4 gl_Position : SV_Position;
11+ uint gl_ViewportIndex : SV_ViewportArrayIndex;
12+};
13+
14+PS_INPUT main
15+(
16+ VS_INPUT input,
17+
18+ uniform float ogreBaseVertex,
19+ uniform float2 rsDepthRange,
20+ uniform matrix worldViewProj
21+)
22+{
23+ PS_INPUT outVs;
24+
25+ outVs.gl_Position.xy= mul( worldViewProj, float4( input.vertex.xy, 0.0f, 1.0f ) ).xy;
26+ outVs.gl_Position.z = rsDepthRange.x;
27+ outVs.gl_Position.w = 1.0f;
28+ outVs.gl_ViewportIndex = gl_VertexID >= (3 * 4) ? 1 : 0;
29+
30+ return outVs;
31+}
diff -r ff49d8a38e01 -r d8e83d6c3af9 Samples/Media/Compute/VR/Foveated/RadialDensityMaskReconstruct_cs.glsl
--- a/Samples/Media/Compute/VR/Foveated/RadialDensityMaskReconstruct_cs.glsl Mon Sep 16 00:09:07 2019 -0300
+++ b/Samples/Media/Compute/VR/Foveated/RadialDensityMaskReconstruct_cs.glsl Mon Sep 16 00:52:40 2019 -0300
@@ -12,6 +12,10 @@
1212
1313 uniform sampler2D srcTex;
1414
15+layout( local_size_x = @value( threads_per_group_x ),
16+ local_size_y = @value( threads_per_group_y ),
17+ local_size_z = @value( threads_per_group_z ) ) in;
18+
1519 @insertpiece( HeaderCS )
1620
1721 void main()
diff -r ff49d8a38e01 -r d8e83d6c3af9 Samples/Media/Compute/VR/Foveated/RadialDensityMaskReconstruct_cs.hlsl
--- a/Samples/Media/Compute/VR/Foveated/RadialDensityMaskReconstruct_cs.hlsl Mon Sep 16 00:09:07 2019 -0300
+++ b/Samples/Media/Compute/VR/Foveated/RadialDensityMaskReconstruct_cs.hlsl Mon Sep 16 00:52:40 2019 -0300
@@ -15,11 +15,12 @@
1515
1616 #define short2 int2
1717 #define ushort2 uint2
18-#define OGRE_imageWrite3D4( outImage, iuv, value ) outImage[uint2( iuv )] = value
18+#define OGRE_imageWrite2D4( outImage, iuv, value ) outImage[uint2( iuv )] = value
1919
2020 RWTexture2D<@insertpiece(uav0_pf_type)> dstTex : register(u0);
2121
22-Texture2D srcTex : register(t0);
22+Texture2D srcTex : register(t0);
23+SamplerState bilinearSampler : register(s0);
2324
2425 @insertpiece( HeaderCS )
2526
diff -r ff49d8a38e01 -r d8e83d6c3af9 Samples/Media/Compute/VR/Foveated/RadialDensityMaskReconstruct_piece_cs.any
--- a/Samples/Media/Compute/VR/Foveated/RadialDensityMaskReconstruct_piece_cs.any Mon Sep 16 00:09:07 2019 -0300
+++ b/Samples/Media/Compute/VR/Foveated/RadialDensityMaskReconstruct_piece_cs.any Mon Sep 16 00:52:40 2019 -0300
@@ -14,10 +14,6 @@
1414 #define invBlockResolution invBlockResolution_invResolution.xy
1515 #define invResolution invBlockResolution_invResolution.zw
1616
17- layout( local_size_x = @value( threads_per_group_x ),
18- local_size_y = @value( threads_per_group_y ),
19- local_size_z = @value( threads_per_group_z ) ) in;
20-
2117 @insertpiece( DeclSRgbFuncs )
2218
2319 /** Takes the pattern (low quality):