Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Commit

Permalink
[DXGI] Fixed DXGI assembly compilation for DX 11.2 platform - replace…
Browse files Browse the repository at this point in the history
…d usage of old math structures by their Raw* equivalents (#398).
  • Loading branch information
ArtiomCiumac committed Jun 4, 2014
1 parent 0794608 commit 3a19428
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 15 deletions.
13 changes: 7 additions & 6 deletions Source/SharpDX.DXGI/PresentParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#if DIRECTX11_1
using System;
using System.Collections.Generic;

using System.Runtime.InteropServices;
using System.Text;
using SharpDX.Mathematics.Interop;

namespace SharpDX.DXGI
{
Expand All @@ -31,20 +31,20 @@ public partial struct PresentParameters
/// <para>A list of updated rectangles that you update in the back buffer for the presented frame. An application must update every single pixel in each rectangle that it reports to the runtime; the application cannot assume that the pixels are saved from the previous frame. For more information about updating dirty rectangles, see Remarks. You can set this member to <c>null</c> if DirtyRectsCount is 0. An application must not update any pixel outside of the dirty rectangles.</para>
/// </summary>
/// <unmanaged>RECT* pDirtyRects</unmanaged>
public SharpDX.Rectangle[] DirtyRectangles;
public RawRectangle[] DirtyRectangles;

/// <summary>
/// <para> A reference to the scrolled rectangle. The scrolled rectangle is the rectangle of the previous frame from which the runtime bit-block transfers (bitblts) content. The runtime also uses the scrolled rectangle to optimize presentation in terminal server and indirect display scenarios.</para>
/// <para>The scrolled rectangle also describes the destination rectangle, that is, the region on the current frame that is filled with scrolled content. You can set this member to <c>null</c> to indicate that no content is scrolled from the previous frame.</para>
/// </summary>
/// <unmanaged>RECT* pScrollRect</unmanaged>
public SharpDX.Rectangle? ScrollRectangle;
public RawRectangle? ScrollRectangle;

/// <summary>
/// <para>A reference to the offset of the scrolled area that goes from the source rectangle (of previous frame) to the destination rectangle (of current frame). You can set this member to <c>null</c> to indicate no offset.</para>
/// </summary>
/// <unmanaged>POINT* pScrollOffset</unmanaged>
public SharpDX.Point? ScrollOffset;
public RawPoint? ScrollOffset;

// Internal native struct used for marshalling
[StructLayout(LayoutKind.Sequential, Pack = 0)]
Expand All @@ -57,4 +57,5 @@ internal partial struct __Native
}
}
}

#endif
8 changes: 4 additions & 4 deletions Source/SharpDX.DXGI/SwapChain1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#if DIRECTX11_1
using System;
using System.Collections.Generic;
using System.Text;
using SharpDX.Mathematics.Interop;

namespace SharpDX.DXGI
{
Expand Down Expand Up @@ -85,8 +85,8 @@ public unsafe void Present(int syncInterval, PresentFlags presentFlags, PresentP
bool hasScrollRectangle = presentParameters.ScrollRectangle.HasValue;
bool hasScrollOffset = presentParameters.ScrollOffset.HasValue;

var scrollRectangle = hasScrollRectangle ? presentParameters.ScrollRectangle.Value : Rectangle.Empty;
var scrollOffset = hasScrollOffset ? presentParameters.ScrollOffset.Value : default(Point);
var scrollRectangle = hasScrollRectangle ? presentParameters.ScrollRectangle.Value : new RawRectangle();
var scrollOffset = hasScrollOffset ? presentParameters.ScrollOffset.Value : default(RawPoint);

fixed (void* pDirtyRects = presentParameters.DirtyRectangles)
{
Expand Down
43 changes: 38 additions & 5 deletions Source/SharpDX.DirectManipulation/Content.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public RawMatrix3x2 ContentTransform
{
get
{
float[] values = new float[6];
var values = new float[6];
GetContentTransform(values, 6);
return new RawMatrix3x2(values);
return ToMatrix(values);
}
}

Expand All @@ -28,9 +28,9 @@ public RawMatrix3x2 OutputTransform
{
get
{
float[] values = new float[6];
var values = new float[6];
GetOutputTransform(values, 6);
return new RawMatrix3x2(values);
return ToMatrix(values);
}
}

Expand All @@ -40,8 +40,41 @@ public RawMatrix3x2 OutputTransform
/// <param name="transform"></param>
public void SyncContentTransform(RawMatrix3x2 transform)
{
float[] values = transform.ToArray();
var values = ToArray(transform);
SyncContentTransform(values, 6);
}

/// <summary>
/// Converts the float array to the equivalend <see cref="RawMatrix3x2"/>.
/// </summary>
/// <param name="values">The values to convert.</param>
/// <returns>The converted result.</returns>
private static RawMatrix3x2 ToMatrix(float[] values)
{
return new RawMatrix3x2
{
M11 = values[0],
M12 = values[1],
M21 = values[2],
M22 = values[3],
M31 = values[4],
M32 = values[5]
};
}

/// <summary>
/// Converts the <see cref="RawMatrix3x2"/> to the equivalend float array.
/// </summary>
/// <param name="matrix">The matrix to convert.</param>
/// <returns>The converted result array.</returns>
private static float[] ToArray(RawMatrix3x2 matrix)
{
return new[]
{
matrix.M11, matrix.M12,
matrix.M21, matrix.M22,
matrix.M31, matrix.M32,
};
}
}
}

0 comments on commit 3a19428

Please sign in to comment.