mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
Drop d3d12 backend
This commit is contained in:
parent
14c63ec014
commit
00bc3fe658
72 changed files with 11 additions and 92125 deletions
8
3rdparty/CMakeLists.txt
vendored
8
3rdparty/CMakeLists.txt
vendored
|
@ -388,13 +388,6 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# dx12
|
|
||||||
add_library(3rdparty_dx12 INTERFACE)
|
|
||||||
if (WIN32)
|
|
||||||
target_link_libraries(3rdparty_dx12 INTERFACE dxgi.lib d2d1.lib dwrite.lib)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# GLEW
|
# GLEW
|
||||||
add_library(3rdparty_glew INTERFACE)
|
add_library(3rdparty_glew INTERFACE)
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
|
@ -427,5 +420,4 @@ add_library(3rdparty::libevdev ALIAS ${LIBEVDEV_TARGET})
|
||||||
add_library(3rdparty::vulkan ALIAS ${VULKAN_TARGET})
|
add_library(3rdparty::vulkan ALIAS ${VULKAN_TARGET})
|
||||||
add_library(3rdparty::openal ALIAS 3rdparty_openal)
|
add_library(3rdparty::openal ALIAS 3rdparty_openal)
|
||||||
add_library(3rdparty::ffmpeg ALIAS 3rdparty_ffmpeg)
|
add_library(3rdparty::ffmpeg ALIAS 3rdparty_ffmpeg)
|
||||||
add_library(3rdparty::dx12 ALIAS 3rdparty_dx12)
|
|
||||||
add_library(3rdparty::glew ALIAS 3rdparty_glew)
|
add_library(3rdparty::glew ALIAS 3rdparty_glew)
|
||||||
|
|
7183
3rdparty/minidx12/Include/d2d1.h
vendored
7183
3rdparty/minidx12/Include/d2d1.h
vendored
File diff suppressed because it is too large
Load diff
4890
3rdparty/minidx12/Include/d2d1_1.h
vendored
4890
3rdparty/minidx12/Include/d2d1_1.h
vendored
File diff suppressed because it is too large
Load diff
924
3rdparty/minidx12/Include/d2d1_1helper.h
vendored
924
3rdparty/minidx12/Include/d2d1_1helper.h
vendored
|
@ -1,924 +0,0 @@
|
||||||
|
|
||||||
/*=========================================================================*\
|
|
||||||
|
|
||||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
|
|
||||||
File: D2D1_1Helper.h
|
|
||||||
|
|
||||||
Module Name: D2D
|
|
||||||
|
|
||||||
Description: Helper files over the D2D interfaces and APIs.
|
|
||||||
|
|
||||||
\*=========================================================================*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifndef _D2D1_1HELPER_H_
|
|
||||||
#define _D2D1_1HELPER_H_
|
|
||||||
|
|
||||||
#ifndef _D2D1_1_H_
|
|
||||||
#include <d2d1_1.h>
|
|
||||||
#endif // #ifndef _D2D1_H_
|
|
||||||
|
|
||||||
#ifndef D2D_USE_C_DEFINITIONS
|
|
||||||
|
|
||||||
#include <winapifamily.h>
|
|
||||||
|
|
||||||
#pragma region Application Family
|
|
||||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
|
||||||
|
|
||||||
namespace D2D1
|
|
||||||
{
|
|
||||||
template<>
|
|
||||||
struct TypeTraits<INT32>
|
|
||||||
{
|
|
||||||
typedef D2D1_POINT_2L Point;
|
|
||||||
typedef D2D1_RECT_L Rect;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct TypeTraits<LONG>
|
|
||||||
{
|
|
||||||
typedef D2D1_POINT_2L Point;
|
|
||||||
typedef D2D1_RECT_L Rect;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Matrix4x3F : public D2D1_MATRIX_4X3_F
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x3F(
|
|
||||||
FLOAT m11, FLOAT m12, FLOAT m13,
|
|
||||||
FLOAT m21, FLOAT m22, FLOAT m23,
|
|
||||||
FLOAT m31, FLOAT m32, FLOAT m33,
|
|
||||||
FLOAT m41, FLOAT m42, FLOAT m43
|
|
||||||
)
|
|
||||||
{
|
|
||||||
_11 = m11;
|
|
||||||
_12 = m12;
|
|
||||||
_13 = m13;
|
|
||||||
|
|
||||||
_21 = m21;
|
|
||||||
_22 = m22;
|
|
||||||
_23 = m23;
|
|
||||||
|
|
||||||
_31 = m31;
|
|
||||||
_32 = m32;
|
|
||||||
_33 = m33;
|
|
||||||
|
|
||||||
_41 = m41;
|
|
||||||
_42 = m42;
|
|
||||||
_43 = m43;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x3F()
|
|
||||||
{
|
|
||||||
_11 = 1;
|
|
||||||
_12 = 0;
|
|
||||||
_13 = 0;
|
|
||||||
|
|
||||||
_21 = 0;
|
|
||||||
_22 = 1;
|
|
||||||
_23 = 0;
|
|
||||||
|
|
||||||
_31 = 0;
|
|
||||||
_32 = 0;
|
|
||||||
_33 = 1;
|
|
||||||
|
|
||||||
_41 = 0;
|
|
||||||
_42 = 0;
|
|
||||||
_43 = 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class Matrix4x4F : public D2D1_MATRIX_4X4_F
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x4F(
|
|
||||||
FLOAT m11, FLOAT m12, FLOAT m13, FLOAT m14,
|
|
||||||
FLOAT m21, FLOAT m22, FLOAT m23, FLOAT m24,
|
|
||||||
FLOAT m31, FLOAT m32, FLOAT m33, FLOAT m34,
|
|
||||||
FLOAT m41, FLOAT m42, FLOAT m43, FLOAT m44
|
|
||||||
)
|
|
||||||
{
|
|
||||||
_11 = m11;
|
|
||||||
_12 = m12;
|
|
||||||
_13 = m13;
|
|
||||||
_14 = m14;
|
|
||||||
|
|
||||||
_21 = m21;
|
|
||||||
_22 = m22;
|
|
||||||
_23 = m23;
|
|
||||||
_24 = m24;
|
|
||||||
|
|
||||||
_31 = m31;
|
|
||||||
_32 = m32;
|
|
||||||
_33 = m33;
|
|
||||||
_34 = m34;
|
|
||||||
|
|
||||||
_41 = m41;
|
|
||||||
_42 = m42;
|
|
||||||
_43 = m43;
|
|
||||||
_44 = m44;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x4F()
|
|
||||||
{
|
|
||||||
_11 = 1;
|
|
||||||
_12 = 0;
|
|
||||||
_13 = 0;
|
|
||||||
_14 = 0;
|
|
||||||
|
|
||||||
_21 = 0;
|
|
||||||
_22 = 1;
|
|
||||||
_23 = 0;
|
|
||||||
_24 = 0;
|
|
||||||
|
|
||||||
_31 = 0;
|
|
||||||
_32 = 0;
|
|
||||||
_33 = 1;
|
|
||||||
_34 = 0;
|
|
||||||
|
|
||||||
_41 = 0;
|
|
||||||
_42 = 0;
|
|
||||||
_43 = 0;
|
|
||||||
_44 = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
bool
|
|
||||||
operator==(
|
|
||||||
const Matrix4x4F& r
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return _11 == r._11 && _12 == r._12 && _13 == r._13 && _14 == r._14 &&
|
|
||||||
_21 == r._21 && _22 == r._22 && _23 == r._23 && _24 == r._24 &&
|
|
||||||
_31 == r._31 && _32 == r._32 && _33 == r._33 && _34 == r._34 &&
|
|
||||||
_41 == r._41 && _42 == r._42 && _43 == r._43 && _44 == r._44;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
bool
|
|
||||||
operator!=(
|
|
||||||
const Matrix4x4F& r
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return !(*this == r);
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x4F
|
|
||||||
Translation(FLOAT x, FLOAT y, FLOAT z)
|
|
||||||
{
|
|
||||||
Matrix4x4F translation;
|
|
||||||
|
|
||||||
translation._11 = 1.0; translation._12 = 0.0; translation._13 = 0.0; translation._14 = 0.0;
|
|
||||||
translation._21 = 0.0; translation._22 = 1.0; translation._23 = 0.0; translation._24 = 0.0;
|
|
||||||
translation._31 = 0.0; translation._32 = 0.0; translation._33 = 1.0; translation._34 = 0.0;
|
|
||||||
translation._41 = x; translation._42 = y; translation._43 = z; translation._44 = 1.0;
|
|
||||||
|
|
||||||
return translation;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x4F
|
|
||||||
Scale(FLOAT x, FLOAT y, FLOAT z)
|
|
||||||
{
|
|
||||||
Matrix4x4F scale;
|
|
||||||
|
|
||||||
scale._11 = x; scale._12 = 0.0; scale._13 = 0.0; scale._14 = 0.0;
|
|
||||||
scale._21 = 0.0; scale._22 = y; scale._23 = 0.0; scale._24 = 0.0;
|
|
||||||
scale._31 = 0.0; scale._32 = 0.0; scale._33 = z; scale._34 = 0.0;
|
|
||||||
scale._41 = 0.0; scale._42 = 0.0; scale._43 = 0.0; scale._44 = 1.0;
|
|
||||||
|
|
||||||
return scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x4F
|
|
||||||
RotationX(FLOAT degreeX)
|
|
||||||
{
|
|
||||||
FLOAT angleInRadian = degreeX * (3.141592654f / 180.0f);
|
|
||||||
|
|
||||||
FLOAT sinAngle = 0.0;
|
|
||||||
FLOAT cosAngle = 0.0;
|
|
||||||
D2D1SinCos(angleInRadian, &sinAngle, &cosAngle);
|
|
||||||
|
|
||||||
Matrix4x4F rotationX(
|
|
||||||
1, 0, 0, 0,
|
|
||||||
0, cosAngle, sinAngle, 0,
|
|
||||||
0, -sinAngle, cosAngle, 0,
|
|
||||||
0, 0, 0, 1
|
|
||||||
);
|
|
||||||
|
|
||||||
return rotationX;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x4F
|
|
||||||
RotationY(FLOAT degreeY)
|
|
||||||
{
|
|
||||||
FLOAT angleInRadian = degreeY * (3.141592654f / 180.0f);
|
|
||||||
|
|
||||||
FLOAT sinAngle = 0.0;
|
|
||||||
FLOAT cosAngle = 0.0;
|
|
||||||
D2D1SinCos(angleInRadian, &sinAngle, &cosAngle);
|
|
||||||
|
|
||||||
Matrix4x4F rotationY(
|
|
||||||
cosAngle, 0, -sinAngle, 0,
|
|
||||||
0, 1, 0, 0,
|
|
||||||
sinAngle, 0, cosAngle, 0,
|
|
||||||
0, 0, 0, 1
|
|
||||||
);
|
|
||||||
|
|
||||||
return rotationY;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x4F
|
|
||||||
RotationZ(FLOAT degreeZ)
|
|
||||||
{
|
|
||||||
FLOAT angleInRadian = degreeZ * (3.141592654f / 180.0f);
|
|
||||||
|
|
||||||
FLOAT sinAngle = 0.0;
|
|
||||||
FLOAT cosAngle = 0.0;
|
|
||||||
D2D1SinCos(angleInRadian, &sinAngle, &cosAngle);
|
|
||||||
|
|
||||||
Matrix4x4F rotationZ(
|
|
||||||
cosAngle, sinAngle, 0, 0,
|
|
||||||
-sinAngle, cosAngle, 0, 0,
|
|
||||||
0, 0, 1, 0,
|
|
||||||
0, 0, 0, 1
|
|
||||||
);
|
|
||||||
|
|
||||||
return rotationZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 3D Rotation matrix for an arbitrary axis specified by x, y and z
|
|
||||||
//
|
|
||||||
static
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x4F
|
|
||||||
RotationArbitraryAxis(FLOAT x, FLOAT y, FLOAT z, FLOAT degree)
|
|
||||||
{
|
|
||||||
// Normalize the vector represented by x, y, and z
|
|
||||||
FLOAT magnitude = D2D1Vec3Length(x, y, z);
|
|
||||||
x /= magnitude;
|
|
||||||
y /= magnitude;
|
|
||||||
z /= magnitude;
|
|
||||||
|
|
||||||
FLOAT angleInRadian = degree * (3.141592654f / 180.0f);
|
|
||||||
|
|
||||||
FLOAT sinAngle = 0.0;
|
|
||||||
FLOAT cosAngle = 0.0;
|
|
||||||
D2D1SinCos(angleInRadian, &sinAngle, &cosAngle);
|
|
||||||
|
|
||||||
FLOAT oneMinusCosAngle = 1 - cosAngle;
|
|
||||||
|
|
||||||
Matrix4x4F rotationArb(
|
|
||||||
1 + oneMinusCosAngle * (x * x - 1),
|
|
||||||
z * sinAngle + oneMinusCosAngle * x * y,
|
|
||||||
-y * sinAngle + oneMinusCosAngle * x * z,
|
|
||||||
0,
|
|
||||||
|
|
||||||
-z * sinAngle + oneMinusCosAngle * y * x,
|
|
||||||
1 + oneMinusCosAngle * (y * y - 1),
|
|
||||||
x * sinAngle + oneMinusCosAngle * y * z,
|
|
||||||
0,
|
|
||||||
|
|
||||||
y * sinAngle + oneMinusCosAngle * z * x,
|
|
||||||
-x * sinAngle + oneMinusCosAngle * z * y,
|
|
||||||
1 + oneMinusCosAngle * (z * z - 1) ,
|
|
||||||
0,
|
|
||||||
|
|
||||||
0, 0, 0, 1
|
|
||||||
);
|
|
||||||
|
|
||||||
return rotationArb;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x4F
|
|
||||||
SkewX(FLOAT degreeX)
|
|
||||||
{
|
|
||||||
FLOAT angleInRadian = degreeX * (3.141592654f / 180.0f);
|
|
||||||
|
|
||||||
FLOAT tanAngle = D2D1Tan(angleInRadian);
|
|
||||||
|
|
||||||
Matrix4x4F skewX(
|
|
||||||
1, 0, 0, 0,
|
|
||||||
tanAngle, 1, 0, 0,
|
|
||||||
0, 0, 1, 0,
|
|
||||||
0, 0, 0, 1
|
|
||||||
);
|
|
||||||
|
|
||||||
return skewX;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x4F
|
|
||||||
SkewY(FLOAT degreeY)
|
|
||||||
{
|
|
||||||
FLOAT angleInRadian = degreeY * (3.141592654f / 180.0f);
|
|
||||||
|
|
||||||
FLOAT tanAngle = D2D1Tan(angleInRadian);
|
|
||||||
|
|
||||||
Matrix4x4F skewY(
|
|
||||||
1, tanAngle, 0, 0,
|
|
||||||
0, 1, 0, 0,
|
|
||||||
0, 0, 1, 0,
|
|
||||||
0, 0, 0, 1
|
|
||||||
);
|
|
||||||
|
|
||||||
return skewY;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x4F
|
|
||||||
PerspectiveProjection(FLOAT depth)
|
|
||||||
{
|
|
||||||
float proj = 0;
|
|
||||||
|
|
||||||
if (depth > 0)
|
|
||||||
{
|
|
||||||
proj = -1/depth;
|
|
||||||
}
|
|
||||||
|
|
||||||
Matrix4x4F projection(
|
|
||||||
1, 0, 0, 0,
|
|
||||||
0, 1, 0, 0,
|
|
||||||
0, 0, 1, proj,
|
|
||||||
0, 0, 0, 1
|
|
||||||
);
|
|
||||||
|
|
||||||
return projection;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Functions for convertion from the base D2D1_MATRIX_4X4_f to
|
|
||||||
// this type without making a copy
|
|
||||||
//
|
|
||||||
static
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
const Matrix4x4F*
|
|
||||||
ReinterpretBaseType(const D2D1_MATRIX_4X4_F *pMatrix)
|
|
||||||
{
|
|
||||||
return static_cast<const Matrix4x4F *>(pMatrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x4F*
|
|
||||||
ReinterpretBaseType(D2D1_MATRIX_4X4_F *pMatrix)
|
|
||||||
{
|
|
||||||
return static_cast<Matrix4x4F *>(pMatrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
FLOAT
|
|
||||||
Determinant() const
|
|
||||||
{
|
|
||||||
FLOAT minor1 = _41 * (_12 * (_23 * _34 - _33 * _24) - _13 * (_22 * _34 - _24 * _32) + _14 * (_22 * _33 - _23 * _32));
|
|
||||||
FLOAT minor2 = _42 * (_11 * (_21 * _34 - _31 * _24) - _13 * (_21 * _34 - _24 * _31) + _14 * (_21 * _33 - _23 * _31));
|
|
||||||
FLOAT minor3 = _43 * (_11 * (_22 * _34 - _32 * _24) - _12 * (_21 * _34 - _24 * _31) + _14 * (_21 * _32 - _22 * _31));
|
|
||||||
FLOAT minor4 = _44 * (_11 * (_22 * _33 - _32 * _23) - _12 * (_21 * _33 - _23 * _31) + _13 * (_21 * _32 - _22 * _31));
|
|
||||||
|
|
||||||
return minor1 - minor2 + minor3 - minor4;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
bool
|
|
||||||
IsIdentity() const
|
|
||||||
{
|
|
||||||
return _11 == 1.f && _12 == 0.f && _13 == 0.f && _14 == 0.f
|
|
||||||
&& _21 == 0.f && _22 == 1.f && _23 == 0.f && _24 == 0.f
|
|
||||||
&& _31 == 0.f && _32 == 0.f && _33 == 1.f && _34 == 0.f
|
|
||||||
&& _41 == 0.f && _42 == 0.f && _43 == 0.f && _44 == 1.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
void
|
|
||||||
SetProduct(const Matrix4x4F &a, const Matrix4x4F &b)
|
|
||||||
{
|
|
||||||
_11 = a._11 * b._11 + a._12 * b._21 + a._13 * b._31 + a._14 * b._41;
|
|
||||||
_12 = a._11 * b._12 + a._12 * b._22 + a._13 * b._32 + a._14 * b._42;
|
|
||||||
_13 = a._11 * b._13 + a._12 * b._23 + a._13 * b._33 + a._14 * b._43;
|
|
||||||
_14 = a._11 * b._14 + a._12 * b._24 + a._13 * b._34 + a._14 * b._44;
|
|
||||||
|
|
||||||
_21 = a._21 * b._11 + a._22 * b._21 + a._23 * b._31 + a._24 * b._41;
|
|
||||||
_22 = a._21 * b._12 + a._22 * b._22 + a._23 * b._32 + a._24 * b._42;
|
|
||||||
_23 = a._21 * b._13 + a._22 * b._23 + a._23 * b._33 + a._24 * b._43;
|
|
||||||
_24 = a._21 * b._14 + a._22 * b._24 + a._23 * b._34 + a._24 * b._44;
|
|
||||||
|
|
||||||
_31 = a._31 * b._11 + a._32 * b._21 + a._33 * b._31 + a._34 * b._41;
|
|
||||||
_32 = a._31 * b._12 + a._32 * b._22 + a._33 * b._32 + a._34 * b._42;
|
|
||||||
_33 = a._31 * b._13 + a._32 * b._23 + a._33 * b._33 + a._34 * b._43;
|
|
||||||
_34 = a._31 * b._14 + a._32 * b._24 + a._33 * b._34 + a._34 * b._44;
|
|
||||||
|
|
||||||
_41 = a._41 * b._11 + a._42 * b._21 + a._43 * b._31 + a._44 * b._41;
|
|
||||||
_42 = a._41 * b._12 + a._42 * b._22 + a._43 * b._32 + a._44 * b._42;
|
|
||||||
_43 = a._41 * b._13 + a._42 * b._23 + a._43 * b._33 + a._44 * b._43;
|
|
||||||
_44 = a._41 * b._14 + a._42 * b._24 + a._43 * b._34 + a._44 * b._44;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix4x4F
|
|
||||||
operator*(const Matrix4x4F &matrix) const
|
|
||||||
{
|
|
||||||
Matrix4x4F result;
|
|
||||||
|
|
||||||
result.SetProduct(*this, matrix);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class Matrix5x4F : public D2D1_MATRIX_5X4_F
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix5x4F(
|
|
||||||
FLOAT m11, FLOAT m12, FLOAT m13, FLOAT m14,
|
|
||||||
FLOAT m21, FLOAT m22, FLOAT m23, FLOAT m24,
|
|
||||||
FLOAT m31, FLOAT m32, FLOAT m33, FLOAT m34,
|
|
||||||
FLOAT m41, FLOAT m42, FLOAT m43, FLOAT m44,
|
|
||||||
FLOAT m51, FLOAT m52, FLOAT m53, FLOAT m54
|
|
||||||
)
|
|
||||||
{
|
|
||||||
_11 = m11;
|
|
||||||
_12 = m12;
|
|
||||||
_13 = m13;
|
|
||||||
_14 = m14;
|
|
||||||
|
|
||||||
_21 = m21;
|
|
||||||
_22 = m22;
|
|
||||||
_23 = m23;
|
|
||||||
_24 = m24;
|
|
||||||
|
|
||||||
_31 = m31;
|
|
||||||
_32 = m32;
|
|
||||||
_33 = m33;
|
|
||||||
_34 = m34;
|
|
||||||
|
|
||||||
_41 = m41;
|
|
||||||
_42 = m42;
|
|
||||||
_43 = m43;
|
|
||||||
_44 = m44;
|
|
||||||
|
|
||||||
_51 = m51;
|
|
||||||
_52 = m52;
|
|
||||||
_53 = m53;
|
|
||||||
_54 = m54;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
Matrix5x4F()
|
|
||||||
{
|
|
||||||
_11 = 1;
|
|
||||||
_12 = 0;
|
|
||||||
_13 = 0;
|
|
||||||
_14 = 0;
|
|
||||||
|
|
||||||
_21 = 0;
|
|
||||||
_22 = 1;
|
|
||||||
_23 = 0;
|
|
||||||
_24 = 0;
|
|
||||||
|
|
||||||
_31 = 0;
|
|
||||||
_32 = 0;
|
|
||||||
_33 = 1;
|
|
||||||
_34 = 0;
|
|
||||||
|
|
||||||
_41 = 0;
|
|
||||||
_42 = 0;
|
|
||||||
_43 = 0;
|
|
||||||
_44 = 1;
|
|
||||||
|
|
||||||
_51 = 0;
|
|
||||||
_52 = 0;
|
|
||||||
_53 = 0;
|
|
||||||
_54 = 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
inline
|
|
||||||
D2D1_COLOR_F
|
|
||||||
ConvertColorSpace(
|
|
||||||
D2D1_COLOR_SPACE sourceColorSpace,
|
|
||||||
D2D1_COLOR_SPACE destinationColorSpace,
|
|
||||||
const D2D1_COLOR_F& color
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return D2D1ConvertColorSpace(
|
|
||||||
sourceColorSpace,
|
|
||||||
destinationColorSpace,
|
|
||||||
&color
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_DRAWING_STATE_DESCRIPTION1
|
|
||||||
DrawingStateDescription1(
|
|
||||||
D2D1_ANTIALIAS_MODE antialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
|
|
||||||
D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = D2D1_TEXT_ANTIALIAS_MODE_DEFAULT,
|
|
||||||
D2D1_TAG tag1 = 0,
|
|
||||||
D2D1_TAG tag2 = 0,
|
|
||||||
_In_ const D2D1_MATRIX_3X2_F &transform = D2D1::IdentityMatrix(),
|
|
||||||
D2D1_PRIMITIVE_BLEND primitiveBlend = D2D1_PRIMITIVE_BLEND_SOURCE_OVER,
|
|
||||||
D2D1_UNIT_MODE unitMode = D2D1_UNIT_MODE_DIPS
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_DRAWING_STATE_DESCRIPTION1 drawingStateDescription1;
|
|
||||||
|
|
||||||
drawingStateDescription1.antialiasMode = antialiasMode;
|
|
||||||
drawingStateDescription1.textAntialiasMode = textAntialiasMode;
|
|
||||||
drawingStateDescription1.tag1 = tag1;
|
|
||||||
drawingStateDescription1.tag2 = tag2;
|
|
||||||
drawingStateDescription1.transform = transform;
|
|
||||||
drawingStateDescription1.primitiveBlend = primitiveBlend;
|
|
||||||
drawingStateDescription1.unitMode = unitMode;
|
|
||||||
|
|
||||||
return drawingStateDescription1;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_DRAWING_STATE_DESCRIPTION1
|
|
||||||
DrawingStateDescription1(
|
|
||||||
_In_ const D2D1_DRAWING_STATE_DESCRIPTION &desc,
|
|
||||||
D2D1_PRIMITIVE_BLEND primitiveBlend = D2D1_PRIMITIVE_BLEND_SOURCE_OVER,
|
|
||||||
D2D1_UNIT_MODE unitMode = D2D1_UNIT_MODE_DIPS
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_DRAWING_STATE_DESCRIPTION1 drawingStateDescription1;
|
|
||||||
|
|
||||||
drawingStateDescription1.antialiasMode = desc.antialiasMode;
|
|
||||||
drawingStateDescription1.textAntialiasMode = desc.textAntialiasMode;
|
|
||||||
drawingStateDescription1.tag1 = desc.tag1;
|
|
||||||
drawingStateDescription1.tag2 = desc.tag2;
|
|
||||||
drawingStateDescription1.transform = desc.transform;
|
|
||||||
drawingStateDescription1.primitiveBlend = primitiveBlend;
|
|
||||||
drawingStateDescription1.unitMode = unitMode;
|
|
||||||
|
|
||||||
return drawingStateDescription1;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_BITMAP_PROPERTIES1
|
|
||||||
BitmapProperties1(
|
|
||||||
D2D1_BITMAP_OPTIONS bitmapOptions = D2D1_BITMAP_OPTIONS_NONE,
|
|
||||||
_In_ CONST D2D1_PIXEL_FORMAT pixelFormat = D2D1::PixelFormat(),
|
|
||||||
FLOAT dpiX = 96.0f,
|
|
||||||
FLOAT dpiY = 96.0f,
|
|
||||||
_In_opt_ ID2D1ColorContext *colorContext = NULL
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_BITMAP_PROPERTIES1 bitmapProperties =
|
|
||||||
{
|
|
||||||
pixelFormat,
|
|
||||||
dpiX, dpiY,
|
|
||||||
bitmapOptions,
|
|
||||||
colorContext
|
|
||||||
};
|
|
||||||
|
|
||||||
return bitmapProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_LAYER_PARAMETERS1
|
|
||||||
LayerParameters1(
|
|
||||||
_In_ CONST D2D1_RECT_F &contentBounds = D2D1::InfiniteRect(),
|
|
||||||
_In_opt_ ID2D1Geometry *geometricMask = NULL,
|
|
||||||
D2D1_ANTIALIAS_MODE maskAntialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
|
|
||||||
D2D1_MATRIX_3X2_F maskTransform = D2D1::IdentityMatrix(),
|
|
||||||
FLOAT opacity = 1.0,
|
|
||||||
_In_opt_ ID2D1Brush *opacityBrush = NULL,
|
|
||||||
D2D1_LAYER_OPTIONS1 layerOptions = D2D1_LAYER_OPTIONS1_NONE
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_LAYER_PARAMETERS1 layerParameters = { 0 };
|
|
||||||
|
|
||||||
layerParameters.contentBounds = contentBounds;
|
|
||||||
layerParameters.geometricMask = geometricMask;
|
|
||||||
layerParameters.maskAntialiasMode = maskAntialiasMode;
|
|
||||||
layerParameters.maskTransform = maskTransform;
|
|
||||||
layerParameters.opacity = opacity;
|
|
||||||
layerParameters.opacityBrush = opacityBrush;
|
|
||||||
layerParameters.layerOptions = layerOptions;
|
|
||||||
|
|
||||||
return layerParameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_STROKE_STYLE_PROPERTIES1
|
|
||||||
StrokeStyleProperties1(
|
|
||||||
D2D1_CAP_STYLE startCap = D2D1_CAP_STYLE_FLAT,
|
|
||||||
D2D1_CAP_STYLE endCap = D2D1_CAP_STYLE_FLAT,
|
|
||||||
D2D1_CAP_STYLE dashCap = D2D1_CAP_STYLE_FLAT,
|
|
||||||
D2D1_LINE_JOIN lineJoin = D2D1_LINE_JOIN_MITER,
|
|
||||||
FLOAT miterLimit = 10.0f,
|
|
||||||
D2D1_DASH_STYLE dashStyle = D2D1_DASH_STYLE_SOLID,
|
|
||||||
FLOAT dashOffset = 0.0f,
|
|
||||||
D2D1_STROKE_TRANSFORM_TYPE transformType = D2D1_STROKE_TRANSFORM_TYPE_NORMAL
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_STROKE_STYLE_PROPERTIES1 strokeStyleProperties;
|
|
||||||
|
|
||||||
strokeStyleProperties.startCap = startCap;
|
|
||||||
strokeStyleProperties.endCap = endCap;
|
|
||||||
strokeStyleProperties.dashCap = dashCap;
|
|
||||||
strokeStyleProperties.lineJoin = lineJoin;
|
|
||||||
strokeStyleProperties.miterLimit = miterLimit;
|
|
||||||
strokeStyleProperties.dashStyle = dashStyle;
|
|
||||||
strokeStyleProperties.dashOffset = dashOffset;
|
|
||||||
strokeStyleProperties.transformType = transformType;
|
|
||||||
|
|
||||||
return strokeStyleProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_IMAGE_BRUSH_PROPERTIES
|
|
||||||
ImageBrushProperties(
|
|
||||||
D2D1_RECT_F sourceRectangle,
|
|
||||||
D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE_CLAMP,
|
|
||||||
D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE_CLAMP,
|
|
||||||
D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties;
|
|
||||||
|
|
||||||
imageBrushProperties.extendModeX = extendModeX;
|
|
||||||
imageBrushProperties.extendModeY = extendModeY;
|
|
||||||
imageBrushProperties.interpolationMode = interpolationMode;
|
|
||||||
imageBrushProperties.sourceRectangle = sourceRectangle;
|
|
||||||
|
|
||||||
return imageBrushProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_BITMAP_BRUSH_PROPERTIES1
|
|
||||||
BitmapBrushProperties1(
|
|
||||||
D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE_CLAMP,
|
|
||||||
D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE_CLAMP,
|
|
||||||
D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_BITMAP_BRUSH_PROPERTIES1 bitmapBrush1Properties;
|
|
||||||
|
|
||||||
bitmapBrush1Properties.extendModeX = extendModeX;
|
|
||||||
bitmapBrush1Properties.extendModeY = extendModeY;
|
|
||||||
bitmapBrush1Properties.interpolationMode = interpolationMode;
|
|
||||||
|
|
||||||
return bitmapBrush1Properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_PRINT_CONTROL_PROPERTIES
|
|
||||||
PrintControlProperties(
|
|
||||||
D2D1_PRINT_FONT_SUBSET_MODE fontSubsetMode = D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT,
|
|
||||||
FLOAT rasterDpi = 150.0f,
|
|
||||||
D2D1_COLOR_SPACE colorSpace = D2D1_COLOR_SPACE_SRGB
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_PRINT_CONTROL_PROPERTIES printControlProps;
|
|
||||||
|
|
||||||
printControlProps.fontSubset = fontSubsetMode;
|
|
||||||
printControlProps.rasterDPI = rasterDpi;
|
|
||||||
printControlProps.colorSpace = colorSpace;
|
|
||||||
|
|
||||||
return printControlProps;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_RENDERING_CONTROLS
|
|
||||||
RenderingControls(
|
|
||||||
D2D1_BUFFER_PRECISION bufferPrecision,
|
|
||||||
D2D1_SIZE_U tileSize
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_RENDERING_CONTROLS renderingControls;
|
|
||||||
|
|
||||||
renderingControls.bufferPrecision = bufferPrecision;
|
|
||||||
renderingControls.tileSize = tileSize;
|
|
||||||
|
|
||||||
return renderingControls;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_EFFECT_INPUT_DESCRIPTION
|
|
||||||
EffectInputDescription(
|
|
||||||
ID2D1Effect *effect,
|
|
||||||
UINT32 inputIndex,
|
|
||||||
D2D1_RECT_F inputRectangle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_EFFECT_INPUT_DESCRIPTION description;
|
|
||||||
|
|
||||||
description.effect = effect;
|
|
||||||
description.inputIndex = inputIndex;
|
|
||||||
description.inputRectangle = inputRectangle;
|
|
||||||
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_CREATION_PROPERTIES
|
|
||||||
CreationProperties(
|
|
||||||
D2D1_THREADING_MODE threadingMode,
|
|
||||||
D2D1_DEBUG_LEVEL debugLevel,
|
|
||||||
D2D1_DEVICE_CONTEXT_OPTIONS options
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_CREATION_PROPERTIES creationProperties;
|
|
||||||
|
|
||||||
creationProperties.threadingMode = threadingMode;
|
|
||||||
creationProperties.debugLevel = debugLevel;
|
|
||||||
creationProperties.options = options;
|
|
||||||
|
|
||||||
return creationProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_VECTOR_2F
|
|
||||||
Vector2F(
|
|
||||||
FLOAT x = 0.0f,
|
|
||||||
FLOAT y = 0.0f
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_VECTOR_2F vec2 = {x, y};
|
|
||||||
return vec2;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_VECTOR_3F
|
|
||||||
Vector3F(
|
|
||||||
FLOAT x = 0.0f,
|
|
||||||
FLOAT y = 0.0f,
|
|
||||||
FLOAT z = 0.0f
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_VECTOR_3F vec3 = {x, y, z};
|
|
||||||
return vec3;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_VECTOR_4F
|
|
||||||
Vector4F(
|
|
||||||
FLOAT x = 0.0f,
|
|
||||||
FLOAT y = 0.0f,
|
|
||||||
FLOAT z = 0.0f,
|
|
||||||
FLOAT w = 0.0f
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_VECTOR_4F vec4 = {x, y, z, w};
|
|
||||||
return vec4;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_POINT_2L
|
|
||||||
Point2L(
|
|
||||||
INT32 x = 0,
|
|
||||||
INT32 y = 0
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return Point2<INT32>(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_RECT_L
|
|
||||||
RectL(
|
|
||||||
INT32 left = 0.f,
|
|
||||||
INT32 top = 0.f,
|
|
||||||
INT32 right = 0.f,
|
|
||||||
INT32 bottom = 0.f
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return Rect<INT32>(left, top, right, bottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Sets a bitmap as an effect input, while inserting a DPI compensation effect
|
|
||||||
// to preserve visual appearance as the device context's DPI changes.
|
|
||||||
//
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
HRESULT
|
|
||||||
SetDpiCompensatedEffectInput(
|
|
||||||
_In_ ID2D1DeviceContext *deviceContext,
|
|
||||||
_In_ ID2D1Effect *effect,
|
|
||||||
UINT32 inputIndex,
|
|
||||||
_In_opt_ ID2D1Bitmap *inputBitmap,
|
|
||||||
D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
|
|
||||||
D2D1_BORDER_MODE borderMode = D2D1_BORDER_MODE_HARD
|
|
||||||
)
|
|
||||||
{
|
|
||||||
HRESULT hr = S_OK;
|
|
||||||
ID2D1Effect *dpiCompensationEffect = NULL;
|
|
||||||
|
|
||||||
if (!inputBitmap)
|
|
||||||
{
|
|
||||||
effect->SetInput(inputIndex, NULL);
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = deviceContext->CreateEffect(CLSID_D2D1DpiCompensation, &dpiCompensationEffect);
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
dpiCompensationEffect->SetInput(0, inputBitmap);
|
|
||||||
|
|
||||||
D2D1_POINT_2F bitmapDpi;
|
|
||||||
inputBitmap->GetDpi(&bitmapDpi.x, &bitmapDpi.y);
|
|
||||||
hr = dpiCompensationEffect->SetValue(D2D1_DPICOMPENSATION_PROP_INPUT_DPI, bitmapDpi);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
hr = dpiCompensationEffect->SetValue(D2D1_DPICOMPENSATION_PROP_INTERPOLATION_MODE, interpolationMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
hr = dpiCompensationEffect->SetValue(D2D1_DPICOMPENSATION_PROP_BORDER_MODE, borderMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
effect->SetInputEffect(inputIndex, dpiCompensationEffect);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dpiCompensationEffect)
|
|
||||||
{
|
|
||||||
dpiCompensationEffect->Release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace D2D1
|
|
||||||
|
|
||||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
|
||||||
#pragma endregion
|
|
||||||
|
|
||||||
#endif // #ifndef D2D_USE_C_DEFINITIONS
|
|
||||||
|
|
||||||
#endif // #ifndef _D2D1_HELPER_H_
|
|
||||||
|
|
809
3rdparty/minidx12/Include/d2d1_2.h
vendored
809
3rdparty/minidx12/Include/d2d1_2.h
vendored
|
@ -1,809 +0,0 @@
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
//
|
|
||||||
// This file is automatically generated. Please do not edit it directly.
|
|
||||||
//
|
|
||||||
// File name: D2D1_2.h
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma once
|
|
||||||
#endif // #ifdef _MSC_VER
|
|
||||||
|
|
||||||
#ifndef _D2D1_2_H_
|
|
||||||
#define _D2D1_2_H_
|
|
||||||
|
|
||||||
#ifndef _D2D1_1_H_
|
|
||||||
#include <d2d1_1.h>
|
|
||||||
#endif // #ifndef _D2D1_1_H_
|
|
||||||
#ifndef _D2D1_EFFECTS_1_
|
|
||||||
#include <d2d1effects_1.h>
|
|
||||||
#endif // #ifndef _D2D1_EFFECTS_1_
|
|
||||||
|
|
||||||
#include <winapifamily.h>
|
|
||||||
|
|
||||||
#pragma region Application Family
|
|
||||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
|
||||||
|
|
||||||
#ifndef D2D_USE_C_DEFINITIONS
|
|
||||||
|
|
||||||
interface ID2D1Device1;
|
|
||||||
#else
|
|
||||||
|
|
||||||
typedef interface ID2D1Device1 ID2D1Device1;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_RENDERING_PRIORITY
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// Specifies the extent to which D2D will throttle work sent to the GPU.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_RENDERING_PRIORITY
|
|
||||||
{
|
|
||||||
D2D1_RENDERING_PRIORITY_NORMAL = 0,
|
|
||||||
D2D1_RENDERING_PRIORITY_LOW = 1,
|
|
||||||
D2D1_RENDERING_PRIORITY_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_RENDERING_PRIORITY;
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef D2D_USE_C_DEFINITIONS
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Interface:
|
|
||||||
// ID2D1GeometryRealization
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
interface DX_DECLARE_INTERFACE("a16907d7-bc02-4801-99e8-8cf7f485f774") ID2D1GeometryRealization : public ID2D1Resource
|
|
||||||
{
|
|
||||||
}; // interface ID2D1GeometryRealization
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Interface:
|
|
||||||
// ID2D1DeviceContext1
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
interface DX_DECLARE_INTERFACE("d37f57e4-6908-459f-a199-e72f24f79987") ID2D1DeviceContext1 : public ID2D1DeviceContext
|
|
||||||
{
|
|
||||||
|
|
||||||
STDMETHOD(CreateFilledGeometryRealization)(
|
|
||||||
_In_ ID2D1Geometry *geometry,
|
|
||||||
FLOAT flatteningTolerance,
|
|
||||||
_Outptr_ ID2D1GeometryRealization **geometryRealization
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(CreateStrokedGeometryRealization)(
|
|
||||||
_In_ ID2D1Geometry *geometry,
|
|
||||||
FLOAT flatteningTolerance,
|
|
||||||
FLOAT strokeWidth,
|
|
||||||
_In_opt_ ID2D1StrokeStyle *strokeStyle,
|
|
||||||
_Outptr_ ID2D1GeometryRealization **geometryRealization
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(void, DrawGeometryRealization)(
|
|
||||||
_In_ ID2D1GeometryRealization *geometryRealization,
|
|
||||||
_In_ ID2D1Brush *brush
|
|
||||||
) PURE;
|
|
||||||
}; // interface ID2D1DeviceContext1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Interface:
|
|
||||||
// ID2D1Device1
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
interface DX_DECLARE_INTERFACE("d21768e1-23a4-4823-a14b-7c3eba85d658") ID2D1Device1 : public ID2D1Device
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Retrieves the rendering priority currently set on the device.
|
|
||||||
//
|
|
||||||
STDMETHOD_(D2D1_RENDERING_PRIORITY, GetRenderingPriority)(
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Sets the rendering priority of the device.
|
|
||||||
//
|
|
||||||
STDMETHOD_(void, SetRenderingPriority)(
|
|
||||||
D2D1_RENDERING_PRIORITY renderingPriority
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Creates a new device context with no initially assigned target.
|
|
||||||
//
|
|
||||||
STDMETHOD(CreateDeviceContext)(
|
|
||||||
D2D1_DEVICE_CONTEXT_OPTIONS options,
|
|
||||||
_Outptr_ ID2D1DeviceContext1 **deviceContext1
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
using ID2D1Device::CreateDeviceContext;
|
|
||||||
}; // interface ID2D1Device1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Interface:
|
|
||||||
// ID2D1Factory2
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
interface DX_DECLARE_INTERFACE("94f81a73-9212-4376-9c58-b16a3a0d3992") ID2D1Factory2 : public ID2D1Factory1
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// This creates a new Direct2D device from the given IDXGIDevice.
|
|
||||||
//
|
|
||||||
STDMETHOD(CreateDevice)(
|
|
||||||
_In_ IDXGIDevice *dxgiDevice,
|
|
||||||
_Outptr_ ID2D1Device1 **d2dDevice1
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
using ID2D1Factory1::CreateDevice;
|
|
||||||
}; // interface ID2D1Factory2
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Interface:
|
|
||||||
// ID2D1CommandSink1
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
interface DX_DECLARE_INTERFACE("9eb767fd-4269-4467-b8c2-eb30cb305743") ID2D1CommandSink1 : public ID2D1CommandSink
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// This method is called if primitiveBlend value was added after Windows 8.
|
|
||||||
// SetPrimitiveBlend method is used for Win8 values (_SOURCE_OVER and _COPY).
|
|
||||||
//
|
|
||||||
STDMETHOD(SetPrimitiveBlend1)(
|
|
||||||
D2D1_PRIMITIVE_BLEND primitiveBlend
|
|
||||||
) PURE;
|
|
||||||
}; // interface ID2D1CommandSink1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
EXTERN_C CONST IID IID_ID2D1GeometryRealization;
|
|
||||||
EXTERN_C CONST IID IID_ID2D1DeviceContext1;
|
|
||||||
EXTERN_C CONST IID IID_ID2D1Device1;
|
|
||||||
EXTERN_C CONST IID IID_ID2D1Factory2;
|
|
||||||
EXTERN_C CONST IID IID_ID2D1CommandSink1;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef D2D_USE_C_DEFINITIONS
|
|
||||||
|
|
||||||
|
|
||||||
typedef interface ID2D1GeometryRealization ID2D1GeometryRealization;
|
|
||||||
|
|
||||||
typedef struct ID2D1GeometryRealizationVtbl
|
|
||||||
{
|
|
||||||
|
|
||||||
ID2D1ResourceVtbl Base;
|
|
||||||
|
|
||||||
} ID2D1GeometryRealizationVtbl;
|
|
||||||
|
|
||||||
interface ID2D1GeometryRealization
|
|
||||||
{
|
|
||||||
CONST struct ID2D1GeometryRealizationVtbl *lpVtbl;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define ID2D1GeometryRealization_QueryInterface(This, riid, ppv) \
|
|
||||||
((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
|
|
||||||
|
|
||||||
#define ID2D1GeometryRealization_AddRef(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This))
|
|
||||||
|
|
||||||
#define ID2D1GeometryRealization_Release(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.Release((IUnknown *)This))
|
|
||||||
|
|
||||||
#define ID2D1GeometryRealization_GetFactory(This, factory) \
|
|
||||||
((This)->lpVtbl->Base.GetFactory((ID2D1Resource *)This, factory))
|
|
||||||
|
|
||||||
typedef interface ID2D1DeviceContext1 ID2D1DeviceContext1;
|
|
||||||
|
|
||||||
typedef struct ID2D1DeviceContext1Vtbl
|
|
||||||
{
|
|
||||||
|
|
||||||
ID2D1DeviceContextVtbl Base;
|
|
||||||
|
|
||||||
|
|
||||||
STDMETHOD(CreateFilledGeometryRealization)(
|
|
||||||
ID2D1DeviceContext1 *This,
|
|
||||||
_In_ ID2D1Geometry *geometry,
|
|
||||||
FLOAT flatteningTolerance,
|
|
||||||
_Outptr_ ID2D1GeometryRealization **geometryRealization
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(CreateStrokedGeometryRealization)(
|
|
||||||
ID2D1DeviceContext1 *This,
|
|
||||||
_In_ ID2D1Geometry *geometry,
|
|
||||||
FLOAT flatteningTolerance,
|
|
||||||
FLOAT strokeWidth,
|
|
||||||
_In_opt_ ID2D1StrokeStyle *strokeStyle,
|
|
||||||
_Outptr_ ID2D1GeometryRealization **geometryRealization
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(void, DrawGeometryRealization)(
|
|
||||||
ID2D1DeviceContext1 *This,
|
|
||||||
_In_ ID2D1GeometryRealization *geometryRealization,
|
|
||||||
_In_ ID2D1Brush *brush
|
|
||||||
) PURE;
|
|
||||||
} ID2D1DeviceContext1Vtbl;
|
|
||||||
|
|
||||||
interface ID2D1DeviceContext1
|
|
||||||
{
|
|
||||||
CONST struct ID2D1DeviceContext1Vtbl *lpVtbl;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_QueryInterface(This, riid, ppv) \
|
|
||||||
((This)->lpVtbl->Base.Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_AddRef(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.Base.Base.AddRef((IUnknown *)This))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_Release(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.Base.Base.Release((IUnknown *)This))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetFactory(This, factory) \
|
|
||||||
((This)->lpVtbl->Base.Base.Base.GetFactory((ID2D1Resource *)This, factory))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateSharedBitmap(This, riid, data, bitmapProperties, bitmap) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateSharedBitmap((ID2D1RenderTarget *)This, riid, data, bitmapProperties, bitmap))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateSolidColorBrush(This, color, brushProperties, solidColorBrush) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateSolidColorBrush((ID2D1RenderTarget *)This, color, brushProperties, solidColorBrush))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateLinearGradientBrush(This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateLinearGradientBrush((ID2D1RenderTarget *)This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateRadialGradientBrush(This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateRadialGradientBrush((ID2D1RenderTarget *)This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateCompatibleRenderTarget(This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateCompatibleRenderTarget((ID2D1RenderTarget *)This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateLayer(This, size, layer) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateLayer((ID2D1RenderTarget *)This, size, layer))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateMesh(This, mesh) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateMesh((ID2D1RenderTarget *)This, mesh))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_DrawLine(This, point0, point1, brush, strokeWidth, strokeStyle) \
|
|
||||||
((This)->lpVtbl->Base.Base.DrawLine((ID2D1RenderTarget *)This, point0, point1, brush, strokeWidth, strokeStyle))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_DrawRectangle(This, rect, brush, strokeWidth, strokeStyle) \
|
|
||||||
((This)->lpVtbl->Base.Base.DrawRectangle((ID2D1RenderTarget *)This, rect, brush, strokeWidth, strokeStyle))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_FillRectangle(This, rect, brush) \
|
|
||||||
((This)->lpVtbl->Base.Base.FillRectangle((ID2D1RenderTarget *)This, rect, brush))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_DrawRoundedRectangle(This, roundedRect, brush, strokeWidth, strokeStyle) \
|
|
||||||
((This)->lpVtbl->Base.Base.DrawRoundedRectangle((ID2D1RenderTarget *)This, roundedRect, brush, strokeWidth, strokeStyle))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_FillRoundedRectangle(This, roundedRect, brush) \
|
|
||||||
((This)->lpVtbl->Base.Base.FillRoundedRectangle((ID2D1RenderTarget *)This, roundedRect, brush))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_DrawEllipse(This, ellipse, brush, strokeWidth, strokeStyle) \
|
|
||||||
((This)->lpVtbl->Base.Base.DrawEllipse((ID2D1RenderTarget *)This, ellipse, brush, strokeWidth, strokeStyle))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_FillEllipse(This, ellipse, brush) \
|
|
||||||
((This)->lpVtbl->Base.Base.FillEllipse((ID2D1RenderTarget *)This, ellipse, brush))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_DrawGeometry(This, geometry, brush, strokeWidth, strokeStyle) \
|
|
||||||
((This)->lpVtbl->Base.Base.DrawGeometry((ID2D1RenderTarget *)This, geometry, brush, strokeWidth, strokeStyle))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_FillGeometry(This, geometry, brush, opacityBrush) \
|
|
||||||
((This)->lpVtbl->Base.Base.FillGeometry((ID2D1RenderTarget *)This, geometry, brush, opacityBrush))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_FillMesh(This, mesh, brush) \
|
|
||||||
((This)->lpVtbl->Base.Base.FillMesh((ID2D1RenderTarget *)This, mesh, brush))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_DrawText(This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode) \
|
|
||||||
((This)->lpVtbl->Base.Base.DrawText((ID2D1RenderTarget *)This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_DrawTextLayout(This, origin, textLayout, defaultForegroundBrush, options) \
|
|
||||||
((This)->lpVtbl->Base.Base.DrawTextLayout((ID2D1RenderTarget *)This, origin, textLayout, defaultForegroundBrush, options))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_SetTransform(This, transform) \
|
|
||||||
((This)->lpVtbl->Base.Base.SetTransform((ID2D1RenderTarget *)This, transform))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetTransform(This, transform) \
|
|
||||||
((This)->lpVtbl->Base.Base.GetTransform((ID2D1RenderTarget *)This, transform))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_SetAntialiasMode(This, antialiasMode) \
|
|
||||||
((This)->lpVtbl->Base.Base.SetAntialiasMode((ID2D1RenderTarget *)This, antialiasMode))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetAntialiasMode(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.GetAntialiasMode((ID2D1RenderTarget *)This))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_SetTextAntialiasMode(This, textAntialiasMode) \
|
|
||||||
((This)->lpVtbl->Base.Base.SetTextAntialiasMode((ID2D1RenderTarget *)This, textAntialiasMode))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetTextAntialiasMode(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.GetTextAntialiasMode((ID2D1RenderTarget *)This))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_SetTextRenderingParams(This, textRenderingParams) \
|
|
||||||
((This)->lpVtbl->Base.Base.SetTextRenderingParams((ID2D1RenderTarget *)This, textRenderingParams))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetTextRenderingParams(This, textRenderingParams) \
|
|
||||||
((This)->lpVtbl->Base.Base.GetTextRenderingParams((ID2D1RenderTarget *)This, textRenderingParams))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_SetTags(This, tag1, tag2) \
|
|
||||||
((This)->lpVtbl->Base.Base.SetTags((ID2D1RenderTarget *)This, tag1, tag2))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetTags(This, tag1, tag2) \
|
|
||||||
((This)->lpVtbl->Base.Base.GetTags((ID2D1RenderTarget *)This, tag1, tag2))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_PopLayer(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.PopLayer((ID2D1RenderTarget *)This))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_Flush(This, tag1, tag2) \
|
|
||||||
((This)->lpVtbl->Base.Base.Flush((ID2D1RenderTarget *)This, tag1, tag2))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_SaveDrawingState(This, drawingStateBlock) \
|
|
||||||
((This)->lpVtbl->Base.Base.SaveDrawingState((ID2D1RenderTarget *)This, drawingStateBlock))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_RestoreDrawingState(This, drawingStateBlock) \
|
|
||||||
((This)->lpVtbl->Base.Base.RestoreDrawingState((ID2D1RenderTarget *)This, drawingStateBlock))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_PushAxisAlignedClip(This, clipRect, antialiasMode) \
|
|
||||||
((This)->lpVtbl->Base.Base.PushAxisAlignedClip((ID2D1RenderTarget *)This, clipRect, antialiasMode))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_PopAxisAlignedClip(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.PopAxisAlignedClip((ID2D1RenderTarget *)This))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_Clear(This, clearColor) \
|
|
||||||
((This)->lpVtbl->Base.Base.Clear((ID2D1RenderTarget *)This, clearColor))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_BeginDraw(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.BeginDraw((ID2D1RenderTarget *)This))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_EndDraw(This, tag1, tag2) \
|
|
||||||
((This)->lpVtbl->Base.Base.EndDraw((ID2D1RenderTarget *)This, tag1, tag2))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetPixelFormat(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.GetPixelFormat((ID2D1RenderTarget *)This))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_SetDpi(This, dpiX, dpiY) \
|
|
||||||
((This)->lpVtbl->Base.Base.SetDpi((ID2D1RenderTarget *)This, dpiX, dpiY))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetDpi(This, dpiX, dpiY) \
|
|
||||||
((This)->lpVtbl->Base.Base.GetDpi((ID2D1RenderTarget *)This, dpiX, dpiY))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetSize(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.GetSize((ID2D1RenderTarget *)This))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetPixelSize(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.GetPixelSize((ID2D1RenderTarget *)This))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetMaximumBitmapSize(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.GetMaximumBitmapSize((ID2D1RenderTarget *)This))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_IsSupported(This, renderTargetProperties) \
|
|
||||||
((This)->lpVtbl->Base.Base.IsSupported((ID2D1RenderTarget *)This, renderTargetProperties))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateBitmap(This, size, sourceData, pitch, bitmapProperties, bitmap) \
|
|
||||||
((This)->lpVtbl->Base.CreateBitmap((ID2D1DeviceContext *)This, size, sourceData, pitch, bitmapProperties, bitmap))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateBitmapFromWicBitmap(This, wicBitmapSource, bitmapProperties, bitmap) \
|
|
||||||
((This)->lpVtbl->Base.CreateBitmapFromWicBitmap((ID2D1DeviceContext *)This, wicBitmapSource, bitmapProperties, bitmap))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateColorContext(This, space, profile, profileSize, colorContext) \
|
|
||||||
((This)->lpVtbl->Base.CreateColorContext((ID2D1DeviceContext *)This, space, profile, profileSize, colorContext))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateColorContextFromFilename(This, filename, colorContext) \
|
|
||||||
((This)->lpVtbl->Base.CreateColorContextFromFilename((ID2D1DeviceContext *)This, filename, colorContext))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateColorContextFromWicColorContext(This, wicColorContext, colorContext) \
|
|
||||||
((This)->lpVtbl->Base.CreateColorContextFromWicColorContext((ID2D1DeviceContext *)This, wicColorContext, colorContext))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateBitmapFromDxgiSurface(This, surface, bitmapProperties, bitmap) \
|
|
||||||
((This)->lpVtbl->Base.CreateBitmapFromDxgiSurface((ID2D1DeviceContext *)This, surface, bitmapProperties, bitmap))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateEffect(This, effectId, effect) \
|
|
||||||
((This)->lpVtbl->Base.CreateEffect((ID2D1DeviceContext *)This, effectId, effect))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateGradientStopCollection(This, straightAlphaGradientStops, straightAlphaGradientStopsCount, preInterpolationSpace, postInterpolationSpace, bufferPrecision, extendMode, colorInterpolationMode, gradientStopCollection1) \
|
|
||||||
((This)->lpVtbl->Base.CreateGradientStopCollection((ID2D1DeviceContext *)This, straightAlphaGradientStops, straightAlphaGradientStopsCount, preInterpolationSpace, postInterpolationSpace, bufferPrecision, extendMode, colorInterpolationMode, gradientStopCollection1))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateImageBrush(This, image, imageBrushProperties, brushProperties, imageBrush) \
|
|
||||||
((This)->lpVtbl->Base.CreateImageBrush((ID2D1DeviceContext *)This, image, imageBrushProperties, brushProperties, imageBrush))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateBitmapBrush(This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush) \
|
|
||||||
((This)->lpVtbl->Base.CreateBitmapBrush((ID2D1DeviceContext *)This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateCommandList(This, commandList) \
|
|
||||||
((This)->lpVtbl->Base.CreateCommandList((ID2D1DeviceContext *)This, commandList))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_IsDxgiFormatSupported(This, format) \
|
|
||||||
((This)->lpVtbl->Base.IsDxgiFormatSupported((ID2D1DeviceContext *)This, format))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_IsBufferPrecisionSupported(This, bufferPrecision) \
|
|
||||||
((This)->lpVtbl->Base.IsBufferPrecisionSupported((ID2D1DeviceContext *)This, bufferPrecision))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetImageLocalBounds(This, image, localBounds) \
|
|
||||||
((This)->lpVtbl->Base.GetImageLocalBounds((ID2D1DeviceContext *)This, image, localBounds))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetImageWorldBounds(This, image, worldBounds) \
|
|
||||||
((This)->lpVtbl->Base.GetImageWorldBounds((ID2D1DeviceContext *)This, image, worldBounds))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetGlyphRunWorldBounds(This, baselineOrigin, glyphRun, measuringMode, bounds) \
|
|
||||||
((This)->lpVtbl->Base.GetGlyphRunWorldBounds((ID2D1DeviceContext *)This, baselineOrigin, glyphRun, measuringMode, bounds))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetDevice(This, device) \
|
|
||||||
((This)->lpVtbl->Base.GetDevice((ID2D1DeviceContext *)This, device))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_SetTarget(This, image) \
|
|
||||||
((This)->lpVtbl->Base.SetTarget((ID2D1DeviceContext *)This, image))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetTarget(This, image) \
|
|
||||||
((This)->lpVtbl->Base.GetTarget((ID2D1DeviceContext *)This, image))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_SetRenderingControls(This, renderingControls) \
|
|
||||||
((This)->lpVtbl->Base.SetRenderingControls((ID2D1DeviceContext *)This, renderingControls))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetRenderingControls(This, renderingControls) \
|
|
||||||
((This)->lpVtbl->Base.GetRenderingControls((ID2D1DeviceContext *)This, renderingControls))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_SetPrimitiveBlend(This, primitiveBlend) \
|
|
||||||
((This)->lpVtbl->Base.SetPrimitiveBlend((ID2D1DeviceContext *)This, primitiveBlend))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetPrimitiveBlend(This) \
|
|
||||||
((This)->lpVtbl->Base.GetPrimitiveBlend((ID2D1DeviceContext *)This))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_SetUnitMode(This, unitMode) \
|
|
||||||
((This)->lpVtbl->Base.SetUnitMode((ID2D1DeviceContext *)This, unitMode))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetUnitMode(This) \
|
|
||||||
((This)->lpVtbl->Base.GetUnitMode((ID2D1DeviceContext *)This))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_DrawGlyphRun(This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode) \
|
|
||||||
((This)->lpVtbl->Base.DrawGlyphRun((ID2D1DeviceContext *)This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_DrawImage(This, image, targetOffset, imageRectangle, interpolationMode, compositeMode) \
|
|
||||||
((This)->lpVtbl->Base.DrawImage((ID2D1DeviceContext *)This, image, targetOffset, imageRectangle, interpolationMode, compositeMode))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_DrawGdiMetafile(This, gdiMetafile, targetOffset) \
|
|
||||||
((This)->lpVtbl->Base.DrawGdiMetafile((ID2D1DeviceContext *)This, gdiMetafile, targetOffset))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_DrawBitmap(This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform) \
|
|
||||||
((This)->lpVtbl->Base.DrawBitmap((ID2D1DeviceContext *)This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_PushLayer(This, layerParameters, layer) \
|
|
||||||
((This)->lpVtbl->Base.PushLayer((ID2D1DeviceContext *)This, layerParameters, layer))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_InvalidateEffectInputRectangle(This, effect, input, inputRectangle) \
|
|
||||||
((This)->lpVtbl->Base.InvalidateEffectInputRectangle((ID2D1DeviceContext *)This, effect, input, inputRectangle))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetEffectInvalidRectangleCount(This, effect, rectangleCount) \
|
|
||||||
((This)->lpVtbl->Base.GetEffectInvalidRectangleCount((ID2D1DeviceContext *)This, effect, rectangleCount))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetEffectInvalidRectangles(This, effect, rectangles, rectanglesCount) \
|
|
||||||
((This)->lpVtbl->Base.GetEffectInvalidRectangles((ID2D1DeviceContext *)This, effect, rectangles, rectanglesCount))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_GetEffectRequiredInputRectangles(This, renderEffect, renderImageRectangle, inputDescriptions, requiredInputRects, inputCount) \
|
|
||||||
((This)->lpVtbl->Base.GetEffectRequiredInputRectangles((ID2D1DeviceContext *)This, renderEffect, renderImageRectangle, inputDescriptions, requiredInputRects, inputCount))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_FillOpacityMask(This, opacityMask, brush, destinationRectangle, sourceRectangle) \
|
|
||||||
((This)->lpVtbl->Base.FillOpacityMask((ID2D1DeviceContext *)This, opacityMask, brush, destinationRectangle, sourceRectangle))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateFilledGeometryRealization(This, geometry, flatteningTolerance, geometryRealization) \
|
|
||||||
((This)->lpVtbl->CreateFilledGeometryRealization(This, geometry, flatteningTolerance, geometryRealization))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_CreateStrokedGeometryRealization(This, geometry, flatteningTolerance, strokeWidth, strokeStyle, geometryRealization) \
|
|
||||||
((This)->lpVtbl->CreateStrokedGeometryRealization(This, geometry, flatteningTolerance, strokeWidth, strokeStyle, geometryRealization))
|
|
||||||
|
|
||||||
#define ID2D1DeviceContext1_DrawGeometryRealization(This, geometryRealization, brush) \
|
|
||||||
((This)->lpVtbl->DrawGeometryRealization(This, geometryRealization, brush))
|
|
||||||
|
|
||||||
typedef interface ID2D1Device1 ID2D1Device1;
|
|
||||||
|
|
||||||
typedef struct ID2D1Device1Vtbl
|
|
||||||
{
|
|
||||||
|
|
||||||
ID2D1DeviceVtbl Base;
|
|
||||||
|
|
||||||
|
|
||||||
STDMETHOD_(D2D1_RENDERING_PRIORITY, GetRenderingPriority)(
|
|
||||||
ID2D1Device1 *This
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(void, SetRenderingPriority)(
|
|
||||||
ID2D1Device1 *This,
|
|
||||||
D2D1_RENDERING_PRIORITY renderingPriority
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(CreateDeviceContext)(
|
|
||||||
ID2D1Device1 *This,
|
|
||||||
D2D1_DEVICE_CONTEXT_OPTIONS options,
|
|
||||||
_Outptr_ ID2D1DeviceContext1 **deviceContext1
|
|
||||||
) PURE;
|
|
||||||
} ID2D1Device1Vtbl;
|
|
||||||
|
|
||||||
interface ID2D1Device1
|
|
||||||
{
|
|
||||||
CONST struct ID2D1Device1Vtbl *lpVtbl;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define ID2D1Device1_QueryInterface(This, riid, ppv) \
|
|
||||||
((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
|
|
||||||
|
|
||||||
#define ID2D1Device1_AddRef(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This))
|
|
||||||
|
|
||||||
#define ID2D1Device1_Release(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This))
|
|
||||||
|
|
||||||
#define ID2D1Device1_GetFactory(This, factory) \
|
|
||||||
((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory))
|
|
||||||
|
|
||||||
#define ID2D1Device1_CreatePrintControl(This, wicFactory, documentTarget, printControlProperties, printControl) \
|
|
||||||
((This)->lpVtbl->Base.CreatePrintControl((ID2D1Device *)This, wicFactory, documentTarget, printControlProperties, printControl))
|
|
||||||
|
|
||||||
#define ID2D1Device1_SetMaximumTextureMemory(This, maximumInBytes) \
|
|
||||||
((This)->lpVtbl->Base.SetMaximumTextureMemory((ID2D1Device *)This, maximumInBytes))
|
|
||||||
|
|
||||||
#define ID2D1Device1_GetMaximumTextureMemory(This) \
|
|
||||||
((This)->lpVtbl->Base.GetMaximumTextureMemory((ID2D1Device *)This))
|
|
||||||
|
|
||||||
#define ID2D1Device1_ClearResources(This, millisecondsSinceUse) \
|
|
||||||
((This)->lpVtbl->Base.ClearResources((ID2D1Device *)This, millisecondsSinceUse))
|
|
||||||
|
|
||||||
#define ID2D1Device1_GetRenderingPriority(This) \
|
|
||||||
((This)->lpVtbl->GetRenderingPriority(This))
|
|
||||||
|
|
||||||
#define ID2D1Device1_SetRenderingPriority(This, renderingPriority) \
|
|
||||||
((This)->lpVtbl->SetRenderingPriority(This, renderingPriority))
|
|
||||||
|
|
||||||
#define ID2D1Device1_CreateDeviceContext(This, options, deviceContext1) \
|
|
||||||
((This)->lpVtbl->CreateDeviceContext(This, options, deviceContext1))
|
|
||||||
|
|
||||||
typedef interface ID2D1Factory2 ID2D1Factory2;
|
|
||||||
|
|
||||||
typedef struct ID2D1Factory2Vtbl
|
|
||||||
{
|
|
||||||
|
|
||||||
ID2D1Factory1Vtbl Base;
|
|
||||||
|
|
||||||
|
|
||||||
STDMETHOD(CreateDevice)(
|
|
||||||
ID2D1Factory2 *This,
|
|
||||||
_In_ IDXGIDevice *dxgiDevice,
|
|
||||||
_Outptr_ ID2D1Device1 **d2dDevice1
|
|
||||||
) PURE;
|
|
||||||
} ID2D1Factory2Vtbl;
|
|
||||||
|
|
||||||
interface ID2D1Factory2
|
|
||||||
{
|
|
||||||
CONST struct ID2D1Factory2Vtbl *lpVtbl;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define ID2D1Factory2_QueryInterface(This, riid, ppv) \
|
|
||||||
((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_AddRef(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_Release(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_ReloadSystemMetrics(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.ReloadSystemMetrics((ID2D1Factory *)This))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_GetDesktopDpi(This, dpiX, dpiY) \
|
|
||||||
((This)->lpVtbl->Base.Base.GetDesktopDpi((ID2D1Factory *)This, dpiX, dpiY))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreateRectangleGeometry(This, rectangle, rectangleGeometry) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateRectangleGeometry((ID2D1Factory *)This, rectangle, rectangleGeometry))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreateRoundedRectangleGeometry(This, roundedRectangle, roundedRectangleGeometry) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateRoundedRectangleGeometry((ID2D1Factory *)This, roundedRectangle, roundedRectangleGeometry))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreateEllipseGeometry(This, ellipse, ellipseGeometry) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateEllipseGeometry((ID2D1Factory *)This, ellipse, ellipseGeometry))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreateGeometryGroup(This, fillMode, geometries, geometriesCount, geometryGroup) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateGeometryGroup((ID2D1Factory *)This, fillMode, geometries, geometriesCount, geometryGroup))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreateTransformedGeometry(This, sourceGeometry, transform, transformedGeometry) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateTransformedGeometry((ID2D1Factory *)This, sourceGeometry, transform, transformedGeometry))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreateWicBitmapRenderTarget(This, target, renderTargetProperties, renderTarget) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateWicBitmapRenderTarget((ID2D1Factory *)This, target, renderTargetProperties, renderTarget))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreateHwndRenderTarget(This, renderTargetProperties, hwndRenderTargetProperties, hwndRenderTarget) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateHwndRenderTarget((ID2D1Factory *)This, renderTargetProperties, hwndRenderTargetProperties, hwndRenderTarget))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreateDxgiSurfaceRenderTarget(This, dxgiSurface, renderTargetProperties, renderTarget) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateDxgiSurfaceRenderTarget((ID2D1Factory *)This, dxgiSurface, renderTargetProperties, renderTarget))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreateDCRenderTarget(This, renderTargetProperties, dcRenderTarget) \
|
|
||||||
((This)->lpVtbl->Base.Base.CreateDCRenderTarget((ID2D1Factory *)This, renderTargetProperties, dcRenderTarget))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreateStrokeStyle(This, strokeStyleProperties, dashes, dashesCount, strokeStyle) \
|
|
||||||
((This)->lpVtbl->Base.CreateStrokeStyle((ID2D1Factory1 *)This, strokeStyleProperties, dashes, dashesCount, strokeStyle))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreatePathGeometry(This, pathGeometry) \
|
|
||||||
((This)->lpVtbl->Base.CreatePathGeometry((ID2D1Factory1 *)This, pathGeometry))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreateDrawingStateBlock(This, drawingStateDescription, textRenderingParams, drawingStateBlock) \
|
|
||||||
((This)->lpVtbl->Base.CreateDrawingStateBlock((ID2D1Factory1 *)This, drawingStateDescription, textRenderingParams, drawingStateBlock))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreateGdiMetafile(This, metafileStream, metafile) \
|
|
||||||
((This)->lpVtbl->Base.CreateGdiMetafile((ID2D1Factory1 *)This, metafileStream, metafile))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_RegisterEffectFromStream(This, classId, propertyXml, bindings, bindingsCount, effectFactory) \
|
|
||||||
((This)->lpVtbl->Base.RegisterEffectFromStream((ID2D1Factory1 *)This, classId, propertyXml, bindings, bindingsCount, effectFactory))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_RegisterEffectFromString(This, classId, propertyXml, bindings, bindingsCount, effectFactory) \
|
|
||||||
((This)->lpVtbl->Base.RegisterEffectFromString((ID2D1Factory1 *)This, classId, propertyXml, bindings, bindingsCount, effectFactory))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_UnregisterEffect(This, classId) \
|
|
||||||
((This)->lpVtbl->Base.UnregisterEffect((ID2D1Factory1 *)This, classId))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_GetRegisteredEffects(This, effects, effectsCount, effectsReturned, effectsRegistered) \
|
|
||||||
((This)->lpVtbl->Base.GetRegisteredEffects((ID2D1Factory1 *)This, effects, effectsCount, effectsReturned, effectsRegistered))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_GetEffectProperties(This, effectId, properties) \
|
|
||||||
((This)->lpVtbl->Base.GetEffectProperties((ID2D1Factory1 *)This, effectId, properties))
|
|
||||||
|
|
||||||
#define ID2D1Factory2_CreateDevice(This, dxgiDevice, d2dDevice1) \
|
|
||||||
((This)->lpVtbl->CreateDevice(This, dxgiDevice, d2dDevice1))
|
|
||||||
|
|
||||||
typedef interface ID2D1CommandSink1 ID2D1CommandSink1;
|
|
||||||
|
|
||||||
typedef struct ID2D1CommandSink1Vtbl
|
|
||||||
{
|
|
||||||
|
|
||||||
ID2D1CommandSinkVtbl Base;
|
|
||||||
|
|
||||||
|
|
||||||
STDMETHOD(SetPrimitiveBlend1)(
|
|
||||||
ID2D1CommandSink1 *This,
|
|
||||||
D2D1_PRIMITIVE_BLEND primitiveBlend
|
|
||||||
) PURE;
|
|
||||||
} ID2D1CommandSink1Vtbl;
|
|
||||||
|
|
||||||
interface ID2D1CommandSink1
|
|
||||||
{
|
|
||||||
CONST struct ID2D1CommandSink1Vtbl *lpVtbl;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_QueryInterface(This, riid, ppv) \
|
|
||||||
((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_AddRef(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_Release(This) \
|
|
||||||
((This)->lpVtbl->Base.Base.Release((IUnknown *)This))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_BeginDraw(This) \
|
|
||||||
((This)->lpVtbl->Base.BeginDraw((ID2D1CommandSink *)This))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_EndDraw(This) \
|
|
||||||
((This)->lpVtbl->Base.EndDraw((ID2D1CommandSink *)This))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_SetAntialiasMode(This, antialiasMode) \
|
|
||||||
((This)->lpVtbl->Base.SetAntialiasMode((ID2D1CommandSink *)This, antialiasMode))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_SetTags(This, tag1, tag2) \
|
|
||||||
((This)->lpVtbl->Base.SetTags((ID2D1CommandSink *)This, tag1, tag2))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_SetTextAntialiasMode(This, textAntialiasMode) \
|
|
||||||
((This)->lpVtbl->Base.SetTextAntialiasMode((ID2D1CommandSink *)This, textAntialiasMode))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_SetTextRenderingParams(This, textRenderingParams) \
|
|
||||||
((This)->lpVtbl->Base.SetTextRenderingParams((ID2D1CommandSink *)This, textRenderingParams))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_SetTransform(This, transform) \
|
|
||||||
((This)->lpVtbl->Base.SetTransform((ID2D1CommandSink *)This, transform))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_SetPrimitiveBlend(This, primitiveBlend) \
|
|
||||||
((This)->lpVtbl->Base.SetPrimitiveBlend((ID2D1CommandSink *)This, primitiveBlend))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_SetUnitMode(This, unitMode) \
|
|
||||||
((This)->lpVtbl->Base.SetUnitMode((ID2D1CommandSink *)This, unitMode))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_Clear(This, color) \
|
|
||||||
((This)->lpVtbl->Base.Clear((ID2D1CommandSink *)This, color))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_DrawGlyphRun(This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode) \
|
|
||||||
((This)->lpVtbl->Base.DrawGlyphRun((ID2D1CommandSink *)This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_DrawLine(This, point0, point1, brush, strokeWidth, strokeStyle) \
|
|
||||||
((This)->lpVtbl->Base.DrawLine((ID2D1CommandSink *)This, point0, point1, brush, strokeWidth, strokeStyle))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_DrawGeometry(This, geometry, brush, strokeWidth, strokeStyle) \
|
|
||||||
((This)->lpVtbl->Base.DrawGeometry((ID2D1CommandSink *)This, geometry, brush, strokeWidth, strokeStyle))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_DrawRectangle(This, rect, brush, strokeWidth, strokeStyle) \
|
|
||||||
((This)->lpVtbl->Base.DrawRectangle((ID2D1CommandSink *)This, rect, brush, strokeWidth, strokeStyle))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_DrawBitmap(This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform) \
|
|
||||||
((This)->lpVtbl->Base.DrawBitmap((ID2D1CommandSink *)This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_DrawImage(This, image, targetOffset, imageRectangle, interpolationMode, compositeMode) \
|
|
||||||
((This)->lpVtbl->Base.DrawImage((ID2D1CommandSink *)This, image, targetOffset, imageRectangle, interpolationMode, compositeMode))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_DrawGdiMetafile(This, gdiMetafile, targetOffset) \
|
|
||||||
((This)->lpVtbl->Base.DrawGdiMetafile((ID2D1CommandSink *)This, gdiMetafile, targetOffset))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_FillMesh(This, mesh, brush) \
|
|
||||||
((This)->lpVtbl->Base.FillMesh((ID2D1CommandSink *)This, mesh, brush))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_FillOpacityMask(This, opacityMask, brush, destinationRectangle, sourceRectangle) \
|
|
||||||
((This)->lpVtbl->Base.FillOpacityMask((ID2D1CommandSink *)This, opacityMask, brush, destinationRectangle, sourceRectangle))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_FillGeometry(This, geometry, brush, opacityBrush) \
|
|
||||||
((This)->lpVtbl->Base.FillGeometry((ID2D1CommandSink *)This, geometry, brush, opacityBrush))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_FillRectangle(This, rect, brush) \
|
|
||||||
((This)->lpVtbl->Base.FillRectangle((ID2D1CommandSink *)This, rect, brush))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_PushAxisAlignedClip(This, clipRect, antialiasMode) \
|
|
||||||
((This)->lpVtbl->Base.PushAxisAlignedClip((ID2D1CommandSink *)This, clipRect, antialiasMode))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_PushLayer(This, layerParameters1, layer) \
|
|
||||||
((This)->lpVtbl->Base.PushLayer((ID2D1CommandSink *)This, layerParameters1, layer))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_PopAxisAlignedClip(This) \
|
|
||||||
((This)->lpVtbl->Base.PopAxisAlignedClip((ID2D1CommandSink *)This))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_PopLayer(This) \
|
|
||||||
((This)->lpVtbl->Base.PopLayer((ID2D1CommandSink *)This))
|
|
||||||
|
|
||||||
#define ID2D1CommandSink1_SetPrimitiveBlend1(This, primitiveBlend) \
|
|
||||||
((This)->lpVtbl->SetPrimitiveBlend1(This, primitiveBlend))
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if NTDDI_VERSION >= NTDDI_WINBLUE
|
|
||||||
FLOAT WINAPI
|
|
||||||
D2D1ComputeMaximumScaleFactor(
|
|
||||||
_In_ CONST D2D1_MATRIX_3X2_F *matrix
|
|
||||||
);
|
|
||||||
#endif // #if NTDDI_VERSION >= NTDDI_WINBLUE
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
|
||||||
#pragma endregion
|
|
||||||
#include <d2d1_2helper.h>
|
|
||||||
#endif // #ifndef _D2D1_2_H_
|
|
65
3rdparty/minidx12/Include/d2d1_2helper.h
vendored
65
3rdparty/minidx12/Include/d2d1_2helper.h
vendored
|
@ -1,65 +0,0 @@
|
||||||
|
|
||||||
/*=========================================================================*\
|
|
||||||
|
|
||||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
|
|
||||||
File: D2D1_2Helper.h
|
|
||||||
|
|
||||||
Module Name: D2D
|
|
||||||
|
|
||||||
Description: Helper files over the D2D interfaces and APIs.
|
|
||||||
|
|
||||||
\*=========================================================================*/
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma once
|
|
||||||
#endif // _MSC_VER
|
|
||||||
|
|
||||||
#ifndef _D2D1_2HELPER_H_
|
|
||||||
#define _D2D1_2HELPER_H_
|
|
||||||
|
|
||||||
#if NTDDI_VERSION >= NTDDI_WINBLUE
|
|
||||||
|
|
||||||
#ifndef _D2D1_2_H_
|
|
||||||
#include <d2d1_2.h>
|
|
||||||
#endif // #ifndef _D2D1_2_H_
|
|
||||||
|
|
||||||
#ifndef D2D_USE_C_DEFINITIONS
|
|
||||||
|
|
||||||
#include <winapifamily.h>
|
|
||||||
|
|
||||||
#pragma region Application Family
|
|
||||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
|
||||||
|
|
||||||
namespace D2D1
|
|
||||||
{
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
FLOAT
|
|
||||||
ComputeFlatteningTolerance(
|
|
||||||
_In_ CONST D2D1_MATRIX_3X2_F &matrix,
|
|
||||||
FLOAT dpiX = 96.0f,
|
|
||||||
FLOAT dpiY = 96.0f,
|
|
||||||
FLOAT maxZoomFactor = 1.0f
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_MATRIX_3X2_F dpiDependentTransform =
|
|
||||||
matrix * D2D1::Matrix3x2F::Scale(dpiX / 96.0f, dpiY / 96.0f);
|
|
||||||
|
|
||||||
FLOAT absMaxZoomFactor = (maxZoomFactor > 0) ? maxZoomFactor : -maxZoomFactor;
|
|
||||||
|
|
||||||
return D2D1_DEFAULT_FLATTENING_TOLERANCE /
|
|
||||||
(absMaxZoomFactor * D2D1ComputeMaximumScaleFactor(&dpiDependentTransform));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace D2D1
|
|
||||||
|
|
||||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
|
||||||
#pragma endregion
|
|
||||||
|
|
||||||
#endif // #ifndef D2D_USE_C_DEFINITIONS
|
|
||||||
|
|
||||||
#endif // #if NTDDI_VERSION >= NTDDI_WINBLUE
|
|
||||||
|
|
||||||
#endif // #ifndef _D2D1_HELPER_H_
|
|
||||||
|
|
2264
3rdparty/minidx12/Include/d2d1_3.h
vendored
2264
3rdparty/minidx12/Include/d2d1_3.h
vendored
File diff suppressed because it is too large
Load diff
228
3rdparty/minidx12/Include/d2d1_3helper.h
vendored
228
3rdparty/minidx12/Include/d2d1_3helper.h
vendored
|
@ -1,228 +0,0 @@
|
||||||
|
|
||||||
/*=========================================================================*\
|
|
||||||
|
|
||||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
|
|
||||||
File: D2D1_3Helper.h
|
|
||||||
|
|
||||||
Module Name: D2D
|
|
||||||
|
|
||||||
Description: Helper files over the D2D interfaces and APIs.
|
|
||||||
|
|
||||||
\*=========================================================================*/
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma once
|
|
||||||
#endif // _MSC_VER
|
|
||||||
|
|
||||||
#ifndef _D2D1_3HELPER_H_
|
|
||||||
#define _D2D1_3HELPER_H_
|
|
||||||
|
|
||||||
#if NTDDI_VERSION >= NTDDI_WINTHRESHOLD
|
|
||||||
|
|
||||||
#ifndef _D2D1_3_H_
|
|
||||||
#include <d2d1_3.h>
|
|
||||||
#endif // #ifndef _D2D1_3_H_
|
|
||||||
|
|
||||||
#ifndef D2D_USE_C_DEFINITIONS
|
|
||||||
|
|
||||||
#include <winapifamily.h>
|
|
||||||
|
|
||||||
#pragma region Application Family
|
|
||||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
|
||||||
|
|
||||||
namespace D2D1
|
|
||||||
{
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_GRADIENT_MESH_PATCH
|
|
||||||
GradientMeshPatch(
|
|
||||||
D2D1_POINT_2F point00,
|
|
||||||
D2D1_POINT_2F point01,
|
|
||||||
D2D1_POINT_2F point02,
|
|
||||||
D2D1_POINT_2F point03,
|
|
||||||
D2D1_POINT_2F point10,
|
|
||||||
D2D1_POINT_2F point11,
|
|
||||||
D2D1_POINT_2F point12,
|
|
||||||
D2D1_POINT_2F point13,
|
|
||||||
D2D1_POINT_2F point20,
|
|
||||||
D2D1_POINT_2F point21,
|
|
||||||
D2D1_POINT_2F point22,
|
|
||||||
D2D1_POINT_2F point23,
|
|
||||||
D2D1_POINT_2F point30,
|
|
||||||
D2D1_POINT_2F point31,
|
|
||||||
D2D1_POINT_2F point32,
|
|
||||||
D2D1_POINT_2F point33,
|
|
||||||
D2D1_COLOR_F color00,
|
|
||||||
D2D1_COLOR_F color03,
|
|
||||||
D2D1_COLOR_F color30,
|
|
||||||
D2D1_COLOR_F color33,
|
|
||||||
D2D1_PATCH_EDGE_MODE topEdgeMode,
|
|
||||||
D2D1_PATCH_EDGE_MODE leftEdgeMode,
|
|
||||||
D2D1_PATCH_EDGE_MODE bottomEdgeMode,
|
|
||||||
D2D1_PATCH_EDGE_MODE rightEdgeMode
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_GRADIENT_MESH_PATCH newPatch;
|
|
||||||
newPatch.point00 = point00;
|
|
||||||
newPatch.point01 = point01;
|
|
||||||
newPatch.point02 = point02;
|
|
||||||
newPatch.point03 = point03;
|
|
||||||
newPatch.point10 = point10;
|
|
||||||
newPatch.point11 = point11;
|
|
||||||
newPatch.point12 = point12;
|
|
||||||
newPatch.point13 = point13;
|
|
||||||
newPatch.point20 = point20;
|
|
||||||
newPatch.point21 = point21;
|
|
||||||
newPatch.point22 = point22;
|
|
||||||
newPatch.point23 = point23;
|
|
||||||
newPatch.point30 = point30;
|
|
||||||
newPatch.point31 = point31;
|
|
||||||
newPatch.point32 = point32;
|
|
||||||
newPatch.point33 = point33;
|
|
||||||
|
|
||||||
newPatch.color00 = color00;
|
|
||||||
newPatch.color03 = color03;
|
|
||||||
newPatch.color30 = color30;
|
|
||||||
newPatch.color33 = color33;
|
|
||||||
|
|
||||||
newPatch.topEdgeMode = topEdgeMode;
|
|
||||||
newPatch.leftEdgeMode = leftEdgeMode;
|
|
||||||
newPatch.bottomEdgeMode = bottomEdgeMode;
|
|
||||||
newPatch.rightEdgeMode = rightEdgeMode;
|
|
||||||
|
|
||||||
return newPatch;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_GRADIENT_MESH_PATCH
|
|
||||||
GradientMeshPatchFromCoonsPatch(
|
|
||||||
D2D1_POINT_2F point0,
|
|
||||||
D2D1_POINT_2F point1,
|
|
||||||
D2D1_POINT_2F point2,
|
|
||||||
D2D1_POINT_2F point3,
|
|
||||||
D2D1_POINT_2F point4,
|
|
||||||
D2D1_POINT_2F point5,
|
|
||||||
D2D1_POINT_2F point6,
|
|
||||||
D2D1_POINT_2F point7,
|
|
||||||
D2D1_POINT_2F point8,
|
|
||||||
D2D1_POINT_2F point9,
|
|
||||||
D2D1_POINT_2F point10,
|
|
||||||
D2D1_POINT_2F point11,
|
|
||||||
D2D1_COLOR_F color0,
|
|
||||||
D2D1_COLOR_F color1,
|
|
||||||
D2D1_COLOR_F color2,
|
|
||||||
D2D1_COLOR_F color3,
|
|
||||||
D2D1_PATCH_EDGE_MODE topEdgeMode,
|
|
||||||
D2D1_PATCH_EDGE_MODE leftEdgeMode,
|
|
||||||
D2D1_PATCH_EDGE_MODE bottomEdgeMode,
|
|
||||||
D2D1_PATCH_EDGE_MODE rightEdgeMode
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_GRADIENT_MESH_PATCH newPatch;
|
|
||||||
newPatch.point00 = point0;
|
|
||||||
newPatch.point01 = point1;
|
|
||||||
newPatch.point02 = point2;
|
|
||||||
newPatch.point03 = point3;
|
|
||||||
newPatch.point13 = point4;
|
|
||||||
newPatch.point23 = point5;
|
|
||||||
newPatch.point33 = point6;
|
|
||||||
newPatch.point32 = point7;
|
|
||||||
newPatch.point31 = point8;
|
|
||||||
newPatch.point30 = point9;
|
|
||||||
newPatch.point20 = point10;
|
|
||||||
newPatch.point10 = point11;
|
|
||||||
|
|
||||||
D2D1GetGradientMeshInteriorPointsFromCoonsPatch(
|
|
||||||
&point0,
|
|
||||||
&point1,
|
|
||||||
&point2,
|
|
||||||
&point3,
|
|
||||||
&point4,
|
|
||||||
&point5,
|
|
||||||
&point6,
|
|
||||||
&point7,
|
|
||||||
&point8,
|
|
||||||
&point9,
|
|
||||||
&point10,
|
|
||||||
&point11,
|
|
||||||
&newPatch.point11,
|
|
||||||
&newPatch.point12,
|
|
||||||
&newPatch.point21,
|
|
||||||
&newPatch.point22
|
|
||||||
);
|
|
||||||
|
|
||||||
newPatch.color00 = color0;
|
|
||||||
newPatch.color03 = color1;
|
|
||||||
newPatch.color33 = color2;
|
|
||||||
newPatch.color30 = color3;
|
|
||||||
newPatch.topEdgeMode = topEdgeMode;
|
|
||||||
newPatch.leftEdgeMode = leftEdgeMode;
|
|
||||||
newPatch.bottomEdgeMode = bottomEdgeMode;
|
|
||||||
newPatch.rightEdgeMode = rightEdgeMode;
|
|
||||||
|
|
||||||
return newPatch;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_INK_POINT
|
|
||||||
InkPoint(
|
|
||||||
const D2D1_POINT_2F &point,
|
|
||||||
FLOAT radius
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_INK_POINT inkPoint;
|
|
||||||
|
|
||||||
inkPoint.x = point.x;
|
|
||||||
inkPoint.y = point.y;
|
|
||||||
inkPoint.radius = radius;
|
|
||||||
|
|
||||||
return inkPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_INK_BEZIER_SEGMENT
|
|
||||||
InkBezierSegment(
|
|
||||||
const D2D1_INK_POINT &point1,
|
|
||||||
const D2D1_INK_POINT &point2,
|
|
||||||
const D2D1_INK_POINT &point3
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_INK_BEZIER_SEGMENT inkBezierSegment;
|
|
||||||
|
|
||||||
inkBezierSegment.point1 = point1;
|
|
||||||
inkBezierSegment.point2 = point2;
|
|
||||||
inkBezierSegment.point3 = point3;
|
|
||||||
|
|
||||||
return inkBezierSegment;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_DECLSPEC_NOTHROW
|
|
||||||
D2D1FORCEINLINE
|
|
||||||
D2D1_INK_STYLE_PROPERTIES
|
|
||||||
InkStyleProperties(
|
|
||||||
D2D1_INK_NIB_SHAPE nibShape,
|
|
||||||
const D2D1_MATRIX_3X2_F &nibTransform
|
|
||||||
)
|
|
||||||
{
|
|
||||||
D2D1_INK_STYLE_PROPERTIES inkStyleProperties;
|
|
||||||
|
|
||||||
inkStyleProperties.nibShape = nibShape;
|
|
||||||
inkStyleProperties.nibTransform = nibTransform;
|
|
||||||
|
|
||||||
return inkStyleProperties;
|
|
||||||
}
|
|
||||||
} // namespace D2D1
|
|
||||||
|
|
||||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
|
||||||
#pragma endregion
|
|
||||||
|
|
||||||
#endif // #ifndef D2D_USE_C_DEFINITIONS
|
|
||||||
|
|
||||||
#endif // #if NTDDI_VERSION >= NTDDI_WINTHRESHOLD
|
|
||||||
|
|
||||||
#endif // #ifndef _D2D1_HELPER_H_
|
|
||||||
|
|
2307
3rdparty/minidx12/Include/d2d1effects.h
vendored
2307
3rdparty/minidx12/Include/d2d1effects.h
vendored
File diff suppressed because it is too large
Load diff
102
3rdparty/minidx12/Include/d2d1effects_1.h
vendored
102
3rdparty/minidx12/Include/d2d1effects_1.h
vendored
|
@ -1,102 +0,0 @@
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
//
|
|
||||||
// This file is automatically generated. Please do not edit it directly.
|
|
||||||
//
|
|
||||||
// File name: D2D1Effects_1.h
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma once
|
|
||||||
#endif // #ifdef _MSC_VER
|
|
||||||
|
|
||||||
#ifndef _D2D1_EFFECTS_1_
|
|
||||||
#define _D2D1_EFFECTS_1_
|
|
||||||
|
|
||||||
#ifndef _D2D1_EFFECTS_
|
|
||||||
#include <d2d1effects.h>
|
|
||||||
#endif // #ifndef _D2D1_EFFECTS_
|
|
||||||
|
|
||||||
|
|
||||||
#include <winapifamily.h>
|
|
||||||
|
|
||||||
#pragma region Application Family
|
|
||||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
|
||||||
|
|
||||||
// Built in effect CLSIDs
|
|
||||||
DEFINE_GUID(CLSID_D2D1YCbCr, 0x99503cc1, 0x66c7, 0x45c9, 0xa8, 0x75, 0x8a, 0xd8, 0xa7, 0x91, 0x44, 0x01);
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_YCBCR_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the YCbCr effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_YCBCR_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "ChromaSubsampling"
|
|
||||||
// Property Type: D2D1_YCBCR_CHROMA_SUBSAMPLING
|
|
||||||
//
|
|
||||||
D2D1_YCBCR_PROP_CHROMA_SUBSAMPLING = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "TransformMatrix"
|
|
||||||
// Property Type: D2D1_MATRIX_3X2_F
|
|
||||||
//
|
|
||||||
D2D1_YCBCR_PROP_TRANSFORM_MATRIX = 1,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "InterpolationMode"
|
|
||||||
// Property Type: D2D1_YCBCR_INTERPOLATION_MODE
|
|
||||||
//
|
|
||||||
D2D1_YCBCR_PROP_INTERPOLATION_MODE = 2,
|
|
||||||
D2D1_YCBCR_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_YCBCR_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_YCBCR_CHROMA_SUBSAMPLING
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_YCBCR_CHROMA_SUBSAMPLING
|
|
||||||
{
|
|
||||||
D2D1_YCBCR_CHROMA_SUBSAMPLING_AUTO = 0,
|
|
||||||
D2D1_YCBCR_CHROMA_SUBSAMPLING_420 = 1,
|
|
||||||
D2D1_YCBCR_CHROMA_SUBSAMPLING_422 = 2,
|
|
||||||
D2D1_YCBCR_CHROMA_SUBSAMPLING_444 = 3,
|
|
||||||
D2D1_YCBCR_CHROMA_SUBSAMPLING_440 = 4,
|
|
||||||
D2D1_YCBCR_CHROMA_SUBSAMPLING_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_YCBCR_CHROMA_SUBSAMPLING;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_YCBCR_INTERPOLATION_MODE
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_YCBCR_INTERPOLATION_MODE
|
|
||||||
{
|
|
||||||
D2D1_YCBCR_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0,
|
|
||||||
D2D1_YCBCR_INTERPOLATION_MODE_LINEAR = 1,
|
|
||||||
D2D1_YCBCR_INTERPOLATION_MODE_CUBIC = 2,
|
|
||||||
D2D1_YCBCR_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = 3,
|
|
||||||
D2D1_YCBCR_INTERPOLATION_MODE_ANISOTROPIC = 4,
|
|
||||||
D2D1_YCBCR_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = 5,
|
|
||||||
D2D1_YCBCR_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_YCBCR_INTERPOLATION_MODE;
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
|
||||||
#pragma endregion
|
|
||||||
|
|
||||||
#endif // #ifndef _D2D1_EFFECTS_1_
|
|
594
3rdparty/minidx12/Include/d2d1effects_2.h
vendored
594
3rdparty/minidx12/Include/d2d1effects_2.h
vendored
|
@ -1,594 +0,0 @@
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
//
|
|
||||||
// This file is automatically generated. Please do not edit it directly.
|
|
||||||
//
|
|
||||||
// File name: D2D1Effects_2.h
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma once
|
|
||||||
#endif // #ifdef _MSC_VER
|
|
||||||
|
|
||||||
#ifndef _D2D1_EFFECTS_2_
|
|
||||||
#define _D2D1_EFFECTS_2_
|
|
||||||
|
|
||||||
#ifndef _D2D1_EFFECTS_1_
|
|
||||||
#include <d2d1effects_1.h>
|
|
||||||
#endif // #ifndef _D2D1_EFFECTS_1_
|
|
||||||
|
|
||||||
|
|
||||||
#include <winapifamily.h>
|
|
||||||
|
|
||||||
#pragma region Application Family
|
|
||||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
|
||||||
|
|
||||||
// Built in effect CLSIDs
|
|
||||||
DEFINE_GUID(CLSID_D2D1Contrast, 0xb648a78a, 0x0ed5, 0x4f80, 0xa9, 0x4a, 0x8e, 0x82, 0x5a, 0xca, 0x6b, 0x77);
|
|
||||||
DEFINE_GUID(CLSID_D2D1RgbToHue, 0x23f3e5ec, 0x91e8, 0x4d3d, 0xad, 0x0a, 0xaf, 0xad, 0xc1, 0x00, 0x4a, 0xa1);
|
|
||||||
DEFINE_GUID(CLSID_D2D1HueToRgb, 0x7b78a6bd, 0x0141, 0x4def, 0x8a, 0x52, 0x63, 0x56, 0xee, 0x0c, 0xbd, 0xd5);
|
|
||||||
DEFINE_GUID(CLSID_D2D1ChromaKey, 0x74C01F5B, 0x2A0D, 0x408C, 0x88, 0xE2, 0xC7, 0xA3, 0xC7, 0x19, 0x77, 0x42);
|
|
||||||
DEFINE_GUID(CLSID_D2D1Emboss, 0xb1c5eb2b, 0x0348, 0x43f0, 0x81, 0x07, 0x49, 0x57, 0xca, 0xcb, 0xa2, 0xae);
|
|
||||||
DEFINE_GUID(CLSID_D2D1Exposure, 0xb56c8cfa, 0xf634, 0x41ee, 0xbe, 0xe0, 0xff, 0xa6, 0x17, 0x10, 0x60, 0x04);
|
|
||||||
DEFINE_GUID(CLSID_D2D1Grayscale, 0x36DDE0EB, 0x3725, 0x42E0, 0x83, 0x6D, 0x52, 0xFB, 0x20, 0xAE, 0xE6, 0x44);
|
|
||||||
DEFINE_GUID(CLSID_D2D1Invert, 0xe0c3784d, 0xcb39, 0x4e84, 0xb6, 0xfd, 0x6b, 0x72, 0xf0, 0x81, 0x02, 0x63);
|
|
||||||
DEFINE_GUID(CLSID_D2D1Posterize, 0x2188945e, 0x33a3, 0x4366, 0xb7, 0xbc, 0x08, 0x6b, 0xd0, 0x2d, 0x08, 0x84);
|
|
||||||
DEFINE_GUID(CLSID_D2D1Sepia, 0x3a1af410, 0x5f1d, 0x4dbe, 0x84, 0xdf, 0x91, 0x5d, 0xa7, 0x9b, 0x71, 0x53);
|
|
||||||
DEFINE_GUID(CLSID_D2D1Sharpen, 0xC9B887CB, 0xC5FF, 0x4DC5, 0x97, 0x79, 0x27, 0x3D, 0xCF, 0x41, 0x7C, 0x7D);
|
|
||||||
DEFINE_GUID(CLSID_D2D1Straighten, 0x4da47b12, 0x79a3, 0x4fb0, 0x82, 0x37, 0xbb, 0xc3, 0xb2, 0xa4, 0xde, 0x08);
|
|
||||||
DEFINE_GUID(CLSID_D2D1TemperatureTint, 0x89176087, 0x8AF9, 0x4A08, 0xAE, 0xB1, 0x89, 0x5F, 0x38, 0xDB, 0x17, 0x66);
|
|
||||||
DEFINE_GUID(CLSID_D2D1Vignette, 0xc00c40be, 0x5e67, 0x4ca3, 0x95, 0xb4, 0xf4, 0xb0, 0x2c, 0x11, 0x51, 0x35);
|
|
||||||
DEFINE_GUID(CLSID_D2D1EdgeDetection, 0xEFF583CA, 0xCB07, 0x4AA9, 0xAC, 0x5D, 0x2C, 0xC4, 0x4C, 0x76, 0x46, 0x0F);
|
|
||||||
DEFINE_GUID(CLSID_D2D1HighlightsShadows, 0xCADC8384, 0x323F, 0x4C7E, 0xA3, 0x61, 0x2E, 0x2B, 0x24, 0xDF, 0x6E, 0xE4);
|
|
||||||
DEFINE_GUID(CLSID_D2D1LookupTable3D, 0x349E0EDA, 0x0088, 0x4A79, 0x9C, 0xA3, 0xC7, 0xE3, 0x00, 0x20, 0x20, 0x20);
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_CONTRAST_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the Contrast effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_CONTRAST_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Contrast"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_CONTRAST_PROP_CONTRAST = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "ClampInput"
|
|
||||||
// Property Type: BOOL
|
|
||||||
//
|
|
||||||
D2D1_CONTRAST_PROP_CLAMP_INPUT = 1,
|
|
||||||
D2D1_CONTRAST_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_CONTRAST_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_RGBTOHUE_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the RgbToHue effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_RGBTOHUE_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "OutputColorSpace"
|
|
||||||
// Property Type: D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE
|
|
||||||
//
|
|
||||||
D2D1_RGBTOHUE_PROP_OUTPUT_COLOR_SPACE = 0,
|
|
||||||
D2D1_RGBTOHUE_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_RGBTOHUE_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE
|
|
||||||
{
|
|
||||||
D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE_HUE_SATURATION_VALUE = 0,
|
|
||||||
D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE_HUE_SATURATION_LIGHTNESS = 1,
|
|
||||||
D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_HUETORGB_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the HueToRgb effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_HUETORGB_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "InputColorSpace"
|
|
||||||
// Property Type: D2D1_HUETORGB_INPUT_COLOR_SPACE
|
|
||||||
//
|
|
||||||
D2D1_HUETORGB_PROP_INPUT_COLOR_SPACE = 0,
|
|
||||||
D2D1_HUETORGB_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_HUETORGB_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_HUETORGB_INPUT_COLOR_SPACE
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_HUETORGB_INPUT_COLOR_SPACE
|
|
||||||
{
|
|
||||||
D2D1_HUETORGB_INPUT_COLOR_SPACE_HUE_SATURATION_VALUE = 0,
|
|
||||||
D2D1_HUETORGB_INPUT_COLOR_SPACE_HUE_SATURATION_LIGHTNESS = 1,
|
|
||||||
D2D1_HUETORGB_INPUT_COLOR_SPACE_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_HUETORGB_INPUT_COLOR_SPACE;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_CHROMAKEY_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the Chroma Key effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_CHROMAKEY_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Color"
|
|
||||||
// Property Type: D2D1_VECTOR_3F
|
|
||||||
//
|
|
||||||
D2D1_CHROMAKEY_PROP_COLOR = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Tolerance"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_CHROMAKEY_PROP_TOLERANCE = 1,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "InvertAlpha"
|
|
||||||
// Property Type: BOOL
|
|
||||||
//
|
|
||||||
D2D1_CHROMAKEY_PROP_INVERT_ALPHA = 2,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Feather"
|
|
||||||
// Property Type: BOOL
|
|
||||||
//
|
|
||||||
D2D1_CHROMAKEY_PROP_FEATHER = 3,
|
|
||||||
D2D1_CHROMAKEY_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_CHROMAKEY_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_EMBOSS_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the Emboss effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_EMBOSS_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Height"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_EMBOSS_PROP_HEIGHT = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Direction"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_EMBOSS_PROP_DIRECTION = 1,
|
|
||||||
D2D1_EMBOSS_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_EMBOSS_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_EXPOSURE_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the Exposure effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_EXPOSURE_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "ExposureValue"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_EXPOSURE_PROP_EXPOSURE_VALUE = 0,
|
|
||||||
D2D1_EXPOSURE_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_EXPOSURE_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_POSTERIZE_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the Posterize effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_POSTERIZE_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "RedValueCount"
|
|
||||||
// Property Type: UINT32
|
|
||||||
//
|
|
||||||
D2D1_POSTERIZE_PROP_RED_VALUE_COUNT = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "GreenValueCount"
|
|
||||||
// Property Type: UINT32
|
|
||||||
//
|
|
||||||
D2D1_POSTERIZE_PROP_GREEN_VALUE_COUNT = 1,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "BlueValueCount"
|
|
||||||
// Property Type: UINT32
|
|
||||||
//
|
|
||||||
D2D1_POSTERIZE_PROP_BLUE_VALUE_COUNT = 2,
|
|
||||||
D2D1_POSTERIZE_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_POSTERIZE_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_SEPIA_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the Sepia effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_SEPIA_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Intensity"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_SEPIA_PROP_INTENSITY = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "AlphaMode"
|
|
||||||
// Property Type: D2D1_ALPHA_MODE
|
|
||||||
//
|
|
||||||
D2D1_SEPIA_PROP_ALPHA_MODE = 1,
|
|
||||||
D2D1_SEPIA_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_SEPIA_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_SHARPEN_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the Sharpen effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_SHARPEN_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Sharpness"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_SHARPEN_PROP_SHARPNESS = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Threshold"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_SHARPEN_PROP_THRESHOLD = 1,
|
|
||||||
D2D1_SHARPEN_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_SHARPEN_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_STRAIGHTEN_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the Straighten effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_STRAIGHTEN_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Angle"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_STRAIGHTEN_PROP_ANGLE = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "MaintainSize"
|
|
||||||
// Property Type: BOOL
|
|
||||||
//
|
|
||||||
D2D1_STRAIGHTEN_PROP_MAINTAIN_SIZE = 1,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "ScaleMode"
|
|
||||||
// Property Type: D2D1_STRAIGHTEN_SCALE_MODE
|
|
||||||
//
|
|
||||||
D2D1_STRAIGHTEN_PROP_SCALE_MODE = 2,
|
|
||||||
D2D1_STRAIGHTEN_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_STRAIGHTEN_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_STRAIGHTEN_SCALE_MODE
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_STRAIGHTEN_SCALE_MODE
|
|
||||||
{
|
|
||||||
D2D1_STRAIGHTEN_SCALE_MODE_NEAREST_NEIGHBOR = 0,
|
|
||||||
D2D1_STRAIGHTEN_SCALE_MODE_LINEAR = 1,
|
|
||||||
D2D1_STRAIGHTEN_SCALE_MODE_CUBIC = 2,
|
|
||||||
D2D1_STRAIGHTEN_SCALE_MODE_MULTI_SAMPLE_LINEAR = 3,
|
|
||||||
D2D1_STRAIGHTEN_SCALE_MODE_ANISOTROPIC = 4,
|
|
||||||
D2D1_STRAIGHTEN_SCALE_MODE_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_STRAIGHTEN_SCALE_MODE;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_TEMPERATUREANDTINT_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the Temperature And Tint effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_TEMPERATUREANDTINT_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Temperature"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_TEMPERATUREANDTINT_PROP_TEMPERATURE = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Tint"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_TEMPERATUREANDTINT_PROP_TINT = 1,
|
|
||||||
D2D1_TEMPERATUREANDTINT_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_TEMPERATUREANDTINT_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_VIGNETTE_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the Vignette effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_VIGNETTE_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Color"
|
|
||||||
// Property Type: D2D1_VECTOR_4F
|
|
||||||
//
|
|
||||||
D2D1_VIGNETTE_PROP_COLOR = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "TransitionSize"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_VIGNETTE_PROP_TRANSITION_SIZE = 1,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Strength"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_VIGNETTE_PROP_STRENGTH = 2,
|
|
||||||
D2D1_VIGNETTE_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_VIGNETTE_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_EDGEDETECTION_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the Edge Detection effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_EDGEDETECTION_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Strength"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_EDGEDETECTION_PROP_STRENGTH = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "BlurRadius"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_EDGEDETECTION_PROP_BLUR_RADIUS = 1,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Mode"
|
|
||||||
// Property Type: D2D1_EDGEDETECTION_MODE
|
|
||||||
//
|
|
||||||
D2D1_EDGEDETECTION_PROP_MODE = 2,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "OverlayEdges"
|
|
||||||
// Property Type: BOOL
|
|
||||||
//
|
|
||||||
D2D1_EDGEDETECTION_PROP_OVERLAY_EDGES = 3,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "AlphaMode"
|
|
||||||
// Property Type: D2D1_ALPHA_MODE
|
|
||||||
//
|
|
||||||
D2D1_EDGEDETECTION_PROP_ALPHA_MODE = 4,
|
|
||||||
D2D1_EDGEDETECTION_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_EDGEDETECTION_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_EDGEDETECTION_MODE
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_EDGEDETECTION_MODE
|
|
||||||
{
|
|
||||||
D2D1_EDGEDETECTION_MODE_SOBEL = 0,
|
|
||||||
D2D1_EDGEDETECTION_MODE_PREWITT = 1,
|
|
||||||
D2D1_EDGEDETECTION_MODE_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_EDGEDETECTION_MODE;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_HIGHLIGHTSANDSHADOWS_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the Highlights and Shadows effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_HIGHLIGHTSANDSHADOWS_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Highlights"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_HIGHLIGHTSANDSHADOWS_PROP_HIGHLIGHTS = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Shadows"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_HIGHLIGHTSANDSHADOWS_PROP_SHADOWS = 1,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Clarity"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_HIGHLIGHTSANDSHADOWS_PROP_CLARITY = 2,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "InputGamma"
|
|
||||||
// Property Type: D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA
|
|
||||||
//
|
|
||||||
D2D1_HIGHLIGHTSANDSHADOWS_PROP_INPUT_GAMMA = 3,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "MaskBlurRadius"
|
|
||||||
// Property Type: FLOAT
|
|
||||||
//
|
|
||||||
D2D1_HIGHLIGHTSANDSHADOWS_PROP_MASK_BLUR_RADIUS = 4,
|
|
||||||
D2D1_HIGHLIGHTSANDSHADOWS_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_HIGHLIGHTSANDSHADOWS_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA
|
|
||||||
{
|
|
||||||
D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA_LINEAR = 0,
|
|
||||||
D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA_SRGB = 1,
|
|
||||||
D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA;
|
|
||||||
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_LOOKUPTABLE3D_PROP
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The enumeration of the Lookup Table 3D effect's top level properties.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_LOOKUPTABLE3D_PROP
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "Lut"
|
|
||||||
// Property Type: IUnknown *
|
|
||||||
//
|
|
||||||
D2D1_LOOKUPTABLE3D_PROP_LUT = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Property Name: "AlphaMode"
|
|
||||||
// Property Type: D2D1_ALPHA_MODE
|
|
||||||
//
|
|
||||||
D2D1_LOOKUPTABLE3D_PROP_ALPHA_MODE = 1,
|
|
||||||
D2D1_LOOKUPTABLE3D_PROP_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_LOOKUPTABLE3D_PROP;
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
|
||||||
#pragma endregion
|
|
||||||
|
|
||||||
#endif // #ifndef _D2D1_EFFECTS_2_
|
|
6819
3rdparty/minidx12/Include/d3d10.h
vendored
6819
3rdparty/minidx12/Include/d3d10.h
vendored
File diff suppressed because it is too large
Load diff
1793
3rdparty/minidx12/Include/d3d10_1.h
vendored
1793
3rdparty/minidx12/Include/d3d10_1.h
vendored
File diff suppressed because it is too large
Load diff
306
3rdparty/minidx12/Include/d3d10_1shader.h
vendored
306
3rdparty/minidx12/Include/d3d10_1shader.h
vendored
|
@ -1,306 +0,0 @@
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
//
|
|
||||||
// File: D3D10_1Shader.h
|
|
||||||
// Content: D3D10.1 Shader Types and APIs
|
|
||||||
//
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef __D3D10_1SHADER_H__
|
|
||||||
#define __D3D10_1SHADER_H__
|
|
||||||
|
|
||||||
#include "d3d10shader.h"
|
|
||||||
|
|
||||||
#include <winapifamily.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// Shader debugging structures
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
typedef enum _D3D10_SHADER_DEBUG_REGTYPE
|
|
||||||
{
|
|
||||||
D3D10_SHADER_DEBUG_REG_INPUT,
|
|
||||||
D3D10_SHADER_DEBUG_REG_OUTPUT,
|
|
||||||
D3D10_SHADER_DEBUG_REG_CBUFFER,
|
|
||||||
D3D10_SHADER_DEBUG_REG_TBUFFER,
|
|
||||||
D3D10_SHADER_DEBUG_REG_TEMP,
|
|
||||||
D3D10_SHADER_DEBUG_REG_TEMPARRAY,
|
|
||||||
D3D10_SHADER_DEBUG_REG_TEXTURE,
|
|
||||||
D3D10_SHADER_DEBUG_REG_SAMPLER,
|
|
||||||
D3D10_SHADER_DEBUG_REG_IMMEDIATECBUFFER,
|
|
||||||
D3D10_SHADER_DEBUG_REG_LITERAL,
|
|
||||||
D3D10_SHADER_DEBUG_REG_UNUSED,
|
|
||||||
D3D11_SHADER_DEBUG_REG_INTERFACE_POINTERS,
|
|
||||||
D3D11_SHADER_DEBUG_REG_UAV,
|
|
||||||
D3D10_SHADER_DEBUG_REG_FORCE_DWORD = 0x7fffffff,
|
|
||||||
} D3D10_SHADER_DEBUG_REGTYPE;
|
|
||||||
|
|
||||||
typedef enum _D3D10_SHADER_DEBUG_SCOPETYPE
|
|
||||||
{
|
|
||||||
D3D10_SHADER_DEBUG_SCOPE_GLOBAL,
|
|
||||||
D3D10_SHADER_DEBUG_SCOPE_BLOCK,
|
|
||||||
D3D10_SHADER_DEBUG_SCOPE_FORLOOP,
|
|
||||||
D3D10_SHADER_DEBUG_SCOPE_STRUCT,
|
|
||||||
D3D10_SHADER_DEBUG_SCOPE_FUNC_PARAMS,
|
|
||||||
D3D10_SHADER_DEBUG_SCOPE_STATEBLOCK,
|
|
||||||
D3D10_SHADER_DEBUG_SCOPE_NAMESPACE,
|
|
||||||
D3D10_SHADER_DEBUG_SCOPE_ANNOTATION,
|
|
||||||
D3D10_SHADER_DEBUG_SCOPE_FORCE_DWORD = 0x7fffffff,
|
|
||||||
} D3D10_SHADER_DEBUG_SCOPETYPE;
|
|
||||||
|
|
||||||
typedef enum _D3D10_SHADER_DEBUG_VARTYPE
|
|
||||||
{
|
|
||||||
D3D10_SHADER_DEBUG_VAR_VARIABLE,
|
|
||||||
D3D10_SHADER_DEBUG_VAR_FUNCTION,
|
|
||||||
D3D10_SHADER_DEBUG_VAR_FORCE_DWORD = 0x7fffffff,
|
|
||||||
} D3D10_SHADER_DEBUG_VARTYPE;
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
|
||||||
// These are the serialized structures that get written to the file
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
typedef struct _D3D10_SHADER_DEBUG_TOKEN_INFO
|
|
||||||
{
|
|
||||||
UINT File; // offset into file list
|
|
||||||
UINT Line; // line #
|
|
||||||
UINT Column; // column #
|
|
||||||
|
|
||||||
UINT TokenLength;
|
|
||||||
UINT TokenId; // offset to LPCSTR of length TokenLength in string datastore
|
|
||||||
} D3D10_SHADER_DEBUG_TOKEN_INFO;
|
|
||||||
|
|
||||||
// Variable list
|
|
||||||
typedef struct _D3D10_SHADER_DEBUG_VAR_INFO
|
|
||||||
{
|
|
||||||
// Index into token list for declaring identifier
|
|
||||||
UINT TokenId;
|
|
||||||
D3D10_SHADER_VARIABLE_TYPE Type;
|
|
||||||
// register and component for this variable, only valid/necessary for arrays
|
|
||||||
UINT Register;
|
|
||||||
UINT Component;
|
|
||||||
// gives the original variable that declared this variable
|
|
||||||
UINT ScopeVar;
|
|
||||||
// this variable's offset in its ScopeVar
|
|
||||||
UINT ScopeVarOffset;
|
|
||||||
} D3D10_SHADER_DEBUG_VAR_INFO;
|
|
||||||
|
|
||||||
typedef struct _D3D10_SHADER_DEBUG_INPUT_INFO
|
|
||||||
{
|
|
||||||
// index into array of variables of variable to initialize
|
|
||||||
UINT Var;
|
|
||||||
// input, cbuffer, tbuffer
|
|
||||||
D3D10_SHADER_DEBUG_REGTYPE InitialRegisterSet;
|
|
||||||
// set to cbuffer or tbuffer slot, geometry shader input primitive #,
|
|
||||||
// identifying register for indexable temp, or -1
|
|
||||||
UINT InitialBank;
|
|
||||||
// -1 if temp, otherwise gives register in register set
|
|
||||||
UINT InitialRegister;
|
|
||||||
// -1 if temp, otherwise gives component
|
|
||||||
UINT InitialComponent;
|
|
||||||
// initial value if literal
|
|
||||||
UINT InitialValue;
|
|
||||||
} D3D10_SHADER_DEBUG_INPUT_INFO;
|
|
||||||
|
|
||||||
typedef struct _D3D10_SHADER_DEBUG_SCOPEVAR_INFO
|
|
||||||
{
|
|
||||||
// Index into variable token
|
|
||||||
UINT TokenId;
|
|
||||||
|
|
||||||
D3D10_SHADER_DEBUG_VARTYPE VarType; // variable or function (different namespaces)
|
|
||||||
D3D10_SHADER_VARIABLE_CLASS Class;
|
|
||||||
UINT Rows; // number of rows (matrices)
|
|
||||||
UINT Columns; // number of columns (vectors and matrices)
|
|
||||||
|
|
||||||
// In an array of structures, one struct member scope is provided, and
|
|
||||||
// you'll have to add the array stride times the index to the variable
|
|
||||||
// index you find, then find that variable in this structure's list of
|
|
||||||
// variables.
|
|
||||||
|
|
||||||
// gives a scope to look up struct members. -1 if not a struct
|
|
||||||
UINT StructMemberScope;
|
|
||||||
|
|
||||||
// number of array indices
|
|
||||||
UINT uArrayIndices; // a[3][2][1] has 3 indices
|
|
||||||
// maximum array index for each index
|
|
||||||
// offset to UINT[uArrayIndices] in UINT datastore
|
|
||||||
UINT ArrayElements; // a[3][2][1] has {3, 2, 1}
|
|
||||||
// how many variables each array index moves
|
|
||||||
// offset to UINT[uArrayIndices] in UINT datastore
|
|
||||||
UINT ArrayStrides; // a[3][2][1] has {2, 1, 1}
|
|
||||||
|
|
||||||
UINT uVariables;
|
|
||||||
// index of the first variable, later variables are offsets from this one
|
|
||||||
UINT uFirstVariable;
|
|
||||||
} D3D10_SHADER_DEBUG_SCOPEVAR_INFO;
|
|
||||||
|
|
||||||
// scope data, this maps variable names to debug variables (useful for the watch window)
|
|
||||||
typedef struct _D3D10_SHADER_DEBUG_SCOPE_INFO
|
|
||||||
{
|
|
||||||
D3D10_SHADER_DEBUG_SCOPETYPE ScopeType;
|
|
||||||
UINT Name; // offset to name of scope in strings list
|
|
||||||
UINT uNameLen; // length of name string
|
|
||||||
UINT uVariables;
|
|
||||||
UINT VariableData; // Offset to UINT[uVariables] indexing the Scope Variable list
|
|
||||||
} D3D10_SHADER_DEBUG_SCOPE_INFO;
|
|
||||||
|
|
||||||
// instruction outputs
|
|
||||||
typedef struct _D3D10_SHADER_DEBUG_OUTPUTVAR
|
|
||||||
{
|
|
||||||
// index variable being written to, if -1 it's not going to a variable
|
|
||||||
UINT Var;
|
|
||||||
// range data that the compiler expects to be true
|
|
||||||
UINT uValueMin, uValueMax;
|
|
||||||
INT iValueMin, iValueMax;
|
|
||||||
FLOAT fValueMin, fValueMax;
|
|
||||||
|
|
||||||
BOOL bNaNPossible, bInfPossible;
|
|
||||||
} D3D10_SHADER_DEBUG_OUTPUTVAR;
|
|
||||||
|
|
||||||
typedef struct _D3D10_SHADER_DEBUG_OUTPUTREG_INFO
|
|
||||||
{
|
|
||||||
// Only temp, indexable temp, and output are valid here
|
|
||||||
D3D10_SHADER_DEBUG_REGTYPE OutputRegisterSet;
|
|
||||||
// -1 means no output
|
|
||||||
UINT OutputReg;
|
|
||||||
// if a temp array, identifier for which one
|
|
||||||
UINT TempArrayReg;
|
|
||||||
// -1 means masked out
|
|
||||||
UINT OutputComponents[4];
|
|
||||||
D3D10_SHADER_DEBUG_OUTPUTVAR OutputVars[4];
|
|
||||||
// when indexing the output, get the value of this register, then add
|
|
||||||
// that to uOutputReg. If uIndexReg is -1, then there is no index.
|
|
||||||
// find the variable whose register is the sum (by looking in the ScopeVar)
|
|
||||||
// and component matches, then set it. This should only happen for indexable
|
|
||||||
// temps and outputs.
|
|
||||||
UINT IndexReg;
|
|
||||||
UINT IndexComp;
|
|
||||||
} D3D10_SHADER_DEBUG_OUTPUTREG_INFO;
|
|
||||||
|
|
||||||
// per instruction data
|
|
||||||
typedef struct _D3D10_SHADER_DEBUG_INST_INFO
|
|
||||||
{
|
|
||||||
UINT Id; // Which instruction this is in the bytecode
|
|
||||||
UINT Opcode; // instruction type
|
|
||||||
|
|
||||||
// 0, 1, or 2
|
|
||||||
UINT uOutputs;
|
|
||||||
|
|
||||||
// up to two outputs per instruction
|
|
||||||
D3D10_SHADER_DEBUG_OUTPUTREG_INFO pOutputs[2];
|
|
||||||
|
|
||||||
// index into the list of tokens for this instruction's token
|
|
||||||
UINT TokenId;
|
|
||||||
|
|
||||||
// how many function calls deep this instruction is
|
|
||||||
UINT NestingLevel;
|
|
||||||
|
|
||||||
// list of scopes from outer-most to inner-most
|
|
||||||
// Number of scopes
|
|
||||||
UINT Scopes;
|
|
||||||
UINT ScopeInfo; // Offset to UINT[uScopes] specifying indices of the ScopeInfo Array
|
|
||||||
|
|
||||||
// list of variables accessed by this instruction
|
|
||||||
// Number of variables
|
|
||||||
UINT AccessedVars;
|
|
||||||
UINT AccessedVarsInfo; // Offset to UINT[AccessedVars] specifying indices of the ScopeVariableInfo Array
|
|
||||||
} D3D10_SHADER_DEBUG_INST_INFO;
|
|
||||||
|
|
||||||
typedef struct _D3D10_SHADER_DEBUG_FILE_INFO
|
|
||||||
{
|
|
||||||
UINT FileName; // Offset to LPCSTR for file name
|
|
||||||
UINT FileNameLen; // Length of file name
|
|
||||||
UINT FileData; // Offset to LPCSTR of length FileLen
|
|
||||||
UINT FileLen; // Length of file
|
|
||||||
} D3D10_SHADER_DEBUG_FILE_INFO;
|
|
||||||
|
|
||||||
typedef struct _D3D10_SHADER_DEBUG_INFO
|
|
||||||
{
|
|
||||||
UINT Size; // sizeof(D3D10_SHADER_DEBUG_INFO)
|
|
||||||
UINT Creator; // Offset to LPCSTR for compiler version
|
|
||||||
UINT EntrypointName; // Offset to LPCSTR for Entry point name
|
|
||||||
UINT ShaderTarget; // Offset to LPCSTR for shader target
|
|
||||||
UINT CompileFlags; // flags used to compile
|
|
||||||
UINT Files; // number of included files
|
|
||||||
UINT FileInfo; // Offset to D3D10_SHADER_DEBUG_FILE_INFO[Files]
|
|
||||||
UINT Instructions; // number of instructions
|
|
||||||
UINT InstructionInfo; // Offset to D3D10_SHADER_DEBUG_INST_INFO[Instructions]
|
|
||||||
UINT Variables; // number of variables
|
|
||||||
UINT VariableInfo; // Offset to D3D10_SHADER_DEBUG_VAR_INFO[Variables]
|
|
||||||
UINT InputVariables; // number of variables to initialize before running
|
|
||||||
UINT InputVariableInfo; // Offset to D3D10_SHADER_DEBUG_INPUT_INFO[InputVariables]
|
|
||||||
UINT Tokens; // number of tokens to initialize
|
|
||||||
UINT TokenInfo; // Offset to D3D10_SHADER_DEBUG_TOKEN_INFO[Tokens]
|
|
||||||
UINT Scopes; // number of scopes
|
|
||||||
UINT ScopeInfo; // Offset to D3D10_SHADER_DEBUG_SCOPE_INFO[Scopes]
|
|
||||||
UINT ScopeVariables; // number of variables declared
|
|
||||||
UINT ScopeVariableInfo; // Offset to D3D10_SHADER_DEBUG_SCOPEVAR_INFO[Scopes]
|
|
||||||
UINT UintOffset; // Offset to the UINT datastore, all UINT offsets are from this offset
|
|
||||||
UINT StringOffset; // Offset to the string datastore, all string offsets are from this offset
|
|
||||||
} D3D10_SHADER_DEBUG_INFO;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// ID3D10ShaderReflection1:
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//
|
|
||||||
// Interface definitions
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
typedef interface ID3D10ShaderReflection1 ID3D10ShaderReflection1;
|
|
||||||
typedef interface ID3D10ShaderReflection1 *LPD3D10SHADERREFLECTION1;
|
|
||||||
|
|
||||||
// {C3457783-A846-47CE-9520-CEA6F66E7447}
|
|
||||||
DEFINE_GUID(IID_ID3D10ShaderReflection1,
|
|
||||||
0xc3457783, 0xa846, 0x47ce, 0x95, 0x20, 0xce, 0xa6, 0xf6, 0x6e, 0x74, 0x47);
|
|
||||||
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3D10ShaderReflection1
|
|
||||||
|
|
||||||
DECLARE_INTERFACE_(ID3D10ShaderReflection1, IUnknown)
|
|
||||||
{
|
|
||||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
|
||||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
|
||||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_SHADER_DESC *pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE;
|
|
||||||
STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, _Out_ D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
|
||||||
STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetResourceBindingDescByName)(THIS_ LPCSTR Name, _Out_ D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetMovInstructionCount)(THIS_ _Out_ UINT* pCount) PURE;
|
|
||||||
STDMETHOD(GetMovcInstructionCount)(THIS_ _Out_ UINT* pCount) PURE;
|
|
||||||
STDMETHOD(GetConversionInstructionCount)(THIS_ _Out_ UINT* pCount) PURE;
|
|
||||||
STDMETHOD(GetBitwiseInstructionCount)(THIS_ _Out_ UINT* pCount) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetGSInputPrimitive)(THIS_ _Out_ D3D10_PRIMITIVE* pPrim) PURE;
|
|
||||||
STDMETHOD(IsLevel9Shader)(THIS_ _Out_ BOOL* pbLevel9Shader) PURE;
|
|
||||||
STDMETHOD(IsSampleFrequencyShader)(THIS_ _Out_ BOOL* pbSampleFrequency) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
// APIs //////////////////////////////////////////////////////////////////////
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif //__cplusplus
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif //__cplusplus
|
|
||||||
|
|
||||||
#endif //__D3D10_1SHADER_H__
|
|
||||||
|
|
14586
3rdparty/minidx12/Include/d3d11.h
vendored
14586
3rdparty/minidx12/Include/d3d11.h
vendored
File diff suppressed because it is too large
Load diff
5222
3rdparty/minidx12/Include/d3d11_1.h
vendored
5222
3rdparty/minidx12/Include/d3d11_1.h
vendored
File diff suppressed because it is too large
Load diff
2721
3rdparty/minidx12/Include/d3d11_2.h
vendored
2721
3rdparty/minidx12/Include/d3d11_2.h
vendored
File diff suppressed because it is too large
Load diff
4817
3rdparty/minidx12/Include/d3d11_3.h
vendored
4817
3rdparty/minidx12/Include/d3d11_3.h
vendored
File diff suppressed because it is too large
Load diff
283
3rdparty/minidx12/Include/d3d11on12.h
vendored
283
3rdparty/minidx12/Include/d3d11on12.h
vendored
|
@ -1,283 +0,0 @@
|
||||||
/*-------------------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Copyright (c) Microsoft Corporation
|
|
||||||
*
|
|
||||||
*-------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
|
|
||||||
|
|
||||||
|
|
||||||
/* File created by MIDL compiler version 8.00.0613 */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* verify that the <rpcndr.h> version is high enough to compile this file*/
|
|
||||||
#ifndef __REQUIRED_RPCNDR_H_VERSION__
|
|
||||||
#define __REQUIRED_RPCNDR_H_VERSION__ 500
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* verify that the <rpcsal.h> version is high enough to compile this file*/
|
|
||||||
#ifndef __REQUIRED_RPCSAL_H_VERSION__
|
|
||||||
#define __REQUIRED_RPCSAL_H_VERSION__ 100
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "rpc.h"
|
|
||||||
#include "rpcndr.h"
|
|
||||||
|
|
||||||
#ifndef __RPCNDR_H_VERSION__
|
|
||||||
#error this stub requires an updated version of <rpcndr.h>
|
|
||||||
#endif /* __RPCNDR_H_VERSION__ */
|
|
||||||
|
|
||||||
#ifndef COM_NO_WINDOWS_H
|
|
||||||
#include "windows.h"
|
|
||||||
#include "ole2.h"
|
|
||||||
#endif /*COM_NO_WINDOWS_H*/
|
|
||||||
|
|
||||||
#ifndef __d3d11on12_h__
|
|
||||||
#define __d3d11on12_h__
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
|
||||||
#pragma once
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Forward Declarations */
|
|
||||||
|
|
||||||
#ifndef __ID3D11On12Device_FWD_DEFINED__
|
|
||||||
#define __ID3D11On12Device_FWD_DEFINED__
|
|
||||||
typedef interface ID3D11On12Device ID3D11On12Device;
|
|
||||||
|
|
||||||
#endif /* __ID3D11On12Device_FWD_DEFINED__ */
|
|
||||||
|
|
||||||
|
|
||||||
/* header files for imported files */
|
|
||||||
#include "oaidl.h"
|
|
||||||
#include "ocidl.h"
|
|
||||||
#include "d3d11.h"
|
|
||||||
#include "d3d12.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* interface __MIDL_itf_d3d11on12_0000_0000 */
|
|
||||||
/* [local] */
|
|
||||||
|
|
||||||
#include <winapifamily.h>
|
|
||||||
#pragma region App Family
|
|
||||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// D3D11On12CreateDevice
|
|
||||||
// ------------------
|
|
||||||
//
|
|
||||||
// pDevice
|
|
||||||
// Specifies a pre-existing D3D12 device to use for D3D11 interop.
|
|
||||||
// May not be NULL.
|
|
||||||
// Flags
|
|
||||||
// Any of those documented for D3D11CreateDeviceAndSwapChain.
|
|
||||||
// pFeatureLevels
|
|
||||||
// Array of any of the following:
|
|
||||||
// D3D_FEATURE_LEVEL_12_1
|
|
||||||
// D3D_FEATURE_LEVEL_12_0
|
|
||||||
// D3D_FEATURE_LEVEL_11_1
|
|
||||||
// D3D_FEATURE_LEVEL_11_0
|
|
||||||
// D3D_FEATURE_LEVEL_10_1
|
|
||||||
// D3D_FEATURE_LEVEL_10_0
|
|
||||||
// D3D_FEATURE_LEVEL_9_3
|
|
||||||
// D3D_FEATURE_LEVEL_9_2
|
|
||||||
// D3D_FEATURE_LEVEL_9_1
|
|
||||||
// The first feature level which is less than or equal to the
|
|
||||||
// D3D12 device's feature level will be used to perform D3D11 validation.
|
|
||||||
// Creation will fail if no acceptable feature levels are provided.
|
|
||||||
// Providing NULL will default to the D3D12 device's feature level.
|
|
||||||
// FeatureLevels
|
|
||||||
// Size of feature levels array.
|
|
||||||
// ppCommandQueues
|
|
||||||
// Array of unique queues for D3D11On12 to use. Valid queue types:
|
|
||||||
// 3D command queue.
|
|
||||||
// Flags must be compatible with device flags, and its NodeMask must
|
|
||||||
// be a subset of the NodeMask provided to this API.
|
|
||||||
// NumQueues
|
|
||||||
// Size of command queue array.
|
|
||||||
// NodeMask
|
|
||||||
// Which node of the D3D12 device to use. Only 1 bit may be set.
|
|
||||||
// ppDevice
|
|
||||||
// Pointer to returned interface. May be NULL.
|
|
||||||
// ppImmediateContext
|
|
||||||
// Pointer to returned interface. May be NULL.
|
|
||||||
// pChosenFeatureLevel
|
|
||||||
// Pointer to returned feature level. May be NULL.
|
|
||||||
//
|
|
||||||
// Return Values
|
|
||||||
// Any of those documented for
|
|
||||||
// D3D11CreateDevice
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
typedef HRESULT (WINAPI* PFN_D3D11ON12_CREATE_DEVICE)( _In_ IUnknown*, UINT,
|
|
||||||
_In_reads_opt_( FeatureLevels ) CONST D3D_FEATURE_LEVEL*, UINT FeatureLevels,
|
|
||||||
_In_reads_opt_( NumQueues ) IUnknown* CONST*, UINT NumQueues,
|
|
||||||
UINT, _COM_Outptr_opt_ ID3D11Device**, _COM_Outptr_opt_ ID3D11DeviceContext**,
|
|
||||||
_Out_opt_ D3D_FEATURE_LEVEL* );
|
|
||||||
|
|
||||||
HRESULT WINAPI D3D11On12CreateDevice(
|
|
||||||
_In_ IUnknown* pDevice,
|
|
||||||
UINT Flags,
|
|
||||||
_In_reads_opt_( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
|
|
||||||
UINT FeatureLevels,
|
|
||||||
_In_reads_opt_( NumQueues ) IUnknown* CONST* ppCommandQueues,
|
|
||||||
UINT NumQueues,
|
|
||||||
UINT NodeMask,
|
|
||||||
_COM_Outptr_opt_ ID3D11Device** ppDevice,
|
|
||||||
_COM_Outptr_opt_ ID3D11DeviceContext** ppImmediateContext,
|
|
||||||
_Out_opt_ D3D_FEATURE_LEVEL* pChosenFeatureLevel );
|
|
||||||
|
|
||||||
typedef struct D3D11_RESOURCE_FLAGS
|
|
||||||
{
|
|
||||||
UINT BindFlags;
|
|
||||||
UINT MiscFlags;
|
|
||||||
UINT CPUAccessFlags;
|
|
||||||
UINT StructureByteStride;
|
|
||||||
} D3D11_RESOURCE_FLAGS;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern RPC_IF_HANDLE __MIDL_itf_d3d11on12_0000_0000_v0_0_c_ifspec;
|
|
||||||
extern RPC_IF_HANDLE __MIDL_itf_d3d11on12_0000_0000_v0_0_s_ifspec;
|
|
||||||
|
|
||||||
#ifndef __ID3D11On12Device_INTERFACE_DEFINED__
|
|
||||||
#define __ID3D11On12Device_INTERFACE_DEFINED__
|
|
||||||
|
|
||||||
/* interface ID3D11On12Device */
|
|
||||||
/* [unique][local][object][uuid] */
|
|
||||||
|
|
||||||
|
|
||||||
EXTERN_C const IID IID_ID3D11On12Device;
|
|
||||||
|
|
||||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
|
||||||
|
|
||||||
MIDL_INTERFACE("85611e73-70a9-490e-9614-a9e302777904")
|
|
||||||
ID3D11On12Device : public IUnknown
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE CreateWrappedResource(
|
|
||||||
_In_ IUnknown *pResource12,
|
|
||||||
_In_ const D3D11_RESOURCE_FLAGS *pFlags11,
|
|
||||||
D3D12_RESOURCE_STATES InState,
|
|
||||||
D3D12_RESOURCE_STATES OutState,
|
|
||||||
REFIID riid,
|
|
||||||
_COM_Outptr_opt_ void **ppResource11) = 0;
|
|
||||||
|
|
||||||
virtual void STDMETHODCALLTYPE ReleaseWrappedResources(
|
|
||||||
_In_reads_( NumResources ) ID3D11Resource *const *ppResources,
|
|
||||||
UINT NumResources) = 0;
|
|
||||||
|
|
||||||
virtual void STDMETHODCALLTYPE AcquireWrappedResources(
|
|
||||||
_In_reads_( NumResources ) ID3D11Resource *const *ppResources,
|
|
||||||
UINT NumResources) = 0;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#else /* C style interface */
|
|
||||||
|
|
||||||
typedef struct ID3D11On12DeviceVtbl
|
|
||||||
{
|
|
||||||
BEGIN_INTERFACE
|
|
||||||
|
|
||||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
|
||||||
ID3D11On12Device * This,
|
|
||||||
REFIID riid,
|
|
||||||
_COM_Outptr_ void **ppvObject);
|
|
||||||
|
|
||||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
|
||||||
ID3D11On12Device * This);
|
|
||||||
|
|
||||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
|
||||||
ID3D11On12Device * This);
|
|
||||||
|
|
||||||
HRESULT ( STDMETHODCALLTYPE *CreateWrappedResource )(
|
|
||||||
ID3D11On12Device * This,
|
|
||||||
_In_ IUnknown *pResource12,
|
|
||||||
_In_ const D3D11_RESOURCE_FLAGS *pFlags11,
|
|
||||||
D3D12_RESOURCE_STATES InState,
|
|
||||||
D3D12_RESOURCE_STATES OutState,
|
|
||||||
REFIID riid,
|
|
||||||
_COM_Outptr_opt_ void **ppResource11);
|
|
||||||
|
|
||||||
void ( STDMETHODCALLTYPE *ReleaseWrappedResources )(
|
|
||||||
ID3D11On12Device * This,
|
|
||||||
_In_reads_( NumResources ) ID3D11Resource *const *ppResources,
|
|
||||||
UINT NumResources);
|
|
||||||
|
|
||||||
void ( STDMETHODCALLTYPE *AcquireWrappedResources )(
|
|
||||||
ID3D11On12Device * This,
|
|
||||||
_In_reads_( NumResources ) ID3D11Resource *const *ppResources,
|
|
||||||
UINT NumResources);
|
|
||||||
|
|
||||||
END_INTERFACE
|
|
||||||
} ID3D11On12DeviceVtbl;
|
|
||||||
|
|
||||||
interface ID3D11On12Device
|
|
||||||
{
|
|
||||||
CONST_VTBL struct ID3D11On12DeviceVtbl *lpVtbl;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef COBJMACROS
|
|
||||||
|
|
||||||
|
|
||||||
#define ID3D11On12Device_QueryInterface(This,riid,ppvObject) \
|
|
||||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
|
||||||
|
|
||||||
#define ID3D11On12Device_AddRef(This) \
|
|
||||||
( (This)->lpVtbl -> AddRef(This) )
|
|
||||||
|
|
||||||
#define ID3D11On12Device_Release(This) \
|
|
||||||
( (This)->lpVtbl -> Release(This) )
|
|
||||||
|
|
||||||
|
|
||||||
#define ID3D11On12Device_CreateWrappedResource(This,pResource12,pFlags11,InState,OutState,riid,ppResource11) \
|
|
||||||
( (This)->lpVtbl -> CreateWrappedResource(This,pResource12,pFlags11,InState,OutState,riid,ppResource11) )
|
|
||||||
|
|
||||||
#define ID3D11On12Device_ReleaseWrappedResources(This,ppResources,NumResources) \
|
|
||||||
( (This)->lpVtbl -> ReleaseWrappedResources(This,ppResources,NumResources) )
|
|
||||||
|
|
||||||
#define ID3D11On12Device_AcquireWrappedResources(This,ppResources,NumResources) \
|
|
||||||
( (This)->lpVtbl -> AcquireWrappedResources(This,ppResources,NumResources) )
|
|
||||||
|
|
||||||
#endif /* COBJMACROS */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* C style interface */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __ID3D11On12Device_INTERFACE_DEFINED__ */
|
|
||||||
|
|
||||||
|
|
||||||
/* interface __MIDL_itf_d3d11on12_0000_0001 */
|
|
||||||
/* [local] */
|
|
||||||
|
|
||||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
|
||||||
#pragma endregion
|
|
||||||
DEFINE_GUID(IID_ID3D11On12Device,0x85611e73,0x70a9,0x490e,0x96,0x14,0xa9,0xe3,0x02,0x77,0x79,0x04);
|
|
||||||
|
|
||||||
|
|
||||||
extern RPC_IF_HANDLE __MIDL_itf_d3d11on12_0000_0001_v0_0_c_ifspec;
|
|
||||||
extern RPC_IF_HANDLE __MIDL_itf_d3d11on12_0000_0001_v0_0_s_ifspec;
|
|
||||||
|
|
||||||
/* Additional Prototypes for ALL interfaces */
|
|
||||||
|
|
||||||
/* end of Additional Prototypes */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
601
3rdparty/minidx12/Include/d3d11shader.h
vendored
601
3rdparty/minidx12/Include/d3d11shader.h
vendored
|
@ -1,601 +0,0 @@
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
//
|
|
||||||
// File: D3D11Shader.h
|
|
||||||
// Content: D3D11 Shader Types and APIs
|
|
||||||
//
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef __D3D11SHADER_H__
|
|
||||||
#define __D3D11SHADER_H__
|
|
||||||
|
|
||||||
#include "d3dcommon.h"
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum D3D11_SHADER_VERSION_TYPE
|
|
||||||
{
|
|
||||||
D3D11_SHVER_PIXEL_SHADER = 0,
|
|
||||||
D3D11_SHVER_VERTEX_SHADER = 1,
|
|
||||||
D3D11_SHVER_GEOMETRY_SHADER = 2,
|
|
||||||
|
|
||||||
// D3D11 Shaders
|
|
||||||
D3D11_SHVER_HULL_SHADER = 3,
|
|
||||||
D3D11_SHVER_DOMAIN_SHADER = 4,
|
|
||||||
D3D11_SHVER_COMPUTE_SHADER = 5,
|
|
||||||
|
|
||||||
D3D11_SHVER_RESERVED0 = 0xFFF0,
|
|
||||||
} D3D11_SHADER_VERSION_TYPE;
|
|
||||||
|
|
||||||
#define D3D11_SHVER_GET_TYPE(_Version) \
|
|
||||||
(((_Version) >> 16) & 0xffff)
|
|
||||||
#define D3D11_SHVER_GET_MAJOR(_Version) \
|
|
||||||
(((_Version) >> 4) & 0xf)
|
|
||||||
#define D3D11_SHVER_GET_MINOR(_Version) \
|
|
||||||
(((_Version) >> 0) & 0xf)
|
|
||||||
|
|
||||||
// Slot ID for library function return
|
|
||||||
#define D3D_RETURN_PARAMETER_INDEX (-1)
|
|
||||||
|
|
||||||
typedef D3D_RESOURCE_RETURN_TYPE D3D11_RESOURCE_RETURN_TYPE;
|
|
||||||
|
|
||||||
typedef D3D_CBUFFER_TYPE D3D11_CBUFFER_TYPE;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _D3D11_SIGNATURE_PARAMETER_DESC
|
|
||||||
{
|
|
||||||
LPCSTR SemanticName; // Name of the semantic
|
|
||||||
UINT SemanticIndex; // Index of the semantic
|
|
||||||
UINT Register; // Number of member variables
|
|
||||||
D3D_NAME SystemValueType;// A predefined system value, or D3D_NAME_UNDEFINED if not applicable
|
|
||||||
D3D_REGISTER_COMPONENT_TYPE ComponentType; // Scalar type (e.g. uint, float, etc.)
|
|
||||||
BYTE Mask; // Mask to indicate which components of the register
|
|
||||||
// are used (combination of D3D10_COMPONENT_MASK values)
|
|
||||||
BYTE ReadWriteMask; // Mask to indicate whether a given component is
|
|
||||||
// never written (if this is an output signature) or
|
|
||||||
// always read (if this is an input signature).
|
|
||||||
// (combination of D3D_MASK_* values)
|
|
||||||
UINT Stream; // Stream index
|
|
||||||
D3D_MIN_PRECISION MinPrecision; // Minimum desired interpolation precision
|
|
||||||
} D3D11_SIGNATURE_PARAMETER_DESC;
|
|
||||||
|
|
||||||
typedef struct _D3D11_SHADER_BUFFER_DESC
|
|
||||||
{
|
|
||||||
LPCSTR Name; // Name of the constant buffer
|
|
||||||
D3D_CBUFFER_TYPE Type; // Indicates type of buffer content
|
|
||||||
UINT Variables; // Number of member variables
|
|
||||||
UINT Size; // Size of CB (in bytes)
|
|
||||||
UINT uFlags; // Buffer description flags
|
|
||||||
} D3D11_SHADER_BUFFER_DESC;
|
|
||||||
|
|
||||||
typedef struct _D3D11_SHADER_VARIABLE_DESC
|
|
||||||
{
|
|
||||||
LPCSTR Name; // Name of the variable
|
|
||||||
UINT StartOffset; // Offset in constant buffer's backing store
|
|
||||||
UINT Size; // Size of variable (in bytes)
|
|
||||||
UINT uFlags; // Variable flags
|
|
||||||
LPVOID DefaultValue; // Raw pointer to default value
|
|
||||||
UINT StartTexture; // First texture index (or -1 if no textures used)
|
|
||||||
UINT TextureSize; // Number of texture slots possibly used.
|
|
||||||
UINT StartSampler; // First sampler index (or -1 if no textures used)
|
|
||||||
UINT SamplerSize; // Number of sampler slots possibly used.
|
|
||||||
} D3D11_SHADER_VARIABLE_DESC;
|
|
||||||
|
|
||||||
typedef struct _D3D11_SHADER_TYPE_DESC
|
|
||||||
{
|
|
||||||
D3D_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.)
|
|
||||||
D3D_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.)
|
|
||||||
UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable)
|
|
||||||
UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable)
|
|
||||||
UINT Elements; // Number of elements (0 if not an array)
|
|
||||||
UINT Members; // Number of members (0 if not a structure)
|
|
||||||
UINT Offset; // Offset from the start of structure (0 if not a structure member)
|
|
||||||
LPCSTR Name; // Name of type, can be NULL
|
|
||||||
} D3D11_SHADER_TYPE_DESC;
|
|
||||||
|
|
||||||
typedef D3D_TESSELLATOR_DOMAIN D3D11_TESSELLATOR_DOMAIN;
|
|
||||||
|
|
||||||
typedef D3D_TESSELLATOR_PARTITIONING D3D11_TESSELLATOR_PARTITIONING;
|
|
||||||
|
|
||||||
typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D11_TESSELLATOR_OUTPUT_PRIMITIVE;
|
|
||||||
|
|
||||||
typedef struct _D3D11_SHADER_DESC
|
|
||||||
{
|
|
||||||
UINT Version; // Shader version
|
|
||||||
LPCSTR Creator; // Creator string
|
|
||||||
UINT Flags; // Shader compilation/parse flags
|
|
||||||
|
|
||||||
UINT ConstantBuffers; // Number of constant buffers
|
|
||||||
UINT BoundResources; // Number of bound resources
|
|
||||||
UINT InputParameters; // Number of parameters in the input signature
|
|
||||||
UINT OutputParameters; // Number of parameters in the output signature
|
|
||||||
|
|
||||||
UINT InstructionCount; // Number of emitted instructions
|
|
||||||
UINT TempRegisterCount; // Number of temporary registers used
|
|
||||||
UINT TempArrayCount; // Number of temporary arrays used
|
|
||||||
UINT DefCount; // Number of constant defines
|
|
||||||
UINT DclCount; // Number of declarations (input + output)
|
|
||||||
UINT TextureNormalInstructions; // Number of non-categorized texture instructions
|
|
||||||
UINT TextureLoadInstructions; // Number of texture load instructions
|
|
||||||
UINT TextureCompInstructions; // Number of texture comparison instructions
|
|
||||||
UINT TextureBiasInstructions; // Number of texture bias instructions
|
|
||||||
UINT TextureGradientInstructions; // Number of texture gradient instructions
|
|
||||||
UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
|
|
||||||
UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
|
|
||||||
UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
|
|
||||||
UINT StaticFlowControlCount; // Number of static flow control instructions used
|
|
||||||
UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
|
|
||||||
UINT MacroInstructionCount; // Number of macro instructions used
|
|
||||||
UINT ArrayInstructionCount; // Number of array instructions used
|
|
||||||
UINT CutInstructionCount; // Number of cut instructions used
|
|
||||||
UINT EmitInstructionCount; // Number of emit instructions used
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology
|
|
||||||
UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count
|
|
||||||
D3D_PRIMITIVE InputPrimitive; // GS/HS input primitive
|
|
||||||
UINT PatchConstantParameters; // Number of parameters in the patch constant signature
|
|
||||||
UINT cGSInstanceCount; // Number of Geometry shader instances
|
|
||||||
UINT cControlPoints; // Number of control points in the HS->DS stage
|
|
||||||
D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive; // Primitive output by the tessellator
|
|
||||||
D3D_TESSELLATOR_PARTITIONING HSPartitioning; // Partitioning mode of the tessellator
|
|
||||||
D3D_TESSELLATOR_DOMAIN TessellatorDomain; // Domain of the tessellator (quad, tri, isoline)
|
|
||||||
// instruction counts
|
|
||||||
UINT cBarrierInstructions; // Number of barrier instructions in a compute shader
|
|
||||||
UINT cInterlockedInstructions; // Number of interlocked instructions
|
|
||||||
UINT cTextureStoreInstructions; // Number of texture writes
|
|
||||||
} D3D11_SHADER_DESC;
|
|
||||||
|
|
||||||
typedef struct _D3D11_SHADER_INPUT_BIND_DESC
|
|
||||||
{
|
|
||||||
LPCSTR Name; // Name of the resource
|
|
||||||
D3D_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.)
|
|
||||||
UINT BindPoint; // Starting bind point
|
|
||||||
UINT BindCount; // Number of contiguous bind points (for arrays)
|
|
||||||
|
|
||||||
UINT uFlags; // Input binding flags
|
|
||||||
D3D_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture)
|
|
||||||
D3D_SRV_DIMENSION Dimension; // Dimension (if texture)
|
|
||||||
UINT NumSamples; // Number of samples (0 if not MS texture)
|
|
||||||
} D3D11_SHADER_INPUT_BIND_DESC;
|
|
||||||
|
|
||||||
#define D3D_SHADER_REQUIRES_DOUBLES 0x00000001
|
|
||||||
#define D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL 0x00000002
|
|
||||||
#define D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE 0x00000004
|
|
||||||
#define D3D_SHADER_REQUIRES_64_UAVS 0x00000008
|
|
||||||
#define D3D_SHADER_REQUIRES_MINIMUM_PRECISION 0x00000010
|
|
||||||
#define D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS 0x00000020
|
|
||||||
#define D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS 0x00000040
|
|
||||||
#define D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING 0x00000080
|
|
||||||
#define D3D_SHADER_REQUIRES_TILED_RESOURCES 0x00000100
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _D3D11_LIBRARY_DESC
|
|
||||||
{
|
|
||||||
LPCSTR Creator; // The name of the originator of the library.
|
|
||||||
UINT Flags; // Compilation flags.
|
|
||||||
UINT FunctionCount; // Number of functions exported from the library.
|
|
||||||
} D3D11_LIBRARY_DESC;
|
|
||||||
|
|
||||||
typedef struct _D3D11_FUNCTION_DESC
|
|
||||||
{
|
|
||||||
UINT Version; // Shader version
|
|
||||||
LPCSTR Creator; // Creator string
|
|
||||||
UINT Flags; // Shader compilation/parse flags
|
|
||||||
|
|
||||||
UINT ConstantBuffers; // Number of constant buffers
|
|
||||||
UINT BoundResources; // Number of bound resources
|
|
||||||
|
|
||||||
UINT InstructionCount; // Number of emitted instructions
|
|
||||||
UINT TempRegisterCount; // Number of temporary registers used
|
|
||||||
UINT TempArrayCount; // Number of temporary arrays used
|
|
||||||
UINT DefCount; // Number of constant defines
|
|
||||||
UINT DclCount; // Number of declarations (input + output)
|
|
||||||
UINT TextureNormalInstructions; // Number of non-categorized texture instructions
|
|
||||||
UINT TextureLoadInstructions; // Number of texture load instructions
|
|
||||||
UINT TextureCompInstructions; // Number of texture comparison instructions
|
|
||||||
UINT TextureBiasInstructions; // Number of texture bias instructions
|
|
||||||
UINT TextureGradientInstructions; // Number of texture gradient instructions
|
|
||||||
UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
|
|
||||||
UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
|
|
||||||
UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
|
|
||||||
UINT StaticFlowControlCount; // Number of static flow control instructions used
|
|
||||||
UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
|
|
||||||
UINT MacroInstructionCount; // Number of macro instructions used
|
|
||||||
UINT ArrayInstructionCount; // Number of array instructions used
|
|
||||||
UINT MovInstructionCount; // Number of mov instructions used
|
|
||||||
UINT MovcInstructionCount; // Number of movc instructions used
|
|
||||||
UINT ConversionInstructionCount; // Number of type conversion instructions used
|
|
||||||
UINT BitwiseInstructionCount; // Number of bitwise arithmetic instructions used
|
|
||||||
D3D_FEATURE_LEVEL MinFeatureLevel; // Min target of the function byte code
|
|
||||||
UINT64 RequiredFeatureFlags; // Required feature flags
|
|
||||||
|
|
||||||
LPCSTR Name; // Function name
|
|
||||||
INT FunctionParameterCount; // Number of logical parameters in the function signature (not including return)
|
|
||||||
BOOL HasReturn; // TRUE, if function returns a value, false - it is a subroutine
|
|
||||||
BOOL Has10Level9VertexShader; // TRUE, if there is a 10L9 VS blob
|
|
||||||
BOOL Has10Level9PixelShader; // TRUE, if there is a 10L9 PS blob
|
|
||||||
} D3D11_FUNCTION_DESC;
|
|
||||||
|
|
||||||
typedef struct _D3D11_PARAMETER_DESC
|
|
||||||
{
|
|
||||||
LPCSTR Name; // Parameter name.
|
|
||||||
LPCSTR SemanticName; // Parameter semantic name (+index).
|
|
||||||
D3D_SHADER_VARIABLE_TYPE Type; // Element type.
|
|
||||||
D3D_SHADER_VARIABLE_CLASS Class; // Scalar/Vector/Matrix.
|
|
||||||
UINT Rows; // Rows are for matrix parameters.
|
|
||||||
UINT Columns; // Components or Columns in matrix.
|
|
||||||
D3D_INTERPOLATION_MODE InterpolationMode; // Interpolation mode.
|
|
||||||
D3D_PARAMETER_FLAGS Flags; // Parameter modifiers.
|
|
||||||
|
|
||||||
UINT FirstInRegister; // The first input register for this parameter.
|
|
||||||
UINT FirstInComponent; // The first input register component for this parameter.
|
|
||||||
UINT FirstOutRegister; // The first output register for this parameter.
|
|
||||||
UINT FirstOutComponent; // The first output register component for this parameter.
|
|
||||||
} D3D11_PARAMETER_DESC;
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Interfaces ////////////////////////////////////////////////////////////////
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
typedef interface ID3D11ShaderReflectionType ID3D11ShaderReflectionType;
|
|
||||||
typedef interface ID3D11ShaderReflectionType *LPD3D11SHADERREFLECTIONTYPE;
|
|
||||||
|
|
||||||
typedef interface ID3D11ShaderReflectionVariable ID3D11ShaderReflectionVariable;
|
|
||||||
typedef interface ID3D11ShaderReflectionVariable *LPD3D11SHADERREFLECTIONVARIABLE;
|
|
||||||
|
|
||||||
typedef interface ID3D11ShaderReflectionConstantBuffer ID3D11ShaderReflectionConstantBuffer;
|
|
||||||
typedef interface ID3D11ShaderReflectionConstantBuffer *LPD3D11SHADERREFLECTIONCONSTANTBUFFER;
|
|
||||||
|
|
||||||
typedef interface ID3D11ShaderReflection ID3D11ShaderReflection;
|
|
||||||
typedef interface ID3D11ShaderReflection *LPD3D11SHADERREFLECTION;
|
|
||||||
|
|
||||||
typedef interface ID3D11LibraryReflection ID3D11LibraryReflection;
|
|
||||||
typedef interface ID3D11LibraryReflection *LPD3D11LIBRARYREFLECTION;
|
|
||||||
|
|
||||||
typedef interface ID3D11FunctionReflection ID3D11FunctionReflection;
|
|
||||||
typedef interface ID3D11FunctionReflection *LPD3D11FUNCTIONREFLECTION;
|
|
||||||
|
|
||||||
typedef interface ID3D11FunctionParameterReflection ID3D11FunctionParameterReflection;
|
|
||||||
typedef interface ID3D11FunctionParameterReflection *LPD3D11FUNCTIONPARAMETERREFLECTION;
|
|
||||||
|
|
||||||
// {6E6FFA6A-9BAE-4613-A51E-91652D508C21}
|
|
||||||
interface DECLSPEC_UUID("6E6FFA6A-9BAE-4613-A51E-91652D508C21") ID3D11ShaderReflectionType;
|
|
||||||
DEFINE_GUID(IID_ID3D11ShaderReflectionType,
|
|
||||||
0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21);
|
|
||||||
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3D11ShaderReflectionType
|
|
||||||
|
|
||||||
DECLARE_INTERFACE(ID3D11ShaderReflectionType)
|
|
||||||
{
|
|
||||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_SHADER_TYPE_DESC *pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ _In_ UINT Index) PURE;
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetMemberTypeByName)(THIS_ _In_ LPCSTR Name) PURE;
|
|
||||||
STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ _In_ UINT Index) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(IsEqual)(THIS_ _In_ ID3D11ShaderReflectionType* pType) PURE;
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetSubType)(THIS) PURE;
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetBaseClass)(THIS) PURE;
|
|
||||||
STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE;
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetInterfaceByIndex)(THIS_ _In_ UINT uIndex) PURE;
|
|
||||||
STDMETHOD(IsOfType)(THIS_ _In_ ID3D11ShaderReflectionType* pType) PURE;
|
|
||||||
STDMETHOD(ImplementsInterface)(THIS_ _In_ ID3D11ShaderReflectionType* pBase) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
// {51F23923-F3E5-4BD1-91CB-606177D8DB4C}
|
|
||||||
interface DECLSPEC_UUID("51F23923-F3E5-4BD1-91CB-606177D8DB4C") ID3D11ShaderReflectionVariable;
|
|
||||||
DEFINE_GUID(IID_ID3D11ShaderReflectionVariable,
|
|
||||||
0x51f23923, 0xf3e5, 0x4bd1, 0x91, 0xcb, 0x60, 0x61, 0x77, 0xd8, 0xdb, 0x4c);
|
|
||||||
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3D11ShaderReflectionVariable
|
|
||||||
|
|
||||||
DECLARE_INTERFACE(ID3D11ShaderReflectionVariable)
|
|
||||||
{
|
|
||||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_SHADER_VARIABLE_DESC *pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetType)(THIS) PURE;
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetBuffer)(THIS) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ _In_ UINT uArrayIndex) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
// {EB62D63D-93DD-4318-8AE8-C6F83AD371B8}
|
|
||||||
interface DECLSPEC_UUID("EB62D63D-93DD-4318-8AE8-C6F83AD371B8") ID3D11ShaderReflectionConstantBuffer;
|
|
||||||
DEFINE_GUID(IID_ID3D11ShaderReflectionConstantBuffer,
|
|
||||||
0xeb62d63d, 0x93dd, 0x4318, 0x8a, 0xe8, 0xc6, 0xf8, 0x3a, 0xd3, 0x71, 0xb8);
|
|
||||||
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3D11ShaderReflectionConstantBuffer
|
|
||||||
|
|
||||||
DECLARE_INTERFACE(ID3D11ShaderReflectionConstantBuffer)
|
|
||||||
{
|
|
||||||
STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_BUFFER_DESC *pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByIndex)(THIS_ _In_ UINT Index) PURE;
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
// The ID3D11ShaderReflection IID may change from SDK version to SDK version
|
|
||||||
// if the reflection API changes. This prevents new code with the new API
|
|
||||||
// from working with an old binary. Recompiling with the new header
|
|
||||||
// will pick up the new IID.
|
|
||||||
|
|
||||||
// 8d536ca1-0cca-4956-a837-786963755584
|
|
||||||
interface DECLSPEC_UUID("8d536ca1-0cca-4956-a837-786963755584") ID3D11ShaderReflection;
|
|
||||||
DEFINE_GUID(IID_ID3D11ShaderReflection,
|
|
||||||
0x8d536ca1, 0x0cca, 0x4956, 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84);
|
|
||||||
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3D11ShaderReflection
|
|
||||||
|
|
||||||
DECLARE_INTERFACE_(ID3D11ShaderReflection, IUnknown)
|
|
||||||
{
|
|
||||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid,
|
|
||||||
_Out_ LPVOID *ppv) PURE;
|
|
||||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
|
||||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_SHADER_DESC *pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ _In_ UINT Index) PURE;
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
|
|
||||||
_Out_ D3D11_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetInputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
|
|
||||||
_Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
|
||||||
STDMETHOD(GetOutputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
|
|
||||||
_Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
|
||||||
STDMETHOD(GetPatchConstantParameterDesc)(THIS_ _In_ UINT ParameterIndex,
|
|
||||||
_Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
|
|
||||||
_Out_ D3D11_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE;
|
|
||||||
STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE;
|
|
||||||
STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE;
|
|
||||||
STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(D3D_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE;
|
|
||||||
STDMETHOD_(BOOL, IsSampleFrequencyShader)(THIS) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE;
|
|
||||||
STDMETHOD(GetMinFeatureLevel)(THIS_ _Out_ enum D3D_FEATURE_LEVEL* pLevel) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(UINT, GetThreadGroupSize)(THIS_
|
|
||||||
_Out_opt_ UINT* pSizeX,
|
|
||||||
_Out_opt_ UINT* pSizeY,
|
|
||||||
_Out_opt_ UINT* pSizeZ) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(UINT64, GetRequiresFlags)(THIS) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
// {54384F1B-5B3E-4BB7-AE01-60BA3097CBB6}
|
|
||||||
interface DECLSPEC_UUID("54384F1B-5B3E-4BB7-AE01-60BA3097CBB6") ID3D11LibraryReflection;
|
|
||||||
DEFINE_GUID(IID_ID3D11LibraryReflection,
|
|
||||||
0x54384f1b, 0x5b3e, 0x4bb7, 0xae, 0x1, 0x60, 0xba, 0x30, 0x97, 0xcb, 0xb6);
|
|
||||||
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3D11LibraryReflection
|
|
||||||
|
|
||||||
DECLARE_INTERFACE_(ID3D11LibraryReflection, IUnknown)
|
|
||||||
{
|
|
||||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
|
|
||||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
|
||||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_LIBRARY_DESC * pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(ID3D11FunctionReflection *, GetFunctionByIndex)(THIS_ _In_ INT FunctionIndex) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
// {207BCECB-D683-4A06-A8A3-9B149B9F73A4}
|
|
||||||
interface DECLSPEC_UUID("207BCECB-D683-4A06-A8A3-9B149B9F73A4") ID3D11FunctionReflection;
|
|
||||||
DEFINE_GUID(IID_ID3D11FunctionReflection,
|
|
||||||
0x207bcecb, 0xd683, 0x4a06, 0xa8, 0xa3, 0x9b, 0x14, 0x9b, 0x9f, 0x73, 0xa4);
|
|
||||||
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3D11FunctionReflection
|
|
||||||
|
|
||||||
DECLARE_INTERFACE(ID3D11FunctionReflection)
|
|
||||||
{
|
|
||||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_FUNCTION_DESC * pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ _In_ UINT BufferIndex) PURE;
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
|
|
||||||
_Out_ D3D11_SHADER_INPUT_BIND_DESC * pDesc) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(ID3D11ShaderReflectionVariable *, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
|
|
||||||
_Out_ D3D11_SHADER_INPUT_BIND_DESC * pDesc) PURE;
|
|
||||||
|
|
||||||
// Use D3D_RETURN_PARAMETER_INDEX to get description of the return value.
|
|
||||||
STDMETHOD_(ID3D11FunctionParameterReflection *, GetFunctionParameter)(THIS_ _In_ INT ParameterIndex) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
// {42757488-334F-47FE-982E-1A65D08CC462}
|
|
||||||
interface DECLSPEC_UUID("42757488-334F-47FE-982E-1A65D08CC462") ID3D11FunctionParameterReflection;
|
|
||||||
DEFINE_GUID(IID_ID3D11FunctionParameterReflection,
|
|
||||||
0x42757488, 0x334f, 0x47fe, 0x98, 0x2e, 0x1a, 0x65, 0xd0, 0x8c, 0xc4, 0x62);
|
|
||||||
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3D11FunctionParameterReflection
|
|
||||||
|
|
||||||
DECLARE_INTERFACE(ID3D11FunctionParameterReflection)
|
|
||||||
{
|
|
||||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_PARAMETER_DESC * pDesc) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
// {CAC701EE-80FC-4122-8242-10B39C8CEC34}
|
|
||||||
interface DECLSPEC_UUID("CAC701EE-80FC-4122-8242-10B39C8CEC34") ID3D11Module;
|
|
||||||
DEFINE_GUID(IID_ID3D11Module,
|
|
||||||
0xcac701ee, 0x80fc, 0x4122, 0x82, 0x42, 0x10, 0xb3, 0x9c, 0x8c, 0xec, 0x34);
|
|
||||||
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3D11Module
|
|
||||||
|
|
||||||
DECLARE_INTERFACE_(ID3D11Module, IUnknown)
|
|
||||||
{
|
|
||||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
|
|
||||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
|
||||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
|
||||||
|
|
||||||
// Create an instance of a module for resource re-binding.
|
|
||||||
STDMETHOD(CreateInstance)(THIS_ _In_opt_ LPCSTR pNamespace,
|
|
||||||
_COM_Outptr_ interface ID3D11ModuleInstance ** ppModuleInstance) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// {469E07F7-045A-48D5-AA12-68A478CDF75D}
|
|
||||||
interface DECLSPEC_UUID("469E07F7-045A-48D5-AA12-68A478CDF75D") ID3D11ModuleInstance;
|
|
||||||
DEFINE_GUID(IID_ID3D11ModuleInstance,
|
|
||||||
0x469e07f7, 0x45a, 0x48d5, 0xaa, 0x12, 0x68, 0xa4, 0x78, 0xcd, 0xf7, 0x5d);
|
|
||||||
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3D11ModuleInstance
|
|
||||||
|
|
||||||
DECLARE_INTERFACE_(ID3D11ModuleInstance, IUnknown)
|
|
||||||
{
|
|
||||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
|
|
||||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
|
||||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Resource binding API.
|
|
||||||
//
|
|
||||||
STDMETHOD(BindConstantBuffer)(THIS_ _In_ UINT uSrcSlot, _In_ UINT uDstSlot, _In_ UINT cbDstOffset) PURE;
|
|
||||||
STDMETHOD(BindConstantBufferByName)(THIS_ _In_ LPCSTR pName, _In_ UINT uDstSlot, _In_ UINT cbDstOffset) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(BindResource)(THIS_ _In_ UINT uSrcSlot, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
|
|
||||||
STDMETHOD(BindResourceByName)(THIS_ _In_ LPCSTR pName, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(BindSampler)(THIS_ _In_ UINT uSrcSlot, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
|
|
||||||
STDMETHOD(BindSamplerByName)(THIS_ _In_ LPCSTR pName, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(BindUnorderedAccessView)(THIS_ _In_ UINT uSrcSlot, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
|
|
||||||
STDMETHOD(BindUnorderedAccessViewByName)(THIS_ _In_ LPCSTR pName, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(BindResourceAsUnorderedAccessView)(THIS_ _In_ UINT uSrcSrvSlot, _In_ UINT uDstUavSlot, _In_ UINT uCount) PURE;
|
|
||||||
STDMETHOD(BindResourceAsUnorderedAccessViewByName)(THIS_ _In_ LPCSTR pSrvName, _In_ UINT uDstUavSlot, _In_ UINT uCount) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// {59A6CD0E-E10D-4C1F-88C0-63ABA1DAF30E}
|
|
||||||
interface DECLSPEC_UUID("59A6CD0E-E10D-4C1F-88C0-63ABA1DAF30E") ID3D11Linker;
|
|
||||||
DEFINE_GUID(IID_ID3D11Linker,
|
|
||||||
0x59a6cd0e, 0xe10d, 0x4c1f, 0x88, 0xc0, 0x63, 0xab, 0xa1, 0xda, 0xf3, 0xe);
|
|
||||||
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3D11Linker
|
|
||||||
|
|
||||||
DECLARE_INTERFACE_(ID3D11Linker, IUnknown)
|
|
||||||
{
|
|
||||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
|
|
||||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
|
||||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
|
||||||
|
|
||||||
// Link the shader and produce a shader blob suitable to D3D runtime.
|
|
||||||
STDMETHOD(Link)(THIS_ _In_ interface ID3D11ModuleInstance * pEntry,
|
|
||||||
_In_ LPCSTR pEntryName,
|
|
||||||
_In_ LPCSTR pTargetName,
|
|
||||||
_In_ UINT uFlags,
|
|
||||||
_COM_Outptr_ ID3DBlob ** ppShaderBlob,
|
|
||||||
_Always_(_Outptr_opt_result_maybenull_) ID3DBlob ** ppErrorBuffer) PURE;
|
|
||||||
|
|
||||||
// Add an instance of a library module to be used for linking.
|
|
||||||
STDMETHOD(UseLibrary)(THIS_ _In_ interface ID3D11ModuleInstance * pLibraryMI) PURE;
|
|
||||||
|
|
||||||
// Add a clip plane with the plane coefficients taken from a cbuffer entry for 10L9 shaders.
|
|
||||||
STDMETHOD(AddClipPlaneFromCBuffer)(THIS_ _In_ UINT uCBufferSlot, _In_ UINT uCBufferEntry) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// {D80DD70C-8D2F-4751-94A1-03C79B3556DB}
|
|
||||||
interface DECLSPEC_UUID("D80DD70C-8D2F-4751-94A1-03C79B3556DB") ID3D11LinkingNode;
|
|
||||||
DEFINE_GUID(IID_ID3D11LinkingNode,
|
|
||||||
0xd80dd70c, 0x8d2f, 0x4751, 0x94, 0xa1, 0x3, 0xc7, 0x9b, 0x35, 0x56, 0xdb);
|
|
||||||
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3D11LinkingNode
|
|
||||||
|
|
||||||
DECLARE_INTERFACE_(ID3D11LinkingNode, IUnknown)
|
|
||||||
{
|
|
||||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
|
|
||||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
|
||||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// {54133220-1CE8-43D3-8236-9855C5CEECFF}
|
|
||||||
interface DECLSPEC_UUID("54133220-1CE8-43D3-8236-9855C5CEECFF") ID3D11FunctionLinkingGraph;
|
|
||||||
DEFINE_GUID(IID_ID3D11FunctionLinkingGraph,
|
|
||||||
0x54133220, 0x1ce8, 0x43d3, 0x82, 0x36, 0x98, 0x55, 0xc5, 0xce, 0xec, 0xff);
|
|
||||||
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3D11FunctionLinkingGraph
|
|
||||||
|
|
||||||
DECLARE_INTERFACE_(ID3D11FunctionLinkingGraph, IUnknown)
|
|
||||||
{
|
|
||||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
|
|
||||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
|
||||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
|
||||||
|
|
||||||
// Create a shader module out of FLG description.
|
|
||||||
STDMETHOD(CreateModuleInstance)(THIS_ _COM_Outptr_ interface ID3D11ModuleInstance ** ppModuleInstance,
|
|
||||||
_Always_(_Outptr_opt_result_maybenull_) ID3DBlob ** ppErrorBuffer) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(SetInputSignature)(THIS_ __in_ecount(cInputParameters) const D3D11_PARAMETER_DESC * pInputParameters,
|
|
||||||
_In_ UINT cInputParameters,
|
|
||||||
_COM_Outptr_ interface ID3D11LinkingNode ** ppInputNode) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(SetOutputSignature)(THIS_ __in_ecount(cOutputParameters) const D3D11_PARAMETER_DESC * pOutputParameters,
|
|
||||||
_In_ UINT cOutputParameters,
|
|
||||||
_COM_Outptr_ interface ID3D11LinkingNode ** ppOutputNode) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(CallFunction)(THIS_ _In_opt_ LPCSTR pModuleInstanceNamespace,
|
|
||||||
_In_ interface ID3D11Module * pModuleWithFunctionPrototype,
|
|
||||||
_In_ LPCSTR pFunctionName,
|
|
||||||
_COM_Outptr_ interface ID3D11LinkingNode ** ppCallNode) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(PassValue)(THIS_ _In_ interface ID3D11LinkingNode * pSrcNode,
|
|
||||||
_In_ INT SrcParameterIndex,
|
|
||||||
_In_ interface ID3D11LinkingNode * pDstNode,
|
|
||||||
_In_ INT DstParameterIndex) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(PassValueWithSwizzle)(THIS_ _In_ interface ID3D11LinkingNode * pSrcNode,
|
|
||||||
_In_ INT SrcParameterIndex,
|
|
||||||
_In_ LPCSTR pSrcSwizzle,
|
|
||||||
_In_ interface ID3D11LinkingNode * pDstNode,
|
|
||||||
_In_ INT DstParameterIndex,
|
|
||||||
_In_ LPCSTR pDstSwizzle) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GetLastError)(THIS_ _Always_(_Outptr_opt_result_maybenull_) ID3DBlob ** ppErrorBuffer) PURE;
|
|
||||||
|
|
||||||
STDMETHOD(GenerateHlsl)(THIS_ _In_ UINT uFlags, // uFlags is reserved for future use.
|
|
||||||
_COM_Outptr_ ID3DBlob ** ppBuffer) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
// APIs //////////////////////////////////////////////////////////////////////
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif //__cplusplus
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif //__cplusplus
|
|
||||||
|
|
||||||
#endif //__D3D11SHADER_H__
|
|
||||||
|
|
6265
3rdparty/minidx12/Include/d3d12.h
vendored
6265
3rdparty/minidx12/Include/d3d12.h
vendored
File diff suppressed because it is too large
Load diff
1926
3rdparty/minidx12/Include/d3d12sdklayers.h
vendored
1926
3rdparty/minidx12/Include/d3d12sdklayers.h
vendored
File diff suppressed because it is too large
Load diff
882
3rdparty/minidx12/Include/d3dcommon.h
vendored
882
3rdparty/minidx12/Include/d3dcommon.h
vendored
|
@ -1,882 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
|
|
||||||
|
|
||||||
|
|
||||||
/* File created by MIDL compiler version 8.00.0613 */
|
|
||||||
/* @@MIDL_FILE_HEADING( ) */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* verify that the <rpcndr.h> version is high enough to compile this file*/
|
|
||||||
#ifndef __REQUIRED_RPCNDR_H_VERSION__
|
|
||||||
#define __REQUIRED_RPCNDR_H_VERSION__ 500
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* verify that the <rpcsal.h> version is high enough to compile this file*/
|
|
||||||
#ifndef __REQUIRED_RPCSAL_H_VERSION__
|
|
||||||
#define __REQUIRED_RPCSAL_H_VERSION__ 100
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "rpc.h"
|
|
||||||
#include "rpcndr.h"
|
|
||||||
|
|
||||||
#ifndef __RPCNDR_H_VERSION__
|
|
||||||
#error this stub requires an updated version of <rpcndr.h>
|
|
||||||
#endif /* __RPCNDR_H_VERSION__ */
|
|
||||||
|
|
||||||
#ifndef COM_NO_WINDOWS_H
|
|
||||||
#include "windows.h"
|
|
||||||
#include "ole2.h"
|
|
||||||
#endif /*COM_NO_WINDOWS_H*/
|
|
||||||
|
|
||||||
#ifndef __d3dcommon_h__
|
|
||||||
#define __d3dcommon_h__
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
|
||||||
#pragma once
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Forward Declarations */
|
|
||||||
|
|
||||||
#ifndef __ID3D10Blob_FWD_DEFINED__
|
|
||||||
#define __ID3D10Blob_FWD_DEFINED__
|
|
||||||
typedef interface ID3D10Blob ID3D10Blob;
|
|
||||||
|
|
||||||
#endif /* __ID3D10Blob_FWD_DEFINED__ */
|
|
||||||
|
|
||||||
|
|
||||||
/* header files for imported files */
|
|
||||||
#include "oaidl.h"
|
|
||||||
#include "ocidl.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* interface __MIDL_itf_d3dcommon_0000_0000 */
|
|
||||||
/* [local] */
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum D3D_DRIVER_TYPE
|
|
||||||
{
|
|
||||||
D3D_DRIVER_TYPE_UNKNOWN = 0,
|
|
||||||
D3D_DRIVER_TYPE_HARDWARE = ( D3D_DRIVER_TYPE_UNKNOWN + 1 ) ,
|
|
||||||
D3D_DRIVER_TYPE_REFERENCE = ( D3D_DRIVER_TYPE_HARDWARE + 1 ) ,
|
|
||||||
D3D_DRIVER_TYPE_NULL = ( D3D_DRIVER_TYPE_REFERENCE + 1 ) ,
|
|
||||||
D3D_DRIVER_TYPE_SOFTWARE = ( D3D_DRIVER_TYPE_NULL + 1 ) ,
|
|
||||||
D3D_DRIVER_TYPE_WARP = ( D3D_DRIVER_TYPE_SOFTWARE + 1 )
|
|
||||||
} D3D_DRIVER_TYPE;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum D3D_FEATURE_LEVEL
|
|
||||||
{
|
|
||||||
D3D_FEATURE_LEVEL_9_1 = 0x9100,
|
|
||||||
D3D_FEATURE_LEVEL_9_2 = 0x9200,
|
|
||||||
D3D_FEATURE_LEVEL_9_3 = 0x9300,
|
|
||||||
D3D_FEATURE_LEVEL_10_0 = 0xa000,
|
|
||||||
D3D_FEATURE_LEVEL_10_1 = 0xa100,
|
|
||||||
D3D_FEATURE_LEVEL_11_0 = 0xb000,
|
|
||||||
D3D_FEATURE_LEVEL_11_1 = 0xb100,
|
|
||||||
D3D_FEATURE_LEVEL_12_0 = 0xc000,
|
|
||||||
D3D_FEATURE_LEVEL_12_1 = 0xc100
|
|
||||||
} D3D_FEATURE_LEVEL;
|
|
||||||
|
|
||||||
#define D3D_FL9_1_REQ_TEXTURE1D_U_DIMENSION 2048
|
|
||||||
#define D3D_FL9_3_REQ_TEXTURE1D_U_DIMENSION 4096
|
|
||||||
#define D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION 2048
|
|
||||||
#define D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION 4096
|
|
||||||
#define D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION 512
|
|
||||||
#define D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION 4096
|
|
||||||
#define D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION 256
|
|
||||||
#define D3D_FL9_1_DEFAULT_MAX_ANISOTROPY 2
|
|
||||||
#define D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT 65535
|
|
||||||
#define D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT 1048575
|
|
||||||
#define D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT 1
|
|
||||||
#define D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT 4
|
|
||||||
#define D3D_FL9_1_MAX_TEXTURE_REPEAT 128
|
|
||||||
#define D3D_FL9_2_MAX_TEXTURE_REPEAT 2048
|
|
||||||
#define D3D_FL9_3_MAX_TEXTURE_REPEAT 8192
|
|
||||||
typedef
|
|
||||||
enum D3D_PRIMITIVE_TOPOLOGY
|
|
||||||
{
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_LINELIST = 2,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST
|
|
||||||
} D3D_PRIMITIVE_TOPOLOGY;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum D3D_PRIMITIVE
|
|
||||||
{
|
|
||||||
D3D_PRIMITIVE_UNDEFINED = 0,
|
|
||||||
D3D_PRIMITIVE_POINT = 1,
|
|
||||||
D3D_PRIMITIVE_LINE = 2,
|
|
||||||
D3D_PRIMITIVE_TRIANGLE = 3,
|
|
||||||
D3D_PRIMITIVE_LINE_ADJ = 6,
|
|
||||||
D3D_PRIMITIVE_TRIANGLE_ADJ = 7,
|
|
||||||
D3D_PRIMITIVE_1_CONTROL_POINT_PATCH = 8,
|
|
||||||
D3D_PRIMITIVE_2_CONTROL_POINT_PATCH = 9,
|
|
||||||
D3D_PRIMITIVE_3_CONTROL_POINT_PATCH = 10,
|
|
||||||
D3D_PRIMITIVE_4_CONTROL_POINT_PATCH = 11,
|
|
||||||
D3D_PRIMITIVE_5_CONTROL_POINT_PATCH = 12,
|
|
||||||
D3D_PRIMITIVE_6_CONTROL_POINT_PATCH = 13,
|
|
||||||
D3D_PRIMITIVE_7_CONTROL_POINT_PATCH = 14,
|
|
||||||
D3D_PRIMITIVE_8_CONTROL_POINT_PATCH = 15,
|
|
||||||
D3D_PRIMITIVE_9_CONTROL_POINT_PATCH = 16,
|
|
||||||
D3D_PRIMITIVE_10_CONTROL_POINT_PATCH = 17,
|
|
||||||
D3D_PRIMITIVE_11_CONTROL_POINT_PATCH = 18,
|
|
||||||
D3D_PRIMITIVE_12_CONTROL_POINT_PATCH = 19,
|
|
||||||
D3D_PRIMITIVE_13_CONTROL_POINT_PATCH = 20,
|
|
||||||
D3D_PRIMITIVE_14_CONTROL_POINT_PATCH = 21,
|
|
||||||
D3D_PRIMITIVE_15_CONTROL_POINT_PATCH = 22,
|
|
||||||
D3D_PRIMITIVE_16_CONTROL_POINT_PATCH = 23,
|
|
||||||
D3D_PRIMITIVE_17_CONTROL_POINT_PATCH = 24,
|
|
||||||
D3D_PRIMITIVE_18_CONTROL_POINT_PATCH = 25,
|
|
||||||
D3D_PRIMITIVE_19_CONTROL_POINT_PATCH = 26,
|
|
||||||
D3D_PRIMITIVE_20_CONTROL_POINT_PATCH = 27,
|
|
||||||
D3D_PRIMITIVE_21_CONTROL_POINT_PATCH = 28,
|
|
||||||
D3D_PRIMITIVE_22_CONTROL_POINT_PATCH = 29,
|
|
||||||
D3D_PRIMITIVE_23_CONTROL_POINT_PATCH = 30,
|
|
||||||
D3D_PRIMITIVE_24_CONTROL_POINT_PATCH = 31,
|
|
||||||
D3D_PRIMITIVE_25_CONTROL_POINT_PATCH = 32,
|
|
||||||
D3D_PRIMITIVE_26_CONTROL_POINT_PATCH = 33,
|
|
||||||
D3D_PRIMITIVE_27_CONTROL_POINT_PATCH = 34,
|
|
||||||
D3D_PRIMITIVE_28_CONTROL_POINT_PATCH = 35,
|
|
||||||
D3D_PRIMITIVE_29_CONTROL_POINT_PATCH = 36,
|
|
||||||
D3D_PRIMITIVE_30_CONTROL_POINT_PATCH = 37,
|
|
||||||
D3D_PRIMITIVE_31_CONTROL_POINT_PATCH = 38,
|
|
||||||
D3D_PRIMITIVE_32_CONTROL_POINT_PATCH = 39,
|
|
||||||
D3D10_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED,
|
|
||||||
D3D10_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT,
|
|
||||||
D3D10_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE,
|
|
||||||
D3D10_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE,
|
|
||||||
D3D10_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ,
|
|
||||||
D3D10_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ,
|
|
||||||
D3D11_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED,
|
|
||||||
D3D11_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT,
|
|
||||||
D3D11_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE,
|
|
||||||
D3D11_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE,
|
|
||||||
D3D11_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ,
|
|
||||||
D3D11_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ,
|
|
||||||
D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH = D3D_PRIMITIVE_1_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH = D3D_PRIMITIVE_2_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH = D3D_PRIMITIVE_3_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH = D3D_PRIMITIVE_4_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH = D3D_PRIMITIVE_5_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH = D3D_PRIMITIVE_6_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH = D3D_PRIMITIVE_7_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH = D3D_PRIMITIVE_8_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH = D3D_PRIMITIVE_9_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH = D3D_PRIMITIVE_10_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH = D3D_PRIMITIVE_11_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH = D3D_PRIMITIVE_12_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH = D3D_PRIMITIVE_13_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH = D3D_PRIMITIVE_14_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH = D3D_PRIMITIVE_15_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH = D3D_PRIMITIVE_16_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH = D3D_PRIMITIVE_17_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH = D3D_PRIMITIVE_18_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH = D3D_PRIMITIVE_19_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH = D3D_PRIMITIVE_20_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH = D3D_PRIMITIVE_21_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH = D3D_PRIMITIVE_22_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH = D3D_PRIMITIVE_23_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH = D3D_PRIMITIVE_24_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH = D3D_PRIMITIVE_25_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH = D3D_PRIMITIVE_26_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH = D3D_PRIMITIVE_27_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH = D3D_PRIMITIVE_28_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH = D3D_PRIMITIVE_29_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH = D3D_PRIMITIVE_30_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH = D3D_PRIMITIVE_31_CONTROL_POINT_PATCH,
|
|
||||||
D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH = D3D_PRIMITIVE_32_CONTROL_POINT_PATCH
|
|
||||||
} D3D_PRIMITIVE;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum D3D_SRV_DIMENSION
|
|
||||||
{
|
|
||||||
D3D_SRV_DIMENSION_UNKNOWN = 0,
|
|
||||||
D3D_SRV_DIMENSION_BUFFER = 1,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE1D = 2,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE1DARRAY = 3,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE2D = 4,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE2DARRAY = 5,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE2DMS = 6,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = 7,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE3D = 8,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURECUBE = 9,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURECUBEARRAY = 10,
|
|
||||||
D3D_SRV_DIMENSION_BUFFEREX = 11,
|
|
||||||
D3D10_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
|
|
||||||
D3D10_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
|
|
||||||
D3D10_1_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
|
|
||||||
D3D10_1_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY,
|
|
||||||
D3D11_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
|
|
||||||
D3D11_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY,
|
|
||||||
D3D11_SRV_DIMENSION_BUFFEREX = D3D_SRV_DIMENSION_BUFFEREX
|
|
||||||
} D3D_SRV_DIMENSION;
|
|
||||||
|
|
||||||
typedef struct _D3D_SHADER_MACRO
|
|
||||||
{
|
|
||||||
LPCSTR Name;
|
|
||||||
LPCSTR Definition;
|
|
||||||
} D3D_SHADER_MACRO;
|
|
||||||
|
|
||||||
typedef struct _D3D_SHADER_MACRO *LPD3D_SHADER_MACRO;
|
|
||||||
|
|
||||||
DEFINE_GUID(IID_ID3D10Blob, 0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2);
|
|
||||||
|
|
||||||
|
|
||||||
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0000_v0_0_c_ifspec;
|
|
||||||
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0000_v0_0_s_ifspec;
|
|
||||||
|
|
||||||
#ifndef __ID3D10Blob_INTERFACE_DEFINED__
|
|
||||||
#define __ID3D10Blob_INTERFACE_DEFINED__
|
|
||||||
|
|
||||||
/* interface ID3D10Blob */
|
|
||||||
/* [unique][local][object][uuid] */
|
|
||||||
|
|
||||||
|
|
||||||
EXTERN_C const IID IID_ID3D10Blob;
|
|
||||||
|
|
||||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
|
||||||
|
|
||||||
MIDL_INTERFACE("8BA5FB08-5195-40e2-AC58-0D989C3A0102")
|
|
||||||
ID3D10Blob : public IUnknown
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual LPVOID STDMETHODCALLTYPE GetBufferPointer( void) = 0;
|
|
||||||
|
|
||||||
virtual SIZE_T STDMETHODCALLTYPE GetBufferSize( void) = 0;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#else /* C style interface */
|
|
||||||
|
|
||||||
typedef struct ID3D10BlobVtbl
|
|
||||||
{
|
|
||||||
BEGIN_INTERFACE
|
|
||||||
|
|
||||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
|
||||||
ID3D10Blob * This,
|
|
||||||
/* [in] */ REFIID riid,
|
|
||||||
/* [annotation][iid_is][out] */
|
|
||||||
_COM_Outptr_ void **ppvObject);
|
|
||||||
|
|
||||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
|
||||||
ID3D10Blob * This);
|
|
||||||
|
|
||||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
|
||||||
ID3D10Blob * This);
|
|
||||||
|
|
||||||
LPVOID ( STDMETHODCALLTYPE *GetBufferPointer )(
|
|
||||||
ID3D10Blob * This);
|
|
||||||
|
|
||||||
SIZE_T ( STDMETHODCALLTYPE *GetBufferSize )(
|
|
||||||
ID3D10Blob * This);
|
|
||||||
|
|
||||||
END_INTERFACE
|
|
||||||
} ID3D10BlobVtbl;
|
|
||||||
|
|
||||||
interface ID3D10Blob
|
|
||||||
{
|
|
||||||
CONST_VTBL struct ID3D10BlobVtbl *lpVtbl;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef COBJMACROS
|
|
||||||
|
|
||||||
|
|
||||||
#define ID3D10Blob_QueryInterface(This,riid,ppvObject) \
|
|
||||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
|
||||||
|
|
||||||
#define ID3D10Blob_AddRef(This) \
|
|
||||||
( (This)->lpVtbl -> AddRef(This) )
|
|
||||||
|
|
||||||
#define ID3D10Blob_Release(This) \
|
|
||||||
( (This)->lpVtbl -> Release(This) )
|
|
||||||
|
|
||||||
|
|
||||||
#define ID3D10Blob_GetBufferPointer(This) \
|
|
||||||
( (This)->lpVtbl -> GetBufferPointer(This) )
|
|
||||||
|
|
||||||
#define ID3D10Blob_GetBufferSize(This) \
|
|
||||||
( (This)->lpVtbl -> GetBufferSize(This) )
|
|
||||||
|
|
||||||
#endif /* COBJMACROS */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* C style interface */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __ID3D10Blob_INTERFACE_DEFINED__ */
|
|
||||||
|
|
||||||
|
|
||||||
/* interface __MIDL_itf_d3dcommon_0000_0001 */
|
|
||||||
/* [local] */
|
|
||||||
|
|
||||||
typedef interface ID3D10Blob* LPD3D10BLOB;
|
|
||||||
typedef ID3D10Blob ID3DBlob;
|
|
||||||
|
|
||||||
typedef ID3DBlob* LPD3DBLOB;
|
|
||||||
#define IID_ID3DBlob IID_ID3D10Blob
|
|
||||||
typedef
|
|
||||||
enum _D3D_INCLUDE_TYPE
|
|
||||||
{
|
|
||||||
D3D_INCLUDE_LOCAL = 0,
|
|
||||||
D3D_INCLUDE_SYSTEM = ( D3D_INCLUDE_LOCAL + 1 ) ,
|
|
||||||
D3D10_INCLUDE_LOCAL = D3D_INCLUDE_LOCAL,
|
|
||||||
D3D10_INCLUDE_SYSTEM = D3D_INCLUDE_SYSTEM,
|
|
||||||
D3D_INCLUDE_FORCE_DWORD = 0x7fffffff
|
|
||||||
} D3D_INCLUDE_TYPE;
|
|
||||||
|
|
||||||
typedef interface ID3DInclude ID3DInclude;
|
|
||||||
#undef INTERFACE
|
|
||||||
#define INTERFACE ID3DInclude
|
|
||||||
DECLARE_INTERFACE(ID3DInclude)
|
|
||||||
{
|
|
||||||
STDMETHOD(Open)(THIS_ D3D_INCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE;
|
|
||||||
STDMETHOD(Close)(THIS_ LPCVOID pData) PURE;
|
|
||||||
};
|
|
||||||
typedef ID3DInclude* LPD3DINCLUDE;
|
|
||||||
typedef
|
|
||||||
enum _D3D_SHADER_VARIABLE_CLASS
|
|
||||||
{
|
|
||||||
D3D_SVC_SCALAR = 0,
|
|
||||||
D3D_SVC_VECTOR = ( D3D_SVC_SCALAR + 1 ) ,
|
|
||||||
D3D_SVC_MATRIX_ROWS = ( D3D_SVC_VECTOR + 1 ) ,
|
|
||||||
D3D_SVC_MATRIX_COLUMNS = ( D3D_SVC_MATRIX_ROWS + 1 ) ,
|
|
||||||
D3D_SVC_OBJECT = ( D3D_SVC_MATRIX_COLUMNS + 1 ) ,
|
|
||||||
D3D_SVC_STRUCT = ( D3D_SVC_OBJECT + 1 ) ,
|
|
||||||
D3D_SVC_INTERFACE_CLASS = ( D3D_SVC_STRUCT + 1 ) ,
|
|
||||||
D3D_SVC_INTERFACE_POINTER = ( D3D_SVC_INTERFACE_CLASS + 1 ) ,
|
|
||||||
D3D10_SVC_SCALAR = D3D_SVC_SCALAR,
|
|
||||||
D3D10_SVC_VECTOR = D3D_SVC_VECTOR,
|
|
||||||
D3D10_SVC_MATRIX_ROWS = D3D_SVC_MATRIX_ROWS,
|
|
||||||
D3D10_SVC_MATRIX_COLUMNS = D3D_SVC_MATRIX_COLUMNS,
|
|
||||||
D3D10_SVC_OBJECT = D3D_SVC_OBJECT,
|
|
||||||
D3D10_SVC_STRUCT = D3D_SVC_STRUCT,
|
|
||||||
D3D11_SVC_INTERFACE_CLASS = D3D_SVC_INTERFACE_CLASS,
|
|
||||||
D3D11_SVC_INTERFACE_POINTER = D3D_SVC_INTERFACE_POINTER,
|
|
||||||
D3D_SVC_FORCE_DWORD = 0x7fffffff
|
|
||||||
} D3D_SHADER_VARIABLE_CLASS;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum _D3D_SHADER_VARIABLE_FLAGS
|
|
||||||
{
|
|
||||||
D3D_SVF_USERPACKED = 1,
|
|
||||||
D3D_SVF_USED = 2,
|
|
||||||
D3D_SVF_INTERFACE_POINTER = 4,
|
|
||||||
D3D_SVF_INTERFACE_PARAMETER = 8,
|
|
||||||
D3D10_SVF_USERPACKED = D3D_SVF_USERPACKED,
|
|
||||||
D3D10_SVF_USED = D3D_SVF_USED,
|
|
||||||
D3D11_SVF_INTERFACE_POINTER = D3D_SVF_INTERFACE_POINTER,
|
|
||||||
D3D11_SVF_INTERFACE_PARAMETER = D3D_SVF_INTERFACE_PARAMETER,
|
|
||||||
D3D_SVF_FORCE_DWORD = 0x7fffffff
|
|
||||||
} D3D_SHADER_VARIABLE_FLAGS;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum _D3D_SHADER_VARIABLE_TYPE
|
|
||||||
{
|
|
||||||
D3D_SVT_VOID = 0,
|
|
||||||
D3D_SVT_BOOL = 1,
|
|
||||||
D3D_SVT_INT = 2,
|
|
||||||
D3D_SVT_FLOAT = 3,
|
|
||||||
D3D_SVT_STRING = 4,
|
|
||||||
D3D_SVT_TEXTURE = 5,
|
|
||||||
D3D_SVT_TEXTURE1D = 6,
|
|
||||||
D3D_SVT_TEXTURE2D = 7,
|
|
||||||
D3D_SVT_TEXTURE3D = 8,
|
|
||||||
D3D_SVT_TEXTURECUBE = 9,
|
|
||||||
D3D_SVT_SAMPLER = 10,
|
|
||||||
D3D_SVT_SAMPLER1D = 11,
|
|
||||||
D3D_SVT_SAMPLER2D = 12,
|
|
||||||
D3D_SVT_SAMPLER3D = 13,
|
|
||||||
D3D_SVT_SAMPLERCUBE = 14,
|
|
||||||
D3D_SVT_PIXELSHADER = 15,
|
|
||||||
D3D_SVT_VERTEXSHADER = 16,
|
|
||||||
D3D_SVT_PIXELFRAGMENT = 17,
|
|
||||||
D3D_SVT_VERTEXFRAGMENT = 18,
|
|
||||||
D3D_SVT_UINT = 19,
|
|
||||||
D3D_SVT_UINT8 = 20,
|
|
||||||
D3D_SVT_GEOMETRYSHADER = 21,
|
|
||||||
D3D_SVT_RASTERIZER = 22,
|
|
||||||
D3D_SVT_DEPTHSTENCIL = 23,
|
|
||||||
D3D_SVT_BLEND = 24,
|
|
||||||
D3D_SVT_BUFFER = 25,
|
|
||||||
D3D_SVT_CBUFFER = 26,
|
|
||||||
D3D_SVT_TBUFFER = 27,
|
|
||||||
D3D_SVT_TEXTURE1DARRAY = 28,
|
|
||||||
D3D_SVT_TEXTURE2DARRAY = 29,
|
|
||||||
D3D_SVT_RENDERTARGETVIEW = 30,
|
|
||||||
D3D_SVT_DEPTHSTENCILVIEW = 31,
|
|
||||||
D3D_SVT_TEXTURE2DMS = 32,
|
|
||||||
D3D_SVT_TEXTURE2DMSARRAY = 33,
|
|
||||||
D3D_SVT_TEXTURECUBEARRAY = 34,
|
|
||||||
D3D_SVT_HULLSHADER = 35,
|
|
||||||
D3D_SVT_DOMAINSHADER = 36,
|
|
||||||
D3D_SVT_INTERFACE_POINTER = 37,
|
|
||||||
D3D_SVT_COMPUTESHADER = 38,
|
|
||||||
D3D_SVT_DOUBLE = 39,
|
|
||||||
D3D_SVT_RWTEXTURE1D = 40,
|
|
||||||
D3D_SVT_RWTEXTURE1DARRAY = 41,
|
|
||||||
D3D_SVT_RWTEXTURE2D = 42,
|
|
||||||
D3D_SVT_RWTEXTURE2DARRAY = 43,
|
|
||||||
D3D_SVT_RWTEXTURE3D = 44,
|
|
||||||
D3D_SVT_RWBUFFER = 45,
|
|
||||||
D3D_SVT_BYTEADDRESS_BUFFER = 46,
|
|
||||||
D3D_SVT_RWBYTEADDRESS_BUFFER = 47,
|
|
||||||
D3D_SVT_STRUCTURED_BUFFER = 48,
|
|
||||||
D3D_SVT_RWSTRUCTURED_BUFFER = 49,
|
|
||||||
D3D_SVT_APPEND_STRUCTURED_BUFFER = 50,
|
|
||||||
D3D_SVT_CONSUME_STRUCTURED_BUFFER = 51,
|
|
||||||
D3D_SVT_MIN8FLOAT = 52,
|
|
||||||
D3D_SVT_MIN10FLOAT = 53,
|
|
||||||
D3D_SVT_MIN16FLOAT = 54,
|
|
||||||
D3D_SVT_MIN12INT = 55,
|
|
||||||
D3D_SVT_MIN16INT = 56,
|
|
||||||
D3D_SVT_MIN16UINT = 57,
|
|
||||||
D3D10_SVT_VOID = D3D_SVT_VOID,
|
|
||||||
D3D10_SVT_BOOL = D3D_SVT_BOOL,
|
|
||||||
D3D10_SVT_INT = D3D_SVT_INT,
|
|
||||||
D3D10_SVT_FLOAT = D3D_SVT_FLOAT,
|
|
||||||
D3D10_SVT_STRING = D3D_SVT_STRING,
|
|
||||||
D3D10_SVT_TEXTURE = D3D_SVT_TEXTURE,
|
|
||||||
D3D10_SVT_TEXTURE1D = D3D_SVT_TEXTURE1D,
|
|
||||||
D3D10_SVT_TEXTURE2D = D3D_SVT_TEXTURE2D,
|
|
||||||
D3D10_SVT_TEXTURE3D = D3D_SVT_TEXTURE3D,
|
|
||||||
D3D10_SVT_TEXTURECUBE = D3D_SVT_TEXTURECUBE,
|
|
||||||
D3D10_SVT_SAMPLER = D3D_SVT_SAMPLER,
|
|
||||||
D3D10_SVT_SAMPLER1D = D3D_SVT_SAMPLER1D,
|
|
||||||
D3D10_SVT_SAMPLER2D = D3D_SVT_SAMPLER2D,
|
|
||||||
D3D10_SVT_SAMPLER3D = D3D_SVT_SAMPLER3D,
|
|
||||||
D3D10_SVT_SAMPLERCUBE = D3D_SVT_SAMPLERCUBE,
|
|
||||||
D3D10_SVT_PIXELSHADER = D3D_SVT_PIXELSHADER,
|
|
||||||
D3D10_SVT_VERTEXSHADER = D3D_SVT_VERTEXSHADER,
|
|
||||||
D3D10_SVT_PIXELFRAGMENT = D3D_SVT_PIXELFRAGMENT,
|
|
||||||
D3D10_SVT_VERTEXFRAGMENT = D3D_SVT_VERTEXFRAGMENT,
|
|
||||||
D3D10_SVT_UINT = D3D_SVT_UINT,
|
|
||||||
D3D10_SVT_UINT8 = D3D_SVT_UINT8,
|
|
||||||
D3D10_SVT_GEOMETRYSHADER = D3D_SVT_GEOMETRYSHADER,
|
|
||||||
D3D10_SVT_RASTERIZER = D3D_SVT_RASTERIZER,
|
|
||||||
D3D10_SVT_DEPTHSTENCIL = D3D_SVT_DEPTHSTENCIL,
|
|
||||||
D3D10_SVT_BLEND = D3D_SVT_BLEND,
|
|
||||||
D3D10_SVT_BUFFER = D3D_SVT_BUFFER,
|
|
||||||
D3D10_SVT_CBUFFER = D3D_SVT_CBUFFER,
|
|
||||||
D3D10_SVT_TBUFFER = D3D_SVT_TBUFFER,
|
|
||||||
D3D10_SVT_TEXTURE1DARRAY = D3D_SVT_TEXTURE1DARRAY,
|
|
||||||
D3D10_SVT_TEXTURE2DARRAY = D3D_SVT_TEXTURE2DARRAY,
|
|
||||||
D3D10_SVT_RENDERTARGETVIEW = D3D_SVT_RENDERTARGETVIEW,
|
|
||||||
D3D10_SVT_DEPTHSTENCILVIEW = D3D_SVT_DEPTHSTENCILVIEW,
|
|
||||||
D3D10_SVT_TEXTURE2DMS = D3D_SVT_TEXTURE2DMS,
|
|
||||||
D3D10_SVT_TEXTURE2DMSARRAY = D3D_SVT_TEXTURE2DMSARRAY,
|
|
||||||
D3D10_SVT_TEXTURECUBEARRAY = D3D_SVT_TEXTURECUBEARRAY,
|
|
||||||
D3D11_SVT_HULLSHADER = D3D_SVT_HULLSHADER,
|
|
||||||
D3D11_SVT_DOMAINSHADER = D3D_SVT_DOMAINSHADER,
|
|
||||||
D3D11_SVT_INTERFACE_POINTER = D3D_SVT_INTERFACE_POINTER,
|
|
||||||
D3D11_SVT_COMPUTESHADER = D3D_SVT_COMPUTESHADER,
|
|
||||||
D3D11_SVT_DOUBLE = D3D_SVT_DOUBLE,
|
|
||||||
D3D11_SVT_RWTEXTURE1D = D3D_SVT_RWTEXTURE1D,
|
|
||||||
D3D11_SVT_RWTEXTURE1DARRAY = D3D_SVT_RWTEXTURE1DARRAY,
|
|
||||||
D3D11_SVT_RWTEXTURE2D = D3D_SVT_RWTEXTURE2D,
|
|
||||||
D3D11_SVT_RWTEXTURE2DARRAY = D3D_SVT_RWTEXTURE2DARRAY,
|
|
||||||
D3D11_SVT_RWTEXTURE3D = D3D_SVT_RWTEXTURE3D,
|
|
||||||
D3D11_SVT_RWBUFFER = D3D_SVT_RWBUFFER,
|
|
||||||
D3D11_SVT_BYTEADDRESS_BUFFER = D3D_SVT_BYTEADDRESS_BUFFER,
|
|
||||||
D3D11_SVT_RWBYTEADDRESS_BUFFER = D3D_SVT_RWBYTEADDRESS_BUFFER,
|
|
||||||
D3D11_SVT_STRUCTURED_BUFFER = D3D_SVT_STRUCTURED_BUFFER,
|
|
||||||
D3D11_SVT_RWSTRUCTURED_BUFFER = D3D_SVT_RWSTRUCTURED_BUFFER,
|
|
||||||
D3D11_SVT_APPEND_STRUCTURED_BUFFER = D3D_SVT_APPEND_STRUCTURED_BUFFER,
|
|
||||||
D3D11_SVT_CONSUME_STRUCTURED_BUFFER = D3D_SVT_CONSUME_STRUCTURED_BUFFER,
|
|
||||||
D3D_SVT_FORCE_DWORD = 0x7fffffff
|
|
||||||
} D3D_SHADER_VARIABLE_TYPE;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum _D3D_SHADER_INPUT_FLAGS
|
|
||||||
{
|
|
||||||
D3D_SIF_USERPACKED = 0x1,
|
|
||||||
D3D_SIF_COMPARISON_SAMPLER = 0x2,
|
|
||||||
D3D_SIF_TEXTURE_COMPONENT_0 = 0x4,
|
|
||||||
D3D_SIF_TEXTURE_COMPONENT_1 = 0x8,
|
|
||||||
D3D_SIF_TEXTURE_COMPONENTS = 0xc,
|
|
||||||
D3D_SIF_UNUSED = 0x10,
|
|
||||||
D3D10_SIF_USERPACKED = D3D_SIF_USERPACKED,
|
|
||||||
D3D10_SIF_COMPARISON_SAMPLER = D3D_SIF_COMPARISON_SAMPLER,
|
|
||||||
D3D10_SIF_TEXTURE_COMPONENT_0 = D3D_SIF_TEXTURE_COMPONENT_0,
|
|
||||||
D3D10_SIF_TEXTURE_COMPONENT_1 = D3D_SIF_TEXTURE_COMPONENT_1,
|
|
||||||
D3D10_SIF_TEXTURE_COMPONENTS = D3D_SIF_TEXTURE_COMPONENTS,
|
|
||||||
D3D_SIF_FORCE_DWORD = 0x7fffffff
|
|
||||||
} D3D_SHADER_INPUT_FLAGS;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum _D3D_SHADER_INPUT_TYPE
|
|
||||||
{
|
|
||||||
D3D_SIT_CBUFFER = 0,
|
|
||||||
D3D_SIT_TBUFFER = ( D3D_SIT_CBUFFER + 1 ) ,
|
|
||||||
D3D_SIT_TEXTURE = ( D3D_SIT_TBUFFER + 1 ) ,
|
|
||||||
D3D_SIT_SAMPLER = ( D3D_SIT_TEXTURE + 1 ) ,
|
|
||||||
D3D_SIT_UAV_RWTYPED = ( D3D_SIT_SAMPLER + 1 ) ,
|
|
||||||
D3D_SIT_STRUCTURED = ( D3D_SIT_UAV_RWTYPED + 1 ) ,
|
|
||||||
D3D_SIT_UAV_RWSTRUCTURED = ( D3D_SIT_STRUCTURED + 1 ) ,
|
|
||||||
D3D_SIT_BYTEADDRESS = ( D3D_SIT_UAV_RWSTRUCTURED + 1 ) ,
|
|
||||||
D3D_SIT_UAV_RWBYTEADDRESS = ( D3D_SIT_BYTEADDRESS + 1 ) ,
|
|
||||||
D3D_SIT_UAV_APPEND_STRUCTURED = ( D3D_SIT_UAV_RWBYTEADDRESS + 1 ) ,
|
|
||||||
D3D_SIT_UAV_CONSUME_STRUCTURED = ( D3D_SIT_UAV_APPEND_STRUCTURED + 1 ) ,
|
|
||||||
D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = ( D3D_SIT_UAV_CONSUME_STRUCTURED + 1 ) ,
|
|
||||||
D3D10_SIT_CBUFFER = D3D_SIT_CBUFFER,
|
|
||||||
D3D10_SIT_TBUFFER = D3D_SIT_TBUFFER,
|
|
||||||
D3D10_SIT_TEXTURE = D3D_SIT_TEXTURE,
|
|
||||||
D3D10_SIT_SAMPLER = D3D_SIT_SAMPLER,
|
|
||||||
D3D11_SIT_UAV_RWTYPED = D3D_SIT_UAV_RWTYPED,
|
|
||||||
D3D11_SIT_STRUCTURED = D3D_SIT_STRUCTURED,
|
|
||||||
D3D11_SIT_UAV_RWSTRUCTURED = D3D_SIT_UAV_RWSTRUCTURED,
|
|
||||||
D3D11_SIT_BYTEADDRESS = D3D_SIT_BYTEADDRESS,
|
|
||||||
D3D11_SIT_UAV_RWBYTEADDRESS = D3D_SIT_UAV_RWBYTEADDRESS,
|
|
||||||
D3D11_SIT_UAV_APPEND_STRUCTURED = D3D_SIT_UAV_APPEND_STRUCTURED,
|
|
||||||
D3D11_SIT_UAV_CONSUME_STRUCTURED = D3D_SIT_UAV_CONSUME_STRUCTURED,
|
|
||||||
D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER
|
|
||||||
} D3D_SHADER_INPUT_TYPE;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum _D3D_SHADER_CBUFFER_FLAGS
|
|
||||||
{
|
|
||||||
D3D_CBF_USERPACKED = 1,
|
|
||||||
D3D10_CBF_USERPACKED = D3D_CBF_USERPACKED,
|
|
||||||
D3D_CBF_FORCE_DWORD = 0x7fffffff
|
|
||||||
} D3D_SHADER_CBUFFER_FLAGS;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum _D3D_CBUFFER_TYPE
|
|
||||||
{
|
|
||||||
D3D_CT_CBUFFER = 0,
|
|
||||||
D3D_CT_TBUFFER = ( D3D_CT_CBUFFER + 1 ) ,
|
|
||||||
D3D_CT_INTERFACE_POINTERS = ( D3D_CT_TBUFFER + 1 ) ,
|
|
||||||
D3D_CT_RESOURCE_BIND_INFO = ( D3D_CT_INTERFACE_POINTERS + 1 ) ,
|
|
||||||
D3D10_CT_CBUFFER = D3D_CT_CBUFFER,
|
|
||||||
D3D10_CT_TBUFFER = D3D_CT_TBUFFER,
|
|
||||||
D3D11_CT_CBUFFER = D3D_CT_CBUFFER,
|
|
||||||
D3D11_CT_TBUFFER = D3D_CT_TBUFFER,
|
|
||||||
D3D11_CT_INTERFACE_POINTERS = D3D_CT_INTERFACE_POINTERS,
|
|
||||||
D3D11_CT_RESOURCE_BIND_INFO = D3D_CT_RESOURCE_BIND_INFO
|
|
||||||
} D3D_CBUFFER_TYPE;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum D3D_NAME
|
|
||||||
{
|
|
||||||
D3D_NAME_UNDEFINED = 0,
|
|
||||||
D3D_NAME_POSITION = 1,
|
|
||||||
D3D_NAME_CLIP_DISTANCE = 2,
|
|
||||||
D3D_NAME_CULL_DISTANCE = 3,
|
|
||||||
D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4,
|
|
||||||
D3D_NAME_VIEWPORT_ARRAY_INDEX = 5,
|
|
||||||
D3D_NAME_VERTEX_ID = 6,
|
|
||||||
D3D_NAME_PRIMITIVE_ID = 7,
|
|
||||||
D3D_NAME_INSTANCE_ID = 8,
|
|
||||||
D3D_NAME_IS_FRONT_FACE = 9,
|
|
||||||
D3D_NAME_SAMPLE_INDEX = 10,
|
|
||||||
D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11,
|
|
||||||
D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12,
|
|
||||||
D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13,
|
|
||||||
D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14,
|
|
||||||
D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15,
|
|
||||||
D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16,
|
|
||||||
D3D_NAME_TARGET = 64,
|
|
||||||
D3D_NAME_DEPTH = 65,
|
|
||||||
D3D_NAME_COVERAGE = 66,
|
|
||||||
D3D_NAME_DEPTH_GREATER_EQUAL = 67,
|
|
||||||
D3D_NAME_DEPTH_LESS_EQUAL = 68,
|
|
||||||
D3D_NAME_STENCIL_REF = 69,
|
|
||||||
D3D_NAME_INNER_COVERAGE = 70,
|
|
||||||
D3D10_NAME_UNDEFINED = D3D_NAME_UNDEFINED,
|
|
||||||
D3D10_NAME_POSITION = D3D_NAME_POSITION,
|
|
||||||
D3D10_NAME_CLIP_DISTANCE = D3D_NAME_CLIP_DISTANCE,
|
|
||||||
D3D10_NAME_CULL_DISTANCE = D3D_NAME_CULL_DISTANCE,
|
|
||||||
D3D10_NAME_RENDER_TARGET_ARRAY_INDEX = D3D_NAME_RENDER_TARGET_ARRAY_INDEX,
|
|
||||||
D3D10_NAME_VIEWPORT_ARRAY_INDEX = D3D_NAME_VIEWPORT_ARRAY_INDEX,
|
|
||||||
D3D10_NAME_VERTEX_ID = D3D_NAME_VERTEX_ID,
|
|
||||||
D3D10_NAME_PRIMITIVE_ID = D3D_NAME_PRIMITIVE_ID,
|
|
||||||
D3D10_NAME_INSTANCE_ID = D3D_NAME_INSTANCE_ID,
|
|
||||||
D3D10_NAME_IS_FRONT_FACE = D3D_NAME_IS_FRONT_FACE,
|
|
||||||
D3D10_NAME_SAMPLE_INDEX = D3D_NAME_SAMPLE_INDEX,
|
|
||||||
D3D10_NAME_TARGET = D3D_NAME_TARGET,
|
|
||||||
D3D10_NAME_DEPTH = D3D_NAME_DEPTH,
|
|
||||||
D3D10_NAME_COVERAGE = D3D_NAME_COVERAGE,
|
|
||||||
D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR = D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR,
|
|
||||||
D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR,
|
|
||||||
D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR = D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR,
|
|
||||||
D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR = D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR,
|
|
||||||
D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR = D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR,
|
|
||||||
D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR = D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR,
|
|
||||||
D3D11_NAME_DEPTH_GREATER_EQUAL = D3D_NAME_DEPTH_GREATER_EQUAL,
|
|
||||||
D3D11_NAME_DEPTH_LESS_EQUAL = D3D_NAME_DEPTH_LESS_EQUAL,
|
|
||||||
D3D11_NAME_STENCIL_REF = D3D_NAME_STENCIL_REF,
|
|
||||||
D3D11_NAME_INNER_COVERAGE = D3D_NAME_INNER_COVERAGE
|
|
||||||
} D3D_NAME;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum D3D_RESOURCE_RETURN_TYPE
|
|
||||||
{
|
|
||||||
D3D_RETURN_TYPE_UNORM = 1,
|
|
||||||
D3D_RETURN_TYPE_SNORM = 2,
|
|
||||||
D3D_RETURN_TYPE_SINT = 3,
|
|
||||||
D3D_RETURN_TYPE_UINT = 4,
|
|
||||||
D3D_RETURN_TYPE_FLOAT = 5,
|
|
||||||
D3D_RETURN_TYPE_MIXED = 6,
|
|
||||||
D3D_RETURN_TYPE_DOUBLE = 7,
|
|
||||||
D3D_RETURN_TYPE_CONTINUED = 8,
|
|
||||||
D3D10_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM,
|
|
||||||
D3D10_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM,
|
|
||||||
D3D10_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT,
|
|
||||||
D3D10_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT,
|
|
||||||
D3D10_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT,
|
|
||||||
D3D10_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED,
|
|
||||||
D3D11_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM,
|
|
||||||
D3D11_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM,
|
|
||||||
D3D11_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT,
|
|
||||||
D3D11_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT,
|
|
||||||
D3D11_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT,
|
|
||||||
D3D11_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED,
|
|
||||||
D3D11_RETURN_TYPE_DOUBLE = D3D_RETURN_TYPE_DOUBLE,
|
|
||||||
D3D11_RETURN_TYPE_CONTINUED = D3D_RETURN_TYPE_CONTINUED
|
|
||||||
} D3D_RESOURCE_RETURN_TYPE;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum D3D_REGISTER_COMPONENT_TYPE
|
|
||||||
{
|
|
||||||
D3D_REGISTER_COMPONENT_UNKNOWN = 0,
|
|
||||||
D3D_REGISTER_COMPONENT_UINT32 = 1,
|
|
||||||
D3D_REGISTER_COMPONENT_SINT32 = 2,
|
|
||||||
D3D_REGISTER_COMPONENT_FLOAT32 = 3,
|
|
||||||
D3D10_REGISTER_COMPONENT_UNKNOWN = D3D_REGISTER_COMPONENT_UNKNOWN,
|
|
||||||
D3D10_REGISTER_COMPONENT_UINT32 = D3D_REGISTER_COMPONENT_UINT32,
|
|
||||||
D3D10_REGISTER_COMPONENT_SINT32 = D3D_REGISTER_COMPONENT_SINT32,
|
|
||||||
D3D10_REGISTER_COMPONENT_FLOAT32 = D3D_REGISTER_COMPONENT_FLOAT32
|
|
||||||
} D3D_REGISTER_COMPONENT_TYPE;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum D3D_TESSELLATOR_DOMAIN
|
|
||||||
{
|
|
||||||
D3D_TESSELLATOR_DOMAIN_UNDEFINED = 0,
|
|
||||||
D3D_TESSELLATOR_DOMAIN_ISOLINE = 1,
|
|
||||||
D3D_TESSELLATOR_DOMAIN_TRI = 2,
|
|
||||||
D3D_TESSELLATOR_DOMAIN_QUAD = 3,
|
|
||||||
D3D11_TESSELLATOR_DOMAIN_UNDEFINED = D3D_TESSELLATOR_DOMAIN_UNDEFINED,
|
|
||||||
D3D11_TESSELLATOR_DOMAIN_ISOLINE = D3D_TESSELLATOR_DOMAIN_ISOLINE,
|
|
||||||
D3D11_TESSELLATOR_DOMAIN_TRI = D3D_TESSELLATOR_DOMAIN_TRI,
|
|
||||||
D3D11_TESSELLATOR_DOMAIN_QUAD = D3D_TESSELLATOR_DOMAIN_QUAD
|
|
||||||
} D3D_TESSELLATOR_DOMAIN;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum D3D_TESSELLATOR_PARTITIONING
|
|
||||||
{
|
|
||||||
D3D_TESSELLATOR_PARTITIONING_UNDEFINED = 0,
|
|
||||||
D3D_TESSELLATOR_PARTITIONING_INTEGER = 1,
|
|
||||||
D3D_TESSELLATOR_PARTITIONING_POW2 = 2,
|
|
||||||
D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 3,
|
|
||||||
D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4,
|
|
||||||
D3D11_TESSELLATOR_PARTITIONING_UNDEFINED = D3D_TESSELLATOR_PARTITIONING_UNDEFINED,
|
|
||||||
D3D11_TESSELLATOR_PARTITIONING_INTEGER = D3D_TESSELLATOR_PARTITIONING_INTEGER,
|
|
||||||
D3D11_TESSELLATOR_PARTITIONING_POW2 = D3D_TESSELLATOR_PARTITIONING_POW2,
|
|
||||||
D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD,
|
|
||||||
D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN
|
|
||||||
} D3D_TESSELLATOR_PARTITIONING;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE
|
|
||||||
{
|
|
||||||
D3D_TESSELLATOR_OUTPUT_UNDEFINED = 0,
|
|
||||||
D3D_TESSELLATOR_OUTPUT_POINT = 1,
|
|
||||||
D3D_TESSELLATOR_OUTPUT_LINE = 2,
|
|
||||||
D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW = 3,
|
|
||||||
D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 4,
|
|
||||||
D3D11_TESSELLATOR_OUTPUT_UNDEFINED = D3D_TESSELLATOR_OUTPUT_UNDEFINED,
|
|
||||||
D3D11_TESSELLATOR_OUTPUT_POINT = D3D_TESSELLATOR_OUTPUT_POINT,
|
|
||||||
D3D11_TESSELLATOR_OUTPUT_LINE = D3D_TESSELLATOR_OUTPUT_LINE,
|
|
||||||
D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW,
|
|
||||||
D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW
|
|
||||||
} D3D_TESSELLATOR_OUTPUT_PRIMITIVE;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum D3D_MIN_PRECISION
|
|
||||||
{
|
|
||||||
D3D_MIN_PRECISION_DEFAULT = 0,
|
|
||||||
D3D_MIN_PRECISION_FLOAT_16 = 1,
|
|
||||||
D3D_MIN_PRECISION_FLOAT_2_8 = 2,
|
|
||||||
D3D_MIN_PRECISION_RESERVED = 3,
|
|
||||||
D3D_MIN_PRECISION_SINT_16 = 4,
|
|
||||||
D3D_MIN_PRECISION_UINT_16 = 5,
|
|
||||||
D3D_MIN_PRECISION_ANY_16 = 0xf0,
|
|
||||||
D3D_MIN_PRECISION_ANY_10 = 0xf1
|
|
||||||
} D3D_MIN_PRECISION;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum D3D_INTERPOLATION_MODE
|
|
||||||
{
|
|
||||||
D3D_INTERPOLATION_UNDEFINED = 0,
|
|
||||||
D3D_INTERPOLATION_CONSTANT = 1,
|
|
||||||
D3D_INTERPOLATION_LINEAR = 2,
|
|
||||||
D3D_INTERPOLATION_LINEAR_CENTROID = 3,
|
|
||||||
D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE = 4,
|
|
||||||
D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID = 5,
|
|
||||||
D3D_INTERPOLATION_LINEAR_SAMPLE = 6,
|
|
||||||
D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE = 7
|
|
||||||
} D3D_INTERPOLATION_MODE;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum _D3D_PARAMETER_FLAGS
|
|
||||||
{
|
|
||||||
D3D_PF_NONE = 0,
|
|
||||||
D3D_PF_IN = 0x1,
|
|
||||||
D3D_PF_OUT = 0x2,
|
|
||||||
D3D_PF_FORCE_DWORD = 0x7fffffff
|
|
||||||
} D3D_PARAMETER_FLAGS;
|
|
||||||
|
|
||||||
DEFINE_GUID(WKPDID_D3DDebugObjectName,0x429b8c22,0x9188,0x4b0c,0x87,0x42,0xac,0xb0,0xbf,0x85,0xc2,0x00);
|
|
||||||
DEFINE_GUID(WKPDID_D3DDebugObjectNameW,0x4cca5fd8,0x921f,0x42c8,0x85,0x66,0x70,0xca,0xf2,0xa9,0xb7,0x41);
|
|
||||||
DEFINE_GUID(WKPDID_CommentStringW,0xd0149dc0,0x90e8,0x4ec8,0x81, 0x44, 0xe9, 0x00, 0xad, 0x26, 0x6b, 0xb2);
|
|
||||||
#define D3D_SET_OBJECT_NAME_N_A(pObject, Chars, pName) (pObject)->SetPrivateData(WKPDID_D3DDebugObjectName, Chars, pName)
|
|
||||||
#define D3D_SET_OBJECT_NAME_A(pObject, pName) D3D_SET_OBJECT_NAME_N_A(pObject, lstrlenA(pName), pName)
|
|
||||||
#define D3D_SET_OBJECT_NAME_N_W(pObject, Chars, pName) (pObject)->SetPrivateData(WKPDID_D3DDebugObjectNameW, Chars*2, pName)
|
|
||||||
#define D3D_SET_OBJECT_NAME_W(pObject, pName) D3D_SET_OBJECT_NAME_N_W(pObject, wcslen(pName), pName)
|
|
||||||
#define D3D_COMPONENT_MASK_X 1
|
|
||||||
#define D3D_COMPONENT_MASK_Y 2
|
|
||||||
#define D3D_COMPONENT_MASK_Z 4
|
|
||||||
#define D3D_COMPONENT_MASK_W 8
|
|
||||||
|
|
||||||
|
|
||||||
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_c_ifspec;
|
|
||||||
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_s_ifspec;
|
|
||||||
|
|
||||||
/* Additional Prototypes for ALL interfaces */
|
|
||||||
|
|
||||||
/* end of Additional Prototypes */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
109
3rdparty/minidx12/Include/dcommon.h
vendored
109
3rdparty/minidx12/Include/dcommon.h
vendored
|
@ -1,109 +0,0 @@
|
||||||
//+--------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
//
|
|
||||||
// Abstract:
|
|
||||||
// Public API definitions for DWrite, D2D and DImage.
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifndef DCOMMON_H_INCLUDED
|
|
||||||
#define DCOMMON_H_INCLUDED
|
|
||||||
|
|
||||||
#include <dxgiformat.h>
|
|
||||||
|
|
||||||
#ifndef DX_DECLARE_INTERFACE
|
|
||||||
#define DX_DECLARE_INTERFACE(x) DECLSPEC_UUID(x) DECLSPEC_NOVTABLE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CHECKMETHOD
|
|
||||||
#define CHECKMETHOD(method) virtual DECLSPEC_NOTHROW _Must_inspect_result_ HRESULT STDMETHODCALLTYPE method
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
|
||||||
// Forward declarations
|
|
||||||
//
|
|
||||||
interface IDXGISurface;
|
|
||||||
|
|
||||||
//+----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// DWRITE_MEASURING_MODE
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// The measuring method used for text layout.
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
typedef enum DWRITE_MEASURING_MODE
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Text is measured using glyph ideal metrics whose values are independent to the current display resolution.
|
|
||||||
//
|
|
||||||
DWRITE_MEASURING_MODE_NATURAL,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Text is measured using glyph display compatible metrics whose values tuned for the current display resolution.
|
|
||||||
//
|
|
||||||
DWRITE_MEASURING_MODE_GDI_CLASSIC,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Text is measured using the same glyph display metrics as text measured by GDI using a font
|
|
||||||
// created with CLEARTYPE_NATURAL_QUALITY.
|
|
||||||
//
|
|
||||||
DWRITE_MEASURING_MODE_GDI_NATURAL
|
|
||||||
|
|
||||||
} DWRITE_MEASURING_MODE;
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enum:
|
|
||||||
// D2D1_ALPHA_MODE
|
|
||||||
//
|
|
||||||
// Synopsis:
|
|
||||||
// Qualifies how alpha is to be treated in a bitmap or render target containing
|
|
||||||
// alpha.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef enum D2D1_ALPHA_MODE
|
|
||||||
{
|
|
||||||
|
|
||||||
//
|
|
||||||
// Alpha mode should be determined implicitly. Some target surfaces do not supply
|
|
||||||
// or imply this information in which case alpha must be specified.
|
|
||||||
//
|
|
||||||
D2D1_ALPHA_MODE_UNKNOWN = 0,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Treat the alpha as premultipled.
|
|
||||||
//
|
|
||||||
D2D1_ALPHA_MODE_PREMULTIPLIED = 1,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Opacity is in the 'A' component only.
|
|
||||||
//
|
|
||||||
D2D1_ALPHA_MODE_STRAIGHT = 2,
|
|
||||||
|
|
||||||
//
|
|
||||||
// Ignore any alpha channel information.
|
|
||||||
//
|
|
||||||
D2D1_ALPHA_MODE_IGNORE = 3,
|
|
||||||
|
|
||||||
D2D1_ALPHA_MODE_FORCE_DWORD = 0xffffffff
|
|
||||||
|
|
||||||
} D2D1_ALPHA_MODE;
|
|
||||||
|
|
||||||
//+-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Struct:
|
|
||||||
// D2D1_PIXEL_FORMAT
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
typedef struct D2D1_PIXEL_FORMAT
|
|
||||||
{
|
|
||||||
DXGI_FORMAT format;
|
|
||||||
D2D1_ALPHA_MODE alphaMode;
|
|
||||||
|
|
||||||
} D2D1_PIXEL_FORMAT;
|
|
||||||
|
|
||||||
#endif /* DCOMMON_H_INCLUDED */
|
|
5090
3rdparty/minidx12/Include/dwrite.h
vendored
5090
3rdparty/minidx12/Include/dwrite.h
vendored
File diff suppressed because it is too large
Load diff
1922
3rdparty/minidx12/Include/dwrite_1.h
vendored
1922
3rdparty/minidx12/Include/dwrite_1.h
vendored
File diff suppressed because it is too large
Load diff
965
3rdparty/minidx12/Include/dwrite_2.h
vendored
965
3rdparty/minidx12/Include/dwrite_2.h
vendored
|
@ -1,965 +0,0 @@
|
||||||
//+--------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
//
|
|
||||||
// Abstract:
|
|
||||||
// DirectX Typography Services public API definitions.
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef DWRITE_2_H_INCLUDED
|
|
||||||
#define DWRITE_2_H_INCLUDED
|
|
||||||
|
|
||||||
#if _MSC_VER > 1000
|
|
||||||
#pragma once
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <DWrite_1.h>
|
|
||||||
|
|
||||||
|
|
||||||
interface IDWriteFontFallback;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// How to align glyphs to the margin.
|
|
||||||
/// </summary>
|
|
||||||
enum DWRITE_OPTICAL_ALIGNMENT
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Align to the default metrics of the glyph.
|
|
||||||
/// </summary>
|
|
||||||
DWRITE_OPTICAL_ALIGNMENT_NONE,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Align glyphs to the margins. Without this, some small whitespace
|
|
||||||
/// may be present between the text and the margin from the glyph's side
|
|
||||||
/// bearing values. Note that glyphs may still overhang outside the
|
|
||||||
/// margin, such as flourishes or italic slants.
|
|
||||||
/// </summary>
|
|
||||||
DWRITE_OPTICAL_ALIGNMENT_NO_SIDE_BEARINGS,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether to enable grid-fitting of glyph outlines (a.k.a. hinting).
|
|
||||||
/// </summary>
|
|
||||||
enum DWRITE_GRID_FIT_MODE
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Choose grid fitting base on the font's gasp table information.
|
|
||||||
/// </summary>
|
|
||||||
DWRITE_GRID_FIT_MODE_DEFAULT,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Always disable grid fitting, using the ideal glyph outlines.
|
|
||||||
/// </summary>
|
|
||||||
DWRITE_GRID_FIT_MODE_DISABLED,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enable grid fitting, adjusting glyph outlines for device pixel display.
|
|
||||||
/// </summary>
|
|
||||||
DWRITE_GRID_FIT_MODE_ENABLED
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Overall metrics associated with text after layout.
|
|
||||||
/// All coordinates are in device independent pixels (DIPs).
|
|
||||||
/// </summary>
|
|
||||||
struct DWRITE_TEXT_METRICS1 : DWRITE_TEXT_METRICS
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The height of the formatted text taking into account the
|
|
||||||
/// trailing whitespace at the end of each line, which will
|
|
||||||
/// matter for vertical reading directions.
|
|
||||||
/// </summary>
|
|
||||||
FLOAT heightIncludingTrailingWhitespace;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The text renderer interface represents a set of application-defined
|
|
||||||
/// callbacks that perform rendering of text, inline objects, and decorations
|
|
||||||
/// such as underlines.
|
|
||||||
/// </summary>
|
|
||||||
interface DWRITE_DECLARE_INTERFACE("D3E0E934-22A0-427E-AAE4-7D9574B59DB1") IDWriteTextRenderer1 : public IDWriteTextRenderer
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// IDWriteTextLayout::Draw calls this function to instruct the client to
|
|
||||||
/// render a run of glyphs.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="clientDrawingContext">The context passed to
|
|
||||||
/// IDWriteTextLayout::Draw.</param>
|
|
||||||
/// <param name="baselineOriginX">X-coordinate of the baseline.</param>
|
|
||||||
/// <param name="baselineOriginY">Y-coordinate of the baseline.</param>
|
|
||||||
/// <param name="orientationAngle">Orientation of the glyph run.</param>
|
|
||||||
/// <param name="measuringMode">Specifies measuring method for glyphs in
|
|
||||||
/// the run. Renderer implementations may choose different rendering
|
|
||||||
/// modes for given measuring methods, but best results are seen when
|
|
||||||
/// the rendering mode matches the corresponding measuring mode:
|
|
||||||
/// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL
|
|
||||||
/// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC
|
|
||||||
/// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL
|
|
||||||
/// </param>
|
|
||||||
/// <param name="glyphRun">The glyph run to draw.</param>
|
|
||||||
/// <param name="glyphRunDescription">Properties of the characters
|
|
||||||
/// associated with this run.</param>
|
|
||||||
/// <param name="clientDrawingEffect">The drawing effect set in
|
|
||||||
/// IDWriteTextLayout::SetDrawingEffect.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
/// <remarks>
|
|
||||||
/// If a non-identity orientation is passed, the glyph run should be
|
|
||||||
/// rotated around the given baseline x and y coordinates. The function
|
|
||||||
/// IDWriteAnalyzer2::GetGlyphOrientationTransform will return the
|
|
||||||
/// necessary transform for you, which can be combined with any existing
|
|
||||||
/// world transform on the drawing context.
|
|
||||||
/// </remarks>
|
|
||||||
STDMETHOD(DrawGlyphRun)(
|
|
||||||
_In_opt_ void* clientDrawingContext,
|
|
||||||
FLOAT baselineOriginX,
|
|
||||||
FLOAT baselineOriginY,
|
|
||||||
DWRITE_GLYPH_ORIENTATION_ANGLE orientationAngle,
|
|
||||||
DWRITE_MEASURING_MODE measuringMode,
|
|
||||||
_In_ DWRITE_GLYPH_RUN const* glyphRun,
|
|
||||||
_In_ DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription,
|
|
||||||
_In_opt_ IUnknown* clientDrawingEffect
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// IDWriteTextLayout::Draw calls this function to instruct the client to draw
|
|
||||||
/// an underline.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="clientDrawingContext">The context passed to
|
|
||||||
/// IDWriteTextLayout::Draw.</param>
|
|
||||||
/// <param name="baselineOriginX">X-coordinate of the baseline.</param>
|
|
||||||
/// <param name="baselineOriginY">Y-coordinate of the baseline.</param>
|
|
||||||
/// <param name="orientationAngle">Orientation of the underline.</param>
|
|
||||||
/// <param name="underline">Underline logical information.</param>
|
|
||||||
/// <param name="clientDrawingEffect">The drawing effect set in
|
|
||||||
/// IDWriteTextLayout::SetDrawingEffect.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
/// <remarks>
|
|
||||||
/// A single underline can be broken into multiple calls, depending on
|
|
||||||
/// how the formatting changes attributes. If font sizes/styles change
|
|
||||||
/// within an underline, the thickness and offset will be averaged
|
|
||||||
/// weighted according to characters.
|
|
||||||
///
|
|
||||||
/// To get the correct top coordinate of the underline rect, add
|
|
||||||
/// underline::offset to the baseline's Y. Otherwise the underline will
|
|
||||||
/// be immediately under the text. The x coordinate will always be passed
|
|
||||||
/// as the left side, regardless of text directionality. This simplifies
|
|
||||||
/// drawing and reduces the problem of round-off that could potentially
|
|
||||||
/// cause gaps or a double stamped alpha blend. To avoid alpha overlap,
|
|
||||||
/// round the end points to the nearest device pixel.
|
|
||||||
/// </remarks>
|
|
||||||
STDMETHOD(DrawUnderline)(
|
|
||||||
_In_opt_ void* clientDrawingContext,
|
|
||||||
FLOAT baselineOriginX,
|
|
||||||
FLOAT baselineOriginY,
|
|
||||||
DWRITE_GLYPH_ORIENTATION_ANGLE orientationAngle,
|
|
||||||
_In_ DWRITE_UNDERLINE const* underline,
|
|
||||||
_In_opt_ IUnknown* clientDrawingEffect
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// IDWriteTextLayout::Draw calls this function to instruct the client to draw
|
|
||||||
/// a strikethrough.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="clientDrawingContext">The context passed to
|
|
||||||
/// IDWriteTextLayout::Draw.</param>
|
|
||||||
/// <param name="baselineOriginX">X-coordinate of the baseline.</param>
|
|
||||||
/// <param name="baselineOriginY">Y-coordinate of the baseline.</param>
|
|
||||||
/// <param name="orientationAngle">Orientation of the strikethrough.</param>
|
|
||||||
/// <param name="strikethrough">Strikethrough logical information.</param>
|
|
||||||
/// <param name="clientDrawingEffect">The drawing effect set in
|
|
||||||
/// IDWriteTextLayout::SetDrawingEffect.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
/// <remarks>
|
|
||||||
/// A single strikethrough can be broken into multiple calls, depending on
|
|
||||||
/// how the formatting changes attributes. Strikethrough is not averaged
|
|
||||||
/// across font sizes/styles changes.
|
|
||||||
/// To get the correct top coordinate of the strikethrough rect,
|
|
||||||
/// add strikethrough::offset to the baseline's Y.
|
|
||||||
/// Like underlines, the x coordinate will always be passed as the left side,
|
|
||||||
/// regardless of text directionality.
|
|
||||||
/// </remarks>
|
|
||||||
STDMETHOD(DrawStrikethrough)(
|
|
||||||
_In_opt_ void* clientDrawingContext,
|
|
||||||
FLOAT baselineOriginX,
|
|
||||||
FLOAT baselineOriginY,
|
|
||||||
DWRITE_GLYPH_ORIENTATION_ANGLE orientationAngle,
|
|
||||||
_In_ DWRITE_STRIKETHROUGH const* strikethrough,
|
|
||||||
_In_opt_ IUnknown* clientDrawingEffect
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// IDWriteTextLayout::Draw calls this application callback when it needs to
|
|
||||||
/// draw an inline object.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="clientDrawingContext">The context passed to
|
|
||||||
/// IDWriteTextLayout::Draw.</param>
|
|
||||||
/// <param name="originX">X-coordinate at the top-left corner of the
|
|
||||||
/// inline object.</param>
|
|
||||||
/// <param name="originY">Y-coordinate at the top-left corner of the
|
|
||||||
/// inline object.</param>
|
|
||||||
/// <param name="orientationAngle">Orientation of the inline object.</param>
|
|
||||||
/// <param name="inlineObject">The object set using IDWriteTextLayout::SetInlineObject.</param>
|
|
||||||
/// <param name="isSideways">The object should be drawn on its side.</param>
|
|
||||||
/// <param name="isRightToLeft">The object is in an right-to-left context
|
|
||||||
/// and should be drawn flipped.</param>
|
|
||||||
/// <param name="clientDrawingEffect">The drawing effect set in
|
|
||||||
/// IDWriteTextLayout::SetDrawingEffect.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
/// <remarks>
|
|
||||||
/// The right-to-left flag is a hint to draw the appropriate visual for
|
|
||||||
/// that reading direction. For example, it would look strange to draw an
|
|
||||||
/// arrow pointing to the right to indicate a submenu. The sideways flag
|
|
||||||
/// similarly hints that the object is drawn in a different orientation.
|
|
||||||
/// If a non-identity orientation is passed, the top left of the inline
|
|
||||||
/// object should be rotated around the given x and y coordinates.
|
|
||||||
/// IDWriteAnalyzer2::GetGlyphOrientationTransform returns the necessary
|
|
||||||
/// transform for this.
|
|
||||||
/// </remarks>
|
|
||||||
STDMETHOD(DrawInlineObject)(
|
|
||||||
_In_opt_ void* clientDrawingContext,
|
|
||||||
FLOAT originX,
|
|
||||||
FLOAT originY,
|
|
||||||
DWRITE_GLYPH_ORIENTATION_ANGLE orientationAngle,
|
|
||||||
_In_ IDWriteInlineObject* inlineObject,
|
|
||||||
BOOL isSideways,
|
|
||||||
BOOL isRightToLeft,
|
|
||||||
_In_opt_ IUnknown* clientDrawingEffect
|
|
||||||
) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The format of text used for text layout.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// This object may not be thread-safe and it may carry the state of text format change.
|
|
||||||
/// </remarks>
|
|
||||||
interface DWRITE_DECLARE_INTERFACE("5F174B49-0D8B-4CFB-8BCA-F1CCE9D06C67") IDWriteTextFormat1 : public IDWriteTextFormat
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Set the preferred orientation of glyphs when using a vertical reading direction.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="glyphOrientation">Preferred glyph orientation.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(SetVerticalGlyphOrientation)(
|
|
||||||
DWRITE_VERTICAL_GLYPH_ORIENTATION glyphOrientation
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the preferred orientation of glyphs when using a vertical reading
|
|
||||||
/// direction.
|
|
||||||
/// </summary>
|
|
||||||
STDMETHOD_(DWRITE_VERTICAL_GLYPH_ORIENTATION, GetVerticalGlyphOrientation)() PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set whether or not the last word on the last line is wrapped.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="isLastLineWrappingEnabled">Line wrapping option.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(SetLastLineWrapping)(
|
|
||||||
BOOL isLastLineWrappingEnabled
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get whether or not the last word on the last line is wrapped.
|
|
||||||
/// </summary>
|
|
||||||
STDMETHOD_(BOOL, GetLastLineWrapping)() PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set how the glyphs align to the edges the margin. Default behavior is
|
|
||||||
/// to align glyphs using their default glyphs metrics which include side
|
|
||||||
/// bearings.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="opticalAlignment">Optical alignment option.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(SetOpticalAlignment)(
|
|
||||||
DWRITE_OPTICAL_ALIGNMENT opticalAlignment
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get how the glyphs align to the edges the margin.
|
|
||||||
/// </summary>
|
|
||||||
STDMETHOD_(DWRITE_OPTICAL_ALIGNMENT, GetOpticalAlignment)() PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Apply a custom font fallback onto layout. If none is specified,
|
|
||||||
/// layout uses the system fallback list.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fontFallback">Custom font fallback created from
|
|
||||||
/// IDWriteFontFallbackBuilder::CreateFontFallback or from
|
|
||||||
/// IDWriteFactory2::GetSystemFontFallback.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(SetFontFallback)(
|
|
||||||
IDWriteFontFallback* fontFallback
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the current font fallback object.
|
|
||||||
/// </summary>
|
|
||||||
STDMETHOD(GetFontFallback)(
|
|
||||||
__out IDWriteFontFallback** fontFallback
|
|
||||||
) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The text layout interface represents a block of text after it has
|
|
||||||
/// been fully analyzed and formatted.
|
|
||||||
///
|
|
||||||
/// All coordinates are in device independent pixels (DIPs).
|
|
||||||
/// </summary>
|
|
||||||
interface DWRITE_DECLARE_INTERFACE("1093C18F-8D5E-43F0-B064-0917311B525E") IDWriteTextLayout2 : public IDWriteTextLayout1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// GetMetrics retrieves overall metrics for the formatted string.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="textMetrics">The returned metrics.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
/// <remarks>
|
|
||||||
/// Drawing effects like underline and strikethrough do not contribute
|
|
||||||
/// to the text size, which is essentially the sum of advance widths and
|
|
||||||
/// line heights. Additionally, visible swashes and other graphic
|
|
||||||
/// adornments may extend outside the returned width and height.
|
|
||||||
/// </remarks>
|
|
||||||
STDMETHOD(GetMetrics)(
|
|
||||||
_Out_ DWRITE_TEXT_METRICS1* textMetrics
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
using IDWriteTextLayout::GetMetrics;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set the preferred orientation of glyphs when using a vertical reading direction.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="glyphOrientation">Preferred glyph orientation.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(SetVerticalGlyphOrientation)(
|
|
||||||
DWRITE_VERTICAL_GLYPH_ORIENTATION glyphOrientation
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the preferred orientation of glyphs when using a vertical reading
|
|
||||||
/// direction.
|
|
||||||
/// </summary>
|
|
||||||
STDMETHOD_(DWRITE_VERTICAL_GLYPH_ORIENTATION, GetVerticalGlyphOrientation)() PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set whether or not the last word on the last line is wrapped.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="isLastLineWrappingEnabled">Line wrapping option.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(SetLastLineWrapping)(
|
|
||||||
BOOL isLastLineWrappingEnabled
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get whether or not the last word on the last line is wrapped.
|
|
||||||
/// </summary>
|
|
||||||
STDMETHOD_(BOOL, GetLastLineWrapping)() PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set how the glyphs align to the edges the margin. Default behavior is
|
|
||||||
/// to align glyphs using their default glyphs metrics which include side
|
|
||||||
/// bearings.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="opticalAlignment">Optical alignment option.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(SetOpticalAlignment)(
|
|
||||||
DWRITE_OPTICAL_ALIGNMENT opticalAlignment
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get how the glyphs align to the edges the margin.
|
|
||||||
/// </summary>
|
|
||||||
STDMETHOD_(DWRITE_OPTICAL_ALIGNMENT, GetOpticalAlignment)() PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Apply a custom font fallback onto layout. If none is specified,
|
|
||||||
/// layout uses the system fallback list.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fontFallback">Custom font fallback created from
|
|
||||||
/// IDWriteFontFallbackBuilder::CreateFontFallback or
|
|
||||||
/// IDWriteFactory2::GetSystemFontFallback.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(SetFontFallback)(
|
|
||||||
IDWriteFontFallback* fontFallback
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the current font fallback object.
|
|
||||||
/// </summary>
|
|
||||||
STDMETHOD(GetFontFallback)(
|
|
||||||
__out IDWriteFontFallback** fontFallback
|
|
||||||
) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The text analyzer interface represents a set of application-defined
|
|
||||||
/// callbacks that perform rendering of text, inline objects, and decorations
|
|
||||||
/// such as underlines.
|
|
||||||
/// </summary>
|
|
||||||
interface DWRITE_DECLARE_INTERFACE("553A9FF3-5693-4DF7-B52B-74806F7F2EB9") IDWriteTextAnalyzer2 : public IDWriteTextAnalyzer1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Returns 2x3 transform matrix for the respective angle to draw the
|
|
||||||
/// glyph run or other object.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="glyphOrientationAngle">The angle reported to one of the application callbacks,
|
|
||||||
/// including IDWriteTextAnalysisSink1::SetGlyphOrientation and IDWriteTextRenderer1::Draw*.</param>
|
|
||||||
/// <param name="isSideways">Whether the run's glyphs are sideways or not.</param>
|
|
||||||
/// <param name="originX">X origin of the element, be it a glyph run or underline or other.</param>
|
|
||||||
/// <param name="originY">Y origin of the element, be it a glyph run or underline or other.</param>
|
|
||||||
/// <param name="transform">Returned transform.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
/// <remarks>
|
|
||||||
/// This rotates around the given origin x and y, returning a translation component
|
|
||||||
/// such that the glyph run, text decoration, or inline object is drawn with the
|
|
||||||
/// right orientation at the expected coordinate.
|
|
||||||
/// </remarks>
|
|
||||||
STDMETHOD(GetGlyphOrientationTransform)(
|
|
||||||
DWRITE_GLYPH_ORIENTATION_ANGLE glyphOrientationAngle,
|
|
||||||
BOOL isSideways,
|
|
||||||
FLOAT originX,
|
|
||||||
FLOAT originY,
|
|
||||||
_Out_ DWRITE_MATRIX* transform
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a list of typographic feature tags for the given script and language.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fontFace">The font face to get features from.</param>
|
|
||||||
/// <param name="scriptAnalysis">Script analysis result from AnalyzeScript.</param>
|
|
||||||
/// <param name="localeName">The locale to use when selecting the feature,
|
|
||||||
/// such en-us or ja-jp.</param>
|
|
||||||
/// <param name="maxTagCount">Maximum tag count.</param>
|
|
||||||
/// <param name="actualTagCount">Actual tag count. If greater than
|
|
||||||
/// maxTagCount, E_NOT_SUFFICIENT_BUFFER is returned, and the call
|
|
||||||
/// should be retried with a larger buffer.</param>
|
|
||||||
/// <param name="tags">Feature tag list.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(GetTypographicFeatures)(
|
|
||||||
IDWriteFontFace* fontFace,
|
|
||||||
DWRITE_SCRIPT_ANALYSIS scriptAnalysis,
|
|
||||||
_In_opt_z_ WCHAR const* localeName,
|
|
||||||
UINT32 maxTagCount,
|
|
||||||
_Out_ UINT32* actualTagCount,
|
|
||||||
_Out_writes_(maxTagCount) DWRITE_FONT_FEATURE_TAG* tags
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns an array of which glyphs are affected by a given feature.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fontFace">The font face to read glyph information from.</param>
|
|
||||||
/// <param name="scriptAnalysis">Script analysis result from AnalyzeScript.</param>
|
|
||||||
/// <param name="localeName">The locale to use when selecting the feature,
|
|
||||||
/// such en-us or ja-jp.</param>
|
|
||||||
/// <param name="featureTag">OpenType feature name to use, which may be one
|
|
||||||
/// of the DWRITE_FONT_FEATURE_TAG values or a custom feature using
|
|
||||||
/// DWRITE_MAKE_OPENTYPE_TAG.</param>
|
|
||||||
/// <param name="glyphCount">Number of glyph indices to check.</param>
|
|
||||||
/// <param name="glyphIndices">Glyph indices to check for feature application.</param>
|
|
||||||
/// <param name="featureApplies">Output of which glyphs are affected by the
|
|
||||||
/// feature, where for each glyph affected, the respective array index
|
|
||||||
/// will be 1. The result is returned per-glyph without regard to
|
|
||||||
/// neighboring context of adjacent glyphs.</param>
|
|
||||||
/// </remarks>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(CheckTypographicFeature)(
|
|
||||||
IDWriteFontFace* fontFace,
|
|
||||||
DWRITE_SCRIPT_ANALYSIS scriptAnalysis,
|
|
||||||
_In_opt_z_ WCHAR const* localeName,
|
|
||||||
DWRITE_FONT_FEATURE_TAG featureTag,
|
|
||||||
UINT32 glyphCount,
|
|
||||||
_In_reads_(glyphCount) UINT16 const* glyphIndices,
|
|
||||||
_Out_writes_(glyphCount) UINT8* featureApplies
|
|
||||||
) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A font fallback definition used for mapping characters to fonts capable of
|
|
||||||
/// supporting them.
|
|
||||||
/// </summary>
|
|
||||||
interface DWRITE_DECLARE_INTERFACE("EFA008F9-F7A1-48BF-B05C-F224713CC0FF") IDWriteFontFallback : public IUnknown
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Determines an appropriate font to use to render the range of text.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="source">The text source implementation holds the text and
|
|
||||||
/// locale.</param>
|
|
||||||
/// <param name="textLength">Length of the text to analyze.</param>
|
|
||||||
/// <param name="baseFontCollection">Default font collection to use.</param>
|
|
||||||
/// <param name="baseFont">Base font to check (optional).</param>
|
|
||||||
/// <param name="baseFamilyName">Family name of the base font. If you pass
|
|
||||||
/// null, no matching will be done against the family.</param>
|
|
||||||
/// <param name="baseWeight">Desired weight.</param>
|
|
||||||
/// <param name="baseStyle">Desired style.</param>
|
|
||||||
/// <param name="baseStretch">Desired stretch.</param>
|
|
||||||
/// <param name="mappedLength">Length of text mapped to the mapped font.
|
|
||||||
/// This will always be less or equal to the input text length and
|
|
||||||
/// greater than zero (if the text length is non-zero) so that the
|
|
||||||
/// caller advances at least one character each call.</param>
|
|
||||||
/// <param name="mappedFont">The font that should be used to render the
|
|
||||||
/// first mappedLength characters of the text. If it returns NULL,
|
|
||||||
/// then no known font can render the text, and mappedLength is the
|
|
||||||
/// number of unsupported characters to skip.</param>
|
|
||||||
/// <param name="scale">Scale factor to multiply the em size of the
|
|
||||||
/// returned font by.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(MapCharacters)(
|
|
||||||
IDWriteTextAnalysisSource* analysisSource,
|
|
||||||
UINT32 textPosition,
|
|
||||||
UINT32 textLength,
|
|
||||||
_In_opt_ IDWriteFontCollection* baseFontCollection,
|
|
||||||
_In_opt_z_ wchar_t const* baseFamilyName,
|
|
||||||
DWRITE_FONT_WEIGHT baseWeight,
|
|
||||||
DWRITE_FONT_STYLE baseStyle,
|
|
||||||
DWRITE_FONT_STRETCH baseStretch,
|
|
||||||
_Deref_out_range_(0, textLength) UINT32* mappedLength,
|
|
||||||
_COM_Outptr_ IDWriteFont** mappedFont,
|
|
||||||
_Out_ FLOAT* scale
|
|
||||||
) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Builder used to create a font fallback definition by appending a series of
|
|
||||||
/// fallback mappings, followed by a creation call.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// This object may not be thread-safe.
|
|
||||||
/// </remarks>
|
|
||||||
interface DWRITE_DECLARE_INTERFACE("FD882D06-8ABA-4FB8-B849-8BE8B73E14DE") IDWriteFontFallbackBuilder : public IUnknown
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Appends a single mapping to the list. Call this once for each additional mapping.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ranges">Unicode ranges that apply to this mapping.</param>
|
|
||||||
/// <param name="rangesCount">Number of Unicode ranges.</param>
|
|
||||||
/// <param name="localeName">Locale of the context (e.g. document locale).</param>
|
|
||||||
/// <param name="baseFamilyName">Base family name to match against, if applicable.</param>
|
|
||||||
/// <param name="fontCollection">Explicit font collection for this mapping (optional).</param>
|
|
||||||
/// <param name="targetFamilyNames">List of target family name strings.</param>
|
|
||||||
/// <param name="targetFamilyNamesCount">Number of target family names.</param>
|
|
||||||
/// <param name="scale">Scale factor to multiply the result target font by.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(AddMapping)(
|
|
||||||
_In_reads_(rangesCount) DWRITE_UNICODE_RANGE const* ranges,
|
|
||||||
UINT32 rangesCount,
|
|
||||||
_In_reads_(targetFamilyNamesCount) WCHAR const** targetFamilyNames,
|
|
||||||
UINT32 targetFamilyNamesCount,
|
|
||||||
_In_opt_ IDWriteFontCollection* fontCollection = NULL,
|
|
||||||
_In_opt_z_ WCHAR const* localeName = NULL,
|
|
||||||
_In_opt_z_ WCHAR const* baseFamilyName = NULL,
|
|
||||||
FLOAT scale = 1.0f
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Appends all the mappings from an existing font fallback object.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fontFallback">Font fallback to read mappings from.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(AddMappings)(
|
|
||||||
IDWriteFontFallback* fontFallback
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates the finalized fallback object from the mappings added.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fontFallback">Created fallback list.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(CreateFontFallback)(
|
|
||||||
_COM_Outptr_ IDWriteFontFallback** fontFallback
|
|
||||||
) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DWRITE_COLOR_F
|
|
||||||
/// </summary>
|
|
||||||
#ifndef D3DCOLORVALUE_DEFINED
|
|
||||||
|
|
||||||
typedef struct _D3DCOLORVALUE {
|
|
||||||
union {
|
|
||||||
FLOAT r;
|
|
||||||
FLOAT dvR;
|
|
||||||
};
|
|
||||||
union {
|
|
||||||
FLOAT g;
|
|
||||||
FLOAT dvG;
|
|
||||||
};
|
|
||||||
union {
|
|
||||||
FLOAT b;
|
|
||||||
FLOAT dvB;
|
|
||||||
};
|
|
||||||
union {
|
|
||||||
FLOAT a;
|
|
||||||
FLOAT dvA;
|
|
||||||
};
|
|
||||||
} D3DCOLORVALUE;
|
|
||||||
|
|
||||||
#define D3DCOLORVALUE_DEFINED
|
|
||||||
#endif D3DCOLORVALUE_DEFINED
|
|
||||||
|
|
||||||
typedef D3DCOLORVALUE DWRITE_COLOR_F;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The IDWriteFont interface represents a physical font in a font collection.
|
|
||||||
/// </summary>
|
|
||||||
interface DWRITE_DECLARE_INTERFACE("29748ed6-8c9c-4a6a-be0b-d912e8538944") IDWriteFont2 : public IDWriteFont1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Returns TRUE if the font contains color information (COLR and CPAL tables),
|
|
||||||
/// or FALSE if not.
|
|
||||||
/// </summary>
|
|
||||||
STDMETHOD_(BOOL, IsColorFont)() PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The interface that represents an absolute reference to a font face.
|
|
||||||
/// It contains font face type, appropriate file references and face identification data.
|
|
||||||
/// Various font data such as metrics, names and glyph outlines is obtained from IDWriteFontFace.
|
|
||||||
/// </summary>
|
|
||||||
interface DWRITE_DECLARE_INTERFACE("d8b768ff-64bc-4e66-982b-ec8e87f693f7") IDWriteFontFace2 : public IDWriteFontFace1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Returns TRUE if the font contains color information (COLR and CPAL tables),
|
|
||||||
/// or FALSE if not.
|
|
||||||
/// </summary>
|
|
||||||
STDMETHOD_(BOOL, IsColorFont)() PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the number of color palettes defined by the font. The return
|
|
||||||
/// value is zero if the font has no color information. Color fonts must
|
|
||||||
/// have at least one palette, with palette index zero being the default.
|
|
||||||
/// </summary>
|
|
||||||
STDMETHOD_(UINT32, GetColorPaletteCount)() PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the number of entries in each color palette. All color palettes
|
|
||||||
/// in a font have the same number of palette entries. The return value is
|
|
||||||
/// zero if the font has no color information.
|
|
||||||
/// </summary>
|
|
||||||
STDMETHOD_(UINT32, GetPaletteEntryCount)() PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reads color values from the font's color palette.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="colorPaletteIndex">Zero-based index of the color palette. If the
|
|
||||||
/// font does not have a palette with the specified index, the method returns
|
|
||||||
/// DWRITE_E_NOCOLOR.<param>
|
|
||||||
/// <param name="firstEntryIndex">Zero-based index of the first palette entry
|
|
||||||
/// to read.</param>
|
|
||||||
/// <param name="entryCount">Number of palette entries to read.</param>
|
|
||||||
/// <param name="paletteEntries">Array that receives the color values.<param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// The return value is E_INVALIDARG if firstEntryIndex + entryCount is greater
|
|
||||||
/// than the actual number of palette entries as returned by GetPaletteEntryCount.
|
|
||||||
/// The return value is DWRITE_E_NOCOLOR if the font does not have a palette
|
|
||||||
/// with the specified palette index.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(GetPaletteEntries)(
|
|
||||||
UINT32 colorPaletteIndex,
|
|
||||||
UINT32 firstEntryIndex,
|
|
||||||
UINT32 entryCount,
|
|
||||||
_Out_writes_(entryCount) DWRITE_COLOR_F* paletteEntries
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines the recommended text rendering and grid-fit mode to be used based on the
|
|
||||||
/// font, size, world transform, and measuring mode.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fontEmSize">Logical font size in DIPs.</param>
|
|
||||||
/// <param name="dpiX">Number of pixels per logical inch in the horizontal direction.</param>
|
|
||||||
/// <param name="dpiY">Number of pixels per logical inch in the vertical direction.</param>
|
|
||||||
/// <param name="transform">Specifies the world transform.</param>
|
|
||||||
/// <param name="outlineThreshold">Specifies the quality of the graphics system's outline rendering,
|
|
||||||
/// affects the size threshold above which outline rendering is used.</param>
|
|
||||||
/// <param name="measuringMode">Specifies the method used to measure during text layout. For proper
|
|
||||||
/// glyph spacing, the function returns a rendering mode that is compatible with the specified
|
|
||||||
/// measuring mode.</param>
|
|
||||||
/// <param name="renderingParams">Rendering parameters object. This parameter is necessary in case the rendering parameters
|
|
||||||
/// object overrides the rendering mode.</param>
|
|
||||||
/// <param name="renderingMode">Receives the recommended rendering mode.</param>
|
|
||||||
/// <param name="gridFitMode">Receives the recommended grid-fit mode.</param>
|
|
||||||
/// <remarks>
|
|
||||||
/// This method should be used to determine the actual rendering mode in cases where the rendering
|
|
||||||
/// mode of the rendering params object is DWRITE_RENDERING_MODE_DEFAULT, and the actual grid-fit
|
|
||||||
/// mode when the rendering params object is DWRITE_GRID_FIT_MODE_DEFAULT.
|
|
||||||
/// </remarks>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(GetRecommendedRenderingMode)(
|
|
||||||
FLOAT fontEmSize,
|
|
||||||
FLOAT dpiX,
|
|
||||||
FLOAT dpiY,
|
|
||||||
_In_opt_ DWRITE_MATRIX const* transform,
|
|
||||||
BOOL isSideways,
|
|
||||||
DWRITE_OUTLINE_THRESHOLD outlineThreshold,
|
|
||||||
DWRITE_MEASURING_MODE measuringMode,
|
|
||||||
_In_opt_ IDWriteRenderingParams* renderingParams,
|
|
||||||
_Out_ DWRITE_RENDERING_MODE* renderingMode,
|
|
||||||
_Out_ DWRITE_GRID_FIT_MODE* gridFitMode
|
|
||||||
) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a color glyph run. The IDWriteFactory2::TranslateColorGlyphRun
|
|
||||||
/// method returns an ordered collection of color glyph runs, which can be
|
|
||||||
/// layered on top of each other to produce a color representation of the
|
|
||||||
/// given base glyph run.
|
|
||||||
/// </summary>
|
|
||||||
struct DWRITE_COLOR_GLYPH_RUN
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Glyph run to render.
|
|
||||||
/// </summary>
|
|
||||||
DWRITE_GLYPH_RUN glyphRun;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Optional glyph run description.
|
|
||||||
/// </summary>
|
|
||||||
_Maybenull_ DWRITE_GLYPH_RUN_DESCRIPTION* glyphRunDescription;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Location at which to draw this glyph run.
|
|
||||||
/// </summary>
|
|
||||||
FLOAT baselineOriginX;
|
|
||||||
FLOAT baselineOriginY;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Color to use for this layer, if any. This is the same color that
|
|
||||||
/// IDWriteFontFace2::GetPaletteEntries would return for the current
|
|
||||||
/// palette index if the paletteIndex member is less than 0xFFFF. If
|
|
||||||
/// the paletteIndex member is 0xFFFF then there is no associated
|
|
||||||
/// palette entry, this member is set to { 0, 0, 0, 0 }, and the client
|
|
||||||
/// should use the current foreground brush.
|
|
||||||
/// </summary>
|
|
||||||
DWRITE_COLOR_F runColor;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Zero-based index of this layer's color entry in the current color
|
|
||||||
/// palette, or 0xFFFF if this layer is to be rendered using
|
|
||||||
/// the current foreground brush.
|
|
||||||
/// </summary>
|
|
||||||
UINT16 paletteIndex;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enumerator for an ordered collection of color glyph runs.
|
|
||||||
/// </summary>
|
|
||||||
interface DWRITE_DECLARE_INTERFACE("d31fbe17-f157-41a2-8d24-cb779e0560e8") IDWriteColorGlyphRunEnumerator : public IUnknown
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Advances to the first or next color run. The runs are enumerated
|
|
||||||
/// in order from back to front.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="hasRun">Receives TRUE if there is a current run or
|
|
||||||
/// FALSE if the end of the sequence has been reached.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(MoveNext)(
|
|
||||||
_Out_ BOOL* hasRun
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the current color glyph run.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="colorGlyphRun">Receives a pointer to the color
|
|
||||||
/// glyph run. The pointer remains valid until the next call to
|
|
||||||
/// MoveNext or until the interface is released.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code. An error is returned if there is
|
|
||||||
/// no current glyph run, i.e., if MoveNext has not yet been called
|
|
||||||
/// or if the end of the sequence has been reached.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(GetCurrentRun)(
|
|
||||||
_Outptr_ DWRITE_COLOR_GLYPH_RUN const** colorGlyphRun
|
|
||||||
) PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The interface that represents text rendering settings for glyph rasterization and filtering.
|
|
||||||
/// </summary>
|
|
||||||
interface DWRITE_DECLARE_INTERFACE("F9D711C3-9777-40AE-87E8-3E5AF9BF0948") IDWriteRenderingParams2 : public IDWriteRenderingParams1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the grid fitting mode.
|
|
||||||
/// </summary>
|
|
||||||
STDMETHOD_(DWRITE_GRID_FIT_MODE, GetGridFitMode)() PURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The root factory interface for all DWrite objects.
|
|
||||||
/// </summary>
|
|
||||||
interface DWRITE_DECLARE_INTERFACE("0439fc60-ca44-4994-8dee-3a9af7b732ec") IDWriteFactory2 : public IDWriteFactory1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Get the system-appropriate font fallback mapping list.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fontFallback">The system fallback list.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(GetSystemFontFallback)(
|
|
||||||
_COM_Outptr_ IDWriteFontFallback** fontFallback
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a custom font fallback builder.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fontFallbackBuilder">Empty font fallback builder.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(CreateFontFallbackBuilder)(
|
|
||||||
_COM_Outptr_ IDWriteFontFallbackBuilder** fontFallbackBuilder
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Translates a glyph run to a sequence of color glyph runs, which can be
|
|
||||||
/// rendered to produce a color representation of the original "base" run.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="baselineOriginX">Horizontal origin of the base glyph run in
|
|
||||||
/// pre-transform coordinates.</param>
|
|
||||||
/// <param name="baselineOriginY">Vertical origin of the base glyph run in
|
|
||||||
/// pre-transform coordinates.</param>
|
|
||||||
/// <param name="glyphRun">Pointer to the original "base" glyph run.</param>
|
|
||||||
/// <param name="glyphRunDescription">Optional glyph run description.</param>
|
|
||||||
/// <param name="measuringMode">Measuring mode, needed to compute the origins
|
|
||||||
/// of each glyph.</param>
|
|
||||||
/// <param name="worldToDeviceTransform">Matrix converting from the client's
|
|
||||||
/// coordinate space to device coordinates (pixels), i.e., the world transform
|
|
||||||
/// multiplied by any DPI scaling.</param>
|
|
||||||
/// <param name="colorPaletteIndex">Zero-based index of the color palette to use.
|
|
||||||
/// Valid indices are less than the number of palettes in the font, as returned
|
|
||||||
/// by IDWriteFontFace2::GetColorPaletteCount.</param>
|
|
||||||
/// <param name="colorLayers">If the function succeeds, receives a pointer
|
|
||||||
/// to an enumerator object that can be used to obtain the color glyph runs.
|
|
||||||
/// If the base run has no color glyphs, then the output pointer is NULL
|
|
||||||
/// and the method returns DWRITE_E_NOCOLOR.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Returns DWRITE_E_NOCOLOR if the font has no color information, the base
|
|
||||||
/// glyph run does not contain any color glyphs, or the specified color palette
|
|
||||||
/// index is out of range. In this case, the client should render the base glyph
|
|
||||||
/// run. Otherwise, returns a standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(TranslateColorGlyphRun)(
|
|
||||||
FLOAT baselineOriginX,
|
|
||||||
FLOAT baselineOriginY,
|
|
||||||
_In_ DWRITE_GLYPH_RUN const* glyphRun,
|
|
||||||
_In_opt_ DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription,
|
|
||||||
DWRITE_MEASURING_MODE measuringMode,
|
|
||||||
_In_opt_ DWRITE_MATRIX const* worldToDeviceTransform,
|
|
||||||
UINT32 colorPaletteIndex,
|
|
||||||
_COM_Outptr_ IDWriteColorGlyphRunEnumerator** colorLayers
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a rendering parameters object with the specified properties.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="gamma">The gamma value used for gamma correction, which must be greater than zero and cannot exceed 256.</param>
|
|
||||||
/// <param name="enhancedContrast">The amount of contrast enhancement, zero or greater.</param>
|
|
||||||
/// <param name="clearTypeLevel">The degree of ClearType level, from 0.0f (no ClearType) to 1.0f (full ClearType).</param>
|
|
||||||
/// <param name="pixelGeometry">The geometry of a device pixel.</param>
|
|
||||||
/// <param name="renderingMode">Method of rendering glyphs. In most cases, this should be DWRITE_RENDERING_MODE_DEFAULT to automatically use an appropriate mode.</param>
|
|
||||||
/// <param name="gridFitMode">How to grid fit glyph outlines. In most cases, this should be DWRITE_GRID_FIT_DEFAULT to automatically choose an appropriate mode.</param>
|
|
||||||
/// <param name="renderingParams">Holds the newly created rendering parameters object, or NULL in case of failure.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(CreateCustomRenderingParams)(
|
|
||||||
FLOAT gamma,
|
|
||||||
FLOAT enhancedContrast,
|
|
||||||
FLOAT grayscaleEnhancedContrast,
|
|
||||||
FLOAT clearTypeLevel,
|
|
||||||
DWRITE_PIXEL_GEOMETRY pixelGeometry,
|
|
||||||
DWRITE_RENDERING_MODE renderingMode,
|
|
||||||
DWRITE_GRID_FIT_MODE gridFitMode,
|
|
||||||
_COM_Outptr_ IDWriteRenderingParams2** renderingParams
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
using IDWriteFactory::CreateCustomRenderingParams;
|
|
||||||
using IDWriteFactory1::CreateCustomRenderingParams;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a glyph run analysis object, which encapsulates information
|
|
||||||
/// used to render a glyph run.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="glyphRun">Structure specifying the properties of the glyph run.</param>
|
|
||||||
/// <param name="transform">Optional transform applied to the glyphs and their positions. This transform is applied after the
|
|
||||||
/// scaling specified by the emSize and pixelsPerDip.</param>
|
|
||||||
/// <param name="renderingMode">Specifies the rendering mode, which must be one of the raster rendering modes (i.e., not default
|
|
||||||
/// and not outline).</param>
|
|
||||||
/// <param name="measuringMode">Specifies the method to measure glyphs.</param>
|
|
||||||
/// <param name="gridFitMode">How to grid-fit glyph outlines. This must be non-default.</param>
|
|
||||||
/// <param name="baselineOriginX">Horizontal position of the baseline origin, in DIPs.</param>
|
|
||||||
/// <param name="baselineOriginY">Vertical position of the baseline origin, in DIPs.</param>
|
|
||||||
/// <param name="glyphRunAnalysis">Receives a pointer to the newly created object.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// Standard HRESULT error code.
|
|
||||||
/// </returns>
|
|
||||||
STDMETHOD(CreateGlyphRunAnalysis)(
|
|
||||||
_In_ DWRITE_GLYPH_RUN const* glyphRun,
|
|
||||||
_In_opt_ DWRITE_MATRIX const* transform,
|
|
||||||
DWRITE_RENDERING_MODE renderingMode,
|
|
||||||
DWRITE_MEASURING_MODE measuringMode,
|
|
||||||
DWRITE_GRID_FIT_MODE gridFitMode,
|
|
||||||
DWRITE_TEXT_ANTIALIAS_MODE antialiasMode,
|
|
||||||
FLOAT baselineOriginX,
|
|
||||||
FLOAT baselineOriginY,
|
|
||||||
_COM_Outptr_ IDWriteGlyphRunAnalysis** glyphRunAnalysis
|
|
||||||
) PURE;
|
|
||||||
|
|
||||||
using IDWriteFactory::CreateGlyphRunAnalysis;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* DWRITE_2_H_INCLUDED */
|
|
1743
3rdparty/minidx12/Include/dwrite_3.h
vendored
1743
3rdparty/minidx12/Include/dwrite_3.h
vendored
File diff suppressed because it is too large
Load diff
2951
3rdparty/minidx12/Include/dxgi.h
vendored
2951
3rdparty/minidx12/Include/dxgi.h
vendored
File diff suppressed because it is too large
Load diff
2474
3rdparty/minidx12/Include/dxgi1_2.h
vendored
2474
3rdparty/minidx12/Include/dxgi1_2.h
vendored
File diff suppressed because it is too large
Load diff
2121
3rdparty/minidx12/Include/dxgi1_3.h
vendored
2121
3rdparty/minidx12/Include/dxgi1_3.h
vendored
File diff suppressed because it is too large
Load diff
1494
3rdparty/minidx12/Include/dxgi1_4.h
vendored
1494
3rdparty/minidx12/Include/dxgi1_4.h
vendored
File diff suppressed because it is too large
Load diff
137
3rdparty/minidx12/Include/dxgiformat.h
vendored
137
3rdparty/minidx12/Include/dxgiformat.h
vendored
|
@ -1,137 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright (C) Microsoft. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef __dxgiformat_h__
|
|
||||||
#define __dxgiformat_h__
|
|
||||||
|
|
||||||
#define DXGI_FORMAT_DEFINED 1
|
|
||||||
|
|
||||||
typedef enum DXGI_FORMAT
|
|
||||||
{
|
|
||||||
DXGI_FORMAT_UNKNOWN = 0,
|
|
||||||
DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
|
|
||||||
DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
|
|
||||||
DXGI_FORMAT_R32G32B32A32_UINT = 3,
|
|
||||||
DXGI_FORMAT_R32G32B32A32_SINT = 4,
|
|
||||||
DXGI_FORMAT_R32G32B32_TYPELESS = 5,
|
|
||||||
DXGI_FORMAT_R32G32B32_FLOAT = 6,
|
|
||||||
DXGI_FORMAT_R32G32B32_UINT = 7,
|
|
||||||
DXGI_FORMAT_R32G32B32_SINT = 8,
|
|
||||||
DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
|
|
||||||
DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
|
|
||||||
DXGI_FORMAT_R16G16B16A16_UNORM = 11,
|
|
||||||
DXGI_FORMAT_R16G16B16A16_UINT = 12,
|
|
||||||
DXGI_FORMAT_R16G16B16A16_SNORM = 13,
|
|
||||||
DXGI_FORMAT_R16G16B16A16_SINT = 14,
|
|
||||||
DXGI_FORMAT_R32G32_TYPELESS = 15,
|
|
||||||
DXGI_FORMAT_R32G32_FLOAT = 16,
|
|
||||||
DXGI_FORMAT_R32G32_UINT = 17,
|
|
||||||
DXGI_FORMAT_R32G32_SINT = 18,
|
|
||||||
DXGI_FORMAT_R32G8X24_TYPELESS = 19,
|
|
||||||
DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
|
|
||||||
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
|
|
||||||
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
|
|
||||||
DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
|
|
||||||
DXGI_FORMAT_R10G10B10A2_UNORM = 24,
|
|
||||||
DXGI_FORMAT_R10G10B10A2_UINT = 25,
|
|
||||||
DXGI_FORMAT_R11G11B10_FLOAT = 26,
|
|
||||||
DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
|
|
||||||
DXGI_FORMAT_R8G8B8A8_UNORM = 28,
|
|
||||||
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
|
|
||||||
DXGI_FORMAT_R8G8B8A8_UINT = 30,
|
|
||||||
DXGI_FORMAT_R8G8B8A8_SNORM = 31,
|
|
||||||
DXGI_FORMAT_R8G8B8A8_SINT = 32,
|
|
||||||
DXGI_FORMAT_R16G16_TYPELESS = 33,
|
|
||||||
DXGI_FORMAT_R16G16_FLOAT = 34,
|
|
||||||
DXGI_FORMAT_R16G16_UNORM = 35,
|
|
||||||
DXGI_FORMAT_R16G16_UINT = 36,
|
|
||||||
DXGI_FORMAT_R16G16_SNORM = 37,
|
|
||||||
DXGI_FORMAT_R16G16_SINT = 38,
|
|
||||||
DXGI_FORMAT_R32_TYPELESS = 39,
|
|
||||||
DXGI_FORMAT_D32_FLOAT = 40,
|
|
||||||
DXGI_FORMAT_R32_FLOAT = 41,
|
|
||||||
DXGI_FORMAT_R32_UINT = 42,
|
|
||||||
DXGI_FORMAT_R32_SINT = 43,
|
|
||||||
DXGI_FORMAT_R24G8_TYPELESS = 44,
|
|
||||||
DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
|
|
||||||
DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
|
|
||||||
DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
|
|
||||||
DXGI_FORMAT_R8G8_TYPELESS = 48,
|
|
||||||
DXGI_FORMAT_R8G8_UNORM = 49,
|
|
||||||
DXGI_FORMAT_R8G8_UINT = 50,
|
|
||||||
DXGI_FORMAT_R8G8_SNORM = 51,
|
|
||||||
DXGI_FORMAT_R8G8_SINT = 52,
|
|
||||||
DXGI_FORMAT_R16_TYPELESS = 53,
|
|
||||||
DXGI_FORMAT_R16_FLOAT = 54,
|
|
||||||
DXGI_FORMAT_D16_UNORM = 55,
|
|
||||||
DXGI_FORMAT_R16_UNORM = 56,
|
|
||||||
DXGI_FORMAT_R16_UINT = 57,
|
|
||||||
DXGI_FORMAT_R16_SNORM = 58,
|
|
||||||
DXGI_FORMAT_R16_SINT = 59,
|
|
||||||
DXGI_FORMAT_R8_TYPELESS = 60,
|
|
||||||
DXGI_FORMAT_R8_UNORM = 61,
|
|
||||||
DXGI_FORMAT_R8_UINT = 62,
|
|
||||||
DXGI_FORMAT_R8_SNORM = 63,
|
|
||||||
DXGI_FORMAT_R8_SINT = 64,
|
|
||||||
DXGI_FORMAT_A8_UNORM = 65,
|
|
||||||
DXGI_FORMAT_R1_UNORM = 66,
|
|
||||||
DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
|
|
||||||
DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
|
|
||||||
DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
|
|
||||||
DXGI_FORMAT_BC1_TYPELESS = 70,
|
|
||||||
DXGI_FORMAT_BC1_UNORM = 71,
|
|
||||||
DXGI_FORMAT_BC1_UNORM_SRGB = 72,
|
|
||||||
DXGI_FORMAT_BC2_TYPELESS = 73,
|
|
||||||
DXGI_FORMAT_BC2_UNORM = 74,
|
|
||||||
DXGI_FORMAT_BC2_UNORM_SRGB = 75,
|
|
||||||
DXGI_FORMAT_BC3_TYPELESS = 76,
|
|
||||||
DXGI_FORMAT_BC3_UNORM = 77,
|
|
||||||
DXGI_FORMAT_BC3_UNORM_SRGB = 78,
|
|
||||||
DXGI_FORMAT_BC4_TYPELESS = 79,
|
|
||||||
DXGI_FORMAT_BC4_UNORM = 80,
|
|
||||||
DXGI_FORMAT_BC4_SNORM = 81,
|
|
||||||
DXGI_FORMAT_BC5_TYPELESS = 82,
|
|
||||||
DXGI_FORMAT_BC5_UNORM = 83,
|
|
||||||
DXGI_FORMAT_BC5_SNORM = 84,
|
|
||||||
DXGI_FORMAT_B5G6R5_UNORM = 85,
|
|
||||||
DXGI_FORMAT_B5G5R5A1_UNORM = 86,
|
|
||||||
DXGI_FORMAT_B8G8R8A8_UNORM = 87,
|
|
||||||
DXGI_FORMAT_B8G8R8X8_UNORM = 88,
|
|
||||||
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
|
|
||||||
DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
|
|
||||||
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
|
|
||||||
DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
|
|
||||||
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
|
|
||||||
DXGI_FORMAT_BC6H_TYPELESS = 94,
|
|
||||||
DXGI_FORMAT_BC6H_UF16 = 95,
|
|
||||||
DXGI_FORMAT_BC6H_SF16 = 96,
|
|
||||||
DXGI_FORMAT_BC7_TYPELESS = 97,
|
|
||||||
DXGI_FORMAT_BC7_UNORM = 98,
|
|
||||||
DXGI_FORMAT_BC7_UNORM_SRGB = 99,
|
|
||||||
DXGI_FORMAT_AYUV = 100,
|
|
||||||
DXGI_FORMAT_Y410 = 101,
|
|
||||||
DXGI_FORMAT_Y416 = 102,
|
|
||||||
DXGI_FORMAT_NV12 = 103,
|
|
||||||
DXGI_FORMAT_P010 = 104,
|
|
||||||
DXGI_FORMAT_P016 = 105,
|
|
||||||
DXGI_FORMAT_420_OPAQUE = 106,
|
|
||||||
DXGI_FORMAT_YUY2 = 107,
|
|
||||||
DXGI_FORMAT_Y210 = 108,
|
|
||||||
DXGI_FORMAT_Y216 = 109,
|
|
||||||
DXGI_FORMAT_NV11 = 110,
|
|
||||||
DXGI_FORMAT_AI44 = 111,
|
|
||||||
DXGI_FORMAT_IA44 = 112,
|
|
||||||
DXGI_FORMAT_P8 = 113,
|
|
||||||
DXGI_FORMAT_A8P8 = 114,
|
|
||||||
DXGI_FORMAT_B4G4R4A4_UNORM = 115,
|
|
||||||
|
|
||||||
DXGI_FORMAT_P208 = 130,
|
|
||||||
DXGI_FORMAT_V208 = 131,
|
|
||||||
DXGI_FORMAT_V408 = 132,
|
|
||||||
|
|
||||||
|
|
||||||
DXGI_FORMAT_FORCE_UINT = 0xffffffff
|
|
||||||
} DXGI_FORMAT;
|
|
||||||
|
|
||||||
#endif // __dxgiformat_h__
|
|
143
3rdparty/minidx12/Include/dxgitype.h
vendored
143
3rdparty/minidx12/Include/dxgitype.h
vendored
|
@ -1,143 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright (C) Microsoft. All rights reserved.
|
|
||||||
//
|
|
||||||
#ifndef __dxgitype_h__
|
|
||||||
#define __dxgitype_h__
|
|
||||||
|
|
||||||
#include "dxgiformat.h"
|
|
||||||
|
|
||||||
#define _FACDXGI 0x87a
|
|
||||||
#define MAKE_DXGI_HRESULT(code) MAKE_HRESULT(1, _FACDXGI, code)
|
|
||||||
#define MAKE_DXGI_STATUS(code) MAKE_HRESULT(0, _FACDXGI, code)
|
|
||||||
|
|
||||||
// DXGI error messages have moved to winerror.h
|
|
||||||
|
|
||||||
#define DXGI_CPU_ACCESS_NONE ( 0 )
|
|
||||||
#define DXGI_CPU_ACCESS_DYNAMIC ( 1 )
|
|
||||||
#define DXGI_CPU_ACCESS_READ_WRITE ( 2 )
|
|
||||||
#define DXGI_CPU_ACCESS_SCRATCH ( 3 )
|
|
||||||
#define DXGI_CPU_ACCESS_FIELD 15
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct DXGI_RGB
|
|
||||||
{
|
|
||||||
float Red;
|
|
||||||
float Green;
|
|
||||||
float Blue;
|
|
||||||
} DXGI_RGB;
|
|
||||||
|
|
||||||
#ifndef D3DCOLORVALUE_DEFINED
|
|
||||||
typedef struct _D3DCOLORVALUE {
|
|
||||||
float r;
|
|
||||||
float g;
|
|
||||||
float b;
|
|
||||||
float a;
|
|
||||||
} D3DCOLORVALUE;
|
|
||||||
|
|
||||||
#define D3DCOLORVALUE_DEFINED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef D3DCOLORVALUE DXGI_RGBA;
|
|
||||||
|
|
||||||
typedef struct DXGI_GAMMA_CONTROL
|
|
||||||
{
|
|
||||||
DXGI_RGB Scale;
|
|
||||||
DXGI_RGB Offset;
|
|
||||||
DXGI_RGB GammaCurve[ 1025 ];
|
|
||||||
} DXGI_GAMMA_CONTROL;
|
|
||||||
|
|
||||||
typedef struct DXGI_GAMMA_CONTROL_CAPABILITIES
|
|
||||||
{
|
|
||||||
BOOL ScaleAndOffsetSupported;
|
|
||||||
float MaxConvertedValue;
|
|
||||||
float MinConvertedValue;
|
|
||||||
UINT NumGammaControlPoints;
|
|
||||||
float ControlPointPositions[1025];
|
|
||||||
} DXGI_GAMMA_CONTROL_CAPABILITIES;
|
|
||||||
|
|
||||||
typedef struct DXGI_RATIONAL
|
|
||||||
{
|
|
||||||
UINT Numerator;
|
|
||||||
UINT Denominator;
|
|
||||||
} DXGI_RATIONAL;
|
|
||||||
|
|
||||||
typedef enum DXGI_MODE_SCANLINE_ORDER
|
|
||||||
{
|
|
||||||
DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0,
|
|
||||||
DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1,
|
|
||||||
DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST = 2,
|
|
||||||
DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3
|
|
||||||
} DXGI_MODE_SCANLINE_ORDER;
|
|
||||||
|
|
||||||
typedef enum DXGI_MODE_SCALING
|
|
||||||
{
|
|
||||||
DXGI_MODE_SCALING_UNSPECIFIED = 0,
|
|
||||||
DXGI_MODE_SCALING_CENTERED = 1,
|
|
||||||
DXGI_MODE_SCALING_STRETCHED = 2
|
|
||||||
} DXGI_MODE_SCALING;
|
|
||||||
|
|
||||||
typedef enum DXGI_MODE_ROTATION
|
|
||||||
{
|
|
||||||
DXGI_MODE_ROTATION_UNSPECIFIED = 0,
|
|
||||||
DXGI_MODE_ROTATION_IDENTITY = 1,
|
|
||||||
DXGI_MODE_ROTATION_ROTATE90 = 2,
|
|
||||||
DXGI_MODE_ROTATION_ROTATE180 = 3,
|
|
||||||
DXGI_MODE_ROTATION_ROTATE270 = 4
|
|
||||||
} DXGI_MODE_ROTATION;
|
|
||||||
|
|
||||||
typedef struct DXGI_MODE_DESC
|
|
||||||
{
|
|
||||||
UINT Width;
|
|
||||||
UINT Height;
|
|
||||||
DXGI_RATIONAL RefreshRate;
|
|
||||||
DXGI_FORMAT Format;
|
|
||||||
DXGI_MODE_SCANLINE_ORDER ScanlineOrdering;
|
|
||||||
DXGI_MODE_SCALING Scaling;
|
|
||||||
} DXGI_MODE_DESC;
|
|
||||||
|
|
||||||
// The following values are used with DXGI_SAMPLE_DESC::Quality:
|
|
||||||
#define DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN 0xffffffff
|
|
||||||
#define DXGI_CENTER_MULTISAMPLE_QUALITY_PATTERN 0xfffffffe
|
|
||||||
|
|
||||||
typedef struct DXGI_SAMPLE_DESC
|
|
||||||
{
|
|
||||||
UINT Count;
|
|
||||||
UINT Quality;
|
|
||||||
} DXGI_SAMPLE_DESC;
|
|
||||||
|
|
||||||
typedef enum DXGI_COLOR_SPACE_TYPE
|
|
||||||
{
|
|
||||||
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0,
|
|
||||||
DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 1,
|
|
||||||
DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 = 2,
|
|
||||||
DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 = 3,
|
|
||||||
DXGI_COLOR_SPACE_RESERVED = 4,
|
|
||||||
DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 = 5,
|
|
||||||
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 = 6,
|
|
||||||
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 = 7,
|
|
||||||
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 = 8,
|
|
||||||
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 9,
|
|
||||||
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 10,
|
|
||||||
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 11,
|
|
||||||
DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF
|
|
||||||
} DXGI_COLOR_SPACE_TYPE;
|
|
||||||
|
|
||||||
typedef struct DXGI_JPEG_DC_HUFFMAN_TABLE
|
|
||||||
{
|
|
||||||
BYTE CodeCounts[12];
|
|
||||||
BYTE CodeValues[12];
|
|
||||||
} DXGI_JPEG_DC_HUFFMAN_TABLE;
|
|
||||||
|
|
||||||
typedef struct DXGI_JPEG_AC_HUFFMAN_TABLE
|
|
||||||
{
|
|
||||||
BYTE CodeCounts[16];
|
|
||||||
BYTE CodeValues[162];
|
|
||||||
} DXGI_JPEG_AC_HUFFMAN_TABLE;
|
|
||||||
|
|
||||||
typedef struct DXGI_JPEG_QUANTIZATION_TABLE
|
|
||||||
{
|
|
||||||
BYTE Elements[64];
|
|
||||||
} DXGI_JPEG_QUANTIZATION_TABLE;
|
|
||||||
|
|
||||||
#endif // __dxgitype_h__
|
|
||||||
|
|
BIN
3rdparty/minidx12/Lib/d2d1.lib
vendored
BIN
3rdparty/minidx12/Lib/d2d1.lib
vendored
Binary file not shown.
BIN
3rdparty/minidx12/Lib/dwrite.lib
vendored
BIN
3rdparty/minidx12/Lib/dwrite.lib
vendored
Binary file not shown.
BIN
3rdparty/minidx12/Lib/dxgi.lib
vendored
BIN
3rdparty/minidx12/Lib/dxgi.lib
vendored
Binary file not shown.
14
rpcs3.sln
14
rpcs3.sln
|
@ -13,8 +13,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "emucore", "rpcs3\emucore.vc
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm_build", "llvm_build\llvm_build.vcxproj", "{8BC303AB-25BE-4276-8E57-73F171B2D672}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm_build", "llvm_build\llvm_build.vcxproj", "{8BC303AB-25BE-4276-8E57-73F171B2D672}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "D3D12GSRender", "rpcs3\D3D12GSRender.vcxproj", "{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GLGSRender", "rpcs3\GLGSRender.vcxproj", "{3384223A-6D97-4799-9862-359F85312892}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GLGSRender", "rpcs3\GLGSRender.vcxproj", "{3384223A-6D97-4799-9862-359F85312892}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "rpcs3.emu", "rpcs3.emu", "{10FBF193-D532-4CCF-B875-4C7091A7F6C2}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "rpcs3.emu", "rpcs3.emu", "{10FBF193-D532-4CCF-B875-4C7091A7F6C2}"
|
||||||
|
@ -61,7 +59,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rpcs3", "rpcs3\rpcs3.vcxpro
|
||||||
{60F89955-91C6-3A36-8000-13C592FEC2DF} = {60F89955-91C6-3A36-8000-13C592FEC2DF}
|
{60F89955-91C6-3A36-8000-13C592FEC2DF} = {60F89955-91C6-3A36-8000-13C592FEC2DF}
|
||||||
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D} = {3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}
|
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D} = {3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}
|
||||||
{D6973076-9317-4EF2-A0B8-B7A18AC0713E} = {D6973076-9317-4EF2-A0B8-B7A18AC0713E}
|
{D6973076-9317-4EF2-A0B8-B7A18AC0713E} = {D6973076-9317-4EF2-A0B8-B7A18AC0713E}
|
||||||
{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078} = {FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}
|
|
||||||
{FDC361C5-7734-493B-8CFB-037308B35122} = {FDC361C5-7734-493B-8CFB-037308B35122}
|
{FDC361C5-7734-493B-8CFB-037308B35122} = {FDC361C5-7734-493B-8CFB-037308B35122}
|
||||||
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C} = {8F85B6CC-250F-4ACA-A617-E820A74E3E3C}
|
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C} = {8F85B6CC-250F-4ACA-A617-E820A74E3E3C}
|
||||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187} = {349EE8F9-7D25-4909-AAF5-FF3FADE72187}
|
{349EE8F9-7D25-4909-AAF5-FF3FADE72187} = {349EE8F9-7D25-4909-AAF5-FF3FADE72187}
|
||||||
|
@ -117,16 +114,6 @@ Global
|
||||||
{8BC303AB-25BE-4276-8E57-73F171B2D672}.Debug|x64.ActiveCfg = Debug|x64
|
{8BC303AB-25BE-4276-8E57-73F171B2D672}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{8BC303AB-25BE-4276-8E57-73F171B2D672}.Release - LLVM|x64.ActiveCfg = Release|x64
|
{8BC303AB-25BE-4276-8E57-73F171B2D672}.Release - LLVM|x64.ActiveCfg = Release|x64
|
||||||
{8BC303AB-25BE-4276-8E57-73F171B2D672}.Release|x64.ActiveCfg = Release|x64
|
{8BC303AB-25BE-4276-8E57-73F171B2D672}.Release|x64.ActiveCfg = Release|x64
|
||||||
{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}.Debug - LLVM|x64.ActiveCfg = Debug - LLVM|x64
|
|
||||||
{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}.Debug - LLVM|x64.Build.0 = Debug - LLVM|x64
|
|
||||||
{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64
|
|
||||||
{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64
|
|
||||||
{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}.Release - LLVM|x64.ActiveCfg = Release - LLVM|x64
|
|
||||||
{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}.Release - LLVM|x64.Build.0 = Release - LLVM|x64
|
|
||||||
{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}.Release|x64.Build.0 = Release|x64
|
|
||||||
{3384223A-6D97-4799-9862-359F85312892}.Debug - LLVM|x64.ActiveCfg = Debug - LLVM|x64
|
{3384223A-6D97-4799-9862-359F85312892}.Debug - LLVM|x64.ActiveCfg = Debug - LLVM|x64
|
||||||
{3384223A-6D97-4799-9862-359F85312892}.Debug - LLVM|x64.Build.0 = Debug - LLVM|x64
|
{3384223A-6D97-4799-9862-359F85312892}.Debug - LLVM|x64.Build.0 = Debug - LLVM|x64
|
||||||
{3384223A-6D97-4799-9862-359F85312892}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64
|
{3384223A-6D97-4799-9862-359F85312892}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64
|
||||||
|
@ -269,7 +256,6 @@ Global
|
||||||
{AC40FF01-426E-4838-A317-66354CEFAE88} = {E2A982F2-4B1A-48B1-8D77-A17A589C58D7}
|
{AC40FF01-426E-4838-A317-66354CEFAE88} = {E2A982F2-4B1A-48B1-8D77-A17A589C58D7}
|
||||||
{C4A10229-4712-4BD2-B63E-50D93C67A038} = {10FBF193-D532-4CCF-B875-4C7091A7F6C2}
|
{C4A10229-4712-4BD2-B63E-50D93C67A038} = {10FBF193-D532-4CCF-B875-4C7091A7F6C2}
|
||||||
{8BC303AB-25BE-4276-8E57-73F171B2D672} = {B0AC29FD-7B01-4B5E-9C8D-0A081E4C5668}
|
{8BC303AB-25BE-4276-8E57-73F171B2D672} = {B0AC29FD-7B01-4B5E-9C8D-0A081E4C5668}
|
||||||
{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078} = {10FBF193-D532-4CCF-B875-4C7091A7F6C2}
|
|
||||||
{3384223A-6D97-4799-9862-359F85312892} = {10FBF193-D532-4CCF-B875-4C7091A7F6C2}
|
{3384223A-6D97-4799-9862-359F85312892} = {10FBF193-D532-4CCF-B875-4C7091A7F6C2}
|
||||||
{78CB2F39-B809-4A06-8329-8C0A19119D3D} = {10FBF193-D532-4CCF-B875-4C7091A7F6C2}
|
{78CB2F39-B809-4A06-8329-8C0A19119D3D} = {10FBF193-D532-4CCF-B875-4C7091A7F6C2}
|
||||||
{30A05C4D-F5FD-421C-A864-17A64BDEAA75} = {10FBF193-D532-4CCF-B875-4C7091A7F6C2}
|
{30A05C4D-F5FD-421C-A864-17A64BDEAA75} = {10FBF193-D532-4CCF-B875-4C7091A7F6C2}
|
||||||
|
|
|
@ -1,99 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug - LLVM|x64">
|
|
||||||
<Configuration>Debug - LLVM</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug - MemLeak|x64">
|
|
||||||
<Configuration>Debug - MemLeak</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release - LLVM|x64">
|
|
||||||
<Configuration>Release - LLVM</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}</ProjectGuid>
|
|
||||||
<RootNamespace>D3D12GSRender</RootNamespace>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="..\common_default.props" />
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<Import Project="..\common_default_macros.props" />
|
|
||||||
<PropertyGroup Label="Configuration">
|
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<ImportGroup Label="ExtensionSettings">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="Shared">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
<Import Project="..\rpcs3_default.props" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<Import Project="..\rpcs3_debug.props" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug - MemLeak|x64'" Label="PropertySheets">
|
|
||||||
<Import Project="..\rpcs3_debug.props" />
|
|
||||||
<Import Project="..\rpcs3_memleak.props" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'" Label="PropertySheets">
|
|
||||||
<Import Project="..\rpcs3_debug.props" />
|
|
||||||
<Import Project="..\rpcs3_llvm.props" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<Import Project="..\rpcs3_release.props" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'" Label="PropertySheets">
|
|
||||||
<Import Project="..\rpcs3_release.props" />
|
|
||||||
<Import Project="..\rpcs3_llvm.props" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12Utils.h" />
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12CommonDecompiler.h" />
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12Formats.h" />
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12FragmentProgramDecompiler.h" />
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12GSRender.h" />
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12MemoryHelpers.h" />
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12PipelineState.h" />
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12RenderTargetSets.h" />
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12VertexProgramDecompiler.h" />
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\d3dx12.h" />
|
|
||||||
<ClInclude Include="stdafx_d3d12.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12Buffer.cpp" />
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12CommonDecompiler.cpp" />
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12Formats.cpp" />
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12FragmentProgramDecompiler.cpp" />
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12GSRender.cpp" />
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12MemoryHelpers.cpp" />
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12Overlay.cpp" />
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12PipelineState.cpp" />
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12RenderTargetSets.cpp" />
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12Texture.cpp" />
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12Utils.cpp" />
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12VertexProgramDecompiler.cpp" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="emucore.vcxproj">
|
|
||||||
<Project>{c4a10229-4712-4bd2-b63e-50d93c67a038}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
|
@ -1,83 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Source Files">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>
|
|
||||||
</Extensions>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12CommonDecompiler.h">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12FragmentProgramDecompiler.h">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12GSRender.h">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12PipelineState.h">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12RenderTargetSets.h">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12VertexProgramDecompiler.h">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\d3dx12.h">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="stdafx_d3d12.h">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12Utils.h">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12Formats.h">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Emu\RSX\D3D12\D3D12MemoryHelpers.h">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12Buffer.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12CommonDecompiler.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12FragmentProgramDecompiler.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12GSRender.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12Overlay.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12PipelineState.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12RenderTargetSets.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12Texture.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12Utils.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12VertexProgramDecompiler.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12Formats.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\RSX\D3D12\D3D12MemoryHelpers.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
|
@ -380,23 +380,6 @@ if(TARGET 3rdparty_vulkan)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
target_sources(rpcs3_emu PRIVATE
|
|
||||||
RSX/D3D12/D3D12Buffer.cpp
|
|
||||||
RSX/D3D12/D3D12CommonDecompiler.cpp
|
|
||||||
RSX/D3D12/D3D12Formats.cpp
|
|
||||||
RSX/D3D12/D3D12FragmentProgramDecompiler.cpp
|
|
||||||
RSX/D3D12/D3D12GSRender.cpp
|
|
||||||
RSX/D3D12/D3D12MemoryHelpers.cpp
|
|
||||||
RSX/D3D12/D3D12Overlay.cpp
|
|
||||||
RSX/D3D12/D3D12PipelineState.cpp
|
|
||||||
RSX/D3D12/D3D12RenderTargetSets.cpp
|
|
||||||
RSX/D3D12/D3D12Texture.cpp
|
|
||||||
RSX/D3D12/D3D12Utils.cpp
|
|
||||||
RSX/D3D12/D3D12VertexProgramDecompiler.cpp
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(rpcs3_emu
|
target_link_libraries(rpcs3_emu
|
||||||
PUBLIC
|
PUBLIC
|
||||||
3rdparty::ffmpeg 3rdparty::cereal
|
3rdparty::ffmpeg 3rdparty::cereal
|
||||||
|
@ -405,7 +388,7 @@ target_link_libraries(rpcs3_emu
|
||||||
3rdparty::libusb
|
3rdparty::libusb
|
||||||
PRIVATE
|
PRIVATE
|
||||||
3rdparty::gsl 3rdparty::xxhash
|
3rdparty::gsl 3rdparty::xxhash
|
||||||
3rdparty::dx12)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Setup cotire
|
# Setup cotire
|
||||||
|
|
|
@ -1,452 +0,0 @@
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "stdafx_d3d12.h"
|
|
||||||
|
|
||||||
#include <variant>
|
|
||||||
|
|
||||||
#include "D3D12GSRender.h"
|
|
||||||
#include "d3dx12.h"
|
|
||||||
#include "../Common/BufferUtils.h"
|
|
||||||
#include "D3D12Formats.h"
|
|
||||||
#include "../rsx_methods.h"
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
UINT get_component_mapping_from_vector_size(rsx::vertex_base_type type, u8 size)
|
|
||||||
{
|
|
||||||
if (type == rsx::vertex_base_type::cmp) return D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
|
||||||
switch (size)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
return D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1);
|
|
||||||
case 2:
|
|
||||||
return D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1);
|
|
||||||
case 3:
|
|
||||||
return D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1);
|
|
||||||
case 4:
|
|
||||||
return D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Wrong vector size %d" HERE, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_SHADER_RESOURCE_VIEW_DESC get_vertex_attribute_srv(const rsx::data_array_format_info &info, UINT64 offset_in_vertex_buffers_buffer, UINT buffer_size)
|
|
||||||
{
|
|
||||||
u32 element_size = rsx::get_vertex_type_size_on_host(info.type(), info.size());
|
|
||||||
D3D12_SHADER_RESOURCE_VIEW_DESC vertex_buffer_view = {
|
|
||||||
get_vertex_attribute_format(info.type(), info.size()), D3D12_SRV_DIMENSION_BUFFER,
|
|
||||||
get_component_mapping_from_vector_size(info.type(), info.size())};
|
|
||||||
vertex_buffer_view.Buffer.FirstElement = offset_in_vertex_buffers_buffer / element_size;
|
|
||||||
vertex_buffer_view.Buffer.NumElements = buffer_size / element_size;
|
|
||||||
return vertex_buffer_view;
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_SHADER_RESOURCE_VIEW_DESC get_vertex_attribute_srv(const rsx::vertex_base_type type, u8 size, UINT64 offset_in_vertex_buffers_buffer, UINT buffer_size)
|
|
||||||
{
|
|
||||||
u32 element_size = rsx::get_vertex_type_size_on_host(type, size);
|
|
||||||
D3D12_SHADER_RESOURCE_VIEW_DESC vertex_buffer_view = {get_vertex_attribute_format(type, size),
|
|
||||||
D3D12_SRV_DIMENSION_BUFFER, get_component_mapping_from_vector_size(type, size)};
|
|
||||||
vertex_buffer_view.Buffer.FirstElement = offset_in_vertex_buffers_buffer / element_size;
|
|
||||||
vertex_buffer_view.Buffer.NumElements = buffer_size / element_size;
|
|
||||||
return vertex_buffer_view;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<int N>
|
|
||||||
UINT64 get_next_multiple_of(UINT64 val)
|
|
||||||
{
|
|
||||||
UINT64 divided_val = (val + N - 1) / N;
|
|
||||||
return divided_val * N;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void D3D12GSRender::upload_and_bind_scale_offset_matrix(size_t descriptorIndex)
|
|
||||||
{
|
|
||||||
size_t heap_offset = m_buffer_data.alloc<D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT>(512);
|
|
||||||
|
|
||||||
// Scale offset buffer
|
|
||||||
// Separate constant buffer
|
|
||||||
void *mapped_buffer = m_buffer_data.map<void>(CD3DX12_RANGE(heap_offset, heap_offset + 512));
|
|
||||||
fill_scale_offset_data(mapped_buffer, true);
|
|
||||||
fill_user_clip_data((char*)mapped_buffer + 64);
|
|
||||||
fill_fragment_state_buffer((char *)mapped_buffer + 128, current_fragment_program);
|
|
||||||
m_buffer_data.unmap(CD3DX12_RANGE(heap_offset, heap_offset + 512));
|
|
||||||
|
|
||||||
D3D12_CONSTANT_BUFFER_VIEW_DESC constant_buffer_view_desc = {
|
|
||||||
m_buffer_data.get_heap()->GetGPUVirtualAddress() + heap_offset,
|
|
||||||
512
|
|
||||||
};
|
|
||||||
m_device->CreateConstantBufferView(&constant_buffer_view_desc,
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(get_current_resource_storage().descriptors_heap->GetCPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((INT)descriptorIndex, m_descriptor_stride_srv_cbv_uav));
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::upload_and_bind_vertex_shader_constants(size_t descriptor_index)
|
|
||||||
{
|
|
||||||
size_t buffer_size = 512 * 4 * sizeof(float);
|
|
||||||
|
|
||||||
size_t heap_offset = m_buffer_data.alloc<D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT>(buffer_size);
|
|
||||||
|
|
||||||
void *mapped_buffer = m_buffer_data.map<void>(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
fill_vertex_program_constants_data(mapped_buffer);
|
|
||||||
*(reinterpret_cast<u32*>((char *)mapped_buffer + (468 * 4 * sizeof(float)))) = rsx::method_registers.transform_branch_bits();
|
|
||||||
m_buffer_data.unmap(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
|
|
||||||
D3D12_CONSTANT_BUFFER_VIEW_DESC constant_buffer_view_desc = {
|
|
||||||
m_buffer_data.get_heap()->GetGPUVirtualAddress() + heap_offset,
|
|
||||||
(UINT)buffer_size
|
|
||||||
};
|
|
||||||
m_device->CreateConstantBufferView(&constant_buffer_view_desc,
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(get_current_resource_storage().descriptors_heap->GetCPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((INT)descriptor_index, m_descriptor_stride_srv_cbv_uav));
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_CONSTANT_BUFFER_VIEW_DESC D3D12GSRender::upload_fragment_shader_constants()
|
|
||||||
{
|
|
||||||
// Get constant from fragment program
|
|
||||||
size_t buffer_size = m_pso_cache.get_fragment_constants_buffer_size(current_fragment_program);
|
|
||||||
// Multiple of 256 never 0
|
|
||||||
buffer_size = (buffer_size + 255) & ~255;
|
|
||||||
|
|
||||||
size_t heap_offset = m_buffer_data.alloc<D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT>(buffer_size);
|
|
||||||
|
|
||||||
size_t offset = 0;
|
|
||||||
float *mapped_buffer = m_buffer_data.map<float>(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
m_pso_cache.fill_fragment_constants_buffer({ mapped_buffer, ::narrow<int>(buffer_size) }, current_fragment_program);
|
|
||||||
m_buffer_data.unmap(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
|
|
||||||
return {
|
|
||||||
m_buffer_data.get_heap()->GetGPUVirtualAddress() + heap_offset,
|
|
||||||
(UINT)buffer_size
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
struct vertex_buffer_visitor
|
|
||||||
{
|
|
||||||
std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC> vertex_buffer_views;
|
|
||||||
|
|
||||||
vertex_buffer_visitor(u32 vtx_cnt, ID3D12GraphicsCommandList* cmdlst,
|
|
||||||
ID3D12Resource* write_vertex_buffer, d3d12_data_heap& heap)
|
|
||||||
: vertex_count(vtx_cnt), offset_in_vertex_buffers_buffer(0), m_buffer_data(heap),
|
|
||||||
command_list(cmdlst), m_vertex_buffer_data(write_vertex_buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator()(const rsx::vertex_array_buffer& vertex_array)
|
|
||||||
{
|
|
||||||
u32 element_size =
|
|
||||||
rsx::get_vertex_type_size_on_host(vertex_array.type, vertex_array.attribute_size);
|
|
||||||
UINT buffer_size = element_size * vertex_count;
|
|
||||||
size_t heap_offset =
|
|
||||||
m_buffer_data.alloc<D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT>(buffer_size);
|
|
||||||
|
|
||||||
void* mapped_buffer =
|
|
||||||
m_buffer_data.map<void>(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
gsl::span<gsl::byte> mapped_buffer_span = {
|
|
||||||
(gsl::byte*)mapped_buffer, gsl::narrow_cast<int>(buffer_size)};
|
|
||||||
write_vertex_array_data_to_buffer(mapped_buffer_span, vertex_array.data, vertex_count,
|
|
||||||
vertex_array.type, vertex_array.attribute_size, vertex_array.stride, element_size, vertex_array.is_be);
|
|
||||||
|
|
||||||
m_buffer_data.unmap(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
|
|
||||||
command_list->CopyBufferRegion(m_vertex_buffer_data, offset_in_vertex_buffers_buffer,
|
|
||||||
m_buffer_data.get_heap(), heap_offset, buffer_size);
|
|
||||||
|
|
||||||
vertex_buffer_views.emplace_back(get_vertex_attribute_srv(vertex_array.type,
|
|
||||||
vertex_array.attribute_size, offset_in_vertex_buffers_buffer, buffer_size));
|
|
||||||
offset_in_vertex_buffers_buffer =
|
|
||||||
get_next_multiple_of<48>(offset_in_vertex_buffers_buffer +
|
|
||||||
buffer_size); // 48 is multiple of 2, 4, 6, 8, 12, 16
|
|
||||||
|
|
||||||
// m_timers.buffer_upload_size += buffer_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator()(const rsx::vertex_array_register& vertex_register)
|
|
||||||
{
|
|
||||||
u32 element_size = rsx::get_vertex_type_size_on_host(
|
|
||||||
vertex_register.type, vertex_register.attribute_size);
|
|
||||||
UINT buffer_size = element_size;
|
|
||||||
size_t heap_offset =
|
|
||||||
m_buffer_data.alloc<D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT>(buffer_size);
|
|
||||||
|
|
||||||
void* mapped_buffer =
|
|
||||||
m_buffer_data.map<void>(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
memcpy(mapped_buffer, vertex_register.data.data(), buffer_size);
|
|
||||||
m_buffer_data.unmap(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
|
|
||||||
command_list->CopyBufferRegion(m_vertex_buffer_data, offset_in_vertex_buffers_buffer,
|
|
||||||
m_buffer_data.get_heap(), heap_offset, buffer_size);
|
|
||||||
|
|
||||||
vertex_buffer_views.emplace_back(get_vertex_attribute_srv(vertex_register.type,
|
|
||||||
vertex_register.attribute_size, offset_in_vertex_buffers_buffer, buffer_size));
|
|
||||||
offset_in_vertex_buffers_buffer =
|
|
||||||
get_next_multiple_of<48>(offset_in_vertex_buffers_buffer +
|
|
||||||
buffer_size); // 48 is multiple of 2, 4, 6, 8, 12, 16
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator()(const rsx::empty_vertex_array& vbo)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
u32 vertex_count;
|
|
||||||
ID3D12GraphicsCommandList* command_list;
|
|
||||||
ID3D12Resource* m_vertex_buffer_data;
|
|
||||||
size_t offset_in_vertex_buffers_buffer;
|
|
||||||
d3d12_data_heap& m_buffer_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::tuple<D3D12_INDEX_BUFFER_VIEW, size_t> generate_index_buffer_for_emulated_primitives_array(
|
|
||||||
u32 vertex_count, d3d12_data_heap& m_buffer_data)
|
|
||||||
{
|
|
||||||
size_t index_count = get_index_count(rsx::method_registers.current_draw_clause.primitive, vertex_count);
|
|
||||||
|
|
||||||
// Alloc
|
|
||||||
size_t buffer_size = align(index_count * sizeof(u16), 64);
|
|
||||||
size_t heap_offset =
|
|
||||||
m_buffer_data.alloc<D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT>(buffer_size);
|
|
||||||
|
|
||||||
void* mapped_buffer =
|
|
||||||
m_buffer_data.map<void>(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
|
|
||||||
write_index_array_for_non_indexed_non_native_primitive_to_buffer((char *)mapped_buffer, rsx::method_registers.current_draw_clause.primitive, vertex_count);
|
|
||||||
|
|
||||||
m_buffer_data.unmap(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
D3D12_INDEX_BUFFER_VIEW index_buffer_view = {
|
|
||||||
m_buffer_data.get_heap()->GetGPUVirtualAddress() + heap_offset, (UINT)buffer_size,
|
|
||||||
DXGI_FORMAT_R16_UINT};
|
|
||||||
|
|
||||||
return std::make_tuple(index_buffer_view, index_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
using attribute_storage = std::vector<std::variant<rsx::vertex_array_buffer,
|
|
||||||
rsx::vertex_array_register, rsx::empty_vertex_array>>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Upload all enabled vertex attributes for vertex in ranges described by vertex_ranges.
|
|
||||||
* A range in vertex_range is a pair whose first element is the index of the beginning of the
|
|
||||||
* range, and whose second element is the number of vertex in this range.
|
|
||||||
*/
|
|
||||||
std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC> upload_vertex_attributes(
|
|
||||||
u32 vertex_count,
|
|
||||||
std::function<attribute_storage()> get_vertex_buffers,
|
|
||||||
ID3D12Resource* m_vertex_buffer_data, d3d12_data_heap& m_buffer_data,
|
|
||||||
ID3D12GraphicsCommandList* command_list)
|
|
||||||
{
|
|
||||||
command_list->ResourceBarrier(1,
|
|
||||||
&CD3DX12_RESOURCE_BARRIER::Transition(m_vertex_buffer_data,
|
|
||||||
D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER, D3D12_RESOURCE_STATE_COPY_DEST));
|
|
||||||
|
|
||||||
vertex_buffer_visitor visitor(
|
|
||||||
vertex_count, command_list, m_vertex_buffer_data, m_buffer_data);
|
|
||||||
const auto& vertex_buffers = get_vertex_buffers();
|
|
||||||
|
|
||||||
for (const auto& vbo : vertex_buffers) std::visit(visitor, vbo);
|
|
||||||
|
|
||||||
command_list->ResourceBarrier(1,
|
|
||||||
&CD3DX12_RESOURCE_BARRIER::Transition(m_vertex_buffer_data,
|
|
||||||
D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER));
|
|
||||||
return visitor.vertex_buffer_views;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::tuple<std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC>, size_t> upload_inlined_vertex_array(
|
|
||||||
gsl::span<const rsx::data_array_format_info, 16> vertex_attribute_infos,
|
|
||||||
gsl::span<const gsl::byte> inlined_array_raw_data, d3d12_data_heap& ring_buffer_data,
|
|
||||||
ID3D12Resource* vertex_buffer_placement, ID3D12GraphicsCommandList* command_list)
|
|
||||||
{
|
|
||||||
// We can't rely on vertex_attribute_infos strides here so compute it
|
|
||||||
// assuming all attributes are packed
|
|
||||||
u32 stride = 0;
|
|
||||||
u32 initial_offsets[rsx::limits::vertex_count];
|
|
||||||
u8 index = 0;
|
|
||||||
for (const auto& info : vertex_attribute_infos) {
|
|
||||||
initial_offsets[index++] = stride;
|
|
||||||
|
|
||||||
if (!info.size()) // disabled
|
|
||||||
continue;
|
|
||||||
|
|
||||||
stride += rsx::get_vertex_type_size_on_host(info.type(), info.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 element_count = ::narrow<u32>(inlined_array_raw_data.size_bytes()) / stride;
|
|
||||||
std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC> result;
|
|
||||||
|
|
||||||
UINT64 vertex_buffer_offset = 0;
|
|
||||||
index = 0;
|
|
||||||
for (const auto& info : vertex_attribute_infos) {
|
|
||||||
if (!info.size()) {
|
|
||||||
index++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 element_size = rsx::get_vertex_type_size_on_host(info.type(), info.size());
|
|
||||||
UINT buffer_size = element_size * element_count;
|
|
||||||
size_t heap_offset =
|
|
||||||
ring_buffer_data.alloc<D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT>(buffer_size);
|
|
||||||
|
|
||||||
void* mapped_buffer =
|
|
||||||
ring_buffer_data.map<void>(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
gsl::span<gsl::byte> dst = {(gsl::byte*)mapped_buffer, buffer_size};
|
|
||||||
|
|
||||||
for (u32 i = 0; i < element_count; i++) {
|
|
||||||
auto subdst = dst.subspan(i * element_size, element_size);
|
|
||||||
auto subsrc = inlined_array_raw_data.subspan(
|
|
||||||
initial_offsets[index] + (i * stride), element_size);
|
|
||||||
if (info.type() == rsx::vertex_base_type::ub && info.size() == 4) {
|
|
||||||
subdst[0] = subsrc[3];
|
|
||||||
subdst[1] = subsrc[2];
|
|
||||||
subdst[2] = subsrc[1];
|
|
||||||
subdst[3] = subsrc[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::copy(subsrc.begin(), subsrc.end(), subdst.begin());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ring_buffer_data.unmap(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
|
|
||||||
command_list->CopyBufferRegion(vertex_buffer_placement, vertex_buffer_offset,
|
|
||||||
ring_buffer_data.get_heap(), heap_offset, buffer_size);
|
|
||||||
|
|
||||||
result.emplace_back(get_vertex_attribute_srv(info, vertex_buffer_offset, buffer_size));
|
|
||||||
vertex_buffer_offset = get_next_multiple_of<48>(
|
|
||||||
vertex_buffer_offset + buffer_size); // 48 is multiple of 2, 4, 6, 8, 12, 16
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_tuple(result, element_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct draw_command_visitor
|
|
||||||
{
|
|
||||||
draw_command_visitor(ID3D12GraphicsCommandList* cmd_list, d3d12_data_heap& buffer_data,
|
|
||||||
ID3D12Resource* vertex_buffer_data,
|
|
||||||
std::function<attribute_storage()> get_vertex_info_lambda)
|
|
||||||
: command_list(cmd_list), m_buffer_data(buffer_data),
|
|
||||||
m_vertex_buffer_data(vertex_buffer_data), get_vertex_buffers(get_vertex_info_lambda)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
std::tuple<bool, size_t, std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC>> operator()(
|
|
||||||
const rsx::draw_array_command& command)
|
|
||||||
{
|
|
||||||
const auto vertex_count = rsx::method_registers.current_draw_clause.get_elements_count();
|
|
||||||
if (is_primitive_native(rsx::method_registers.current_draw_clause.primitive)) {
|
|
||||||
return std::make_tuple(false, vertex_count,
|
|
||||||
upload_vertex_attributes(vertex_count,
|
|
||||||
get_vertex_buffers,
|
|
||||||
m_vertex_buffer_data, m_buffer_data, command_list));
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_INDEX_BUFFER_VIEW index_buffer_view;
|
|
||||||
size_t index_count;
|
|
||||||
std::tie(index_buffer_view, index_count) =
|
|
||||||
generate_index_buffer_for_emulated_primitives_array(
|
|
||||||
vertex_count, m_buffer_data);
|
|
||||||
command_list->IASetIndexBuffer(&index_buffer_view);
|
|
||||||
return std::make_tuple(true, index_count,
|
|
||||||
upload_vertex_attributes(vertex_count,
|
|
||||||
get_vertex_buffers,
|
|
||||||
m_vertex_buffer_data, m_buffer_data, command_list));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::tuple<bool, size_t, std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC>> operator()(
|
|
||||||
const rsx::draw_indexed_array_command& command)
|
|
||||||
{
|
|
||||||
// Index count
|
|
||||||
size_t index_count =
|
|
||||||
get_index_count(rsx::method_registers.current_draw_clause.primitive,
|
|
||||||
rsx::method_registers.current_draw_clause.get_elements_count());
|
|
||||||
|
|
||||||
rsx::index_array_type indexed_type = rsx::method_registers.current_draw_clause.is_immediate_draw?
|
|
||||||
rsx::index_array_type::u32:
|
|
||||||
rsx::method_registers.index_type();
|
|
||||||
|
|
||||||
size_t index_size = get_index_type_size(indexed_type);
|
|
||||||
|
|
||||||
// Alloc
|
|
||||||
size_t buffer_size = align(index_count * index_size, 64);
|
|
||||||
size_t heap_offset =
|
|
||||||
m_buffer_data.alloc<D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT>(buffer_size);
|
|
||||||
|
|
||||||
void* mapped_buffer =
|
|
||||||
m_buffer_data.map<void>(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
u32 min_index, max_index;
|
|
||||||
gsl::span<gsl::byte> dst{
|
|
||||||
reinterpret_cast<gsl::byte*>(mapped_buffer), ::narrow<u32>(buffer_size)};
|
|
||||||
|
|
||||||
std::tie(min_index, max_index, index_count) =
|
|
||||||
write_index_array_data_to_buffer(dst, command.raw_index_buffer, indexed_type,
|
|
||||||
rsx::method_registers.current_draw_clause.primitive,
|
|
||||||
rsx::method_registers.restart_index_enabled(),
|
|
||||||
rsx::method_registers.restart_index(),
|
|
||||||
[](auto prim) { return !is_primitive_native(prim); });
|
|
||||||
|
|
||||||
m_buffer_data.unmap(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
D3D12_INDEX_BUFFER_VIEW index_buffer_view = {
|
|
||||||
m_buffer_data.get_heap()->GetGPUVirtualAddress() + heap_offset, (UINT)buffer_size,
|
|
||||||
get_index_type(indexed_type)};
|
|
||||||
// m_timers.buffer_upload_size += buffer_size;
|
|
||||||
command_list->IASetIndexBuffer(&index_buffer_view);
|
|
||||||
|
|
||||||
return std::make_tuple(true, index_count,
|
|
||||||
upload_vertex_attributes(max_index + 1, get_vertex_buffers,
|
|
||||||
m_vertex_buffer_data, m_buffer_data, command_list));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::tuple<bool, size_t, std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC>> operator()(
|
|
||||||
const rsx::draw_inlined_array& command)
|
|
||||||
{
|
|
||||||
size_t vertex_count;
|
|
||||||
std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC> vertex_buffer_view;
|
|
||||||
std::tie(vertex_buffer_view, vertex_count) =
|
|
||||||
upload_inlined_vertex_array(rsx::method_registers.vertex_arrays_info,
|
|
||||||
{(const gsl::byte*)rsx::method_registers.current_draw_clause.inline_vertex_array.data(),
|
|
||||||
::narrow<int>(rsx::method_registers.current_draw_clause.inline_vertex_array.size() * sizeof(uint))},
|
|
||||||
m_buffer_data, m_vertex_buffer_data, command_list);
|
|
||||||
|
|
||||||
if (is_primitive_native(rsx::method_registers.current_draw_clause.primitive))
|
|
||||||
return std::make_tuple(false, vertex_count, vertex_buffer_view);
|
|
||||||
|
|
||||||
D3D12_INDEX_BUFFER_VIEW index_buffer_view;
|
|
||||||
size_t index_count;
|
|
||||||
std::tie(index_buffer_view, index_count) =
|
|
||||||
generate_index_buffer_for_emulated_primitives_array(
|
|
||||||
vertex_count, m_buffer_data);
|
|
||||||
command_list->IASetIndexBuffer(&index_buffer_view);
|
|
||||||
return std::make_tuple(true, index_count, vertex_buffer_view);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
ID3D12GraphicsCommandList* command_list;
|
|
||||||
d3d12_data_heap& m_buffer_data;
|
|
||||||
std::function<attribute_storage()> get_vertex_buffers;
|
|
||||||
ID3D12Resource* m_vertex_buffer_data;
|
|
||||||
};
|
|
||||||
} // End anonymous namespace
|
|
||||||
|
|
||||||
std::tuple<bool, size_t, std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC>>
|
|
||||||
D3D12GSRender::upload_and_set_vertex_index_data(ID3D12GraphicsCommandList* command_list)
|
|
||||||
{
|
|
||||||
return std::visit(
|
|
||||||
draw_command_visitor(command_list, m_buffer_data, m_vertex_buffer_data.Get(),
|
|
||||||
[this]() { return get_vertex_buffers(rsx::method_registers, 0); }),
|
|
||||||
get_draw_command(rsx::method_registers));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,233 +0,0 @@
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "stdafx_d3d12.h"
|
|
||||||
#include "D3D12CommonDecompiler.h"
|
|
||||||
|
|
||||||
std::string getFloatTypeNameImp(size_t elementCount)
|
|
||||||
{
|
|
||||||
switch (elementCount)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
abort();
|
|
||||||
case 1:
|
|
||||||
return "float";
|
|
||||||
case 2:
|
|
||||||
return "float2";
|
|
||||||
case 3:
|
|
||||||
return "float3";
|
|
||||||
case 4:
|
|
||||||
return "float4";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string getFunctionImp(FUNCTION f)
|
|
||||||
{
|
|
||||||
switch (f)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
fmt::throw_exception("Unsupported program function %d", (u32)f);
|
|
||||||
case FUNCTION::FUNCTION_DP2:
|
|
||||||
return "dot($0.xy, $1.xy).xxxx";
|
|
||||||
case FUNCTION::FUNCTION_DP2A:
|
|
||||||
return "(dot($0.xy, $1.xy) + $2.x).xxxx";
|
|
||||||
case FUNCTION::FUNCTION_DP3:
|
|
||||||
return "dot($0.xyz, $1.xyz).xxxx";
|
|
||||||
case FUNCTION::FUNCTION_DP4:
|
|
||||||
return "dot($0, $1).xxxx";
|
|
||||||
case FUNCTION::FUNCTION_DPH:
|
|
||||||
return "dot(float4($0.xyz, 1.0), $1).xxxx";
|
|
||||||
case FUNCTION::FUNCTION_SFL:
|
|
||||||
return "float4(0., 0., 0., 0.)";
|
|
||||||
case FUNCTION::FUNCTION_STR:
|
|
||||||
return "float4(1., 1., 1., 1.)";
|
|
||||||
case FUNCTION::FUNCTION_FRACT:
|
|
||||||
return "frac($0)";
|
|
||||||
case FUNCTION::FUNCTION_REFL:
|
|
||||||
return "($0 - 2.0 * (dot($0, $1)) * $1)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE1D:
|
|
||||||
return "$t.Sample($tsampler, $0.x)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE1D_PROJ:
|
|
||||||
return "$t.Sample($tsampler, ($0.x / $0.w))";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE1D_BIAS:
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE1D_LOD:
|
|
||||||
return "$t.SampleLevel($tsampler, $0.x, $1)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE1D_GRAD:
|
|
||||||
return "$t.SampleGrad($tsampler, $0.x, $1, $2)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SHADOW2D: //TODO
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SHADOW2D_PROJ:
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D:
|
|
||||||
return "$t.Sample($tsampler, $0.xy * $t_scale)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D_PROJ:
|
|
||||||
return "$t.Sample($tsampler, ($0.xy / $0.w) * $t_scale)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D_BIAS:
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D_LOD:
|
|
||||||
return "$t.SampleLevel($tsampler, $0.xy * $t_scale, $1)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D_GRAD:
|
|
||||||
return "$t.SampleGrad($tsampler, $0.xy, $1, $2)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLECUBE:
|
|
||||||
return "$t.Sample($tsampler, $0.xyz)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLECUBE_PROJ:
|
|
||||||
return "$t.Sample($tsampler, ($0.xyz / $0.w))";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLECUBE_BIAS:
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLECUBE_LOD:
|
|
||||||
return "$t.SampleLevel($tsampler, $0.xyz, $1)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLECUBE_GRAD:
|
|
||||||
return "$t.SampleGrad($tsampler, $0.xyz, $1, $2)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE3D:
|
|
||||||
return "$t.Sample($tsampler, $0.xyz)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE3D_PROJ:
|
|
||||||
return "$t.Sample($tsampler, ($0.xyz / $0.w))";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE3D_BIAS:
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE3D_LOD:
|
|
||||||
return "$t.SampleLevel($tsampler, $0.xyz, $1)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE3D_GRAD:
|
|
||||||
return "$t.SampleGrad($tsampler, $0.xyz, $1, $2)";
|
|
||||||
case FUNCTION::FUNCTION_DFDX:
|
|
||||||
return "ddx($0)";
|
|
||||||
case FUNCTION::FUNCTION_DFDY:
|
|
||||||
return "ddy($0)";
|
|
||||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D_DEPTH_RGBA:
|
|
||||||
return "texture2DReconstruct($t.Sample($tsampler, $0.xy * $t_scale), texture_parameters[$_i].z)";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string compareFunctionImp(COMPARE f, const std::string &Op0, const std::string &Op1)
|
|
||||||
{
|
|
||||||
switch (f)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
abort();
|
|
||||||
case COMPARE::FUNCTION_SEQ:
|
|
||||||
return "(" + Op0 + " == " + Op1 + ")";
|
|
||||||
case COMPARE::FUNCTION_SGE:
|
|
||||||
return "(" + Op0 + " >= " + Op1 + ")";
|
|
||||||
case COMPARE::FUNCTION_SGT:
|
|
||||||
return "(" + Op0 + " > " + Op1 + ")";
|
|
||||||
case COMPARE::FUNCTION_SLE:
|
|
||||||
return "(" + Op0 + " <= " + Op1 + ")";
|
|
||||||
case COMPARE::FUNCTION_SLT:
|
|
||||||
return "(" + Op0 + " < " + Op1 + ")";
|
|
||||||
case COMPARE::FUNCTION_SNE:
|
|
||||||
return "(" + Op0 + " != " + Op1 + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void insert_d3d12_legacy_function(std::ostream& OS, bool is_fragment_program)
|
|
||||||
{
|
|
||||||
OS << "#define _select lerp\n\n";
|
|
||||||
|
|
||||||
OS << "float4 lit_legacy(float4 val)";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " float4 clamped_val = val;\n";
|
|
||||||
OS << " clamped_val.x = max(val.x, 0);\n";
|
|
||||||
OS << " clamped_val.y = max(val.y, 0);\n";
|
|
||||||
OS << " float4 result;\n";
|
|
||||||
OS << " result.x = 1.0;\n";
|
|
||||||
OS << " result.w = 1.;\n";
|
|
||||||
OS << " result.y = clamped_val.x;\n";
|
|
||||||
OS << " result.z = clamped_val.x > 0.0 ? exp(clamped_val.w * log(max(clamped_val.y, 1.E-10))) : 0.0;\n";
|
|
||||||
OS << " return result;\n";
|
|
||||||
OS << "}\n\n";
|
|
||||||
|
|
||||||
if (!is_fragment_program)
|
|
||||||
return;
|
|
||||||
|
|
||||||
program_common::insert_compare_op(OS, false);
|
|
||||||
|
|
||||||
OS << "uint packSnorm2x16(float2 val)";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " uint high_bits = round(clamp(val.x, -1., 1.) * 32767.);\n";
|
|
||||||
OS << " uint low_bits = round(clamp(val.y, -1., 1.) * 32767.);\n";
|
|
||||||
OS << " return (high_bits << 16)|low_bits;\n";
|
|
||||||
OS << "}\n\n";
|
|
||||||
|
|
||||||
OS << "uint packSnorm4x8(float4 val)";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " uint high_bits_a = round(clamp(val.x, -1., 1.) * 127.);\n";
|
|
||||||
OS << " uint high_bits_b = round(clamp(val.y, -1., 1.) * 127.);\n";
|
|
||||||
OS << " uint low_bits_a = round(clamp(val.z, -1., 1.) * 127.);\n";
|
|
||||||
OS << " uint low_bits_b = round(clamp(val.z, -1., 1.) * 127.);\n";
|
|
||||||
OS << " return (high_bits_a << 24)|(high_bits_b << 16)|(low_bits_a << 8)|low_bits_b;\n";
|
|
||||||
OS << "}\n\n";
|
|
||||||
|
|
||||||
OS << "float2 unpackSnorm2x16(uint val)";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " float high = clamp((val >> 16) / 32767., -1., 1.);\n";
|
|
||||||
OS << " float low = clamp((val & 0x0000FFFF) / 32767., -1., 1.);\n";
|
|
||||||
OS << " return float2(high, low);\n";
|
|
||||||
OS << "}\n\n";
|
|
||||||
|
|
||||||
OS << "float4 unpackSnorm4x8(uint val)";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " float high_a = clamp((val >> 24) / 127., -1., 1.);\n";
|
|
||||||
OS << " float high_b = clamp(((val >> 16) & 0xFF) / 127., -1., 1.);\n";
|
|
||||||
OS << " float low_a = clamp(((val >> 8) & 0xFF) / 127., -1., 1.);\n";
|
|
||||||
OS << " float low_b = clamp((val & 0xFF) / 127., -1., 1.);\n";
|
|
||||||
OS << " return float4(high_a, high_b, low_a, low_b);\n";
|
|
||||||
OS << "}\n\n";
|
|
||||||
|
|
||||||
OS << "uint packUnorm4x8(float4 val)";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " uint high_bits_a = round(clamp(val.x, -1., 1.) * 255.);\n";
|
|
||||||
OS << " uint high_bits_b = round(clamp(val.y, -1., 1.) * 255.);\n";
|
|
||||||
OS << " uint low_bits_a = round(clamp(val.z, -1., 1.) * 255.);\n";
|
|
||||||
OS << " uint low_bits_b = round(clamp(val.z, -1., 1.) * 255.);\n";
|
|
||||||
OS << " return (high_bits_a << 24)|(high_bits_b << 16)|(low_bits_a << 8)|low_bits_b;\n";
|
|
||||||
OS << "}\n\n";
|
|
||||||
|
|
||||||
OS << "float4 unpackUnorm4x8(uint val)";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " float high_a = clamp((val >> 24) / 255., -1., 1.);\n";
|
|
||||||
OS << " float high_b = clamp(((val >> 16) & 0xFF) / 255., -1., 1.);\n";
|
|
||||||
OS << " float low_a = clamp(((val >> 8) & 0xFF) / 255., -1., 1.);\n";
|
|
||||||
OS << " float low_b = clamp((val & 0xFF) / 255., -1., 1.);\n";
|
|
||||||
OS << " return float4(high_a, high_b, low_a, low_b);\n";
|
|
||||||
OS << "}\n\n";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* There is no easy way to do this in a shader since we cant recast the f16 blocks to u16
|
|
||||||
* Fake it and hope the program requests the corresponding f16 unpack
|
|
||||||
**/
|
|
||||||
OS << "uint packHalf2x16(float2 val)";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " return packSnorm2x16(val / 65504.);\n";
|
|
||||||
OS << "}\n\n";
|
|
||||||
|
|
||||||
OS << "float2 unpackHalf2x16(uint val)";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " return unpackSnorm2x16(val) * 65504.;\n";
|
|
||||||
OS << "}\n\n";
|
|
||||||
|
|
||||||
OS << "float read_value(float4 src, uint remap_index)\n";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " switch (remap_index)\n";
|
|
||||||
OS << " {\n";
|
|
||||||
OS << " case 0: return src.a;\n";
|
|
||||||
OS << " case 1: return src.r;\n";
|
|
||||||
OS << " case 2: return src.g;\n";
|
|
||||||
OS << " case 3: return src.b;\n";
|
|
||||||
OS << " }\n";
|
|
||||||
OS << "}\n\n";
|
|
||||||
|
|
||||||
OS << "float4 texture2DReconstruct(float depth_value, float remap)\n";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " uint value = round(depth_value * 16777215);\n";
|
|
||||||
OS << " uint b = (value & 0xff);\n";
|
|
||||||
OS << " uint g = (value >> 8) & 0xff;\n";
|
|
||||||
OS << " uint r = (value >> 16) & 0xff;\n";
|
|
||||||
OS << " float4 result = float4(g/255., b/255., 1., r/255.);\n\n";
|
|
||||||
OS << " uint remap_vector = asuint(remap) & 0xFF;\n";
|
|
||||||
OS << " if (remap_vector == 0xE4) return result;\n\n";
|
|
||||||
OS << " float4 tmp;\n";
|
|
||||||
OS << " uint remap_a = remap_vector & 0x3;\n";
|
|
||||||
OS << " uint remap_r = (remap_vector >> 2) & 0x3;\n";
|
|
||||||
OS << " uint remap_g = (remap_vector >> 4) & 0x3;\n";
|
|
||||||
OS << " uint remap_b = (remap_vector >> 6) & 0x3;\n";
|
|
||||||
OS << " tmp.a = read_value(result, remap_a);\n";
|
|
||||||
OS << " tmp.r = read_value(result, remap_r);\n";
|
|
||||||
OS << " tmp.g = read_value(result, remap_g);\n";
|
|
||||||
OS << " tmp.b = read_value(result, remap_b);\n";
|
|
||||||
OS << " return tmp;\n";
|
|
||||||
OS << "}\n\n";
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,10 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../Common/ShaderParam.h"
|
|
||||||
#include "../Common/GLSLCommon.h"
|
|
||||||
|
|
||||||
std::string getFloatTypeNameImp(size_t elementCount);
|
|
||||||
std::string getFunctionImp(FUNCTION f);
|
|
||||||
std::string compareFunctionImp(COMPARE f, const std::string &Op0, const std::string &Op1);
|
|
||||||
|
|
||||||
void insert_d3d12_legacy_function(std::ostream&, bool is_fragment_program);
|
|
|
@ -1,513 +0,0 @@
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "stdafx_d3d12.h"
|
|
||||||
#include "D3D12Formats.h"
|
|
||||||
#include "D3D12Utils.h"
|
|
||||||
#include "Emu/RSX/GCM.h"
|
|
||||||
|
|
||||||
|
|
||||||
D3D12_BLEND_OP get_blend_op(rsx::blend_equation op)
|
|
||||||
{
|
|
||||||
switch (op)
|
|
||||||
{
|
|
||||||
case rsx::blend_equation::add: return D3D12_BLEND_OP_ADD;
|
|
||||||
case rsx::blend_equation::substract: return D3D12_BLEND_OP_SUBTRACT;
|
|
||||||
case rsx::blend_equation::reverse_substract: return D3D12_BLEND_OP_REV_SUBTRACT;
|
|
||||||
case rsx::blend_equation::min: return D3D12_BLEND_OP_MIN;
|
|
||||||
case rsx::blend_equation::max: return D3D12_BLEND_OP_MAX;
|
|
||||||
case rsx::blend_equation::add_signed:
|
|
||||||
case rsx::blend_equation::reverse_add_signed:
|
|
||||||
case rsx::blend_equation::reverse_substract_signed:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid or unsupported blend op (0x%x)" HERE, (u32)op);
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_BLEND get_blend_factor(rsx::blend_factor factor)
|
|
||||||
{
|
|
||||||
switch (factor)
|
|
||||||
{
|
|
||||||
case rsx::blend_factor::zero: return D3D12_BLEND_ZERO;
|
|
||||||
case rsx::blend_factor::one: return D3D12_BLEND_ONE;
|
|
||||||
case rsx::blend_factor::src_color: return D3D12_BLEND_SRC_COLOR;
|
|
||||||
case rsx::blend_factor::one_minus_src_color: return D3D12_BLEND_INV_SRC_COLOR;
|
|
||||||
case rsx::blend_factor::src_alpha: return D3D12_BLEND_SRC_ALPHA;
|
|
||||||
case rsx::blend_factor::one_minus_src_alpha: return D3D12_BLEND_INV_SRC_ALPHA;
|
|
||||||
case rsx::blend_factor::dst_alpha: return D3D12_BLEND_DEST_ALPHA;
|
|
||||||
case rsx::blend_factor::one_minus_dst_alpha: return D3D12_BLEND_INV_DEST_ALPHA;
|
|
||||||
case rsx::blend_factor::dst_color: return D3D12_BLEND_DEST_COLOR;
|
|
||||||
case rsx::blend_factor::one_minus_dst_color: return D3D12_BLEND_INV_DEST_COLOR;
|
|
||||||
case rsx::blend_factor::src_alpha_saturate: return D3D12_BLEND_SRC_ALPHA_SAT;
|
|
||||||
case rsx::blend_factor::constant_color:
|
|
||||||
case rsx::blend_factor::constant_alpha:
|
|
||||||
return D3D12_BLEND_BLEND_FACTOR;
|
|
||||||
case rsx::blend_factor::one_minus_constant_color:
|
|
||||||
case rsx::blend_factor::one_minus_constant_alpha:
|
|
||||||
return D3D12_BLEND_INV_BLEND_FACTOR;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid blend factor (0x%x)" HERE, (u32)factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_BLEND get_blend_factor_alpha(rsx::blend_factor factor)
|
|
||||||
{
|
|
||||||
switch (factor)
|
|
||||||
{
|
|
||||||
case rsx::blend_factor::zero: return D3D12_BLEND_ZERO;
|
|
||||||
case rsx::blend_factor::one: return D3D12_BLEND_ONE;
|
|
||||||
case rsx::blend_factor::src_color: return D3D12_BLEND_SRC_ALPHA;
|
|
||||||
case rsx::blend_factor::one_minus_src_color: return D3D12_BLEND_INV_SRC_ALPHA;
|
|
||||||
case rsx::blend_factor::src_alpha: return D3D12_BLEND_SRC_ALPHA;
|
|
||||||
case rsx::blend_factor::one_minus_src_alpha: return D3D12_BLEND_INV_SRC_ALPHA;
|
|
||||||
case rsx::blend_factor::dst_alpha: return D3D12_BLEND_DEST_ALPHA;
|
|
||||||
case rsx::blend_factor::one_minus_dst_alpha: return D3D12_BLEND_INV_DEST_ALPHA;
|
|
||||||
case rsx::blend_factor::dst_color: return D3D12_BLEND_DEST_ALPHA;
|
|
||||||
case rsx::blend_factor::one_minus_dst_color: return D3D12_BLEND_INV_DEST_ALPHA;
|
|
||||||
case rsx::blend_factor::src_alpha_saturate: return D3D12_BLEND_SRC_ALPHA_SAT;
|
|
||||||
case rsx::blend_factor::constant_color:
|
|
||||||
case rsx::blend_factor::constant_alpha:
|
|
||||||
return D3D12_BLEND_BLEND_FACTOR;
|
|
||||||
case rsx::blend_factor::one_minus_constant_color:
|
|
||||||
case rsx::blend_factor::one_minus_constant_alpha:
|
|
||||||
return D3D12_BLEND_INV_BLEND_FACTOR;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid blend alpha factor (0x%x)" HERE, (u32)factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert GCM logic op code to D3D12 one
|
|
||||||
*/
|
|
||||||
D3D12_LOGIC_OP get_logic_op(rsx::logic_op op)
|
|
||||||
{
|
|
||||||
switch (op)
|
|
||||||
{
|
|
||||||
case rsx::logic_op::logic_clear: return D3D12_LOGIC_OP_CLEAR;
|
|
||||||
case rsx::logic_op::logic_and: return D3D12_LOGIC_OP_AND;
|
|
||||||
case rsx::logic_op::logic_and_reverse: return D3D12_LOGIC_OP_AND_REVERSE;
|
|
||||||
case rsx::logic_op::logic_copy: return D3D12_LOGIC_OP_COPY;
|
|
||||||
case rsx::logic_op::logic_and_inverted: return D3D12_LOGIC_OP_AND_INVERTED;
|
|
||||||
case rsx::logic_op::logic_noop: return D3D12_LOGIC_OP_NOOP;
|
|
||||||
case rsx::logic_op::logic_xor: return D3D12_LOGIC_OP_XOR;
|
|
||||||
case rsx::logic_op::logic_or: return D3D12_LOGIC_OP_OR;
|
|
||||||
case rsx::logic_op::logic_nor: return D3D12_LOGIC_OP_NOR;
|
|
||||||
case rsx::logic_op::logic_equiv: return D3D12_LOGIC_OP_EQUIV;
|
|
||||||
case rsx::logic_op::logic_invert: return D3D12_LOGIC_OP_INVERT;
|
|
||||||
case rsx::logic_op::logic_or_reverse: return D3D12_LOGIC_OP_OR_REVERSE;
|
|
||||||
case rsx::logic_op::logic_copy_inverted: return D3D12_LOGIC_OP_COPY_INVERTED;
|
|
||||||
case rsx::logic_op::logic_or_inverted: return D3D12_LOGIC_OP_OR_INVERTED;
|
|
||||||
case rsx::logic_op::logic_nand: return D3D12_LOGIC_OP_NAND;
|
|
||||||
case rsx::logic_op::logic_set: return D3D12_LOGIC_OP_SET;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid logic op (0x%x)" HERE, (u32)op);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert GCM stencil op code to D3D12 one
|
|
||||||
*/
|
|
||||||
D3D12_STENCIL_OP get_stencil_op(rsx::stencil_op op)
|
|
||||||
{
|
|
||||||
switch (op)
|
|
||||||
{
|
|
||||||
case rsx::stencil_op::keep: return D3D12_STENCIL_OP_KEEP;
|
|
||||||
case rsx::stencil_op::zero: return D3D12_STENCIL_OP_ZERO;
|
|
||||||
case rsx::stencil_op::replace: return D3D12_STENCIL_OP_REPLACE;
|
|
||||||
case rsx::stencil_op::incr: return D3D12_STENCIL_OP_INCR_SAT;
|
|
||||||
case rsx::stencil_op::decr: return D3D12_STENCIL_OP_DECR_SAT;
|
|
||||||
case rsx::stencil_op::invert: return D3D12_STENCIL_OP_INVERT;
|
|
||||||
case rsx::stencil_op::incr_wrap: return D3D12_STENCIL_OP_INCR;
|
|
||||||
case rsx::stencil_op::decr_wrap: return D3D12_STENCIL_OP_DECR;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid stencil op (0x%x)" HERE, (u32)op);
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_COMPARISON_FUNC get_compare_func(rsx::comparison_function op)
|
|
||||||
{
|
|
||||||
switch (op)
|
|
||||||
{
|
|
||||||
case rsx::comparison_function::never: return D3D12_COMPARISON_FUNC_NEVER;
|
|
||||||
case rsx::comparison_function::less: return D3D12_COMPARISON_FUNC_LESS;
|
|
||||||
case rsx::comparison_function::equal: return D3D12_COMPARISON_FUNC_EQUAL;
|
|
||||||
case rsx::comparison_function::less_or_equal: return D3D12_COMPARISON_FUNC_LESS_EQUAL;
|
|
||||||
case rsx::comparison_function::greater: return D3D12_COMPARISON_FUNC_GREATER;
|
|
||||||
case rsx::comparison_function::not_equal: return D3D12_COMPARISON_FUNC_NOT_EQUAL;
|
|
||||||
case rsx::comparison_function::greater_or_equal: return D3D12_COMPARISON_FUNC_GREATER_EQUAL;
|
|
||||||
case rsx::comparison_function::always: return D3D12_COMPARISON_FUNC_ALWAYS;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid compare func (0x%x)" HERE, (u32)op);
|
|
||||||
}
|
|
||||||
|
|
||||||
DXGI_FORMAT get_texture_format(u8 format)
|
|
||||||
{
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case CELL_GCM_TEXTURE_B8: return DXGI_FORMAT_R8_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_A1R5G5B5: return DXGI_FORMAT_B5G5R5A1_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_A4R4G4B4: return DXGI_FORMAT_B4G4R4A4_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_R5G6B5: return DXGI_FORMAT_B5G6R5_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_A8R8G8B8: return DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_DXT1: return DXGI_FORMAT_BC1_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_DXT23: return DXGI_FORMAT_BC2_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_DXT45: return DXGI_FORMAT_BC3_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_G8B8: return DXGI_FORMAT_G8R8_G8B8_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_R6G5B5: return DXGI_FORMAT_B5G6R5_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_DEPTH24_D8: return DXGI_FORMAT_R32_UINT; // Untested
|
|
||||||
case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT: return DXGI_FORMAT_R32_FLOAT; // Untested
|
|
||||||
case CELL_GCM_TEXTURE_DEPTH16: return DXGI_FORMAT_R16_UINT; // Untested
|
|
||||||
case CELL_GCM_TEXTURE_DEPTH16_FLOAT: return DXGI_FORMAT_R16_FLOAT; // Untested
|
|
||||||
case CELL_GCM_TEXTURE_X16: return DXGI_FORMAT_R16_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_Y16_X16: return DXGI_FORMAT_R16G16_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_Y16_X16_FLOAT: return DXGI_FORMAT_R16G16_FLOAT;
|
|
||||||
case CELL_GCM_TEXTURE_X32_FLOAT: return DXGI_FORMAT_R32_FLOAT;
|
|
||||||
case CELL_GCM_TEXTURE_R5G5B5A1: return DXGI_FORMAT_B5G5R5A1_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT: return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
|
||||||
case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT: return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
|
||||||
case CELL_GCM_TEXTURE_D1R5G5B5: return DXGI_FORMAT_B5G5R5A1_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_D8R8G8B8: return DXGI_FORMAT_B8G8R8A8_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8: return DXGI_FORMAT_G8R8_G8B8_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8: return DXGI_FORMAT_R8G8_B8G8_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_HILO8: return DXGI_FORMAT_G8R8_G8B8_UNORM;
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8: return DXGI_FORMAT_R8G8_SNORM;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid texture format (0x%x)" HERE, (u32)format);
|
|
||||||
}
|
|
||||||
|
|
||||||
UCHAR get_dxgi_texel_size(DXGI_FORMAT format)
|
|
||||||
{
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case DXGI_FORMAT_R8_UNORM:
|
|
||||||
return 1;
|
|
||||||
case DXGI_FORMAT_B5G5R5A1_UNORM:
|
|
||||||
case DXGI_FORMAT_B5G6R5_UNORM:
|
|
||||||
case DXGI_FORMAT_R8G8_UNORM:
|
|
||||||
case DXGI_FORMAT_D16_UNORM:
|
|
||||||
case DXGI_FORMAT_R16_UNORM:
|
|
||||||
case DXGI_FORMAT_R16_TYPELESS:
|
|
||||||
return 2;
|
|
||||||
case DXGI_FORMAT_B8G8R8A8_UNORM:
|
|
||||||
case DXGI_FORMAT_B8G8R8X8_UNORM:
|
|
||||||
case DXGI_FORMAT_R8G8B8A8_UNORM:
|
|
||||||
case DXGI_FORMAT_R32_FLOAT:
|
|
||||||
case DXGI_FORMAT_D24_UNORM_S8_UINT:
|
|
||||||
case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
|
|
||||||
case DXGI_FORMAT_R24G8_TYPELESS:
|
|
||||||
return 4;
|
|
||||||
case DXGI_FORMAT_R16G16B16A16_FLOAT:
|
|
||||||
return 8;
|
|
||||||
case DXGI_FORMAT_R32G32B32A32_FLOAT:
|
|
||||||
return 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt::throw_exception("Unsupported DXGI format 0x%X" HERE, (u32)format);
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT get_texture_max_aniso(rsx::texture_max_anisotropy aniso)
|
|
||||||
{
|
|
||||||
switch (aniso)
|
|
||||||
{
|
|
||||||
case rsx::texture_max_anisotropy::x1: return 1;
|
|
||||||
case rsx::texture_max_anisotropy::x2: return 2;
|
|
||||||
case rsx::texture_max_anisotropy::x4: return 4;
|
|
||||||
case rsx::texture_max_anisotropy::x6: return 6;
|
|
||||||
case rsx::texture_max_anisotropy::x8: return 8;
|
|
||||||
case rsx::texture_max_anisotropy::x10: return 10;
|
|
||||||
case rsx::texture_max_anisotropy::x12: return 12;
|
|
||||||
case rsx::texture_max_anisotropy::x16: return 16;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid texture max aniso (0x%x)" HERE, (u32)aniso);
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_TEXTURE_ADDRESS_MODE get_texture_wrap_mode(rsx::texture_wrap_mode wrap)
|
|
||||||
{
|
|
||||||
switch (wrap)
|
|
||||||
{
|
|
||||||
case rsx::texture_wrap_mode::wrap: return D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
|
||||||
case rsx::texture_wrap_mode::mirror: return D3D12_TEXTURE_ADDRESS_MODE_MIRROR;
|
|
||||||
case rsx::texture_wrap_mode::clamp_to_edge: return D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
|
|
||||||
case rsx::texture_wrap_mode::border: return D3D12_TEXTURE_ADDRESS_MODE_BORDER;
|
|
||||||
case rsx::texture_wrap_mode::clamp: return D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
|
|
||||||
case rsx::texture_wrap_mode::mirror_once_clamp_to_edge: return D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE;
|
|
||||||
case rsx::texture_wrap_mode::mirror_once_border: return D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE;
|
|
||||||
case rsx::texture_wrap_mode::mirror_once_clamp: return D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid texture wrap mode (0x%x)" HERE, (u32)wrap);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
void get_min_filter(rsx::texture_minify_filter min_filter, D3D12_FILTER_TYPE &min, D3D12_FILTER_TYPE &mip)
|
|
||||||
{
|
|
||||||
switch (min_filter)
|
|
||||||
{
|
|
||||||
case rsx::texture_minify_filter::nearest:
|
|
||||||
min = D3D12_FILTER_TYPE_POINT;
|
|
||||||
mip = D3D12_FILTER_TYPE_POINT;
|
|
||||||
return;
|
|
||||||
case rsx::texture_minify_filter::linear:
|
|
||||||
min = D3D12_FILTER_TYPE_LINEAR;
|
|
||||||
mip = D3D12_FILTER_TYPE_POINT;
|
|
||||||
return;
|
|
||||||
case rsx::texture_minify_filter::nearest_nearest:
|
|
||||||
min = D3D12_FILTER_TYPE_POINT;
|
|
||||||
mip = D3D12_FILTER_TYPE_POINT;
|
|
||||||
return;
|
|
||||||
case rsx::texture_minify_filter::linear_nearest:
|
|
||||||
min = D3D12_FILTER_TYPE_LINEAR;
|
|
||||||
mip = D3D12_FILTER_TYPE_POINT;
|
|
||||||
return;
|
|
||||||
case rsx::texture_minify_filter::nearest_linear:
|
|
||||||
min = D3D12_FILTER_TYPE_POINT;
|
|
||||||
mip = D3D12_FILTER_TYPE_LINEAR;
|
|
||||||
return;
|
|
||||||
case rsx::texture_minify_filter::linear_linear:
|
|
||||||
min = D3D12_FILTER_TYPE_LINEAR;
|
|
||||||
mip = D3D12_FILTER_TYPE_LINEAR;
|
|
||||||
return;
|
|
||||||
case rsx::texture_minify_filter::convolution_min:
|
|
||||||
min = D3D12_FILTER_TYPE_LINEAR;
|
|
||||||
mip = D3D12_FILTER_TYPE_POINT;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid max filter" HERE);
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_FILTER_TYPE get_mag_filter(rsx::texture_magnify_filter mag_filter)
|
|
||||||
{
|
|
||||||
switch (mag_filter)
|
|
||||||
{
|
|
||||||
case rsx::texture_magnify_filter::nearest: return D3D12_FILTER_TYPE_POINT;
|
|
||||||
case rsx::texture_magnify_filter::linear: return D3D12_FILTER_TYPE_LINEAR;
|
|
||||||
case rsx::texture_magnify_filter::convolution_mag: return D3D12_FILTER_TYPE_LINEAR;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid mag filter" HERE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_FILTER get_texture_filter(rsx::texture_minify_filter min_filter, rsx::texture_magnify_filter mag_filter)
|
|
||||||
{
|
|
||||||
D3D12_FILTER_TYPE min, mip;
|
|
||||||
get_min_filter(min_filter, min, mip);
|
|
||||||
D3D12_FILTER_TYPE mag = get_mag_filter(mag_filter);
|
|
||||||
return D3D12_ENCODE_BASIC_FILTER(min, mag, mip, D3D12_FILTER_REDUCTION_TYPE_STANDARD);
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_PRIMITIVE_TOPOLOGY get_primitive_topology(rsx::primitive_type draw_mode)
|
|
||||||
{
|
|
||||||
switch (draw_mode)
|
|
||||||
{
|
|
||||||
case rsx::primitive_type::points: return D3D_PRIMITIVE_TOPOLOGY_POINTLIST;
|
|
||||||
case rsx::primitive_type::lines: return D3D_PRIMITIVE_TOPOLOGY_LINELIST;
|
|
||||||
case rsx::primitive_type::line_loop: return D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ;
|
|
||||||
case rsx::primitive_type::line_strip: return D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
|
|
||||||
case rsx::primitive_type::triangles: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
|
||||||
case rsx::primitive_type::triangle_strip: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
|
|
||||||
case rsx::primitive_type::triangle_fan: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
|
||||||
case rsx::primitive_type::quads: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
|
||||||
case rsx::primitive_type::quad_strip: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
|
|
||||||
case rsx::primitive_type::polygon: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid draw mode (0x%x)" HERE, (u32)draw_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_PRIMITIVE_TOPOLOGY_TYPE get_primitive_topology_type(rsx::primitive_type draw_mode)
|
|
||||||
{
|
|
||||||
switch (draw_mode)
|
|
||||||
{
|
|
||||||
case rsx::primitive_type::points: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT;
|
|
||||||
case rsx::primitive_type::lines: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
|
|
||||||
case rsx::primitive_type::line_strip: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
|
|
||||||
case rsx::primitive_type::triangles: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
|
||||||
case rsx::primitive_type::triangle_strip: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
|
||||||
case rsx::primitive_type::triangle_fan: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
|
||||||
case rsx::primitive_type::quads: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
|
||||||
case rsx::primitive_type::quad_strip: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
|
||||||
case rsx::primitive_type::polygon: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
|
||||||
case rsx::primitive_type::line_loop: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid draw mode (0x%x)" HERE, (u32)draw_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
DXGI_FORMAT get_color_surface_format(rsx::surface_color_format format)
|
|
||||||
{
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case rsx::surface_color_format::x1r5g5b5_z1r5g5b5:
|
|
||||||
case rsx::surface_color_format::x1r5g5b5_o1r5g5b5:
|
|
||||||
return DXGI_FORMAT_B5G5R5A1_UNORM;
|
|
||||||
case rsx::surface_color_format::r5g6b5: return DXGI_FORMAT_B5G6R5_UNORM;
|
|
||||||
case rsx::surface_color_format::x8b8g8r8_o8b8g8r8:
|
|
||||||
case rsx::surface_color_format::x8b8g8r8_z8b8g8r8:
|
|
||||||
return DXGI_FORMAT_B8G8R8X8_UNORM;
|
|
||||||
case rsx::surface_color_format::a8b8g8r8: return DXGI_FORMAT_B8G8R8A8_UNORM;
|
|
||||||
case rsx::surface_color_format::x8r8g8b8_o8r8g8b8:
|
|
||||||
case rsx::surface_color_format::x8r8g8b8_z8r8g8b8:
|
|
||||||
case rsx::surface_color_format::a8r8g8b8:
|
|
||||||
return DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
||||||
case rsx::surface_color_format::b8: return DXGI_FORMAT_R8_UNORM;
|
|
||||||
case rsx::surface_color_format::g8b8: return DXGI_FORMAT_R8G8_UNORM;
|
|
||||||
case rsx::surface_color_format::w16z16y16x16: return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
|
||||||
case rsx::surface_color_format::w32z32y32x32: return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
|
||||||
case rsx::surface_color_format::x32: return DXGI_FORMAT_R32_FLOAT;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid format (0x%x)" HERE, (u32)format);
|
|
||||||
}
|
|
||||||
|
|
||||||
DXGI_FORMAT get_depth_stencil_surface_format(rsx::surface_depth_format format)
|
|
||||||
{
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case rsx::surface_depth_format::z16: return DXGI_FORMAT_D16_UNORM;
|
|
||||||
case rsx::surface_depth_format::z24s8: return DXGI_FORMAT_D24_UNORM_S8_UINT;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid format (0x%x)" HERE, (u32)format);
|
|
||||||
}
|
|
||||||
|
|
||||||
DXGI_FORMAT get_depth_stencil_surface_clear_format(rsx::surface_depth_format format)
|
|
||||||
{
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case rsx::surface_depth_format::z16: return DXGI_FORMAT_D16_UNORM;
|
|
||||||
case rsx::surface_depth_format::z24s8: return DXGI_FORMAT_D24_UNORM_S8_UINT;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid format (0x%x)" HERE, (u32)format);
|
|
||||||
}
|
|
||||||
|
|
||||||
DXGI_FORMAT get_depth_stencil_typeless_surface_format(rsx::surface_depth_format format)
|
|
||||||
{
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case rsx::surface_depth_format::z16: return DXGI_FORMAT_R16_TYPELESS;
|
|
||||||
case rsx::surface_depth_format::z24s8: return DXGI_FORMAT_R24G8_TYPELESS;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid format (0x%x)" HERE, (u32)format);
|
|
||||||
}
|
|
||||||
|
|
||||||
DXGI_FORMAT get_depth_samplable_surface_format(rsx::surface_depth_format format)
|
|
||||||
{
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case rsx::surface_depth_format::z16: return DXGI_FORMAT_R16_UNORM;
|
|
||||||
case rsx::surface_depth_format::z24s8: return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid format (0x%x)" HERE, (u32)format);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL get_front_face_ccw(rsx::front_face ffv)
|
|
||||||
{
|
|
||||||
switch (ffv)
|
|
||||||
{
|
|
||||||
case rsx::front_face::cw: return FALSE;
|
|
||||||
case rsx::front_face::ccw: return TRUE;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid front face value (0x%x)" HERE, (u32)ffv);
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_CULL_MODE get_cull_face(rsx::cull_face cfv)
|
|
||||||
{
|
|
||||||
switch (cfv)
|
|
||||||
{
|
|
||||||
case rsx::cull_face::front: return D3D12_CULL_MODE_FRONT;
|
|
||||||
case rsx::cull_face::back: return D3D12_CULL_MODE_BACK;
|
|
||||||
case rsx::cull_face::front_and_back: return D3D12_CULL_MODE_NONE;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid cull face value (0x%x)" HERE, (u32)cfv);
|
|
||||||
}
|
|
||||||
|
|
||||||
DXGI_FORMAT get_index_type(rsx::index_array_type index_type)
|
|
||||||
{
|
|
||||||
switch (index_type)
|
|
||||||
{
|
|
||||||
case rsx::index_array_type::u16: return DXGI_FORMAT_R16_UINT;
|
|
||||||
case rsx::index_array_type::u32: return DXGI_FORMAT_R32_UINT;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Invalid index_type (0x%x)" HERE, (u32)index_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
DXGI_FORMAT get_vertex_attribute_format(rsx::vertex_base_type type, u8 size)
|
|
||||||
{
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case rsx::vertex_base_type::s1:
|
|
||||||
{
|
|
||||||
switch (size)
|
|
||||||
{
|
|
||||||
case 1: return DXGI_FORMAT_R16_SNORM;
|
|
||||||
case 2: return DXGI_FORMAT_R16G16_SNORM;
|
|
||||||
case 3: return DXGI_FORMAT_R16G16B16A16_SNORM; // No 3 channel type
|
|
||||||
case 4: return DXGI_FORMAT_R16G16B16A16_SNORM;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case rsx::vertex_base_type::f:
|
|
||||||
{
|
|
||||||
switch (size)
|
|
||||||
{
|
|
||||||
case 1: return DXGI_FORMAT_R32_FLOAT;
|
|
||||||
case 2: return DXGI_FORMAT_R32G32_FLOAT;
|
|
||||||
case 3: return DXGI_FORMAT_R32G32B32_FLOAT;
|
|
||||||
case 4: return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case rsx::vertex_base_type::sf:
|
|
||||||
{
|
|
||||||
switch (size)
|
|
||||||
{
|
|
||||||
case 1: return DXGI_FORMAT_R16_FLOAT;
|
|
||||||
case 2: return DXGI_FORMAT_R16G16_FLOAT;
|
|
||||||
case 3: return DXGI_FORMAT_R16G16B16A16_FLOAT; // No 3 channel type
|
|
||||||
case 4: return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case rsx::vertex_base_type::ub:
|
|
||||||
{
|
|
||||||
switch (size)
|
|
||||||
{
|
|
||||||
case 1: return DXGI_FORMAT_R8_UNORM;
|
|
||||||
case 2: return DXGI_FORMAT_R8G8_UNORM;
|
|
||||||
case 3: return DXGI_FORMAT_R8G8B8A8_UNORM; // No 3 channel type
|
|
||||||
case 4: return DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case rsx::vertex_base_type::s32k:
|
|
||||||
{
|
|
||||||
switch (size)
|
|
||||||
{
|
|
||||||
case 1: return DXGI_FORMAT_R16_SINT;
|
|
||||||
case 2: return DXGI_FORMAT_R16G16_SINT;
|
|
||||||
case 3: return DXGI_FORMAT_R16G16B16A16_SINT; // No 3 channel type
|
|
||||||
case 4: return DXGI_FORMAT_R16G16B16A16_SINT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case rsx::vertex_base_type::cmp:
|
|
||||||
{
|
|
||||||
return DXGI_FORMAT_R16G16B16A16_SNORM;
|
|
||||||
}
|
|
||||||
case rsx::vertex_base_type::ub256:
|
|
||||||
{
|
|
||||||
switch (size)
|
|
||||||
{
|
|
||||||
case 1: return DXGI_FORMAT_R8_UINT;
|
|
||||||
case 2: return DXGI_FORMAT_R8G8_UINT;
|
|
||||||
case 3: return DXGI_FORMAT_R8G8B8A8_UINT; // No 3 channel type
|
|
||||||
case 4: return DXGI_FORMAT_R8G8B8A8_UINT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt::throw_exception("Invalid or unsupported type or size (type=0x%x, size=0x%x)" HERE, (u32)type, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_RECT get_scissor(u16 clip_origin_x, u16 clip_origin_y, u16 clip_w, u16 clip_h)
|
|
||||||
{
|
|
||||||
return{
|
|
||||||
clip_origin_x,
|
|
||||||
clip_origin_y,
|
|
||||||
clip_origin_x + clip_w,
|
|
||||||
clip_origin_y + clip_h,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,121 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../gcm_enums.h"
|
|
||||||
|
|
||||||
#include <d3d12.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert GCM blend operator code to D3D12 one
|
|
||||||
*/
|
|
||||||
D3D12_BLEND_OP get_blend_op(rsx::blend_equation op);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert GCM blend factor code to D3D12 one
|
|
||||||
*/
|
|
||||||
D3D12_BLEND get_blend_factor(rsx::blend_factor factor);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert GCM blend factor code to D3D12 one for alpha component
|
|
||||||
*/
|
|
||||||
D3D12_BLEND get_blend_factor_alpha(rsx::blend_factor factor);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert GCM logic op code to D3D12 one
|
|
||||||
*/
|
|
||||||
D3D12_LOGIC_OP get_logic_op(rsx::logic_op op);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert GCM stencil op code to D3D12 one
|
|
||||||
*/
|
|
||||||
D3D12_STENCIL_OP get_stencil_op(rsx::stencil_op op);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert GCM comparison function code to D3D12 one.
|
|
||||||
*/
|
|
||||||
D3D12_COMPARISON_FUNC get_compare_func(rsx::comparison_function op);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert GCM texture format to an equivalent one supported by D3D12.
|
|
||||||
* Destination format may require a byte swap or data conversion.
|
|
||||||
*/
|
|
||||||
DXGI_FORMAT get_texture_format(u8 format);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert texture aniso value to UINT.
|
|
||||||
*/
|
|
||||||
UINT get_texture_max_aniso(rsx::texture_max_anisotropy aniso);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert texture wrap mode to D3D12_TEXTURE_ADDRESS_MODE
|
|
||||||
*/
|
|
||||||
D3D12_TEXTURE_ADDRESS_MODE get_texture_wrap_mode(rsx::texture_wrap_mode wrap);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert minify and magnify filter to D3D12_FILTER
|
|
||||||
*/
|
|
||||||
D3D12_FILTER get_texture_filter(rsx::texture_minify_filter min_filter, rsx::texture_magnify_filter mag_filter);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert draw mode to D3D12_PRIMITIVE_TOPOLOGY
|
|
||||||
*/
|
|
||||||
D3D12_PRIMITIVE_TOPOLOGY get_primitive_topology(rsx::primitive_type draw_mode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert draw mode to D3D12_PRIMITIVE_TOPOLOGY_TYPE
|
|
||||||
*/
|
|
||||||
D3D12_PRIMITIVE_TOPOLOGY_TYPE get_primitive_topology_type(rsx::primitive_type draw_mode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert color surface format to DXGI_FORMAT
|
|
||||||
*/
|
|
||||||
DXGI_FORMAT get_color_surface_format(rsx::surface_color_format format);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert depth stencil surface format to DXGI_FORMAT
|
|
||||||
*/
|
|
||||||
DXGI_FORMAT get_depth_stencil_surface_format(rsx::surface_depth_format format);
|
|
||||||
|
|
||||||
/**
|
|
||||||
*Convert depth stencil surface format to DXGI_FORMAT suited for clear value
|
|
||||||
*/
|
|
||||||
DXGI_FORMAT get_depth_stencil_surface_clear_format(rsx::surface_depth_format format);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert depth surface format to a typeless DXGI_FORMAT
|
|
||||||
*/
|
|
||||||
DXGI_FORMAT get_depth_stencil_typeless_surface_format(rsx::surface_depth_format format);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert depth surface format to a DXGI_FORMAT that can be depth sampled
|
|
||||||
*/
|
|
||||||
DXGI_FORMAT get_depth_samplable_surface_format(rsx::surface_depth_format format);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get block size in bytes for a DXGI_FORMAT
|
|
||||||
*/
|
|
||||||
UCHAR get_dxgi_texel_size(DXGI_FORMAT format);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert front face value to bool value telling whether front face is counterclockwise or not
|
|
||||||
*/
|
|
||||||
BOOL get_front_face_ccw(rsx::front_face set_front_face_value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert cull face value to a D3D12_CULL_MODE telling whether cull face is front or back
|
|
||||||
*/
|
|
||||||
D3D12_CULL_MODE get_cull_face(rsx::cull_face set_cull_face_value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert index type to DXGI_FORMAT
|
|
||||||
*/
|
|
||||||
DXGI_FORMAT get_index_type(rsx::index_array_type index_type);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert vertex attribute format and size to DXGI_FORMAT
|
|
||||||
*/
|
|
||||||
DXGI_FORMAT get_vertex_attribute_format(rsx::vertex_base_type type, u8 size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert scissor register value to D3D12_RECT
|
|
||||||
*/
|
|
||||||
D3D12_RECT get_scissor(u16 clip_origin_x, u16 clip_origin_y, u16 clip_w, u16 clip_h);
|
|
|
@ -1,346 +0,0 @@
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "stdafx_d3d12.h"
|
|
||||||
#include "D3D12FragmentProgramDecompiler.h"
|
|
||||||
#include "D3D12CommonDecompiler.h"
|
|
||||||
#include "Emu/Memory/vm.h"
|
|
||||||
#include "Emu/System.h"
|
|
||||||
#include <set>
|
|
||||||
|
|
||||||
D3D12FragmentDecompiler::D3D12FragmentDecompiler(const RSXFragmentProgram &prog, u32& size) :
|
|
||||||
FragmentProgramDecompiler(prog, size)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string D3D12FragmentDecompiler::getFloatTypeName(size_t elementCount)
|
|
||||||
{
|
|
||||||
return getFloatTypeNameImp(elementCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string D3D12FragmentDecompiler::getHalfTypeName(size_t elementCount)
|
|
||||||
{
|
|
||||||
return getFloatTypeNameImp(elementCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string D3D12FragmentDecompiler::getFunction(enum class FUNCTION f)
|
|
||||||
{
|
|
||||||
return getFunctionImp(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string D3D12FragmentDecompiler::compareFunction(COMPARE f, const std::string &Op0, const std::string &Op1)
|
|
||||||
{
|
|
||||||
return compareFunctionImp(f, Op0, Op1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12FragmentDecompiler::insertHeader(std::stringstream & OS)
|
|
||||||
{
|
|
||||||
OS << "#define floatBitsToUint asuint\n";
|
|
||||||
OS << "#define uintBitsToFloat asfloat\n\n";
|
|
||||||
|
|
||||||
OS << "cbuffer SCALE_OFFSET : register(b0)\n";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " float4x4 scaleOffsetMat;\n";
|
|
||||||
OS << " int4 userClipEnabled[2];\n";
|
|
||||||
OS << " float4 userClipFactor[2];\n";
|
|
||||||
OS << " float fog_param0;\n";
|
|
||||||
OS << " float fog_param1;\n";
|
|
||||||
OS << " uint alpha_test;\n";
|
|
||||||
OS << " float alpha_ref;\n";
|
|
||||||
OS << " uint alpha_func;\n";
|
|
||||||
OS << " uint fog_mode;\n";
|
|
||||||
OS << " float wpos_scale;\n";
|
|
||||||
OS << " float wpos_bias;\n";
|
|
||||||
OS << " float4 texture_parameters[16];\n";
|
|
||||||
OS << "};\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12FragmentDecompiler::insertInputs(std::stringstream & OS)
|
|
||||||
{
|
|
||||||
OS << "struct PixelInput\n";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " float4 Position : SV_POSITION;\n";
|
|
||||||
OS << " float4 diff_color : COLOR0;\n";
|
|
||||||
OS << " float4 spec_color : COLOR1;\n";
|
|
||||||
OS << " float4 dst_reg3 : COLOR2;\n";
|
|
||||||
OS << " float4 dst_reg4 : COLOR3;\n";
|
|
||||||
OS << " float4 fogc : FOG;\n";
|
|
||||||
OS << " float4 tc9 : TEXCOORD9;\n";
|
|
||||||
OS << " float4 tc0 : TEXCOORD0;\n";
|
|
||||||
OS << " float4 tc1 : TEXCOORD1;\n";
|
|
||||||
OS << " float4 tc2 : TEXCOORD2;\n";
|
|
||||||
OS << " float4 tc3 : TEXCOORD3;\n";
|
|
||||||
OS << " float4 tc4 : TEXCOORD4;\n";
|
|
||||||
OS << " float4 tc5 : TEXCOORD5;\n";
|
|
||||||
OS << " float4 tc6 : TEXCOORD6;\n";
|
|
||||||
OS << " float4 tc7 : TEXCOORD7;\n";
|
|
||||||
OS << " float4 tc8 : TEXCOORD8;\n";
|
|
||||||
OS << " float4 dst_userClip0 : SV_ClipDistance0;\n";
|
|
||||||
OS << " float4 dst_userClip1 : SV_ClipDistance1;\n";
|
|
||||||
OS << "};\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12FragmentDecompiler::insertOutputs(std::stringstream & OS)
|
|
||||||
{
|
|
||||||
OS << "struct PixelOutput\n";
|
|
||||||
OS << "{\n";
|
|
||||||
const std::pair<std::string, std::string> table[] =
|
|
||||||
{
|
|
||||||
{ "ocol0", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r0" : "h0" },
|
|
||||||
{ "ocol1", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r2" : "h4" },
|
|
||||||
{ "ocol2", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r3" : "h6" },
|
|
||||||
{ "ocol3", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r4" : "h8" },
|
|
||||||
};
|
|
||||||
size_t idx = 0;
|
|
||||||
for (int i = 0; i < std::size(table); ++i)
|
|
||||||
{
|
|
||||||
if (m_parr.HasParam(PF_PARAM_NONE, "float4", table[i].second))
|
|
||||||
OS << " " << "float4" << " " << table[i].first << " : SV_TARGET" << idx++ << ";\n";
|
|
||||||
}
|
|
||||||
if (m_ctrl & CELL_GCM_SHADER_CONTROL_DEPTH_EXPORT)
|
|
||||||
OS << " float depth : SV_Depth;\n";
|
|
||||||
OS << "};\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12FragmentDecompiler::insertConstants(std::stringstream & OS)
|
|
||||||
{
|
|
||||||
OS << "cbuffer CONSTANT : register(b2)\n";
|
|
||||||
OS << "{\n";
|
|
||||||
for (const ParamType &PT : m_parr.params[PF_PARAM_UNIFORM])
|
|
||||||
{
|
|
||||||
if (PT.type == "sampler1D" || PT.type == "sampler2D" || PT.type == "samplerCube" || PT.type == "sampler3D")
|
|
||||||
continue;
|
|
||||||
for (const ParamItem &PI : PT.items)
|
|
||||||
OS << " " << PT.type << " " << PI.name << ";\n";
|
|
||||||
}
|
|
||||||
OS << "};\n\n";
|
|
||||||
|
|
||||||
for (const ParamType &PT : m_parr.params[PF_PARAM_UNIFORM])
|
|
||||||
{
|
|
||||||
if (PT.type == "sampler1D")
|
|
||||||
{
|
|
||||||
for (const ParamItem &PI : PT.items)
|
|
||||||
{
|
|
||||||
size_t textureIndex = atoi(PI.name.data() + 3);
|
|
||||||
OS << "Texture1D " << PI.name << " : register(t" << textureIndex << ");\n";
|
|
||||||
OS << "sampler " << PI.name << "sampler : register(s" << textureIndex << ");\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (PT.type == "sampler2D")
|
|
||||||
{
|
|
||||||
for (const ParamItem &PI : PT.items)
|
|
||||||
{
|
|
||||||
size_t textureIndex = atoi(PI.name.data() + 3);
|
|
||||||
OS << "Texture2D " << PI.name << " : register(t" << textureIndex << ");\n";
|
|
||||||
OS << "sampler " << PI.name << "sampler : register(s" << textureIndex << ");\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (PT.type == "sampler3D")
|
|
||||||
{
|
|
||||||
for (const ParamItem &PI : PT.items)
|
|
||||||
{
|
|
||||||
size_t textureIndex = atoi(PI.name.data() + 3);
|
|
||||||
OS << "Texture3D " << PI.name << " : register(t" << textureIndex << ");\n";
|
|
||||||
OS << "sampler " << PI.name << "sampler : register(s" << textureIndex << ");\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (PT.type == "samplerCube")
|
|
||||||
{
|
|
||||||
for (const ParamItem &PI : PT.items)
|
|
||||||
{
|
|
||||||
size_t textureIndex = atoi(PI.name.data() + 3);
|
|
||||||
OS << "TextureCube " << PI.name << " : register(t" << textureIndex << ");\n";
|
|
||||||
OS << "sampler " << PI.name << "sampler : register(s" << textureIndex << ");\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
std::string insert_texture_fetch(const RSXFragmentProgram& prog, int index)
|
|
||||||
{
|
|
||||||
std::string tex_name = "tex" + std::to_string(index) + ".Sample";
|
|
||||||
std::string sampler_name = "tex" + std::to_string(index) + "sampler";
|
|
||||||
std::string coord_name = "In.tc" + std::to_string(index);
|
|
||||||
|
|
||||||
switch (prog.get_texture_dimension(index))
|
|
||||||
{
|
|
||||||
case rsx::texture_dimension_extended::texture_dimension_1d: return " " + tex_name + " (" + sampler_name + ", " + coord_name + ".x) ";
|
|
||||||
case rsx::texture_dimension_extended::texture_dimension_2d: return " " + tex_name + " (" + sampler_name + ", " + coord_name + ".xy) ";
|
|
||||||
case rsx::texture_dimension_extended::texture_dimension_3d:
|
|
||||||
case rsx::texture_dimension_extended::texture_dimension_cubemap: return " " + tex_name + " (" + sampler_name + ", " + coord_name + ".xyz) ";
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt::throw_exception("Invalid texture dimension %d" HERE, (u32)prog.get_texture_dimension(index));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12FragmentDecompiler::insertGlobalFunctions(std::stringstream &OS)
|
|
||||||
{
|
|
||||||
insert_d3d12_legacy_function(OS, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12FragmentDecompiler::insertMainStart(std::stringstream & OS)
|
|
||||||
{
|
|
||||||
for (const ParamType &PT : m_parr.params[PF_PARAM_IN])
|
|
||||||
{
|
|
||||||
for (const ParamItem &PI : PT.items)
|
|
||||||
{
|
|
||||||
if (PI.name == "fogc")
|
|
||||||
{
|
|
||||||
program_common::insert_fog_declaration(OS, "float4", "fogc", true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::set<std::string> output_value =
|
|
||||||
{
|
|
||||||
"r0", "r1", "r2", "r3", "r4",
|
|
||||||
"h0", "h2", "h4", "h6", "h8"
|
|
||||||
};
|
|
||||||
OS << "void ps_impl(bool is_front_face, PixelInput In, inout float4 r0, inout float4 h0, inout float4 r1, inout float4 h2, inout float4 r2, inout float4 h4, inout float4 r3, inout float4 h6, inout float4 r4, inout float4 h8)\n";
|
|
||||||
OS << "{\n";
|
|
||||||
for (const ParamType &PT : m_parr.params[PF_PARAM_IN])
|
|
||||||
{
|
|
||||||
for (const ParamItem &PI : PT.items)
|
|
||||||
{
|
|
||||||
if (PI.name == "fogc")
|
|
||||||
{
|
|
||||||
OS << " float4 fogc = fetch_fog_value(fog_mode, In.fogc);\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (PI.name == "ssa")
|
|
||||||
continue;
|
|
||||||
OS << " " << PT.type << " " << PI.name << " = In." << PI.name << ";\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//NOTE: Framebuffer scaling not actually supported. wpos_scale is used to reconstruct the true window height
|
|
||||||
OS << " float4 wpos = In.Position;\n";
|
|
||||||
OS << " float4 res_scale = abs(1.f / wpos_scale);\n";
|
|
||||||
OS << " if (wpos_scale < 0) wpos.y = (wpos_bias * res_scale) - wpos.y;\n";
|
|
||||||
OS << " float4 ssa = is_front_face ? float4(1., 1., 1., 1.) : float4(-1., -1., -1., -1.);\n";
|
|
||||||
|
|
||||||
// Declare output
|
|
||||||
for (const ParamType &PT : m_parr.params[PF_PARAM_NONE])
|
|
||||||
{
|
|
||||||
for (const ParamItem &PI : PT.items)
|
|
||||||
if (output_value.find(PI.name) == output_value.end())
|
|
||||||
OS << " " << PT.type << " " << PI.name << " = float4(0., 0., 0., 0.);\n";
|
|
||||||
}
|
|
||||||
// Declare texture coordinate scaling component (to handle unormalized texture coordinates)
|
|
||||||
|
|
||||||
for (const ParamType &PT : m_parr.params[PF_PARAM_UNIFORM])
|
|
||||||
{
|
|
||||||
if (PT.type != "sampler2D")
|
|
||||||
continue;
|
|
||||||
for (const ParamItem& PI : PT.items)
|
|
||||||
{
|
|
||||||
size_t textureIndex = atoi(PI.name.data() + 3);
|
|
||||||
bool is_unorm = !!(m_prog.unnormalized_coords & (1 << textureIndex));
|
|
||||||
if (!is_unorm)
|
|
||||||
{
|
|
||||||
OS << " float2 " << PI.name << "_scale = float2(1., 1.);\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
OS << " float2 " << PI.name << "_dim;\n";
|
|
||||||
OS << " " << PI.name << ".GetDimensions(" << PI.name << "_dim.x, " << PI.name << "_dim.y);\n";
|
|
||||||
OS << " float2 " << PI.name << "_scale = texture_parameters[" << textureIndex << "] / " << PI.name << "_dim;\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12FragmentDecompiler::insertMainEnd(std::stringstream & OS)
|
|
||||||
{
|
|
||||||
OS << "}\n";
|
|
||||||
OS << "\n";
|
|
||||||
OS << "PixelOutput main(PixelInput In, bool is_front_face : SV_IsFrontFace)\n";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " float4 r0 = float4(0., 0., 0., 0.);\n";
|
|
||||||
OS << " float4 r1 = float4(0., 0., 0., 0.);\n";
|
|
||||||
OS << " float4 r2 = float4(0., 0., 0., 0.);\n";
|
|
||||||
OS << " float4 r3 = float4(0., 0., 0., 0.);\n";
|
|
||||||
OS << " float4 r4 = float4(0., 0., 0., 0.);\n";
|
|
||||||
OS << " float4 h0 = float4(0., 0., 0., 0.);\n";
|
|
||||||
OS << " float4 h2 = float4(0., 0., 0., 0.);\n";
|
|
||||||
OS << " float4 h4 = float4(0., 0., 0., 0.);\n";
|
|
||||||
OS << " float4 h6 = float4(0., 0., 0., 0.);\n";
|
|
||||||
OS << " float4 h8 = float4(0., 0., 0., 0.);\n";
|
|
||||||
OS << " ps_impl(is_front_face, In, r0, h0, r1, h2, r2, h4, r3, h6, r4, h8);\n";
|
|
||||||
|
|
||||||
const std::pair<std::string, std::string> table[] =
|
|
||||||
{
|
|
||||||
{ "ocol0", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r0" : "h0" },
|
|
||||||
{ "ocol1", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r2" : "h4" },
|
|
||||||
{ "ocol2", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r3" : "h6" },
|
|
||||||
{ "ocol3", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r4" : "h8" },
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string first_output_name;
|
|
||||||
OS << " PixelOutput Out = (PixelOutput)0;\n";
|
|
||||||
for (int i = 0; i < std::size(table); ++i)
|
|
||||||
{
|
|
||||||
if (m_parr.HasParam(PF_PARAM_NONE, "float4", table[i].second))
|
|
||||||
{
|
|
||||||
OS << " Out." << table[i].first << " = " << table[i].second << ";\n";
|
|
||||||
if (first_output_name.empty()) first_output_name = table[i].first;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (m_ctrl & CELL_GCM_SHADER_CONTROL_DEPTH_EXPORT)
|
|
||||||
{
|
|
||||||
if (m_parr.HasParam(PF_PARAM_NONE, "vec4", "r1"))
|
|
||||||
{
|
|
||||||
//Depth writes are always from a fp32 register. See issues section on nvidia's NV_fragment_program spec
|
|
||||||
//https://www.khronos.org/registry/OpenGL/extensions/NV/NV_fragment_program.txt
|
|
||||||
OS << " Out.depth = r1.z;\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Input not declared. Leave commented to assist in debugging the shader
|
|
||||||
OS << " //Out.depth = r1.z;\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Shaders don't always output colors (for instance if they write to depth only)
|
|
||||||
if (!first_output_name.empty())
|
|
||||||
{
|
|
||||||
auto make_comparison_test = [](rsx::comparison_function compare_func, const std::string &test, const std::string &a, const std::string &b) -> std::string
|
|
||||||
{
|
|
||||||
std::string compare;
|
|
||||||
switch (compare_func)
|
|
||||||
{
|
|
||||||
case rsx::comparison_function::equal: compare = " == "; break;
|
|
||||||
case rsx::comparison_function::not_equal: compare = " != "; break;
|
|
||||||
case rsx::comparison_function::less_or_equal: compare = " <= "; break;
|
|
||||||
case rsx::comparison_function::less: compare = " < "; break;
|
|
||||||
case rsx::comparison_function::greater: compare = " > "; break;
|
|
||||||
case rsx::comparison_function::greater_or_equal: compare = " >= "; break;
|
|
||||||
default:
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return " if (" + test + "!(" + a + compare + b + ")) discard;\n";
|
|
||||||
};
|
|
||||||
|
|
||||||
for (u8 index = 0; index < 16; ++index)
|
|
||||||
{
|
|
||||||
if (m_prog.textures_alpha_kill[index])
|
|
||||||
{
|
|
||||||
const std::string texture_name = "tex" + std::to_string(index);
|
|
||||||
if (m_parr.HasParamTypeless(PF_PARAM_UNIFORM, texture_name))
|
|
||||||
{
|
|
||||||
std::string fetch_texture = insert_texture_fetch(m_prog, index) + ".a";
|
|
||||||
OS << make_comparison_test((rsx::comparison_function)m_prog.textures_zfunc[index], "", "0", fetch_texture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
OS << " if ((alpha_test & 0x11) != 0 && !comparison_passes(Out." << first_output_name << ".a, alpha_ref, alpha_func)) discard;\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
OS << " return Out;\n";
|
|
||||||
OS << "}\n";
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,25 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Emu/RSX/RSXFragmentProgram.h"
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
#include "../Common/FragmentProgramDecompiler.h"
|
|
||||||
|
|
||||||
class D3D12FragmentDecompiler : public FragmentProgramDecompiler
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
virtual std::string getFloatTypeName(size_t elementCount) override;
|
|
||||||
virtual std::string getHalfTypeName(size_t elementCount) override;
|
|
||||||
virtual std::string getFunction(enum FUNCTION) override;
|
|
||||||
virtual std::string compareFunction(enum COMPARE, const std::string &, const std::string &) override;
|
|
||||||
|
|
||||||
virtual void insertHeader(std::stringstream &OS) override;
|
|
||||||
virtual void insertInputs(std::stringstream &OS) override;
|
|
||||||
virtual void insertOutputs(std::stringstream &OS) override;
|
|
||||||
virtual void insertConstants(std::stringstream &OS) override;
|
|
||||||
virtual void insertGlobalFunctions(std::stringstream &OS) override;
|
|
||||||
virtual void insertMainStart(std::stringstream &OS) override;
|
|
||||||
virtual void insertMainEnd(std::stringstream &OS) override;
|
|
||||||
public:
|
|
||||||
D3D12FragmentDecompiler(const RSXFragmentProgram &prog, u32& size);
|
|
||||||
};
|
|
|
@ -1,748 +0,0 @@
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "stdafx_d3d12.h"
|
|
||||||
#include "D3D12GSRender.h"
|
|
||||||
#include "Emu/System.h"
|
|
||||||
#include <wrl/client.h>
|
|
||||||
#include <dxgi1_4.h>
|
|
||||||
#include <thread>
|
|
||||||
#include <chrono>
|
|
||||||
#include <locale>
|
|
||||||
#include <codecvt>
|
|
||||||
#include <cmath>
|
|
||||||
#include "d3dx12.h"
|
|
||||||
#include <d3d11on12.h>
|
|
||||||
#include "D3D12Formats.h"
|
|
||||||
#include "../rsx_methods.h"
|
|
||||||
|
|
||||||
PFN_D3D12_CREATE_DEVICE wrapD3D12CreateDevice;
|
|
||||||
PFN_D3D12_GET_DEBUG_INTERFACE wrapD3D12GetDebugInterface;
|
|
||||||
PFN_D3D12_SERIALIZE_ROOT_SIGNATURE wrapD3D12SerializeRootSignature;
|
|
||||||
PFN_D3D11ON12_CREATE_DEVICE wrapD3D11On12CreateDevice;
|
|
||||||
pD3DCompile wrapD3DCompile;
|
|
||||||
|
|
||||||
ID3D12Device* g_d3d12_device = nullptr;
|
|
||||||
|
|
||||||
#define VERTEX_BUFFERS_SLOT 0
|
|
||||||
#define FRAGMENT_CONSTANT_BUFFERS_SLOT 1
|
|
||||||
#define VERTEX_CONSTANT_BUFFERS_SLOT 2
|
|
||||||
#define TEXTURES_SLOT 3
|
|
||||||
#define SAMPLERS_SLOT 4
|
|
||||||
#define SCALE_OFFSET_SLOT 5
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
HMODULE D3D12Module;
|
|
||||||
HMODULE D3D11Module;
|
|
||||||
HMODULE D3DCompiler;
|
|
||||||
|
|
||||||
void loadD3D12FunctionPointers()
|
|
||||||
{
|
|
||||||
D3D12Module = verify("d3d12.dll", LoadLibrary(L"d3d12.dll"));
|
|
||||||
wrapD3D12CreateDevice = (PFN_D3D12_CREATE_DEVICE)GetProcAddress(D3D12Module, "D3D12CreateDevice");
|
|
||||||
wrapD3D12GetDebugInterface = (PFN_D3D12_GET_DEBUG_INTERFACE)GetProcAddress(D3D12Module, "D3D12GetDebugInterface");
|
|
||||||
wrapD3D12SerializeRootSignature = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)GetProcAddress(D3D12Module, "D3D12SerializeRootSignature");
|
|
||||||
D3D11Module = verify("d3d11.dll", LoadLibrary(L"d3d11.dll"));
|
|
||||||
wrapD3D11On12CreateDevice = (PFN_D3D11ON12_CREATE_DEVICE)GetProcAddress(D3D11Module, "D3D11On12CreateDevice");
|
|
||||||
D3DCompiler = verify("d3dcompiler_47.dll", LoadLibrary(L"d3dcompiler_47.dll"));
|
|
||||||
wrapD3DCompile = (pD3DCompile)GetProcAddress(D3DCompiler, "D3DCompile");
|
|
||||||
}
|
|
||||||
|
|
||||||
void unloadD3D12FunctionPointers()
|
|
||||||
{
|
|
||||||
FreeLibrary(D3D12Module);
|
|
||||||
FreeLibrary(D3D11Module);
|
|
||||||
FreeLibrary(D3DCompiler);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wait until command queue has completed all task.
|
|
||||||
*/
|
|
||||||
void wait_for_command_queue(ID3D12Device *device, ID3D12CommandQueue *command_queue)
|
|
||||||
{
|
|
||||||
ComPtr<ID3D12Fence> fence;
|
|
||||||
CHECK_HRESULT(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(fence.GetAddressOf())));
|
|
||||||
HANDLE handle = CreateEventEx(nullptr, FALSE, FALSE, EVENT_ALL_ACCESS);
|
|
||||||
fence->SetEventOnCompletion(1, handle);
|
|
||||||
command_queue->Signal(fence.Get(), 1);
|
|
||||||
WaitForSingleObjectEx(handle, INFINITE, FALSE);
|
|
||||||
CloseHandle(handle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::shader::release()
|
|
||||||
{
|
|
||||||
pso->Release();
|
|
||||||
root_signature->Release();
|
|
||||||
vertex_buffer->Release();
|
|
||||||
texture_descriptor_heap->Release();
|
|
||||||
sampler_descriptor_heap->Release();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool D3D12GSRender::invalidate_address(u32 addr)
|
|
||||||
{
|
|
||||||
bool result = false;
|
|
||||||
result |= m_texture_cache.invalidate_address(addr);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12DLLManagement::D3D12DLLManagement()
|
|
||||||
{
|
|
||||||
loadD3D12FunctionPointers();
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12DLLManagement::~D3D12DLLManagement()
|
|
||||||
{
|
|
||||||
unloadD3D12FunctionPointers();
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
ComPtr<ID3DBlob> get_shared_root_signature_blob()
|
|
||||||
{
|
|
||||||
CD3DX12_ROOT_PARAMETER RP[6];
|
|
||||||
|
|
||||||
// vertex buffer are bound each draw calls
|
|
||||||
CD3DX12_DESCRIPTOR_RANGE vertex_buffer_descriptors(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 16, 0);
|
|
||||||
RP[VERTEX_BUFFERS_SLOT].InitAsDescriptorTable(1, &vertex_buffer_descriptors, D3D12_SHADER_VISIBILITY_VERTEX);
|
|
||||||
|
|
||||||
// fragment constants are bound each draw calls
|
|
||||||
RP[FRAGMENT_CONSTANT_BUFFERS_SLOT].InitAsConstantBufferView(2, 0, D3D12_SHADER_VISIBILITY_PIXEL);
|
|
||||||
|
|
||||||
// vertex constants are bound often
|
|
||||||
CD3DX12_DESCRIPTOR_RANGE vertex_constant_buffer_descriptors(D3D12_DESCRIPTOR_RANGE_TYPE_CBV, 1, 1);
|
|
||||||
RP[VERTEX_CONSTANT_BUFFERS_SLOT].InitAsDescriptorTable(1, &vertex_constant_buffer_descriptors, D3D12_SHADER_VISIBILITY_VERTEX);
|
|
||||||
|
|
||||||
// textures are bound often
|
|
||||||
CD3DX12_DESCRIPTOR_RANGE texture_descriptors(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 16, 0);
|
|
||||||
RP[TEXTURES_SLOT].InitAsDescriptorTable(1, &texture_descriptors, D3D12_SHADER_VISIBILITY_PIXEL);
|
|
||||||
// samplers are bound often
|
|
||||||
CD3DX12_DESCRIPTOR_RANGE sampler_descriptors(D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, 16, 0);
|
|
||||||
RP[SAMPLERS_SLOT].InitAsDescriptorTable(1, &sampler_descriptors, D3D12_SHADER_VISIBILITY_PIXEL);
|
|
||||||
|
|
||||||
// scale offset matrix are bound once in a while
|
|
||||||
CD3DX12_DESCRIPTOR_RANGE scale_offset_descriptors(D3D12_DESCRIPTOR_RANGE_TYPE_CBV, 1, 0);
|
|
||||||
RP[SCALE_OFFSET_SLOT].InitAsDescriptorTable(1, &scale_offset_descriptors, D3D12_SHADER_VISIBILITY_ALL);
|
|
||||||
|
|
||||||
Microsoft::WRL::ComPtr<ID3DBlob> root_signature_blob;
|
|
||||||
Microsoft::WRL::ComPtr<ID3DBlob> error_blob;
|
|
||||||
CHECK_HRESULT(wrapD3D12SerializeRootSignature(
|
|
||||||
&CD3DX12_ROOT_SIGNATURE_DESC(6, RP, 0, 0),
|
|
||||||
D3D_ROOT_SIGNATURE_VERSION_1, root_signature_blob.GetAddressOf(), error_blob.GetAddressOf()));
|
|
||||||
|
|
||||||
return root_signature_blob;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 D3D12GSRender::get_cycles()
|
|
||||||
{
|
|
||||||
return thread_ctrl::get_cycles(static_cast<named_thread<D3D12GSRender>&>(*this));
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12GSRender::D3D12GSRender()
|
|
||||||
: GSRender()
|
|
||||||
, m_d3d12_lib()
|
|
||||||
, m_current_pso({})
|
|
||||||
{
|
|
||||||
if (g_cfg.video.debug_output)
|
|
||||||
{
|
|
||||||
Microsoft::WRL::ComPtr<ID3D12Debug> debugInterface;
|
|
||||||
wrapD3D12GetDebugInterface(IID_PPV_ARGS(&debugInterface));
|
|
||||||
debugInterface->EnableDebugLayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
Microsoft::WRL::ComPtr<IDXGIFactory4> dxgi_factory;
|
|
||||||
CHECK_HRESULT(CreateDXGIFactory(IID_PPV_ARGS(&dxgi_factory)));
|
|
||||||
|
|
||||||
// Create adapter
|
|
||||||
ComPtr<IDXGIAdapter> adapter;
|
|
||||||
const std::wstring adapter_name = std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>>().from_bytes(g_cfg.video.d3d12.adapter);
|
|
||||||
|
|
||||||
for (UINT id = 0; dxgi_factory->EnumAdapters(id, adapter.ReleaseAndGetAddressOf()) != DXGI_ERROR_NOT_FOUND; id++)
|
|
||||||
{
|
|
||||||
DXGI_ADAPTER_DESC desc;
|
|
||||||
adapter->GetDesc(&desc);
|
|
||||||
|
|
||||||
// Adapter with specified name
|
|
||||||
if (adapter_name == desc.Description)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default adapter
|
|
||||||
if (id == 1 && adapter_name.empty())
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED(wrapD3D12CreateDevice(adapter.Get(), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device))))
|
|
||||||
{
|
|
||||||
LOG_ERROR(RSX, "Failed to initialize D3D device on adapter '%s', falling back to first available GPU", g_cfg.video.d3d12.adapter.get());
|
|
||||||
|
|
||||||
//Try to create a device on the first available device
|
|
||||||
if (FAILED(wrapD3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device))))
|
|
||||||
{
|
|
||||||
LOG_FATAL(RSX, "Unable to create D3D12 device. Your GPU(s) may not have D3D12 support.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_d3d12_device = m_device.Get();
|
|
||||||
|
|
||||||
// Queues
|
|
||||||
D3D12_COMMAND_QUEUE_DESC graphic_queue_desc = { D3D12_COMMAND_LIST_TYPE_DIRECT };
|
|
||||||
CHECK_HRESULT(m_device->CreateCommandQueue(&graphic_queue_desc, IID_PPV_ARGS(m_command_queue.GetAddressOf())));
|
|
||||||
|
|
||||||
m_descriptor_stride_srv_cbv_uav = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
|
|
||||||
m_descriptor_stride_dsv = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV);
|
|
||||||
m_descriptor_stride_rtv = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
|
|
||||||
m_descriptor_stride_samplers = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
|
|
||||||
|
|
||||||
// Create swap chain and put them in a descriptor heap as rendertarget
|
|
||||||
DXGI_SWAP_CHAIN_DESC swap_chain = {};
|
|
||||||
swap_chain.BufferCount = 2;
|
|
||||||
swap_chain.Windowed = true;
|
|
||||||
swap_chain.OutputWindow = (HWND)m_frame->handle();
|
|
||||||
swap_chain.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
||||||
swap_chain.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
|
||||||
swap_chain.SampleDesc.Count = 1;
|
|
||||||
swap_chain.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
|
|
||||||
swap_chain.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
|
|
||||||
|
|
||||||
CHECK_HRESULT(dxgi_factory->CreateSwapChain(m_command_queue.Get(), &swap_chain, (IDXGISwapChain**)m_swap_chain.GetAddressOf()));
|
|
||||||
m_swap_chain->GetBuffer(0, IID_PPV_ARGS(&m_backbuffer[0]));
|
|
||||||
m_swap_chain->GetBuffer(1, IID_PPV_ARGS(&m_backbuffer[1]));
|
|
||||||
|
|
||||||
D3D12_DESCRIPTOR_HEAP_DESC render_target_descriptor_heap_desc = { D3D12_DESCRIPTOR_HEAP_TYPE_RTV, 1};
|
|
||||||
D3D12_RENDER_TARGET_VIEW_DESC renter_target_view_desc = {};
|
|
||||||
renter_target_view_desc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D;
|
|
||||||
renter_target_view_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
||||||
m_device->CreateDescriptorHeap(&render_target_descriptor_heap_desc, IID_PPV_ARGS(&m_backbuffer_descriptor_heap[0]));
|
|
||||||
m_device->CreateRenderTargetView(m_backbuffer[0].Get(), &renter_target_view_desc, m_backbuffer_descriptor_heap[0]->GetCPUDescriptorHandleForHeapStart());
|
|
||||||
m_device->CreateDescriptorHeap(&render_target_descriptor_heap_desc, IID_PPV_ARGS(&m_backbuffer_descriptor_heap[1]));
|
|
||||||
m_device->CreateRenderTargetView(m_backbuffer[1].Get(), &renter_target_view_desc, m_backbuffer_descriptor_heap[1]->GetCPUDescriptorHandleForHeapStart());
|
|
||||||
|
|
||||||
|
|
||||||
D3D12_DESCRIPTOR_HEAP_DESC current_texture_descriptors_desc = { D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 16 };
|
|
||||||
CHECK_HRESULT(m_device->CreateDescriptorHeap(¤t_texture_descriptors_desc, IID_PPV_ARGS(m_current_texture_descriptors.GetAddressOf())));
|
|
||||||
D3D12_DESCRIPTOR_HEAP_DESC current_sampler_descriptors_desc = { D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, 16 };
|
|
||||||
CHECK_HRESULT(m_device->CreateDescriptorHeap(¤t_sampler_descriptors_desc, IID_PPV_ARGS(m_current_sampler_descriptors.GetAddressOf())));
|
|
||||||
|
|
||||||
ComPtr<ID3DBlob> root_signature_blob = get_shared_root_signature_blob();
|
|
||||||
|
|
||||||
m_device->CreateRootSignature(0,
|
|
||||||
root_signature_blob->GetBufferPointer(),
|
|
||||||
root_signature_blob->GetBufferSize(),
|
|
||||||
IID_PPV_ARGS(m_shared_root_signature.GetAddressOf()));
|
|
||||||
|
|
||||||
m_per_frame_storage[0].init(m_device.Get());
|
|
||||||
m_per_frame_storage[0].reset();
|
|
||||||
m_per_frame_storage[1].init(m_device.Get());
|
|
||||||
m_per_frame_storage[1].reset();
|
|
||||||
|
|
||||||
m_output_scaling_pass.init(m_device.Get(), m_command_queue.Get());
|
|
||||||
|
|
||||||
CHECK_HRESULT(
|
|
||||||
m_device->CreateCommittedResource(
|
|
||||||
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
|
|
||||||
D3D12_HEAP_FLAG_NONE,
|
|
||||||
&CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8G8B8A8_UNORM, 2, 2, 1, 1),
|
|
||||||
D3D12_RESOURCE_STATE_GENERIC_READ,
|
|
||||||
nullptr,
|
|
||||||
IID_PPV_ARGS(&m_dummy_texture))
|
|
||||||
);
|
|
||||||
|
|
||||||
m_rtts.init(m_device.Get());
|
|
||||||
m_readback_resources.init(m_device.Get(), 1024 * 1024 * 128, D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_STATE_COPY_DEST);
|
|
||||||
m_buffer_data.init(m_device.Get(), 1024 * 1024 * 896, D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_STATE_GENERIC_READ);
|
|
||||||
|
|
||||||
CHECK_HRESULT(
|
|
||||||
m_device->CreateCommittedResource(
|
|
||||||
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
|
|
||||||
D3D12_HEAP_FLAG_NONE,
|
|
||||||
&CD3DX12_RESOURCE_DESC::Buffer(1024 * 1024 * 16),
|
|
||||||
D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER,
|
|
||||||
nullptr,
|
|
||||||
IID_PPV_ARGS(m_vertex_buffer_data.GetAddressOf())
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (g_cfg.video.overlay)
|
|
||||||
init_d2d_structures();
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12GSRender::~D3D12GSRender()
|
|
||||||
{
|
|
||||||
if (!m_device)
|
|
||||||
{
|
|
||||||
//Initialization must have failed
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wait_for_command_queue(m_device.Get(), m_command_queue.Get());
|
|
||||||
|
|
||||||
m_texture_cache.unprotect_all();
|
|
||||||
|
|
||||||
m_dummy_texture->Release();
|
|
||||||
m_per_frame_storage[0].release();
|
|
||||||
m_per_frame_storage[1].release();
|
|
||||||
m_output_scaling_pass.release();
|
|
||||||
|
|
||||||
release_d2d_structures();
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::on_init_thread()
|
|
||||||
{
|
|
||||||
if (!m_device)
|
|
||||||
{
|
|
||||||
//Init must have failed
|
|
||||||
fmt::throw_exception("No D3D12 device was created");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::on_exit()
|
|
||||||
{
|
|
||||||
GSRender::on_exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::do_local_task(rsx::FIFO_state state)
|
|
||||||
{
|
|
||||||
rsx::thread::do_local_task(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool D3D12GSRender::do_method(u32 cmd, u32 arg)
|
|
||||||
{
|
|
||||||
switch (cmd)
|
|
||||||
{
|
|
||||||
case NV4097_CLEAR_SURFACE:
|
|
||||||
clear_surface(arg);
|
|
||||||
return true;
|
|
||||||
case NV4097_TEXTURE_READ_SEMAPHORE_RELEASE:
|
|
||||||
copy_render_target_to_dma_location();
|
|
||||||
return false; //call rsx::thread method implementation
|
|
||||||
case NV4097_BACK_END_WRITE_SEMAPHORE_RELEASE:
|
|
||||||
copy_render_target_to_dma_location();
|
|
||||||
return false; //call rsx::thread method implementation
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::end()
|
|
||||||
{
|
|
||||||
std::chrono::time_point<steady_clock> start_duration = steady_clock::now();
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> program_load_start = steady_clock::now();
|
|
||||||
load_program();
|
|
||||||
std::chrono::time_point<steady_clock> program_load_end = steady_clock::now();
|
|
||||||
m_timers.program_load_duration += std::chrono::duration_cast<std::chrono::microseconds>(program_load_end - program_load_start).count();
|
|
||||||
|
|
||||||
if (!current_fragment_program.valid)
|
|
||||||
{
|
|
||||||
rsx::thread::end();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> rtt_duration_start = steady_clock::now();
|
|
||||||
prepare_render_targets(get_current_resource_storage().command_list.Get());
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> rtt_duration_end = steady_clock::now();
|
|
||||||
m_timers.prepare_rtt_duration += std::chrono::duration_cast<std::chrono::microseconds>(rtt_duration_end - rtt_duration_start).count();
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> vertex_index_duration_start = steady_clock::now();
|
|
||||||
|
|
||||||
size_t currentDescriptorIndex = get_current_resource_storage().descriptors_heap_index;
|
|
||||||
|
|
||||||
size_t vertex_count;
|
|
||||||
bool indexed_draw;
|
|
||||||
std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC> vertex_buffer_views;
|
|
||||||
std::tie(indexed_draw, vertex_count, vertex_buffer_views) = upload_and_set_vertex_index_data(get_current_resource_storage().command_list.Get());
|
|
||||||
|
|
||||||
UINT vertex_buffer_count = static_cast<UINT>(vertex_buffer_views.size());
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> vertex_index_duration_end = steady_clock::now();
|
|
||||||
m_timers.vertex_index_duration += std::chrono::duration_cast<std::chrono::microseconds>(vertex_index_duration_end - vertex_index_duration_start).count();
|
|
||||||
|
|
||||||
get_current_resource_storage().command_list->SetGraphicsRootSignature(m_shared_root_signature.Get());
|
|
||||||
get_current_resource_storage().command_list->OMSetStencilRef(rsx::method_registers.stencil_func_ref());
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> constants_duration_start = steady_clock::now();
|
|
||||||
|
|
||||||
INT offset = 0;
|
|
||||||
for (const auto view : vertex_buffer_views)
|
|
||||||
{
|
|
||||||
m_device->CreateShaderResourceView(m_vertex_buffer_data.Get(), &view,
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(get_current_resource_storage().descriptors_heap->GetCPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((INT)currentDescriptorIndex + offset++, m_descriptor_stride_srv_cbv_uav));
|
|
||||||
}
|
|
||||||
// Bind vertex buffer
|
|
||||||
get_current_resource_storage().command_list->SetGraphicsRootDescriptorTable(VERTEX_BUFFERS_SLOT,
|
|
||||||
CD3DX12_GPU_DESCRIPTOR_HANDLE(get_current_resource_storage().descriptors_heap->GetGPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((INT)currentDescriptorIndex, m_descriptor_stride_srv_cbv_uav)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Constants
|
|
||||||
const D3D12_CONSTANT_BUFFER_VIEW_DESC &fragment_constant_view = upload_fragment_shader_constants();
|
|
||||||
get_current_resource_storage().command_list->SetGraphicsRootConstantBufferView(FRAGMENT_CONSTANT_BUFFERS_SLOT, fragment_constant_view.BufferLocation);
|
|
||||||
|
|
||||||
upload_and_bind_scale_offset_matrix(currentDescriptorIndex + vertex_buffer_count);
|
|
||||||
get_current_resource_storage().command_list->SetGraphicsRootDescriptorTable(SCALE_OFFSET_SLOT,
|
|
||||||
CD3DX12_GPU_DESCRIPTOR_HANDLE(get_current_resource_storage().descriptors_heap->GetGPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((INT)currentDescriptorIndex + vertex_buffer_count, m_descriptor_stride_srv_cbv_uav)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!g_cfg.video.debug_output && (m_graphics_state & rsx::pipeline_state::transform_constants_dirty))
|
|
||||||
{
|
|
||||||
m_current_transform_constants_buffer_descriptor_id = (u32)currentDescriptorIndex + 1 + vertex_buffer_count;
|
|
||||||
upload_and_bind_vertex_shader_constants(currentDescriptorIndex + 1 + vertex_buffer_count);
|
|
||||||
get_current_resource_storage().command_list->SetGraphicsRootDescriptorTable(VERTEX_CONSTANT_BUFFERS_SLOT,
|
|
||||||
CD3DX12_GPU_DESCRIPTOR_HANDLE(get_current_resource_storage().descriptors_heap->GetGPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset(m_current_transform_constants_buffer_descriptor_id, m_descriptor_stride_srv_cbv_uav)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_graphics_state &= ~rsx::pipeline_state::memory_barrier_bits;
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> constants_duration_end = steady_clock::now();
|
|
||||||
m_timers.constants_duration += std::chrono::duration_cast<std::chrono::microseconds>(constants_duration_end - constants_duration_start).count();
|
|
||||||
|
|
||||||
get_current_resource_storage().command_list->SetPipelineState(std::get<0>(m_current_pso).Get());
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> texture_duration_start = steady_clock::now();
|
|
||||||
|
|
||||||
get_current_resource_storage().descriptors_heap_index += 2 + vertex_buffer_count;
|
|
||||||
size_t texture_count = std::get<2>(m_current_pso);
|
|
||||||
if (texture_count > 0)
|
|
||||||
{
|
|
||||||
if (get_current_resource_storage().current_sampler_index + 16 > 2048)
|
|
||||||
{
|
|
||||||
get_current_resource_storage().sampler_descriptors_heap_index = 1;
|
|
||||||
get_current_resource_storage().current_sampler_index = 0;
|
|
||||||
|
|
||||||
ID3D12DescriptorHeap *descriptors[] =
|
|
||||||
{
|
|
||||||
get_current_resource_storage().descriptors_heap.Get(),
|
|
||||||
get_current_resource_storage().sampler_descriptor_heap[get_current_resource_storage().sampler_descriptors_heap_index].Get(),
|
|
||||||
};
|
|
||||||
get_current_resource_storage().command_list->SetDescriptorHeaps(2, descriptors);
|
|
||||||
}
|
|
||||||
|
|
||||||
upload_textures(get_current_resource_storage().command_list.Get(), texture_count);
|
|
||||||
|
|
||||||
m_device->CopyDescriptorsSimple(16,
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(get_current_resource_storage().descriptors_heap->GetCPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((UINT)get_current_resource_storage().descriptors_heap_index, m_descriptor_stride_srv_cbv_uav),
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(m_current_texture_descriptors->GetCPUDescriptorHandleForHeapStart()),
|
|
||||||
D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV
|
|
||||||
);
|
|
||||||
|
|
||||||
m_device->CopyDescriptorsSimple(16,
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(get_current_resource_storage().sampler_descriptor_heap[get_current_resource_storage().sampler_descriptors_heap_index]->GetCPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((UINT)get_current_resource_storage().current_sampler_index, m_descriptor_stride_samplers),
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(m_current_sampler_descriptors->GetCPUDescriptorHandleForHeapStart()),
|
|
||||||
D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER
|
|
||||||
);
|
|
||||||
|
|
||||||
get_current_resource_storage().command_list->SetGraphicsRootDescriptorTable(TEXTURES_SLOT,
|
|
||||||
CD3DX12_GPU_DESCRIPTOR_HANDLE(get_current_resource_storage().descriptors_heap->GetGPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((INT)get_current_resource_storage().descriptors_heap_index, m_descriptor_stride_srv_cbv_uav)
|
|
||||||
);
|
|
||||||
get_current_resource_storage().command_list->SetGraphicsRootDescriptorTable(SAMPLERS_SLOT,
|
|
||||||
CD3DX12_GPU_DESCRIPTOR_HANDLE(get_current_resource_storage().sampler_descriptor_heap[get_current_resource_storage().sampler_descriptors_heap_index]->GetGPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((INT)get_current_resource_storage().current_sampler_index, m_descriptor_stride_samplers)
|
|
||||||
);
|
|
||||||
|
|
||||||
get_current_resource_storage().current_sampler_index += texture_count;
|
|
||||||
get_current_resource_storage().descriptors_heap_index += texture_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> texture_duration_end = steady_clock::now();
|
|
||||||
m_timers.texture_duration += std::chrono::duration_cast<std::chrono::microseconds>(texture_duration_end - texture_duration_start).count();
|
|
||||||
set_rtt_and_ds(get_current_resource_storage().command_list.Get());
|
|
||||||
|
|
||||||
int clip_w = rsx::method_registers.surface_clip_width();
|
|
||||||
int clip_h = rsx::method_registers.surface_clip_height();
|
|
||||||
|
|
||||||
D3D12_VIEWPORT viewport =
|
|
||||||
{
|
|
||||||
0.f,
|
|
||||||
0.f,
|
|
||||||
(float)clip_w,
|
|
||||||
(float)clip_h,
|
|
||||||
0.f,
|
|
||||||
1.f,
|
|
||||||
};
|
|
||||||
get_current_resource_storage().command_list->RSSetViewports(1, &viewport);
|
|
||||||
|
|
||||||
get_current_resource_storage().command_list->RSSetScissorRects(1, &::get_scissor(rsx::method_registers.scissor_origin_x(), rsx::method_registers.scissor_origin_y(),
|
|
||||||
rsx::method_registers.scissor_width(), rsx::method_registers.scissor_height()));
|
|
||||||
|
|
||||||
get_current_resource_storage().command_list->IASetPrimitiveTopology(get_primitive_topology(rsx::method_registers.current_draw_clause.primitive));
|
|
||||||
|
|
||||||
if (indexed_draw)
|
|
||||||
get_current_resource_storage().command_list->DrawIndexedInstanced((UINT)vertex_count, 1, 0, 0, 0);
|
|
||||||
else
|
|
||||||
get_current_resource_storage().command_list->DrawInstanced((UINT)vertex_count, 1, 0, 0);
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> end_duration = steady_clock::now();
|
|
||||||
m_timers.draw_calls_duration += std::chrono::duration_cast<std::chrono::microseconds>(end_duration - start_duration).count();
|
|
||||||
m_timers.draw_calls_count++;
|
|
||||||
|
|
||||||
if (g_cfg.video.debug_output)
|
|
||||||
{
|
|
||||||
CHECK_HRESULT(get_current_resource_storage().command_list->Close());
|
|
||||||
m_command_queue->ExecuteCommandLists(1, (ID3D12CommandList**)get_current_resource_storage().command_list.GetAddressOf());
|
|
||||||
get_current_resource_storage().set_new_command_list();
|
|
||||||
}
|
|
||||||
thread::end();
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
bool is_flip_surface_in_global_memory(rsx::surface_target color_target)
|
|
||||||
{
|
|
||||||
switch (color_target)
|
|
||||||
{
|
|
||||||
case rsx::surface_target::surface_a:
|
|
||||||
case rsx::surface_target::surface_b:
|
|
||||||
case rsx::surface_target::surfaces_a_b:
|
|
||||||
case rsx::surface_target::surfaces_a_b_c:
|
|
||||||
case rsx::surface_target::surfaces_a_b_c_d:
|
|
||||||
return true;
|
|
||||||
case rsx::surface_target::none:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Wrong color_target" HERE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::flip(const rsx::display_flip_info_t&)
|
|
||||||
{
|
|
||||||
ID3D12Resource *resource_to_flip;
|
|
||||||
float viewport_w, viewport_h;
|
|
||||||
|
|
||||||
if (!is_flip_surface_in_global_memory(rsx::method_registers.surface_color_target()))
|
|
||||||
{
|
|
||||||
resource_storage &storage = get_current_resource_storage();
|
|
||||||
verify(HERE), storage.ram_framebuffer == nullptr;
|
|
||||||
|
|
||||||
size_t w = 0, h = 0, row_pitch = 0;
|
|
||||||
|
|
||||||
size_t offset = 0;
|
|
||||||
if (false)
|
|
||||||
{
|
|
||||||
u32 addr = rsx::get_address(display_buffers[current_display_buffer].offset, CELL_GCM_LOCATION_LOCAL);
|
|
||||||
w = display_buffers[current_display_buffer].width;
|
|
||||||
h = display_buffers[current_display_buffer].height;
|
|
||||||
u8 *src_buffer = vm::_ptr<u8>(addr);
|
|
||||||
|
|
||||||
row_pitch = align(w * 4, 256);
|
|
||||||
size_t texture_size = row_pitch * h; // * 4 for mipmap levels
|
|
||||||
size_t heap_offset = m_buffer_data.alloc<D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT>(texture_size);
|
|
||||||
|
|
||||||
void *mapped_buffer = m_buffer_data.map<void>(heap_offset);
|
|
||||||
for (unsigned row = 0; row < h; row++)
|
|
||||||
memcpy((char*)mapped_buffer + row * row_pitch, (char*)src_buffer + row * w * 4, w * 4);
|
|
||||||
m_buffer_data.unmap(CD3DX12_RANGE(heap_offset, heap_offset + texture_size));
|
|
||||||
offset = heap_offset;
|
|
||||||
|
|
||||||
CHECK_HRESULT(
|
|
||||||
m_device->CreateCommittedResource(
|
|
||||||
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
|
|
||||||
D3D12_HEAP_FLAG_NONE,
|
|
||||||
&CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8G8B8A8_UNORM, (UINT)w, (UINT)h, 1, 1),
|
|
||||||
D3D12_RESOURCE_STATE_COPY_DEST,
|
|
||||||
nullptr,
|
|
||||||
IID_PPV_ARGS(storage.ram_framebuffer.GetAddressOf())
|
|
||||||
)
|
|
||||||
);
|
|
||||||
get_current_resource_storage().command_list->CopyTextureRegion(&CD3DX12_TEXTURE_COPY_LOCATION(storage.ram_framebuffer.Get(), 0), 0, 0, 0,
|
|
||||||
&CD3DX12_TEXTURE_COPY_LOCATION(m_buffer_data.get_heap(), { offset,{ DXGI_FORMAT_R8G8B8A8_UNORM, (UINT)w, (UINT)h, 1, (UINT)row_pitch } }), nullptr);
|
|
||||||
|
|
||||||
get_current_resource_storage().command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(storage.ram_framebuffer.Get(), D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_GENERIC_READ));
|
|
||||||
resource_to_flip = storage.ram_framebuffer.Get();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
resource_to_flip = nullptr;
|
|
||||||
|
|
||||||
viewport_w = (float)w, viewport_h = (float)h;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (std::get<1>(m_rtts.m_bound_render_targets[0]) != nullptr)
|
|
||||||
{
|
|
||||||
get_current_resource_storage().command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(std::get<1>(m_rtts.m_bound_render_targets[0]), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_GENERIC_READ));
|
|
||||||
resource_to_flip = std::get<1>(m_rtts.m_bound_render_targets[0]);
|
|
||||||
}
|
|
||||||
else if (std::get<1>(m_rtts.m_bound_render_targets[1]) != nullptr)
|
|
||||||
{
|
|
||||||
get_current_resource_storage().command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(std::get<1>(m_rtts.m_bound_render_targets[1]), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_GENERIC_READ));
|
|
||||||
resource_to_flip = std::get<1>(m_rtts.m_bound_render_targets[1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
resource_to_flip = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
get_current_resource_storage().command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_backbuffer[m_swap_chain->GetCurrentBackBufferIndex()].Get(), D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET));
|
|
||||||
|
|
||||||
D3D12_VIEWPORT viewport =
|
|
||||||
{
|
|
||||||
0.f,
|
|
||||||
0.f,
|
|
||||||
(float)m_backbuffer[m_swap_chain->GetCurrentBackBufferIndex()]->GetDesc().Width,
|
|
||||||
(float)m_backbuffer[m_swap_chain->GetCurrentBackBufferIndex()]->GetDesc().Height,
|
|
||||||
0.f,
|
|
||||||
1.f
|
|
||||||
};
|
|
||||||
get_current_resource_storage().command_list->RSSetViewports(1, &viewport);
|
|
||||||
|
|
||||||
D3D12_RECT box =
|
|
||||||
{
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
(LONG)m_backbuffer[m_swap_chain->GetCurrentBackBufferIndex()]->GetDesc().Width,
|
|
||||||
(LONG)m_backbuffer[m_swap_chain->GetCurrentBackBufferIndex()]->GetDesc().Height,
|
|
||||||
};
|
|
||||||
get_current_resource_storage().command_list->RSSetScissorRects(1, &box);
|
|
||||||
get_current_resource_storage().command_list->SetGraphicsRootSignature(m_output_scaling_pass.root_signature);
|
|
||||||
get_current_resource_storage().command_list->SetPipelineState(m_output_scaling_pass.pso);
|
|
||||||
|
|
||||||
D3D12_SHADER_RESOURCE_VIEW_DESC shader_resource_view_desc = {};
|
|
||||||
// FIXME: Not always true
|
|
||||||
shader_resource_view_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
||||||
shader_resource_view_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
|
|
||||||
shader_resource_view_desc.Texture2D.MipLevels = 1;
|
|
||||||
if (is_flip_surface_in_global_memory(rsx::method_registers.surface_color_target()))
|
|
||||||
shader_resource_view_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
|
||||||
else
|
|
||||||
shader_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0
|
|
||||||
);
|
|
||||||
m_device->CreateShaderResourceView(resource_to_flip, &shader_resource_view_desc,
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(m_output_scaling_pass.texture_descriptor_heap->GetCPUDescriptorHandleForHeapStart()).Offset(m_swap_chain->GetCurrentBackBufferIndex(), m_descriptor_stride_srv_cbv_uav));
|
|
||||||
|
|
||||||
D3D12_SAMPLER_DESC sampler_desc = {};
|
|
||||||
sampler_desc.Filter = D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT;
|
|
||||||
sampler_desc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
|
||||||
sampler_desc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
|
||||||
sampler_desc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
|
||||||
m_device->CreateSampler(&sampler_desc,
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(m_output_scaling_pass.sampler_descriptor_heap->GetCPUDescriptorHandleForHeapStart()).Offset(m_swap_chain->GetCurrentBackBufferIndex(), m_descriptor_stride_samplers));
|
|
||||||
|
|
||||||
ID3D12DescriptorHeap *descriptors_heaps[] =
|
|
||||||
{
|
|
||||||
m_output_scaling_pass.texture_descriptor_heap,
|
|
||||||
m_output_scaling_pass.sampler_descriptor_heap
|
|
||||||
};
|
|
||||||
get_current_resource_storage().command_list->SetDescriptorHeaps(2, descriptors_heaps);
|
|
||||||
get_current_resource_storage().command_list->SetGraphicsRootDescriptorTable(0,
|
|
||||||
CD3DX12_GPU_DESCRIPTOR_HANDLE(m_output_scaling_pass.texture_descriptor_heap->GetGPUDescriptorHandleForHeapStart()).Offset(m_swap_chain->GetCurrentBackBufferIndex(), m_descriptor_stride_srv_cbv_uav));
|
|
||||||
get_current_resource_storage().command_list->SetGraphicsRootDescriptorTable(1,
|
|
||||||
CD3DX12_GPU_DESCRIPTOR_HANDLE(m_output_scaling_pass.sampler_descriptor_heap->GetGPUDescriptorHandleForHeapStart()).Offset(m_swap_chain->GetCurrentBackBufferIndex(), m_descriptor_stride_samplers));
|
|
||||||
|
|
||||||
get_current_resource_storage().command_list->OMSetRenderTargets(1,
|
|
||||||
&CD3DX12_CPU_DESCRIPTOR_HANDLE(m_backbuffer_descriptor_heap[m_swap_chain->GetCurrentBackBufferIndex()]->GetCPUDescriptorHandleForHeapStart()),
|
|
||||||
true, nullptr);
|
|
||||||
D3D12_VERTEX_BUFFER_VIEW vertex_buffer_view = {};
|
|
||||||
vertex_buffer_view.BufferLocation = m_output_scaling_pass.vertex_buffer->GetGPUVirtualAddress();
|
|
||||||
vertex_buffer_view.StrideInBytes = 4 * sizeof(float);
|
|
||||||
vertex_buffer_view.SizeInBytes = 16 * sizeof(float);
|
|
||||||
get_current_resource_storage().command_list->IASetVertexBuffers(0, 1, &vertex_buffer_view);
|
|
||||||
get_current_resource_storage().command_list->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
|
||||||
if (resource_to_flip)
|
|
||||||
get_current_resource_storage().command_list->DrawInstanced(4, 1, 0, 0);
|
|
||||||
|
|
||||||
if (!g_cfg.video.overlay)
|
|
||||||
get_current_resource_storage().command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_backbuffer[m_swap_chain->GetCurrentBackBufferIndex()].Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT));
|
|
||||||
if (is_flip_surface_in_global_memory(rsx::method_registers.surface_color_target()) && resource_to_flip != nullptr)
|
|
||||||
get_current_resource_storage().command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(resource_to_flip, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET));
|
|
||||||
CHECK_HRESULT(get_current_resource_storage().command_list->Close());
|
|
||||||
m_command_queue->ExecuteCommandLists(1, (ID3D12CommandList**)get_current_resource_storage().command_list.GetAddressOf());
|
|
||||||
|
|
||||||
if (g_cfg.video.overlay)
|
|
||||||
render_overlay();
|
|
||||||
|
|
||||||
reset_timer();
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> flip_start = steady_clock::now();
|
|
||||||
|
|
||||||
CHECK_HRESULT(m_swap_chain->Present(g_cfg.video.vsync ? 1 : 0, 0));
|
|
||||||
// Add an event signaling queue completion
|
|
||||||
|
|
||||||
resource_storage &storage = get_non_current_resource_storage();
|
|
||||||
|
|
||||||
m_command_queue->Signal(storage.frame_finished_fence.Get(), storage.fence_value);
|
|
||||||
storage.frame_finished_fence->SetEventOnCompletion(storage.fence_value, storage.frame_finished_handle);
|
|
||||||
storage.fence_value++;
|
|
||||||
|
|
||||||
storage.in_use = true;
|
|
||||||
storage.dirty_textures.merge(m_rtts.invalidated_resources);
|
|
||||||
m_rtts.invalidated_resources.clear();
|
|
||||||
|
|
||||||
// Get the put pos - 1. This way after cleaning we can set the get ptr to
|
|
||||||
// this value, allowing heap to proceed even if we cleant before allocating
|
|
||||||
// a new value (that's the reason of the -1)
|
|
||||||
storage.buffer_heap_get_pos = m_buffer_data.get_current_put_pos_minus_one();
|
|
||||||
storage.readback_heap_get_pos = m_readback_resources.get_current_put_pos_minus_one();
|
|
||||||
|
|
||||||
// Now get ready for next frame
|
|
||||||
resource_storage &new_storage = get_current_resource_storage();
|
|
||||||
|
|
||||||
new_storage.wait_and_clean();
|
|
||||||
if (new_storage.in_use)
|
|
||||||
{
|
|
||||||
m_buffer_data.m_get_pos = new_storage.buffer_heap_get_pos;
|
|
||||||
m_readback_resources.m_get_pos = new_storage.readback_heap_get_pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_frame->flip(nullptr);
|
|
||||||
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> flip_end = steady_clock::now();
|
|
||||||
m_timers.flip_duration += std::chrono::duration_cast<std::chrono::microseconds>(flip_end - flip_start).count();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool D3D12GSRender::on_access_violation(u32 address, bool is_writing)
|
|
||||||
{
|
|
||||||
if (!is_writing)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (invalidate_address(address))
|
|
||||||
{
|
|
||||||
LOG_WARNING(RSX, "Reporting Cell writing to 0x%x", address);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::reset_timer()
|
|
||||||
{
|
|
||||||
m_timers.draw_calls_count = 0;
|
|
||||||
m_timers.draw_calls_duration = 0;
|
|
||||||
m_timers.prepare_rtt_duration = 0;
|
|
||||||
m_timers.vertex_index_duration = 0;
|
|
||||||
m_timers.buffer_upload_size = 0;
|
|
||||||
m_timers.program_load_duration = 0;
|
|
||||||
m_timers.constants_duration = 0;
|
|
||||||
m_timers.texture_duration = 0;
|
|
||||||
m_timers.flip_duration = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
resource_storage& D3D12GSRender::get_current_resource_storage()
|
|
||||||
{
|
|
||||||
return m_per_frame_storage[m_swap_chain->GetCurrentBackBufferIndex()];
|
|
||||||
}
|
|
||||||
|
|
||||||
resource_storage& D3D12GSRender::get_non_current_resource_storage()
|
|
||||||
{
|
|
||||||
return m_per_frame_storage[1 - m_swap_chain->GetCurrentBackBufferIndex()];
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,188 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "D3D12Utils.h"
|
|
||||||
#include "Emu/Memory/vm.h"
|
|
||||||
#include "Emu/System.h"
|
|
||||||
#include "Emu/RSX/GSRender.h"
|
|
||||||
|
|
||||||
#include "D3D12RenderTargetSets.h"
|
|
||||||
#include "D3D12PipelineState.h"
|
|
||||||
#include "d3dx12.h"
|
|
||||||
#include "D3D12MemoryHelpers.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: If you want to improve this backend, a small list of things that are unimplemented atm :
|
|
||||||
* - Vertex texture
|
|
||||||
* It requires adding the reading command in D3D12FragmentProgramDecompiler,
|
|
||||||
* generates corresponding root signatures and descriptor heap binding, and ensure that code in
|
|
||||||
* D3D12Textures.cpp doesn't contain pixel shader specific code.
|
|
||||||
* - MSAA
|
|
||||||
* There is no support in the gl backend for MSAA textures atm so it needs to be implemented from scratch.
|
|
||||||
* - Depth buffer read
|
|
||||||
* The depth buffer can be currently properly read, but for some reasons it needs a conversion from depth16/24
|
|
||||||
* format to rgba8 format, which doesn't make sense since the PS3 doesn't make such conversion implicitly afaik.
|
|
||||||
* - Improve caching of vertex buffers and texture
|
|
||||||
* Vertex buffers are cached by range. This works but in some rare situation it may be wrong, for instance if 2
|
|
||||||
* draw call use the same buffer, but the first one doesn't use all the attribute ; then the second one will use
|
|
||||||
* the cached version and not have updated attributes. Same for texture, if format/size does change, the caching
|
|
||||||
* system is ignoring it.
|
|
||||||
* - Improve sync between cell and RSX
|
|
||||||
* A lot of optimisation can be gained from using Cell and RSX latency. Cell can't read RSX generated data without
|
|
||||||
* synchronisation. We currently only cover semaphore sync, but there are more (like implicit sync at flip) that
|
|
||||||
* are not currently correctly signaled which leads to deadlock.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Structure used to load/unload D3D12 lib.
|
|
||||||
*/
|
|
||||||
struct D3D12DLLManagement
|
|
||||||
{
|
|
||||||
D3D12DLLManagement();
|
|
||||||
~D3D12DLLManagement();
|
|
||||||
};
|
|
||||||
|
|
||||||
class D3D12GSRender : public GSRender
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
/** D3D12 structures.
|
|
||||||
* Note: they should be declared in reverse order of destruction
|
|
||||||
*/
|
|
||||||
D3D12DLLManagement m_d3d12_lib;
|
|
||||||
ComPtr<ID3D12Device> m_device;
|
|
||||||
ComPtr<ID3D12CommandQueue> m_command_queue;
|
|
||||||
ComPtr<struct IDXGISwapChain3> m_swap_chain;
|
|
||||||
ComPtr<ID3D12Resource> m_backbuffer[2];
|
|
||||||
ComPtr<ID3D12DescriptorHeap> m_backbuffer_descriptor_heap[2];
|
|
||||||
|
|
||||||
ComPtr<ID3D12RootSignature> m_shared_root_signature;
|
|
||||||
|
|
||||||
// TODO: Use a tree structure to parse more efficiently
|
|
||||||
data_cache m_texture_cache;
|
|
||||||
bool invalidate_address(u32 addr);
|
|
||||||
|
|
||||||
PipelineStateObjectCache m_pso_cache;
|
|
||||||
std::tuple<ComPtr<ID3D12PipelineState>, size_t, size_t> m_current_pso;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
size_t draw_calls_duration;
|
|
||||||
size_t draw_calls_count;
|
|
||||||
size_t prepare_rtt_duration;
|
|
||||||
size_t vertex_index_duration;
|
|
||||||
size_t buffer_upload_size;
|
|
||||||
size_t program_load_duration;
|
|
||||||
size_t constants_duration;
|
|
||||||
size_t texture_duration;
|
|
||||||
size_t flip_duration;
|
|
||||||
} m_timers;
|
|
||||||
|
|
||||||
void reset_timer();
|
|
||||||
|
|
||||||
struct shader
|
|
||||||
{
|
|
||||||
ID3D12PipelineState *pso;
|
|
||||||
ID3D12RootSignature *root_signature;
|
|
||||||
ID3D12Resource *vertex_buffer;
|
|
||||||
ID3D12DescriptorHeap *texture_descriptor_heap;
|
|
||||||
ID3D12DescriptorHeap *sampler_descriptor_heap;
|
|
||||||
void init(ID3D12Device *device, ID3D12CommandQueue *gfx_command_queue);
|
|
||||||
void release();
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores data related to the scaling pass that turns internal
|
|
||||||
* render targets into presented buffers.
|
|
||||||
*/
|
|
||||||
shader m_output_scaling_pass;
|
|
||||||
|
|
||||||
resource_storage m_per_frame_storage[2];
|
|
||||||
resource_storage &get_current_resource_storage();
|
|
||||||
resource_storage &get_non_current_resource_storage();
|
|
||||||
|
|
||||||
// Textures, constants, index and vertex buffers storage
|
|
||||||
d3d12_data_heap m_buffer_data;
|
|
||||||
d3d12_data_heap m_readback_resources;
|
|
||||||
ComPtr<ID3D12Resource> m_vertex_buffer_data;
|
|
||||||
|
|
||||||
rsx::render_targets m_rtts;
|
|
||||||
|
|
||||||
INT m_descriptor_stride_srv_cbv_uav;
|
|
||||||
INT m_descriptor_stride_dsv;
|
|
||||||
INT m_descriptor_stride_rtv;
|
|
||||||
INT m_descriptor_stride_samplers;
|
|
||||||
|
|
||||||
// Used to fill unused texture slot
|
|
||||||
ID3D12Resource *m_dummy_texture;
|
|
||||||
|
|
||||||
// Currently used shader resources / samplers descriptor
|
|
||||||
u32 m_current_transform_constants_buffer_descriptor_id;
|
|
||||||
ComPtr<ID3D12DescriptorHeap> m_current_texture_descriptors;
|
|
||||||
ComPtr<ID3D12DescriptorHeap> m_current_sampler_descriptors;
|
|
||||||
|
|
||||||
public:
|
|
||||||
u64 get_cycles() override final;
|
|
||||||
D3D12GSRender();
|
|
||||||
virtual ~D3D12GSRender();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void init_d2d_structures();
|
|
||||||
void release_d2d_structures();
|
|
||||||
|
|
||||||
void load_program();
|
|
||||||
|
|
||||||
void set_rtt_and_ds(ID3D12GraphicsCommandList *command_list);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create vertex and index buffers (if needed) and set them to cmdlist.
|
|
||||||
* Non native primitive type are emulated by index buffers expansion.
|
|
||||||
* Returns whether the draw call is indexed or not and the vertex count to draw.
|
|
||||||
*/
|
|
||||||
std::tuple<bool, size_t, std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC> > upload_and_set_vertex_index_data(ID3D12GraphicsCommandList *command_list);
|
|
||||||
|
|
||||||
void upload_and_bind_scale_offset_matrix(size_t descriptor_index);
|
|
||||||
void upload_and_bind_vertex_shader_constants(size_t descriptor_index);
|
|
||||||
D3D12_CONSTANT_BUFFER_VIEW_DESC upload_fragment_shader_constants();
|
|
||||||
/**
|
|
||||||
* Fetch all textures recorded in the state in the render target cache and in the texture cache.
|
|
||||||
* If a texture is not cached, populate cmdlist with uploads command.
|
|
||||||
* Create necessary resource view/sampler descriptors in the per frame storage struct.
|
|
||||||
* If the count of enabled texture is below texture_count, fills with dummy texture and sampler.
|
|
||||||
*/
|
|
||||||
void upload_textures(ID3D12GraphicsCommandList *command_list, size_t texture_count);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates render target if necessary.
|
|
||||||
* Populate cmdlist with render target state change (from RTT to generic read for previous rtt,
|
|
||||||
* from generic to rtt for rtt in cache).
|
|
||||||
*/
|
|
||||||
void prepare_render_targets(ID3D12GraphicsCommandList *command_list);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Render D2D overlay if enabled on top of the backbuffer.
|
|
||||||
*/
|
|
||||||
void render_overlay();
|
|
||||||
|
|
||||||
void clear_surface(u32 arg);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy currently bound current target to the dma location affecting them.
|
|
||||||
* NOTE: We should also copy previously bound rtts.
|
|
||||||
*/
|
|
||||||
void copy_render_target_to_dma_location();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void on_init_thread() override;
|
|
||||||
virtual void on_exit() override;
|
|
||||||
virtual void do_local_task(rsx::FIFO_state state) override;
|
|
||||||
virtual bool do_method(u32 cmd, u32 arg) override;
|
|
||||||
virtual void end() override;
|
|
||||||
virtual void flip(const rsx::display_flip_info_t&) override;
|
|
||||||
|
|
||||||
virtual bool on_access_violation(u32 address, bool is_writing) override;
|
|
||||||
|
|
||||||
virtual std::array<std::vector<gsl::byte>, 4> copy_render_targets_to_memory() override;
|
|
||||||
virtual std::array<std::vector<gsl::byte>, 2> copy_depth_stencil_buffer_to_memory() override;
|
|
||||||
virtual std::pair<std::string, std::string> get_programs() const override;
|
|
||||||
virtual void notify_tile_unbound(u32 tile) override;
|
|
||||||
};
|
|
|
@ -1,150 +0,0 @@
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "stdafx_d3d12.h"
|
|
||||||
#include "D3D12MemoryHelpers.h"
|
|
||||||
#include "Utilities/VirtualMemory.h"
|
|
||||||
|
|
||||||
|
|
||||||
void data_cache::store_and_protect_data(u64 key, u32 start, size_t size, u8 format, size_t w, size_t h, size_t d, size_t m, ComPtr<ID3D12Resource> data)
|
|
||||||
{
|
|
||||||
std::lock_guard lock(m_mut);
|
|
||||||
m_address_to_data[key] = std::make_pair(texture_entry(format, w, h, d, m), data);
|
|
||||||
protect_data(key, start, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void data_cache::protect_data(u64 key, u32 start, size_t size)
|
|
||||||
{
|
|
||||||
/// align start to 4096 byte
|
|
||||||
static const u32 memory_page_size = 4096;
|
|
||||||
u32 protected_range_start = start & ~(memory_page_size - 1);
|
|
||||||
u32 protected_range_size = (u32)align(size, memory_page_size);
|
|
||||||
m_protected_ranges.push_back(std::make_tuple(key, protected_range_start, protected_range_size));
|
|
||||||
utils::memory_protect(vm::base(protected_range_start), protected_range_size, utils::protection::ro);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool data_cache::invalidate_address(u32 addr)
|
|
||||||
{
|
|
||||||
// In case 2 threads write to texture memory
|
|
||||||
std::lock_guard lock(m_mut);
|
|
||||||
bool handled = false;
|
|
||||||
auto It = m_protected_ranges.begin(), E = m_protected_ranges.end();
|
|
||||||
for (; It != E;)
|
|
||||||
{
|
|
||||||
auto currentIt = It;
|
|
||||||
++It;
|
|
||||||
auto protectedTexture = *currentIt;
|
|
||||||
u32 protectedRangeStart = std::get<1>(protectedTexture), protectedRangeSize = std::get<2>(protectedTexture);
|
|
||||||
if (addr >= protectedRangeStart && addr <= protectedRangeSize + protectedRangeStart)
|
|
||||||
{
|
|
||||||
u64 texadrr = std::get<0>(protectedTexture);
|
|
||||||
m_address_to_data[texadrr].first.m_is_dirty = true;
|
|
||||||
|
|
||||||
utils::memory_protect(vm::base(protectedRangeStart), protectedRangeSize, utils::protection::rw);
|
|
||||||
m_protected_ranges.erase(currentIt);
|
|
||||||
handled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::pair<texture_entry, ComPtr<ID3D12Resource> > *data_cache::find_data_if_available(u64 key)
|
|
||||||
{
|
|
||||||
std::lock_guard lock(m_mut);
|
|
||||||
auto It = m_address_to_data.find(key);
|
|
||||||
if (It == m_address_to_data.end())
|
|
||||||
return nullptr;
|
|
||||||
return &It->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
void data_cache::unprotect_all()
|
|
||||||
{
|
|
||||||
std::lock_guard lock(m_mut);
|
|
||||||
for (auto &protectedTexture : m_protected_ranges)
|
|
||||||
{
|
|
||||||
u32 protectedRangeStart = std::get<1>(protectedTexture), protectedRangeSize = std::get<2>(protectedTexture);
|
|
||||||
utils::memory_protect(vm::base(protectedRangeStart), protectedRangeSize, utils::protection::rw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ComPtr<ID3D12Resource> data_cache::remove_from_cache(u64 key)
|
|
||||||
{
|
|
||||||
auto result = m_address_to_data[key].second;
|
|
||||||
m_address_to_data.erase(key);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void resource_storage::reset()
|
|
||||||
{
|
|
||||||
descriptors_heap_index = 0;
|
|
||||||
current_sampler_index = 0;
|
|
||||||
sampler_descriptors_heap_index = 0;
|
|
||||||
render_targets_descriptors_heap_index = 0;
|
|
||||||
depth_stencil_descriptor_heap_index = 0;
|
|
||||||
|
|
||||||
CHECK_HRESULT(command_allocator->Reset());
|
|
||||||
set_new_command_list();
|
|
||||||
}
|
|
||||||
|
|
||||||
void resource_storage::set_new_command_list()
|
|
||||||
{
|
|
||||||
CHECK_HRESULT(command_list->Reset(command_allocator.Get(), nullptr));
|
|
||||||
|
|
||||||
ID3D12DescriptorHeap *descriptors[] =
|
|
||||||
{
|
|
||||||
descriptors_heap.Get(),
|
|
||||||
sampler_descriptor_heap[sampler_descriptors_heap_index].Get(),
|
|
||||||
};
|
|
||||||
command_list->SetDescriptorHeaps(2, descriptors);
|
|
||||||
}
|
|
||||||
|
|
||||||
void resource_storage::init(ID3D12Device *device)
|
|
||||||
{
|
|
||||||
in_use = false;
|
|
||||||
m_device = device;
|
|
||||||
ram_framebuffer = nullptr;
|
|
||||||
// Create a global command allocator
|
|
||||||
CHECK_HRESULT(device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(command_allocator.GetAddressOf())));
|
|
||||||
|
|
||||||
CHECK_HRESULT(m_device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, command_allocator.Get(), nullptr, IID_PPV_ARGS(command_list.GetAddressOf())));
|
|
||||||
CHECK_HRESULT(command_list->Close());
|
|
||||||
|
|
||||||
D3D12_DESCRIPTOR_HEAP_DESC descriptor_heap_desc = { D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 50000, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE };
|
|
||||||
CHECK_HRESULT(device->CreateDescriptorHeap(&descriptor_heap_desc, IID_PPV_ARGS(&descriptors_heap)));
|
|
||||||
|
|
||||||
D3D12_DESCRIPTOR_HEAP_DESC sampler_heap_desc = { D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER , 2048, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE };
|
|
||||||
CHECK_HRESULT(device->CreateDescriptorHeap(&sampler_heap_desc, IID_PPV_ARGS(&sampler_descriptor_heap[0])));
|
|
||||||
CHECK_HRESULT(device->CreateDescriptorHeap(&sampler_heap_desc, IID_PPV_ARGS(&sampler_descriptor_heap[1])));
|
|
||||||
|
|
||||||
D3D12_DESCRIPTOR_HEAP_DESC ds_descriptor_heap_desc = { D3D12_DESCRIPTOR_HEAP_TYPE_DSV , 10000};
|
|
||||||
device->CreateDescriptorHeap(&ds_descriptor_heap_desc, IID_PPV_ARGS(&depth_stencil_descriptor_heap));
|
|
||||||
|
|
||||||
D3D12_DESCRIPTOR_HEAP_DESC rtv_descriptor_heap_desc = { D3D12_DESCRIPTOR_HEAP_TYPE_RTV , 10000 };
|
|
||||||
device->CreateDescriptorHeap(&rtv_descriptor_heap_desc, IID_PPV_ARGS(&render_targets_descriptors_heap));
|
|
||||||
|
|
||||||
frame_finished_handle = CreateEventEx(nullptr, FALSE, FALSE, EVENT_ALL_ACCESS);
|
|
||||||
fence_value = 0;
|
|
||||||
CHECK_HRESULT(device->CreateFence(fence_value++, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(frame_finished_fence.GetAddressOf())));
|
|
||||||
}
|
|
||||||
|
|
||||||
void resource_storage::wait_and_clean()
|
|
||||||
{
|
|
||||||
if (in_use)
|
|
||||||
WaitForSingleObjectEx(frame_finished_handle, INFINITE, FALSE);
|
|
||||||
else
|
|
||||||
CHECK_HRESULT(command_list->Close());
|
|
||||||
|
|
||||||
reset();
|
|
||||||
|
|
||||||
dirty_textures.clear();
|
|
||||||
|
|
||||||
ram_framebuffer = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void resource_storage::release()
|
|
||||||
{
|
|
||||||
dirty_textures.clear();
|
|
||||||
// NOTE: Should be released only after gfx pipeline last command has been finished.
|
|
||||||
CloseHandle(frame_finished_handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,192 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include "D3D12Utils.h"
|
|
||||||
#include "d3dx12.h"
|
|
||||||
#include "../Common/ring_buffer_helper.h"
|
|
||||||
|
|
||||||
#include "Utilities/mutex.h"
|
|
||||||
|
|
||||||
#include <list>
|
|
||||||
#include <mutex>
|
|
||||||
|
|
||||||
struct d3d12_data_heap : public data_heap
|
|
||||||
{
|
|
||||||
ComPtr<ID3D12Resource> m_heap;
|
|
||||||
public:
|
|
||||||
d3d12_data_heap() = default;
|
|
||||||
~d3d12_data_heap() = default;
|
|
||||||
d3d12_data_heap(const d3d12_data_heap&) = delete;
|
|
||||||
d3d12_data_heap(d3d12_data_heap&&) = delete;
|
|
||||||
|
|
||||||
template <typename... arg_type>
|
|
||||||
void init(ID3D12Device *device, size_t heap_size, D3D12_HEAP_TYPE type, D3D12_RESOURCE_STATES state)
|
|
||||||
{
|
|
||||||
m_size = heap_size;
|
|
||||||
m_put_pos = 0;
|
|
||||||
m_get_pos = heap_size - 1;
|
|
||||||
|
|
||||||
D3D12_HEAP_PROPERTIES heap_properties = {};
|
|
||||||
heap_properties.Type = type;
|
|
||||||
CHECK_HRESULT(device->CreateCommittedResource(&heap_properties,
|
|
||||||
D3D12_HEAP_FLAG_NONE,
|
|
||||||
&CD3DX12_RESOURCE_DESC::Buffer(heap_size),
|
|
||||||
state,
|
|
||||||
nullptr,
|
|
||||||
IID_PPV_ARGS(m_heap.GetAddressOf()))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T* map(const D3D12_RANGE &range)
|
|
||||||
{
|
|
||||||
void *buffer;
|
|
||||||
CHECK_HRESULT(m_heap->Map(0, &range, &buffer));
|
|
||||||
void *mapped_buffer = (char*)buffer + range.Begin;
|
|
||||||
return static_cast<T*>(mapped_buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T* map(size_t heap_offset)
|
|
||||||
{
|
|
||||||
void *buffer;
|
|
||||||
CHECK_HRESULT(m_heap->Map(0, nullptr, &buffer));
|
|
||||||
void *mapped_buffer = (char*)buffer + heap_offset;
|
|
||||||
return static_cast<T*>(mapped_buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void unmap(const D3D12_RANGE &range)
|
|
||||||
{
|
|
||||||
m_heap->Unmap(0, &range);
|
|
||||||
}
|
|
||||||
|
|
||||||
void unmap()
|
|
||||||
{
|
|
||||||
m_heap->Unmap(0, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
ID3D12Resource* get_heap()
|
|
||||||
{
|
|
||||||
return m_heap.Get();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct texture_entry
|
|
||||||
{
|
|
||||||
u8 m_format;
|
|
||||||
bool m_is_dirty;
|
|
||||||
size_t m_width;
|
|
||||||
size_t m_height;
|
|
||||||
size_t m_mipmap;
|
|
||||||
size_t m_depth;
|
|
||||||
|
|
||||||
texture_entry() : m_format(0), m_width(0), m_height(0), m_depth(0), m_is_dirty(true)
|
|
||||||
{}
|
|
||||||
|
|
||||||
texture_entry(u8 f, size_t w, size_t h, size_t d, size_t m) : m_format(f), m_width(w), m_height(h), m_depth(d), m_is_dirty(false), m_mipmap(m)
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool operator==(const texture_entry &other)
|
|
||||||
{
|
|
||||||
return (m_format == other.m_format && m_width == other.m_width && m_height == other.m_height && m_mipmap == other.m_mipmap && m_depth == other.m_depth);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Manages cache of data (texture/vertex/index)
|
|
||||||
*/
|
|
||||||
struct data_cache
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* Mutex protecting m_dataCache access
|
|
||||||
* Memory protection fault catch can be generated by any thread and
|
|
||||||
* modifies it.
|
|
||||||
*/
|
|
||||||
shared_mutex m_mut;
|
|
||||||
|
|
||||||
std::unordered_map<u64, std::pair<texture_entry, ComPtr<ID3D12Resource>> > m_address_to_data; // Storage
|
|
||||||
std::list <std::tuple<u64, u32, u32> > m_protected_ranges; // address, start of protected range, size of protected range
|
|
||||||
public:
|
|
||||||
data_cache() = default;
|
|
||||||
~data_cache() = default;
|
|
||||||
data_cache(const data_cache&) = delete;
|
|
||||||
data_cache(data_cache&&) = delete;
|
|
||||||
|
|
||||||
void store_and_protect_data(u64 key, u32 start, size_t size, u8 format, size_t w, size_t h, size_t d, size_t m, ComPtr<ID3D12Resource> data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make memory from start to start + size write protected.
|
|
||||||
* Associate key to this range so that when a write is detected, data at key is marked dirty.
|
|
||||||
*/
|
|
||||||
void protect_data(u64 key, u32 start, size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove all data containing addr from cache, unprotect them. Returns false if no data is modified.
|
|
||||||
*/
|
|
||||||
bool invalidate_address(u32 addr);
|
|
||||||
|
|
||||||
std::pair<texture_entry, ComPtr<ID3D12Resource> > *find_data_if_available(u64 key);
|
|
||||||
|
|
||||||
void unprotect_all();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove data stored at key, and returns a ComPtr owning it.
|
|
||||||
* The caller is responsible for releasing the ComPtr.
|
|
||||||
*/
|
|
||||||
ComPtr<ID3D12Resource> remove_from_cache(u64 key);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores data that are "ping ponged" between frame.
|
|
||||||
* For instance command allocator : maintains 2 command allocators and
|
|
||||||
* swap between them when frame is flipped.
|
|
||||||
*/
|
|
||||||
struct resource_storage
|
|
||||||
{
|
|
||||||
resource_storage() = default;
|
|
||||||
~resource_storage() = default;
|
|
||||||
resource_storage(const resource_storage&) = delete;
|
|
||||||
resource_storage(resource_storage&&) = delete;
|
|
||||||
|
|
||||||
bool in_use; // False until command list has been populated at least once
|
|
||||||
ComPtr<ID3D12Fence> frame_finished_fence;
|
|
||||||
UINT64 fence_value;
|
|
||||||
HANDLE frame_finished_handle;
|
|
||||||
|
|
||||||
// Pointer to device, not owned by ResourceStorage
|
|
||||||
ID3D12Device *m_device;
|
|
||||||
ComPtr<ID3D12CommandAllocator> command_allocator;
|
|
||||||
ComPtr<ID3D12GraphicsCommandList> command_list;
|
|
||||||
|
|
||||||
// Descriptor heap
|
|
||||||
ComPtr<ID3D12DescriptorHeap> descriptors_heap;
|
|
||||||
size_t descriptors_heap_index;
|
|
||||||
|
|
||||||
// Sampler heap
|
|
||||||
ComPtr<ID3D12DescriptorHeap> sampler_descriptor_heap[2];
|
|
||||||
size_t sampler_descriptors_heap_index;
|
|
||||||
size_t current_sampler_index;
|
|
||||||
|
|
||||||
size_t render_targets_descriptors_heap_index;
|
|
||||||
ComPtr<ID3D12DescriptorHeap> render_targets_descriptors_heap;
|
|
||||||
size_t depth_stencil_descriptor_heap_index;
|
|
||||||
ComPtr<ID3D12DescriptorHeap> depth_stencil_descriptor_heap;
|
|
||||||
|
|
||||||
ComPtr<ID3D12Resource> ram_framebuffer;
|
|
||||||
|
|
||||||
/// Texture that were invalidated
|
|
||||||
std::list<ComPtr<ID3D12Resource> > dirty_textures;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start position in heaps of resources used for this frame.
|
|
||||||
* This means newer resources shouldn't allocate memory crossing this position
|
|
||||||
* until the frame rendering is over.
|
|
||||||
*/
|
|
||||||
size_t buffer_heap_get_pos;
|
|
||||||
size_t readback_heap_get_pos;
|
|
||||||
|
|
||||||
void reset();
|
|
||||||
void init(ID3D12Device *device);
|
|
||||||
void set_new_command_list();
|
|
||||||
void wait_and_clean();
|
|
||||||
void release();
|
|
||||||
};
|
|
|
@ -1,181 +0,0 @@
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "stdafx_d3d12.h"
|
|
||||||
#include "D3D12GSRender.h"
|
|
||||||
#include <d2d1_3.h>
|
|
||||||
#include <dwrite_3.h>
|
|
||||||
#include <d3d11on12.h>
|
|
||||||
#include <dxgi1_4.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
// D2D
|
|
||||||
ComPtr<ID3D11Device> g_d3d11_device;
|
|
||||||
ComPtr<ID3D11DeviceContext> g_d3d11_device_context;
|
|
||||||
ComPtr<ID3D11On12Device> g_d3d11on12_device;
|
|
||||||
ComPtr<IDWriteFactory> g_dwrite_factory;
|
|
||||||
ComPtr<ID2D1Factory3> g_d2d_factory;
|
|
||||||
ComPtr<ID2D1Device2> g_d2d_device;
|
|
||||||
ComPtr<ID2D1DeviceContext2> g_d2d_device_context;
|
|
||||||
ComPtr<ID3D11Resource> g_wrapped_backbuffers[2];
|
|
||||||
ComPtr<ID2D1Bitmap1> g_d2d_render_targets[2];
|
|
||||||
ComPtr<IDWriteTextFormat> g_text_format;
|
|
||||||
ComPtr<ID2D1SolidColorBrush> g_text_brush;
|
|
||||||
|
|
||||||
void draw_strings(const D2D1_SIZE_F &rtSize, size_t backbuffer_id, const std::vector<std::wstring> &strings)
|
|
||||||
{
|
|
||||||
// Acquire our wrapped render target resource for the current back buffer.
|
|
||||||
g_d3d11on12_device->AcquireWrappedResources(g_wrapped_backbuffers[backbuffer_id ].GetAddressOf(), 1);
|
|
||||||
|
|
||||||
// Render text directly to the back buffer.
|
|
||||||
g_d2d_device_context->SetTarget(g_d2d_render_targets[backbuffer_id].Get());
|
|
||||||
g_d2d_device_context->BeginDraw();
|
|
||||||
g_d2d_device_context->SetTransform(D2D1::Matrix3x2F::Identity());
|
|
||||||
float xpos = 0.f;
|
|
||||||
for (const std::wstring &str : strings)
|
|
||||||
{
|
|
||||||
g_d2d_device_context->DrawTextW(
|
|
||||||
str.c_str(),
|
|
||||||
(UINT32)str.size(),
|
|
||||||
g_text_format.Get(),
|
|
||||||
&D2D1::RectF(0, xpos, rtSize.width, rtSize.height),
|
|
||||||
g_text_brush.Get()
|
|
||||||
);
|
|
||||||
xpos += 14.f;
|
|
||||||
}
|
|
||||||
g_d2d_device_context->EndDraw();
|
|
||||||
|
|
||||||
// Release our wrapped render target resource. Releasing
|
|
||||||
// transitions the back buffer resource to the state specified
|
|
||||||
// as the OutState when the wrapped resource was created.
|
|
||||||
g_d3d11on12_device->ReleaseWrappedResources(g_wrapped_backbuffers[backbuffer_id].GetAddressOf(), 1);
|
|
||||||
|
|
||||||
// Flush to submit the 11 command list to the shared command queue.
|
|
||||||
g_d3d11_device_context->Flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern PFN_D3D11ON12_CREATE_DEVICE wrapD3D11On12CreateDevice;
|
|
||||||
|
|
||||||
void D3D12GSRender::init_d2d_structures()
|
|
||||||
{
|
|
||||||
wrapD3D11On12CreateDevice(
|
|
||||||
m_device.Get(),
|
|
||||||
D3D11_CREATE_DEVICE_BGRA_SUPPORT,
|
|
||||||
nullptr,
|
|
||||||
0,
|
|
||||||
reinterpret_cast<IUnknown**>(m_command_queue.GetAddressOf()),
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
&g_d3d11_device,
|
|
||||||
&g_d3d11_device_context,
|
|
||||||
nullptr
|
|
||||||
);
|
|
||||||
|
|
||||||
g_d3d11_device.As(&g_d3d11on12_device);
|
|
||||||
|
|
||||||
D2D1_DEVICE_CONTEXT_OPTIONS deviceOptions = D2D1_DEVICE_CONTEXT_OPTIONS_NONE;
|
|
||||||
D2D1_FACTORY_OPTIONS d2dFactoryOptions = {};
|
|
||||||
D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, __uuidof(ID2D1Factory3), &d2dFactoryOptions, &g_d2d_factory);
|
|
||||||
Microsoft::WRL::ComPtr<IDXGIDevice> dxgiDevice;
|
|
||||||
g_d3d11on12_device.As(&dxgiDevice);
|
|
||||||
g_d2d_factory->CreateDevice(dxgiDevice.Get(), &g_d2d_device);
|
|
||||||
g_d2d_device->CreateDeviceContext(deviceOptions, &g_d2d_device_context);
|
|
||||||
DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), &g_dwrite_factory);
|
|
||||||
|
|
||||||
float dpiX;
|
|
||||||
float dpiY;
|
|
||||||
g_d2d_factory->GetDesktopDpi(&dpiX, &dpiY);
|
|
||||||
D2D1_BITMAP_PROPERTIES1 bitmapProperties = D2D1::BitmapProperties1(
|
|
||||||
D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW,
|
|
||||||
D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED),
|
|
||||||
dpiX,
|
|
||||||
dpiY
|
|
||||||
);
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < 2; i++)
|
|
||||||
{
|
|
||||||
D3D11_RESOURCE_FLAGS d3d11Flags = { D3D11_BIND_RENDER_TARGET };
|
|
||||||
g_d3d11on12_device->CreateWrappedResource(
|
|
||||||
m_backbuffer[i].Get(),
|
|
||||||
&d3d11Flags,
|
|
||||||
D3D12_RESOURCE_STATE_RENDER_TARGET,
|
|
||||||
D3D12_RESOURCE_STATE_PRESENT,
|
|
||||||
IID_PPV_ARGS(&g_wrapped_backbuffers[i])
|
|
||||||
);
|
|
||||||
|
|
||||||
// Create a render target for D2D to draw directly to this back buffer.
|
|
||||||
Microsoft::WRL::ComPtr<IDXGISurface> surface;
|
|
||||||
g_wrapped_backbuffers[i].As(&surface);
|
|
||||||
g_d2d_device_context->CreateBitmapFromDxgiSurface(
|
|
||||||
surface.Get(),
|
|
||||||
&bitmapProperties,
|
|
||||||
&g_d2d_render_targets[i]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_d2d_device_context->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::DarkGreen), &g_text_brush);
|
|
||||||
g_dwrite_factory->CreateTextFormat(
|
|
||||||
L"Verdana",
|
|
||||||
NULL,
|
|
||||||
DWRITE_FONT_WEIGHT_BOLD,
|
|
||||||
DWRITE_FONT_STYLE_NORMAL,
|
|
||||||
DWRITE_FONT_STRETCH_NORMAL,
|
|
||||||
14,
|
|
||||||
L"en-us",
|
|
||||||
&g_text_format
|
|
||||||
);
|
|
||||||
g_text_format->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);
|
|
||||||
g_text_format->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::release_d2d_structures()
|
|
||||||
{
|
|
||||||
g_d3d11_device.Reset();
|
|
||||||
g_d3d11_device_context.Reset();
|
|
||||||
g_d3d11on12_device.Reset();
|
|
||||||
g_dwrite_factory.Reset();
|
|
||||||
g_d2d_factory.Reset();
|
|
||||||
g_d2d_device.Reset();
|
|
||||||
g_d2d_device_context.Reset();
|
|
||||||
g_wrapped_backbuffers[0].Reset();
|
|
||||||
g_d2d_render_targets[0].Reset();
|
|
||||||
g_wrapped_backbuffers[1].Reset();
|
|
||||||
g_d2d_render_targets[1].Reset();
|
|
||||||
g_text_format.Reset();
|
|
||||||
g_text_brush.Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::render_overlay()
|
|
||||||
{
|
|
||||||
D2D1_SIZE_F rtSize = g_d2d_render_targets[m_swap_chain->GetCurrentBackBufferIndex()]->GetSize();
|
|
||||||
std::wstring duration = L"Draw duration : " + std::to_wstring(m_timers.draw_calls_duration) + L" us";
|
|
||||||
float vtxIdxPercent = (float)m_timers.vertex_index_duration / (float)m_timers.draw_calls_duration;
|
|
||||||
std::wstring vertexIndexDuration = L"Vtx/Idx upload : " + std::to_wstring(m_timers.vertex_index_duration) + L" us (" + std::to_wstring(100.f * vtxIdxPercent) + L" %)";
|
|
||||||
std::wstring size = L"Upload size : " + std::to_wstring(m_timers.buffer_upload_size) + L" Bytes";
|
|
||||||
float texPercent = (float)m_timers.texture_duration / (float)m_timers.draw_calls_duration;
|
|
||||||
std::wstring texDuration = L"Textures : " + std::to_wstring(m_timers.texture_duration) + L" us (" + std::to_wstring(100.f * texPercent) + L" %)";
|
|
||||||
float programPercent = (float)m_timers.program_load_duration / (float)m_timers.draw_calls_duration;
|
|
||||||
std::wstring programDuration = L"Program : " + std::to_wstring(m_timers.program_load_duration) + L" us (" + std::to_wstring(100.f * programPercent) + L" %)";
|
|
||||||
float constantsPercent = (float)m_timers.constants_duration / (float)m_timers.draw_calls_duration;
|
|
||||||
std::wstring constantDuration = L"Constants : " + std::to_wstring(m_timers.constants_duration) + L" us (" + std::to_wstring(100.f * constantsPercent) + L" %)";
|
|
||||||
float rttPercent = (float)m_timers.prepare_rtt_duration / (float)m_timers.draw_calls_duration;
|
|
||||||
std::wstring rttDuration = L"RTT : " + std::to_wstring(m_timers.prepare_rtt_duration) + L" us (" + std::to_wstring(100.f * rttPercent) + L" %)";
|
|
||||||
std::wstring flipDuration = L"Flip : " + std::to_wstring(m_timers.flip_duration) + L" us";
|
|
||||||
|
|
||||||
std::wstring count = L"Draw count : " + std::to_wstring(m_timers.draw_calls_count);
|
|
||||||
draw_strings(rtSize, m_swap_chain->GetCurrentBackBufferIndex(),
|
|
||||||
{
|
|
||||||
duration,
|
|
||||||
count,
|
|
||||||
rttDuration,
|
|
||||||
vertexIndexDuration,
|
|
||||||
size,
|
|
||||||
programDuration,
|
|
||||||
constantDuration,
|
|
||||||
texDuration,
|
|
||||||
flipDuration
|
|
||||||
});
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,325 +0,0 @@
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "stdafx_d3d12.h"
|
|
||||||
#include "D3D12PipelineState.h"
|
|
||||||
#include "D3D12GSRender.h"
|
|
||||||
#include "D3D12Formats.h"
|
|
||||||
#include "../rsx_methods.h"
|
|
||||||
#include "../rsx_utils.h"
|
|
||||||
#include "../Common/TextureUtils.h"
|
|
||||||
|
|
||||||
#define TO_STRING(x) #x
|
|
||||||
|
|
||||||
extern pD3DCompile wrapD3DCompile;
|
|
||||||
|
|
||||||
void Shader::Compile(const std::string &code, SHADER_TYPE st)
|
|
||||||
{
|
|
||||||
content = code;
|
|
||||||
HRESULT hr;
|
|
||||||
ComPtr<ID3DBlob> errorBlob;
|
|
||||||
UINT compileFlags;
|
|
||||||
if (g_cfg.video.debug_output)
|
|
||||||
compileFlags = D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
|
|
||||||
else
|
|
||||||
compileFlags = 0;
|
|
||||||
switch (st)
|
|
||||||
{
|
|
||||||
case SHADER_TYPE::SHADER_TYPE_VERTEX:
|
|
||||||
hr = wrapD3DCompile(code.c_str(), code.size(), "VertexProgram.hlsl", nullptr, nullptr, "main", "vs_5_0", compileFlags, 0, &bytecode, errorBlob.GetAddressOf());
|
|
||||||
if (hr != S_OK)
|
|
||||||
LOG_ERROR(RSX, "VS build failed:%s", (char*)errorBlob->GetBufferPointer());
|
|
||||||
break;
|
|
||||||
case SHADER_TYPE::SHADER_TYPE_FRAGMENT:
|
|
||||||
hr = wrapD3DCompile(code.c_str(), code.size(), "FragmentProgram.hlsl", nullptr, nullptr, "main", "ps_5_0", compileFlags, 0, &bytecode, errorBlob.GetAddressOf());
|
|
||||||
if (hr != S_OK)
|
|
||||||
LOG_ERROR(RSX, "FS build failed:%s", (char*)errorBlob->GetBufferPointer());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::load_program()
|
|
||||||
{
|
|
||||||
auto rtt_lookup_func = [this](u32 texaddr, rsx::fragment_texture&, bool is_depth) -> std::tuple<bool, u16>
|
|
||||||
{
|
|
||||||
ID3D12Resource *surface = nullptr;
|
|
||||||
if (!is_depth)
|
|
||||||
surface = m_rtts.get_texture_from_render_target_if_applicable(texaddr);
|
|
||||||
else
|
|
||||||
surface = m_rtts.get_texture_from_depth_stencil_if_applicable(texaddr);
|
|
||||||
|
|
||||||
if (!surface) return std::make_tuple(false, 0);
|
|
||||||
|
|
||||||
D3D12_RESOURCE_DESC desc = surface->GetDesc();
|
|
||||||
u16 native_pitch = get_dxgi_texel_size(desc.Format) * (u16)desc.Width;
|
|
||||||
return std::make_tuple(true, native_pitch);
|
|
||||||
};
|
|
||||||
|
|
||||||
get_current_vertex_program({}, true, false);
|
|
||||||
get_current_fragment_program_legacy(rtt_lookup_func);
|
|
||||||
|
|
||||||
if (!current_fragment_program.valid)
|
|
||||||
return;
|
|
||||||
|
|
||||||
D3D12PipelineProperties prop = {};
|
|
||||||
prop.Topology = get_primitive_topology_type(rsx::method_registers.current_draw_clause.primitive);
|
|
||||||
|
|
||||||
static D3D12_BLEND_DESC CD3D12_BLEND_DESC =
|
|
||||||
{
|
|
||||||
FALSE,
|
|
||||||
FALSE,
|
|
||||||
{
|
|
||||||
FALSE,FALSE,
|
|
||||||
D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD,
|
|
||||||
D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD,
|
|
||||||
D3D12_LOGIC_OP_NOOP,
|
|
||||||
D3D12_COLOR_WRITE_ENABLE_ALL,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
prop.Blend = CD3D12_BLEND_DESC;
|
|
||||||
|
|
||||||
if (rsx::method_registers.blend_enabled())
|
|
||||||
{
|
|
||||||
//We can use the d3d blend factor as long as !(rgb_factor == alpha && a_factor == color)
|
|
||||||
rsx::blend_factor sfactor_rgb = rsx::method_registers.blend_func_sfactor_rgb();
|
|
||||||
rsx::blend_factor dfactor_rgb = rsx::method_registers.blend_func_dfactor_rgb();
|
|
||||||
rsx::blend_factor sfactor_a = rsx::method_registers.blend_func_sfactor_a();
|
|
||||||
rsx::blend_factor dfactor_a = rsx::method_registers.blend_func_dfactor_a();
|
|
||||||
|
|
||||||
D3D12_BLEND d3d_sfactor_rgb = get_blend_factor(sfactor_rgb);
|
|
||||||
D3D12_BLEND d3d_dfactor_rgb = get_blend_factor(dfactor_rgb);;
|
|
||||||
D3D12_BLEND d3d_sfactor_alpha = get_blend_factor_alpha(sfactor_a);
|
|
||||||
D3D12_BLEND d3d_dfactor_alpha = get_blend_factor_alpha(dfactor_a);
|
|
||||||
|
|
||||||
auto BlendColor = rsx::get_constant_blend_colors();
|
|
||||||
bool color_blend_possible = true;
|
|
||||||
|
|
||||||
if (sfactor_rgb == rsx::blend_factor::constant_alpha ||
|
|
||||||
dfactor_rgb == rsx::blend_factor::constant_alpha)
|
|
||||||
{
|
|
||||||
if (sfactor_rgb == rsx::blend_factor::constant_color ||
|
|
||||||
dfactor_rgb == rsx::blend_factor::constant_color)
|
|
||||||
{
|
|
||||||
//Color information will be destroyed
|
|
||||||
color_blend_possible = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//All components are alpha.
|
|
||||||
//If an alpha factor refers to constant_color, it only refers to the alpha component, so no need to replace it
|
|
||||||
BlendColor[0] = BlendColor[1] = BlendColor[2] = BlendColor[3];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!color_blend_possible)
|
|
||||||
{
|
|
||||||
LOG_ERROR(RSX, "The constant_color blend factor combination defined is not supported");
|
|
||||||
|
|
||||||
auto flatten_d3d12_factor = [](D3D12_BLEND in) -> D3D12_BLEND
|
|
||||||
{
|
|
||||||
switch (in)
|
|
||||||
{
|
|
||||||
case D3D12_BLEND_BLEND_FACTOR:
|
|
||||||
return D3D12_BLEND_ONE;
|
|
||||||
case D3D12_BLEND_INV_BLEND_FACTOR:
|
|
||||||
return D3D12_BLEND_ZERO;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_ERROR(RSX, "No suitable conversion defined for blend factor 0x%X" HERE, (u32)in);
|
|
||||||
return in;
|
|
||||||
};
|
|
||||||
|
|
||||||
d3d_sfactor_rgb = flatten_d3d12_factor(d3d_sfactor_rgb);
|
|
||||||
d3d_dfactor_rgb = flatten_d3d12_factor(d3d_dfactor_rgb);;
|
|
||||||
d3d_sfactor_alpha = flatten_d3d12_factor(d3d_sfactor_alpha);
|
|
||||||
d3d_dfactor_alpha = flatten_d3d12_factor(d3d_dfactor_alpha);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
get_current_resource_storage().command_list->OMSetBlendFactor(BlendColor.data());
|
|
||||||
}
|
|
||||||
|
|
||||||
prop.Blend.RenderTarget[0].BlendEnable = true;
|
|
||||||
|
|
||||||
if (rsx::method_registers.blend_enabled_surface_1())
|
|
||||||
prop.Blend.RenderTarget[1].BlendEnable = true;
|
|
||||||
if (rsx::method_registers.blend_enabled_surface_2())
|
|
||||||
prop.Blend.RenderTarget[2].BlendEnable = true;
|
|
||||||
if (rsx::method_registers.blend_enabled_surface_3())
|
|
||||||
prop.Blend.RenderTarget[3].BlendEnable = true;
|
|
||||||
|
|
||||||
prop.Blend.RenderTarget[0].BlendOp = get_blend_op(rsx::method_registers.blend_equation_rgb());
|
|
||||||
prop.Blend.RenderTarget[0].BlendOpAlpha = get_blend_op(rsx::method_registers.blend_equation_a());
|
|
||||||
|
|
||||||
if (rsx::method_registers.blend_enabled_surface_1())
|
|
||||||
{
|
|
||||||
prop.Blend.RenderTarget[1].BlendOp = get_blend_op(rsx::method_registers.blend_equation_rgb());
|
|
||||||
prop.Blend.RenderTarget[1].BlendOpAlpha = get_blend_op(rsx::method_registers.blend_equation_a());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rsx::method_registers.blend_enabled_surface_2())
|
|
||||||
{
|
|
||||||
prop.Blend.RenderTarget[2].BlendOp = get_blend_op(rsx::method_registers.blend_equation_rgb());
|
|
||||||
prop.Blend.RenderTarget[2].BlendOpAlpha = get_blend_op(rsx::method_registers.blend_equation_a());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rsx::method_registers.blend_enabled_surface_3())
|
|
||||||
{
|
|
||||||
prop.Blend.RenderTarget[3].BlendOp = get_blend_op(rsx::method_registers.blend_equation_rgb());
|
|
||||||
prop.Blend.RenderTarget[3].BlendOpAlpha = get_blend_op(rsx::method_registers.blend_equation_a());
|
|
||||||
}
|
|
||||||
|
|
||||||
prop.Blend.RenderTarget[0].SrcBlend = d3d_sfactor_rgb;
|
|
||||||
prop.Blend.RenderTarget[0].DestBlend = d3d_dfactor_rgb;
|
|
||||||
prop.Blend.RenderTarget[0].SrcBlendAlpha = d3d_sfactor_alpha;
|
|
||||||
prop.Blend.RenderTarget[0].DestBlendAlpha = d3d_dfactor_alpha;
|
|
||||||
|
|
||||||
if (rsx::method_registers.blend_enabled_surface_1())
|
|
||||||
{
|
|
||||||
prop.Blend.RenderTarget[1].SrcBlend = d3d_sfactor_rgb;
|
|
||||||
prop.Blend.RenderTarget[1].DestBlend = d3d_dfactor_rgb;
|
|
||||||
prop.Blend.RenderTarget[1].SrcBlendAlpha = d3d_sfactor_alpha;
|
|
||||||
prop.Blend.RenderTarget[1].DestBlendAlpha = d3d_dfactor_alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rsx::method_registers.blend_enabled_surface_2())
|
|
||||||
{
|
|
||||||
prop.Blend.RenderTarget[2].SrcBlend = d3d_sfactor_rgb;
|
|
||||||
prop.Blend.RenderTarget[2].DestBlend = d3d_dfactor_rgb;
|
|
||||||
prop.Blend.RenderTarget[2].SrcBlendAlpha = d3d_sfactor_alpha;
|
|
||||||
prop.Blend.RenderTarget[2].DestBlendAlpha = d3d_dfactor_alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rsx::method_registers.blend_enabled_surface_3())
|
|
||||||
{
|
|
||||||
prop.Blend.RenderTarget[3].SrcBlend = d3d_sfactor_rgb;
|
|
||||||
prop.Blend.RenderTarget[3].DestBlend = d3d_dfactor_rgb;
|
|
||||||
prop.Blend.RenderTarget[3].SrcBlendAlpha = d3d_sfactor_alpha;
|
|
||||||
prop.Blend.RenderTarget[3].DestBlendAlpha = d3d_dfactor_alpha;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rsx::method_registers.logic_op_enabled())
|
|
||||||
{
|
|
||||||
prop.Blend.RenderTarget[0].LogicOpEnable = true;
|
|
||||||
prop.Blend.RenderTarget[0].LogicOp = get_logic_op(rsx::method_registers.logic_operation());
|
|
||||||
}
|
|
||||||
|
|
||||||
prop.DepthStencilFormat = get_depth_stencil_surface_format(rsx::method_registers.surface_depth_fmt());
|
|
||||||
prop.RenderTargetsFormat = get_color_surface_format(rsx::method_registers.surface_color());
|
|
||||||
|
|
||||||
switch (rsx::method_registers.surface_color_target())
|
|
||||||
{
|
|
||||||
case rsx::surface_target::surface_a:
|
|
||||||
case rsx::surface_target::surface_b:
|
|
||||||
prop.numMRT = 1;
|
|
||||||
break;
|
|
||||||
case rsx::surface_target::surfaces_a_b:
|
|
||||||
prop.numMRT = 2;
|
|
||||||
break;
|
|
||||||
case rsx::surface_target::surfaces_a_b_c:
|
|
||||||
prop.numMRT = 3;
|
|
||||||
break;
|
|
||||||
case rsx::surface_target::surfaces_a_b_c_d:
|
|
||||||
prop.numMRT = 4;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (rsx::method_registers.depth_test_enabled())
|
|
||||||
{
|
|
||||||
prop.DepthStencil.DepthEnable = TRUE;
|
|
||||||
prop.DepthStencil.DepthFunc = get_compare_func(rsx::method_registers.depth_func());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
prop.DepthStencil.DepthEnable = FALSE;
|
|
||||||
|
|
||||||
prop.DepthStencil.DepthWriteMask = rsx::method_registers.depth_write_enabled() ? D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO;
|
|
||||||
|
|
||||||
if (rsx::method_registers.stencil_test_enabled())
|
|
||||||
{
|
|
||||||
prop.DepthStencil.StencilEnable = TRUE;
|
|
||||||
prop.DepthStencil.StencilReadMask = rsx::method_registers.stencil_func_mask();
|
|
||||||
prop.DepthStencil.StencilWriteMask = rsx::method_registers.stencil_mask();
|
|
||||||
prop.DepthStencil.FrontFace.StencilPassOp = get_stencil_op(rsx::method_registers.stencil_op_zpass());
|
|
||||||
prop.DepthStencil.FrontFace.StencilDepthFailOp = get_stencil_op(rsx::method_registers.stencil_op_zfail());
|
|
||||||
prop.DepthStencil.FrontFace.StencilFailOp = get_stencil_op(rsx::method_registers.stencil_op_fail());
|
|
||||||
prop.DepthStencil.FrontFace.StencilFunc = get_compare_func(rsx::method_registers.stencil_func());
|
|
||||||
|
|
||||||
if (rsx::method_registers.two_sided_stencil_test_enabled())
|
|
||||||
{
|
|
||||||
prop.DepthStencil.BackFace.StencilFailOp = get_stencil_op(rsx::method_registers.back_stencil_op_fail());
|
|
||||||
prop.DepthStencil.BackFace.StencilFunc = get_compare_func(rsx::method_registers.back_stencil_func());
|
|
||||||
prop.DepthStencil.BackFace.StencilPassOp = get_stencil_op(rsx::method_registers.back_stencil_op_zpass());
|
|
||||||
prop.DepthStencil.BackFace.StencilDepthFailOp = get_stencil_op(rsx::method_registers.back_stencil_op_zfail());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
prop.DepthStencil.BackFace.StencilPassOp = get_stencil_op(rsx::method_registers.stencil_op_zpass());
|
|
||||||
prop.DepthStencil.BackFace.StencilDepthFailOp = get_stencil_op(rsx::method_registers.stencil_op_zfail());
|
|
||||||
prop.DepthStencil.BackFace.StencilFailOp = get_stencil_op(rsx::method_registers.stencil_op_fail());
|
|
||||||
prop.DepthStencil.BackFace.StencilFunc = get_compare_func(rsx::method_registers.stencil_func());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sensible default value
|
|
||||||
static D3D12_RASTERIZER_DESC CD3D12_RASTERIZER_DESC =
|
|
||||||
{
|
|
||||||
D3D12_FILL_MODE_SOLID,
|
|
||||||
D3D12_CULL_MODE_NONE,
|
|
||||||
FALSE,
|
|
||||||
D3D12_DEFAULT_DEPTH_BIAS,
|
|
||||||
D3D12_DEFAULT_DEPTH_BIAS_CLAMP,
|
|
||||||
D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS,
|
|
||||||
TRUE,
|
|
||||||
FALSE,
|
|
||||||
FALSE,
|
|
||||||
0,
|
|
||||||
D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF,
|
|
||||||
};
|
|
||||||
prop.Rasterization = CD3D12_RASTERIZER_DESC;
|
|
||||||
prop.Rasterization.DepthClipEnable = rsx::method_registers.depth_clip_enabled();
|
|
||||||
|
|
||||||
if (rsx::method_registers.cull_face_enabled())
|
|
||||||
{
|
|
||||||
prop.Rasterization.CullMode = get_cull_face(rsx::method_registers.cull_face_mode());
|
|
||||||
}
|
|
||||||
|
|
||||||
prop.Rasterization.FrontCounterClockwise = get_front_face_ccw(rsx::method_registers.front_face_mode());
|
|
||||||
|
|
||||||
UINT8 mask = 0;
|
|
||||||
mask |= rsx::method_registers.color_mask_r(0) ? D3D12_COLOR_WRITE_ENABLE_RED : 0;
|
|
||||||
mask |= rsx::method_registers.color_mask_g(0) ? D3D12_COLOR_WRITE_ENABLE_GREEN : 0;
|
|
||||||
mask |= rsx::method_registers.color_mask_b(0) ? D3D12_COLOR_WRITE_ENABLE_BLUE : 0;
|
|
||||||
mask |= rsx::method_registers.color_mask_a(0) ? D3D12_COLOR_WRITE_ENABLE_ALPHA : 0;
|
|
||||||
for (unsigned i = 0; i < prop.numMRT; i++)
|
|
||||||
prop.Blend.RenderTarget[i].RenderTargetWriteMask = mask;
|
|
||||||
|
|
||||||
if (rsx::method_registers.restart_index_enabled())
|
|
||||||
{
|
|
||||||
rsx::index_array_type index_type = rsx::method_registers.current_draw_clause.is_immediate_draw?
|
|
||||||
rsx::index_array_type::u32:
|
|
||||||
rsx::method_registers.index_type();
|
|
||||||
|
|
||||||
if (index_type == rsx::index_array_type::u32)
|
|
||||||
{
|
|
||||||
prop.CutValue = D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
if (index_type == rsx::index_array_type::u16)
|
|
||||||
{
|
|
||||||
prop.CutValue = D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_current_pso = m_pso_cache.get_graphics_pipeline(current_vertex_program, current_fragment_program, prop, false, m_device.Get(), m_shared_root_signature.Get());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::pair<std::string, std::string> D3D12GSRender::get_programs() const
|
|
||||||
{
|
|
||||||
return std::make_pair(m_pso_cache.get_transform_program(current_vertex_program).content, m_pso_cache.get_shader_program(current_fragment_program).content);
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::notify_tile_unbound(u32 tile)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,203 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "D3D12Utils.h"
|
|
||||||
#include "../Common/ProgramStateCache.h"
|
|
||||||
#include "D3D12VertexProgramDecompiler.h"
|
|
||||||
#include "D3D12FragmentProgramDecompiler.h"
|
|
||||||
#include "Utilities/File.h"
|
|
||||||
|
|
||||||
|
|
||||||
struct D3D12PipelineProperties
|
|
||||||
{
|
|
||||||
D3D12_PRIMITIVE_TOPOLOGY_TYPE Topology;
|
|
||||||
DXGI_FORMAT DepthStencilFormat;
|
|
||||||
DXGI_FORMAT RenderTargetsFormat;
|
|
||||||
D3D12_BLEND_DESC Blend;
|
|
||||||
unsigned numMRT : 3;
|
|
||||||
D3D12_DEPTH_STENCIL_DESC DepthStencil;
|
|
||||||
D3D12_RASTERIZER_DESC Rasterization;
|
|
||||||
D3D12_INDEX_BUFFER_STRIP_CUT_VALUE CutValue;
|
|
||||||
|
|
||||||
bool operator==(const D3D12PipelineProperties &in) const
|
|
||||||
{
|
|
||||||
if (memcmp(&DepthStencil, &in.DepthStencil, sizeof(D3D12_DEPTH_STENCIL_DESC)))
|
|
||||||
return false;
|
|
||||||
if (memcmp(&Blend, &in.Blend, sizeof(D3D12_BLEND_DESC)))
|
|
||||||
return false;
|
|
||||||
if (memcmp(&Rasterization, &in.Rasterization, sizeof(D3D12_RASTERIZER_DESC)))
|
|
||||||
return false;
|
|
||||||
return Topology == in.Topology && DepthStencilFormat == in.DepthStencilFormat && numMRT == in.numMRT && RenderTargetsFormat == in.RenderTargetsFormat;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
size_t hashStructContent(const T& structure)
|
|
||||||
{
|
|
||||||
char *data = (char*)(&structure);
|
|
||||||
size_t result = 0;
|
|
||||||
for (unsigned i = 0; i < sizeof(T); i++)
|
|
||||||
result ^= std::hash<char>()(data[i]);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace std
|
|
||||||
{
|
|
||||||
template <>
|
|
||||||
struct hash<D3D12PipelineProperties> {
|
|
||||||
size_t operator()(const D3D12PipelineProperties &pipelineProperties) const {
|
|
||||||
size_t seed = hash<unsigned>()(pipelineProperties.DepthStencilFormat) ^
|
|
||||||
(hash<unsigned>()(pipelineProperties.RenderTargetsFormat) << 2) ^
|
|
||||||
(hash<unsigned>()(pipelineProperties.Topology) << 2) ^
|
|
||||||
(hash<unsigned>()(pipelineProperties.numMRT) << 4);
|
|
||||||
seed ^= hashStructContent(pipelineProperties.Blend);
|
|
||||||
seed ^= hashStructContent(pipelineProperties.DepthStencil);
|
|
||||||
seed ^= hashStructContent(pipelineProperties.Rasterization);
|
|
||||||
return hash<size_t>()(seed);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Storage for a shader
|
|
||||||
* Embeds the D3DBlob
|
|
||||||
*/
|
|
||||||
struct Shader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum class SHADER_TYPE
|
|
||||||
{
|
|
||||||
SHADER_TYPE_VERTEX,
|
|
||||||
SHADER_TYPE_FRAGMENT
|
|
||||||
};
|
|
||||||
|
|
||||||
Shader() = default;
|
|
||||||
~Shader() = default;
|
|
||||||
Shader(const Shader &) = delete;
|
|
||||||
|
|
||||||
u32 id;
|
|
||||||
ComPtr<ID3DBlob> bytecode;
|
|
||||||
// For debugging
|
|
||||||
std::string content;
|
|
||||||
size_t vertex_shader_input_count;
|
|
||||||
std::vector<size_t> FragmentConstantOffsetCache;
|
|
||||||
size_t m_textureCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decompile a fragment shader located in the PS3's Memory. This function operates synchronously.
|
|
||||||
* @param prog RSXShaderProgram specifying the location and size of the shader in memory
|
|
||||||
*/
|
|
||||||
// void Decompile(RSXFragmentProgram& prog)
|
|
||||||
|
|
||||||
/** Compile the decompiled fragment shader into a format we can use with OpenGL. */
|
|
||||||
void Compile(const std::string &code, enum SHADER_TYPE st);
|
|
||||||
};
|
|
||||||
|
|
||||||
static
|
|
||||||
bool has_attribute(size_t attribute, const std::vector<D3D12_INPUT_ELEMENT_DESC> &desc)
|
|
||||||
{
|
|
||||||
for (const auto &attribute_desc : desc)
|
|
||||||
{
|
|
||||||
if (attribute_desc.SemanticIndex == attribute)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct D3D12Traits
|
|
||||||
{
|
|
||||||
using vertex_program_type = Shader;
|
|
||||||
using fragment_program_type = Shader;
|
|
||||||
using pipeline_storage_type = std::tuple<ComPtr<ID3D12PipelineState>, size_t, size_t>;
|
|
||||||
using pipeline_properties = D3D12PipelineProperties;
|
|
||||||
|
|
||||||
static
|
|
||||||
void recompile_fragment_program(const RSXFragmentProgram &RSXFP, fragment_program_type& fragmentProgramData, size_t ID)
|
|
||||||
{
|
|
||||||
u32 size;
|
|
||||||
D3D12FragmentDecompiler FS(RSXFP, size);
|
|
||||||
const std::string &shader = FS.Decompile();
|
|
||||||
fragmentProgramData.Compile(shader, Shader::SHADER_TYPE::SHADER_TYPE_FRAGMENT);
|
|
||||||
fragmentProgramData.m_textureCount = 0;
|
|
||||||
for (const ParamType& PT : FS.m_parr.params[PF_PARAM_UNIFORM])
|
|
||||||
{
|
|
||||||
for (const ParamItem PI : PT.items)
|
|
||||||
{
|
|
||||||
if (PT.type == "sampler1D" || PT.type == "sampler2D" || PT.type == "samplerCube" || PT.type == "sampler3D")
|
|
||||||
{
|
|
||||||
size_t texture_unit = atoi(PI.name.c_str() + 3);
|
|
||||||
fragmentProgramData.m_textureCount = std::max(texture_unit + 1, fragmentProgramData.m_textureCount);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
size_t offset = atoi(PI.name.c_str() + 2);
|
|
||||||
fragmentProgramData.FragmentConstantOffsetCache.push_back(offset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (g_cfg.video.log_programs)
|
|
||||||
fs::file(fs::get_cache_dir() + "shaderlog/FragmentProgram" + std::to_string(ID) + ".hlsl", fs::rewrite).write(shader);
|
|
||||||
fragmentProgramData.id = (u32)ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
void recompile_vertex_program(const RSXVertexProgram &RSXVP, vertex_program_type& vertexProgramData, size_t ID)
|
|
||||||
{
|
|
||||||
D3D12VertexProgramDecompiler VS(RSXVP);
|
|
||||||
std::string shaderCode = VS.Decompile();
|
|
||||||
vertexProgramData.Compile(shaderCode, Shader::SHADER_TYPE::SHADER_TYPE_VERTEX);
|
|
||||||
vertexProgramData.vertex_shader_input_count = RSXVP.rsx_vertex_inputs.size();
|
|
||||||
if (g_cfg.video.log_programs)
|
|
||||||
fs::file(fs::get_cache_dir() + "shaderlog/VertexProgram" + std::to_string(ID) + ".hlsl", fs::rewrite).write(shaderCode);
|
|
||||||
vertexProgramData.id = (u32)ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
void validate_pipeline_properties(const vertex_program_type&, const fragment_program_type&, pipeline_properties&)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
pipeline_storage_type build_pipeline(
|
|
||||||
const vertex_program_type &vertexProgramData, const fragment_program_type &fragmentProgramData, const pipeline_properties &pipelineProperties,
|
|
||||||
ID3D12Device *device, ID3D12RootSignature* root_signatures)
|
|
||||||
{
|
|
||||||
std::tuple<ID3D12PipelineState *, std::vector<size_t>, size_t> result = {};
|
|
||||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC graphicPipelineStateDesc = {};
|
|
||||||
|
|
||||||
if (vertexProgramData.bytecode == nullptr)
|
|
||||||
fmt::throw_exception("Vertex program compilation failure" HERE);
|
|
||||||
graphicPipelineStateDesc.VS.BytecodeLength = vertexProgramData.bytecode->GetBufferSize();
|
|
||||||
graphicPipelineStateDesc.VS.pShaderBytecode = vertexProgramData.bytecode->GetBufferPointer();
|
|
||||||
|
|
||||||
if (fragmentProgramData.bytecode == nullptr)
|
|
||||||
fmt::throw_exception("fragment program compilation failure" HERE);
|
|
||||||
graphicPipelineStateDesc.PS.BytecodeLength = fragmentProgramData.bytecode->GetBufferSize();
|
|
||||||
graphicPipelineStateDesc.PS.pShaderBytecode = fragmentProgramData.bytecode->GetBufferPointer();
|
|
||||||
|
|
||||||
graphicPipelineStateDesc.pRootSignature = root_signatures;
|
|
||||||
|
|
||||||
graphicPipelineStateDesc.BlendState = pipelineProperties.Blend;
|
|
||||||
graphicPipelineStateDesc.DepthStencilState = pipelineProperties.DepthStencil;
|
|
||||||
graphicPipelineStateDesc.RasterizerState = pipelineProperties.Rasterization;
|
|
||||||
graphicPipelineStateDesc.PrimitiveTopologyType = pipelineProperties.Topology;
|
|
||||||
|
|
||||||
graphicPipelineStateDesc.NumRenderTargets = pipelineProperties.numMRT;
|
|
||||||
for (unsigned i = 0; i < pipelineProperties.numMRT; i++)
|
|
||||||
graphicPipelineStateDesc.RTVFormats[i] = pipelineProperties.RenderTargetsFormat;
|
|
||||||
graphicPipelineStateDesc.DSVFormat = pipelineProperties.DepthStencilFormat;
|
|
||||||
|
|
||||||
graphicPipelineStateDesc.SampleDesc.Count = 1;
|
|
||||||
graphicPipelineStateDesc.SampleMask = UINT_MAX;
|
|
||||||
graphicPipelineStateDesc.NodeMask = 1;
|
|
||||||
|
|
||||||
graphicPipelineStateDesc.IBStripCutValue = pipelineProperties.CutValue;
|
|
||||||
|
|
||||||
ComPtr<ID3D12PipelineState> pso;
|
|
||||||
CHECK_HRESULT(device->CreateGraphicsPipelineState(&graphicPipelineStateDesc, IID_PPV_ARGS(pso.GetAddressOf())));
|
|
||||||
|
|
||||||
std::wstring name = L"PSO_" + std::to_wstring(vertexProgramData.id) + L"_" + std::to_wstring(fragmentProgramData.id);
|
|
||||||
pso->SetName(name.c_str());
|
|
||||||
return std::make_tuple(pso, vertexProgramData.vertex_shader_input_count, fragmentProgramData.m_textureCount);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class PipelineStateObjectCache : public program_state_cache<D3D12Traits>
|
|
||||||
{
|
|
||||||
};
|
|
|
@ -1,409 +0,0 @@
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "stdafx_d3d12.h"
|
|
||||||
#include "D3D12RenderTargetSets.h"
|
|
||||||
#include "Emu/Memory/vm.h"
|
|
||||||
#include "Emu/System.h"
|
|
||||||
#include "Emu/RSX/GSRender.h"
|
|
||||||
#include "../rsx_methods.h"
|
|
||||||
|
|
||||||
#include <D3D12.h>
|
|
||||||
#include "D3D12GSRender.h"
|
|
||||||
#include "D3D12Formats.h"
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
u32 get_max_depth_value(rsx::surface_depth_format format)
|
|
||||||
{
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case rsx::surface_depth_format::z16: return 0xFFFF;
|
|
||||||
case rsx::surface_depth_format::z24s8: return 0xFFFFFF;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Unknown depth format" HERE);
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT get_num_rtt(rsx::surface_target color_target)
|
|
||||||
{
|
|
||||||
switch (color_target)
|
|
||||||
{
|
|
||||||
case rsx::surface_target::none: return 0;
|
|
||||||
case rsx::surface_target::surface_a:
|
|
||||||
case rsx::surface_target::surface_b: return 1;
|
|
||||||
case rsx::surface_target::surfaces_a_b: return 2;
|
|
||||||
case rsx::surface_target::surfaces_a_b_c: return 3;
|
|
||||||
case rsx::surface_target::surfaces_a_b_c_d: return 4;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Unknown color target" HERE);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<u8> get_rtt_indexes(rsx::surface_target color_target)
|
|
||||||
{
|
|
||||||
switch (color_target)
|
|
||||||
{
|
|
||||||
case rsx::surface_target::none: return{};
|
|
||||||
case rsx::surface_target::surface_a: return{ 0 };
|
|
||||||
case rsx::surface_target::surface_b: return{ 1 };
|
|
||||||
case rsx::surface_target::surfaces_a_b: return{ 0, 1 };
|
|
||||||
case rsx::surface_target::surfaces_a_b_c: return{ 0, 1, 2 };
|
|
||||||
case rsx::surface_target::surfaces_a_b_c_d: return{ 0, 1, 2, 3 };
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Unknown color target" HERE);
|
|
||||||
}
|
|
||||||
|
|
||||||
u8 get_clear_stencil(u32 register_value)
|
|
||||||
{
|
|
||||||
return register_value & 0xff;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t get_aligned_pitch(rsx::surface_color_format format, u32 width)
|
|
||||||
{
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case rsx::surface_color_format::b8: return align(width, 256);
|
|
||||||
case rsx::surface_color_format::g8b8:
|
|
||||||
case rsx::surface_color_format::x1r5g5b5_o1r5g5b5:
|
|
||||||
case rsx::surface_color_format::x1r5g5b5_z1r5g5b5:
|
|
||||||
case rsx::surface_color_format::r5g6b5: return align(width * 2, 256);
|
|
||||||
case rsx::surface_color_format::a8b8g8r8:
|
|
||||||
case rsx::surface_color_format::x8b8g8r8_o8b8g8r8:
|
|
||||||
case rsx::surface_color_format::x8b8g8r8_z8b8g8r8:
|
|
||||||
case rsx::surface_color_format::x8r8g8b8_o8r8g8b8:
|
|
||||||
case rsx::surface_color_format::x8r8g8b8_z8r8g8b8:
|
|
||||||
case rsx::surface_color_format::x32:
|
|
||||||
case rsx::surface_color_format::a8r8g8b8: return align(width * 4, 256);
|
|
||||||
case rsx::surface_color_format::w16z16y16x16: return align(width * 8, 256);
|
|
||||||
case rsx::surface_color_format::w32z32y32x32: return align(width * 16, 256);
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Unknown color surface format" HERE);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t get_packed_pitch(rsx::surface_color_format format, u32 width)
|
|
||||||
{
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case rsx::surface_color_format::b8: return width;
|
|
||||||
case rsx::surface_color_format::g8b8:
|
|
||||||
case rsx::surface_color_format::x1r5g5b5_o1r5g5b5:
|
|
||||||
case rsx::surface_color_format::x1r5g5b5_z1r5g5b5:
|
|
||||||
case rsx::surface_color_format::r5g6b5: return width * 2;
|
|
||||||
case rsx::surface_color_format::a8b8g8r8:
|
|
||||||
case rsx::surface_color_format::x8b8g8r8_o8b8g8r8:
|
|
||||||
case rsx::surface_color_format::x8b8g8r8_z8b8g8r8:
|
|
||||||
case rsx::surface_color_format::x8r8g8b8_o8r8g8b8:
|
|
||||||
case rsx::surface_color_format::x8r8g8b8_z8r8g8b8:
|
|
||||||
case rsx::surface_color_format::x32:
|
|
||||||
case rsx::surface_color_format::a8r8g8b8: return width * 4;
|
|
||||||
case rsx::surface_color_format::w16z16y16x16: return width * 8;
|
|
||||||
case rsx::surface_color_format::w32z32y32x32: return width * 16;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Unknown color surface format" HERE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::clear_surface(u32 arg)
|
|
||||||
{
|
|
||||||
if ((arg & 0xf3) == 0) return;
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> start_duration = steady_clock::now();
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> rtt_duration_start = steady_clock::now();
|
|
||||||
prepare_render_targets(get_current_resource_storage().command_list.Get());
|
|
||||||
|
|
||||||
if (!framebuffer_status_valid) return;
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> rtt_duration_end = steady_clock::now();
|
|
||||||
m_timers.prepare_rtt_duration += std::chrono::duration_cast<std::chrono::microseconds>(rtt_duration_end - rtt_duration_start).count();
|
|
||||||
|
|
||||||
if (arg & 0x1 || arg & 0x2)
|
|
||||||
{
|
|
||||||
get_current_resource_storage().depth_stencil_descriptor_heap_index++;
|
|
||||||
|
|
||||||
if (arg & 0x1)
|
|
||||||
{
|
|
||||||
auto depth_format = rsx::method_registers.surface_depth_fmt();
|
|
||||||
u32 clear_depth = rsx::method_registers.z_clear_value(depth_format == rsx::surface_depth_format::z24s8);
|
|
||||||
u32 max_depth_value = get_max_depth_value(depth_format);
|
|
||||||
get_current_resource_storage().command_list->ClearDepthStencilView(m_rtts.current_ds_handle, D3D12_CLEAR_FLAG_DEPTH, clear_depth / (float)max_depth_value, 0,
|
|
||||||
1, &::get_scissor(rsx::method_registers.scissor_origin_x(), rsx::method_registers.scissor_origin_y(), rsx::method_registers.scissor_width(), rsx::method_registers.scissor_height()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arg & 0x2)
|
|
||||||
get_current_resource_storage().command_list->ClearDepthStencilView(m_rtts.current_ds_handle, D3D12_CLEAR_FLAG_STENCIL, 0.f, get_clear_stencil(rsx::method_registers.stencil_clear_value()),
|
|
||||||
1, &::get_scissor(rsx::method_registers.scissor_origin_x(), rsx::method_registers.scissor_origin_y(), rsx::method_registers.scissor_width(), rsx::method_registers.scissor_height()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arg & 0xF0)
|
|
||||||
{
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE handle = CD3DX12_CPU_DESCRIPTOR_HANDLE(m_rtts.current_rtts_handle);
|
|
||||||
size_t rtt_index = get_num_rtt(rsx::method_registers.surface_color_target());
|
|
||||||
get_current_resource_storage().render_targets_descriptors_heap_index += rtt_index;
|
|
||||||
std::array<float, 4> clear_color =
|
|
||||||
{
|
|
||||||
rsx::method_registers.clear_color_r() / 255.f,
|
|
||||||
rsx::method_registers.clear_color_g() / 255.f,
|
|
||||||
rsx::method_registers.clear_color_b() / 255.f,
|
|
||||||
rsx::method_registers.clear_color_a() / 255.f,
|
|
||||||
};
|
|
||||||
for (unsigned i = 0; i < rtt_index; i++)
|
|
||||||
get_current_resource_storage().command_list->ClearRenderTargetView(handle.Offset(i, m_descriptor_stride_rtv), clear_color.data(),
|
|
||||||
1, &::get_scissor(rsx::method_registers.scissor_origin_x(), rsx::method_registers.scissor_origin_y(), rsx::method_registers.scissor_width(), rsx::method_registers.scissor_height()));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::chrono::time_point<steady_clock> end_duration = steady_clock::now();
|
|
||||||
m_timers.draw_calls_duration += std::chrono::duration_cast<std::chrono::microseconds>(end_duration - start_duration).count();
|
|
||||||
m_timers.draw_calls_count++;
|
|
||||||
|
|
||||||
if (g_cfg.video.debug_output)
|
|
||||||
{
|
|
||||||
CHECK_HRESULT(get_current_resource_storage().command_list->Close());
|
|
||||||
m_command_queue->ExecuteCommandLists(1, (ID3D12CommandList**)get_current_resource_storage().command_list.GetAddressOf());
|
|
||||||
get_current_resource_storage().set_new_command_list();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::prepare_render_targets(ID3D12GraphicsCommandList *copycmdlist)
|
|
||||||
{
|
|
||||||
// Exit early if there is no rtt changes
|
|
||||||
if (!m_rtts_dirty)
|
|
||||||
return;
|
|
||||||
m_rtts_dirty = false;
|
|
||||||
|
|
||||||
std::array<float, 4> clear_color =
|
|
||||||
{
|
|
||||||
rsx::method_registers.clear_color_r() / 255.f,
|
|
||||||
rsx::method_registers.clear_color_g() / 255.f,
|
|
||||||
rsx::method_registers.clear_color_b() / 255.f,
|
|
||||||
rsx::method_registers.clear_color_a() / 255.f,
|
|
||||||
};
|
|
||||||
|
|
||||||
rsx::framebuffer_layout layout;
|
|
||||||
get_framebuffer_layout(rsx::framebuffer_creation_context::context_draw, layout);
|
|
||||||
if (!framebuffer_status_valid)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_rtts.prepare_render_target(copycmdlist,
|
|
||||||
layout.color_format, layout.depth_format,
|
|
||||||
layout.width, layout.height,
|
|
||||||
layout.target, layout.aa_mode,
|
|
||||||
layout.color_addresses, layout.zeta_address,
|
|
||||||
layout.actual_color_pitch, layout.actual_zeta_pitch,
|
|
||||||
m_device.Get(), clear_color, 1.f, 0);
|
|
||||||
|
|
||||||
// write descriptors
|
|
||||||
DXGI_FORMAT dxgi_format = get_color_surface_format(rsx::method_registers.surface_color());
|
|
||||||
D3D12_RENDER_TARGET_VIEW_DESC rtt_view_desc = {};
|
|
||||||
rtt_view_desc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D;
|
|
||||||
rtt_view_desc.Format = dxgi_format;
|
|
||||||
|
|
||||||
m_rtts.current_rtts_handle = CD3DX12_CPU_DESCRIPTOR_HANDLE(get_current_resource_storage().render_targets_descriptors_heap->GetCPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((INT)get_current_resource_storage().render_targets_descriptors_heap_index * m_descriptor_stride_rtv);
|
|
||||||
size_t rtt_index = 0;
|
|
||||||
for (u8 i : get_rtt_indexes(rsx::method_registers.surface_color_target()))
|
|
||||||
{
|
|
||||||
if (std::get<1>(m_rtts.m_bound_render_targets[i]) == nullptr)
|
|
||||||
continue;
|
|
||||||
m_device->CreateRenderTargetView(std::get<1>(m_rtts.m_bound_render_targets[i]), &rtt_view_desc,
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(m_rtts.current_rtts_handle).Offset((INT)rtt_index * m_descriptor_stride_rtv));
|
|
||||||
rtt_index++;
|
|
||||||
}
|
|
||||||
get_current_resource_storage().render_targets_descriptors_heap_index += rtt_index;
|
|
||||||
|
|
||||||
if (std::get<1>(m_rtts.m_bound_depth_stencil) == nullptr)
|
|
||||||
return;
|
|
||||||
m_rtts.current_ds_handle = CD3DX12_CPU_DESCRIPTOR_HANDLE(get_current_resource_storage().depth_stencil_descriptor_heap->GetCPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((INT)get_current_resource_storage().depth_stencil_descriptor_heap_index * m_descriptor_stride_dsv);
|
|
||||||
get_current_resource_storage().depth_stencil_descriptor_heap_index += 1;
|
|
||||||
D3D12_DEPTH_STENCIL_VIEW_DESC depth_stencil_view_desc = {};
|
|
||||||
depth_stencil_view_desc.Format = get_depth_stencil_surface_format(rsx::method_registers.surface_depth_fmt());
|
|
||||||
depth_stencil_view_desc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D;
|
|
||||||
m_device->CreateDepthStencilView(std::get<1>(m_rtts.m_bound_depth_stencil), &depth_stencil_view_desc, m_rtts.current_ds_handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::set_rtt_and_ds(ID3D12GraphicsCommandList *command_list)
|
|
||||||
{
|
|
||||||
UINT num_rtt = get_num_rtt(rsx::method_registers.surface_color_target());
|
|
||||||
D3D12_CPU_DESCRIPTOR_HANDLE* ds_handle = (std::get<1>(m_rtts.m_bound_depth_stencil) != nullptr) ? &m_rtts.current_ds_handle : nullptr;
|
|
||||||
command_list->OMSetRenderTargets((UINT)num_rtt, &m_rtts.current_rtts_handle, true, ds_handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void rsx::render_targets::init(ID3D12Device *device)
|
|
||||||
{
|
|
||||||
g_descriptor_stride_rtv = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Populate command_list with copy command with color_surface data and return offset in readback buffer
|
|
||||||
*/
|
|
||||||
size_t download_to_readback_buffer(
|
|
||||||
ID3D12Device *device,
|
|
||||||
ID3D12GraphicsCommandList * command_list,
|
|
||||||
d3d12_data_heap &readback_heap,
|
|
||||||
ID3D12Resource * color_surface,
|
|
||||||
rsx::surface_color_format color_surface_format
|
|
||||||
)
|
|
||||||
{
|
|
||||||
int clip_w = rsx::method_registers.surface_clip_width();
|
|
||||||
int clip_h = rsx::method_registers.surface_clip_height();
|
|
||||||
|
|
||||||
DXGI_FORMAT dxgi_format = get_color_surface_format(color_surface_format);
|
|
||||||
size_t row_pitch = get_aligned_pitch(color_surface_format, clip_w);
|
|
||||||
|
|
||||||
size_t buffer_size = row_pitch * clip_h;
|
|
||||||
size_t heap_offset = readback_heap.alloc<D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT>(buffer_size);
|
|
||||||
|
|
||||||
command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(color_surface, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE));
|
|
||||||
|
|
||||||
command_list->CopyTextureRegion(&CD3DX12_TEXTURE_COPY_LOCATION(readback_heap.get_heap(), { heap_offset, { dxgi_format, (UINT)clip_w, (UINT)clip_h, 1, (UINT)row_pitch } }), 0, 0, 0,
|
|
||||||
&CD3DX12_TEXTURE_COPY_LOCATION(color_surface, 0), nullptr);
|
|
||||||
command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(color_surface, D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET));
|
|
||||||
return heap_offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
void copy_readback_buffer_to_dest(void *dest, d3d12_data_heap &readback_heap, size_t offset_in_heap, size_t dst_pitch, size_t src_pitch, size_t height)
|
|
||||||
{
|
|
||||||
// TODO: Use exact range
|
|
||||||
void *mapped_buffer = readback_heap.map<void>(offset_in_heap);
|
|
||||||
for (unsigned row = 0; row < height; row++)
|
|
||||||
{
|
|
||||||
u32 *casted_dest = (u32*)((char*)dest + row * dst_pitch);
|
|
||||||
u32 *casted_src = (u32*)((char*)mapped_buffer + row * src_pitch);
|
|
||||||
for (unsigned col = 0; col < src_pitch / 4; col++)
|
|
||||||
*casted_dest++ = se_storage<u32>::swap(*casted_src++);
|
|
||||||
}
|
|
||||||
readback_heap.unmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wait_for_command_queue(ID3D12Device *device, ID3D12CommandQueue *command_queue)
|
|
||||||
{
|
|
||||||
ComPtr<ID3D12Fence> fence;
|
|
||||||
CHECK_HRESULT(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(fence.GetAddressOf())));
|
|
||||||
HANDLE handle = CreateEventEx(nullptr, FALSE, FALSE, EVENT_ALL_ACCESS);
|
|
||||||
fence->SetEventOnCompletion(1, handle);
|
|
||||||
command_queue->Signal(fence.Get(), 1);
|
|
||||||
WaitForSingleObjectEx(handle, INFINITE, FALSE);
|
|
||||||
CloseHandle(handle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void D3D12GSRender::copy_render_target_to_dma_location()
|
|
||||||
{
|
|
||||||
// Add all buffer write
|
|
||||||
// Cell can't make any assumption about readyness of color/depth buffer
|
|
||||||
// Except when a semaphore is written by RSX
|
|
||||||
int clip_w = rsx::method_registers.surface_clip_width();
|
|
||||||
int clip_h = rsx::method_registers.surface_clip_height();
|
|
||||||
|
|
||||||
if (clip_w == 0 || clip_h == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
size_t depth_row_pitch = align(clip_w * 4, 256);
|
|
||||||
size_t depth_buffer_offset_in_heap = 0;
|
|
||||||
|
|
||||||
|
|
||||||
u32 address_color[] =
|
|
||||||
{
|
|
||||||
rsx::get_address(rsx::method_registers.surface_a_offset(), rsx::method_registers.surface_a_dma()),
|
|
||||||
rsx::get_address(rsx::method_registers.surface_b_offset(), rsx::method_registers.surface_b_dma()),
|
|
||||||
rsx::get_address(rsx::method_registers.surface_c_offset(), rsx::method_registers.surface_c_dma()),
|
|
||||||
rsx::get_address(rsx::method_registers.surface_d_offset(), rsx::method_registers.surface_d_dma()),
|
|
||||||
};
|
|
||||||
u32 address_z = rsx::get_address(rsx::method_registers.surface_z_offset(), rsx::method_registers.surface_z_dma());
|
|
||||||
|
|
||||||
bool need_transfer = false;
|
|
||||||
|
|
||||||
if (rsx::method_registers.surface_z_dma() && g_cfg.video.write_depth_buffer)
|
|
||||||
{
|
|
||||||
get_current_resource_storage().command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(std::get<1>(m_rtts.m_bound_depth_stencil), D3D12_RESOURCE_STATE_DEPTH_WRITE, D3D12_RESOURCE_STATE_COPY_SOURCE));
|
|
||||||
get_current_resource_storage().command_list->CopyTextureRegion(&CD3DX12_TEXTURE_COPY_LOCATION(m_readback_resources.get_heap(), { depth_buffer_offset_in_heap,{ DXGI_FORMAT_R32_TYPELESS, (UINT)clip_w, (UINT)clip_h, 1, (UINT)depth_row_pitch } }), 0, 0, 0,
|
|
||||||
&CD3DX12_TEXTURE_COPY_LOCATION(std::get<1>(m_rtts.m_bound_depth_stencil), 0), nullptr);
|
|
||||||
get_current_resource_storage().command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(std::get<1>(m_rtts.m_bound_depth_stencil), D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_DEPTH_WRITE));
|
|
||||||
invalidate_address(address_z);
|
|
||||||
|
|
||||||
need_transfer = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t color_buffer_offset_in_heap[4];
|
|
||||||
if (g_cfg.video.write_color_buffers)
|
|
||||||
{
|
|
||||||
for (u8 i : get_rtt_indexes(rsx::method_registers.surface_color_target()))
|
|
||||||
{
|
|
||||||
if (!address_color[i] || std::get<1>(m_rtts.m_bound_render_targets[i]) == nullptr)
|
|
||||||
continue;
|
|
||||||
color_buffer_offset_in_heap[i] = download_to_readback_buffer(m_device.Get(), get_current_resource_storage().command_list.Get(), m_readback_resources, std::get<1>(m_rtts.m_bound_render_targets[i]), rsx::method_registers.surface_color());
|
|
||||||
invalidate_address(address_color[i]);
|
|
||||||
need_transfer = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (need_transfer)
|
|
||||||
{
|
|
||||||
CHECK_HRESULT(get_current_resource_storage().command_list->Close());
|
|
||||||
m_command_queue->ExecuteCommandLists(1, (ID3D12CommandList**)get_current_resource_storage().command_list.GetAddressOf());
|
|
||||||
get_current_resource_storage().set_new_command_list();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Wait for result
|
|
||||||
wait_for_command_queue(m_device.Get(), m_command_queue.Get());
|
|
||||||
|
|
||||||
if (address_z && g_cfg.video.write_depth_buffer)
|
|
||||||
{
|
|
||||||
auto ptr = vm::base(address_z);
|
|
||||||
char *depth_buffer = (char*)ptr;
|
|
||||||
u8 *mapped_buffer = m_readback_resources.map<u8>(depth_buffer_offset_in_heap);
|
|
||||||
|
|
||||||
for (unsigned row = 0; row < (unsigned)clip_h; row++)
|
|
||||||
{
|
|
||||||
for (unsigned i = 0; i < (unsigned)clip_w; i++)
|
|
||||||
{
|
|
||||||
unsigned char c = mapped_buffer[row * depth_row_pitch + i];
|
|
||||||
depth_buffer[4 * (row * clip_w + i)] = c;
|
|
||||||
depth_buffer[4 * (row * clip_w + i) + 1] = c;
|
|
||||||
depth_buffer[4 * (row * clip_w + i) + 2] = c;
|
|
||||||
depth_buffer[4 * (row * clip_w + i) + 3] = c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_readback_resources.unmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_cfg.video.write_color_buffers)
|
|
||||||
{
|
|
||||||
size_t srcPitch = get_aligned_pitch(rsx::method_registers.surface_color(), clip_w);
|
|
||||||
size_t dstPitch = get_packed_pitch(rsx::method_registers.surface_color(), clip_w);
|
|
||||||
|
|
||||||
void *dest_buffer[] =
|
|
||||||
{
|
|
||||||
vm::base(address_color[0]),
|
|
||||||
vm::base(address_color[1]),
|
|
||||||
vm::base(address_color[2]),
|
|
||||||
vm::base(address_color[3]),
|
|
||||||
};
|
|
||||||
|
|
||||||
for (u8 i : get_rtt_indexes(rsx::method_registers.surface_color_target()))
|
|
||||||
{
|
|
||||||
if (!address_color[i] || std::get<1>(m_rtts.m_bound_render_targets[i]) == nullptr)
|
|
||||||
continue;
|
|
||||||
copy_readback_buffer_to_dest(dest_buffer[i], m_readback_resources, color_buffer_offset_in_heap[i], srcPitch, dstPitch, clip_h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::array<std::vector<gsl::byte>, 4> D3D12GSRender::copy_render_targets_to_memory()
|
|
||||||
{
|
|
||||||
int clip_w = rsx::method_registers.surface_clip_width();
|
|
||||||
int clip_h = rsx::method_registers.surface_clip_height();
|
|
||||||
return m_rtts.get_render_targets_data(rsx::method_registers.surface_color(), clip_w, clip_h, m_device.Get(), m_command_queue.Get(), m_readback_resources, get_current_resource_storage());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::array<std::vector<gsl::byte>, 2> D3D12GSRender::copy_depth_stencil_buffer_to_memory()
|
|
||||||
{
|
|
||||||
int clip_w = rsx::method_registers.surface_clip_width();
|
|
||||||
int clip_h = rsx::method_registers.surface_clip_height();
|
|
||||||
return m_rtts.get_depth_stencil_data(rsx::method_registers.surface_depth_fmt(), clip_w, clip_h, m_device.Get(), m_command_queue.Get(), m_readback_resources, get_current_resource_storage());
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,419 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#define INCOMPLETE_SURFACE_CACHE_IMPL
|
|
||||||
|
|
||||||
#include <utility>
|
|
||||||
#include <d3d12.h>
|
|
||||||
#include "d3dx12.h"
|
|
||||||
|
|
||||||
#include "D3D12Formats.h"
|
|
||||||
#include "D3D12MemoryHelpers.h"
|
|
||||||
|
|
||||||
namespace rsx
|
|
||||||
{
|
|
||||||
namespace utility
|
|
||||||
{
|
|
||||||
std::vector<u8> get_rtt_indexes(surface_target color_target);
|
|
||||||
size_t get_aligned_pitch(surface_color_format format, u32 width);
|
|
||||||
size_t get_packed_pitch(surface_color_format format, u32 width);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Traits>
|
|
||||||
struct surface_store_deprecated
|
|
||||||
{
|
|
||||||
template<typename T, typename U>
|
|
||||||
void copy_pitched_src_to_dst(gsl::span<T> dest, gsl::span<const U> src, size_t src_pitch_in_bytes, size_t width, size_t height)
|
|
||||||
{
|
|
||||||
for (unsigned row = 0; row < height; row++)
|
|
||||||
{
|
|
||||||
for (unsigned col = 0; col < width; col++)
|
|
||||||
dest[col] = src[col];
|
|
||||||
src = src.subspan(src_pitch_in_bytes / sizeof(U));
|
|
||||||
dest = dest.subspan(width);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
using surface_storage_type = typename Traits::surface_storage_type;
|
|
||||||
using surface_type = typename Traits::surface_type;
|
|
||||||
using command_list_type = typename Traits::command_list_type;
|
|
||||||
using download_buffer_object = typename Traits::download_buffer_object;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
std::unordered_map<u32, surface_storage_type> m_render_targets_storage = {};
|
|
||||||
std::unordered_map<u32, surface_storage_type> m_depth_stencil_storage = {};
|
|
||||||
|
|
||||||
public:
|
|
||||||
std::pair<u8, u8> m_bound_render_targets_config = {};
|
|
||||||
std::array<std::pair<u32, surface_type>, 4> m_bound_render_targets = {};
|
|
||||||
std::pair<u32, surface_type> m_bound_depth_stencil = {};
|
|
||||||
|
|
||||||
std::list<surface_storage_type> invalidated_resources;
|
|
||||||
|
|
||||||
surface_store_deprecated() = default;
|
|
||||||
~surface_store_deprecated() = default;
|
|
||||||
surface_store_deprecated(const surface_store_deprecated&) = delete;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* If render target already exists at address, issue state change operation on cmdList.
|
|
||||||
* Otherwise create one with width, height, clearColor info.
|
|
||||||
* returns the corresponding render target resource.
|
|
||||||
*/
|
|
||||||
template <typename ...Args>
|
|
||||||
surface_type bind_address_as_render_targets(
|
|
||||||
command_list_type command_list,
|
|
||||||
u32 address,
|
|
||||||
surface_color_format color_format,
|
|
||||||
surface_antialiasing antialias,
|
|
||||||
size_t width, size_t height, size_t pitch,
|
|
||||||
Args&&... extra_params)
|
|
||||||
{
|
|
||||||
// Check if render target already exists
|
|
||||||
auto It = m_render_targets_storage.find(address);
|
|
||||||
if (It != m_render_targets_storage.end())
|
|
||||||
{
|
|
||||||
surface_storage_type &rtt = It->second;
|
|
||||||
if (Traits::rtt_has_format_width_height(rtt, color_format, width, height))
|
|
||||||
{
|
|
||||||
Traits::prepare_rtt_for_drawing(command_list, Traits::get(rtt));
|
|
||||||
return Traits::get(rtt);
|
|
||||||
}
|
|
||||||
|
|
||||||
invalidated_resources.push_back(std::move(rtt));
|
|
||||||
m_render_targets_storage.erase(It);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_render_targets_storage[address] = Traits::create_new_surface(address, color_format, width, height, pitch, std::forward<Args>(extra_params)...);
|
|
||||||
return Traits::get(m_render_targets_storage[address]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename ...Args>
|
|
||||||
surface_type bind_address_as_depth_stencil(
|
|
||||||
command_list_type command_list,
|
|
||||||
u32 address,
|
|
||||||
surface_depth_format depth_format,
|
|
||||||
surface_antialiasing antialias,
|
|
||||||
size_t width, size_t height, size_t pitch,
|
|
||||||
Args&&... extra_params)
|
|
||||||
{
|
|
||||||
auto It = m_depth_stencil_storage.find(address);
|
|
||||||
if (It != m_depth_stencil_storage.end())
|
|
||||||
{
|
|
||||||
surface_storage_type &ds = It->second;
|
|
||||||
if (Traits::ds_has_format_width_height(ds, depth_format, width, height))
|
|
||||||
{
|
|
||||||
Traits::prepare_ds_for_drawing(command_list, Traits::get(ds));
|
|
||||||
return Traits::get(ds);
|
|
||||||
}
|
|
||||||
|
|
||||||
invalidated_resources.push_back(std::move(ds));
|
|
||||||
m_depth_stencil_storage.erase(It);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_depth_stencil_storage[address] = Traits::create_new_surface(address, depth_format, width, height, pitch, std::forward<Args>(extra_params)...);
|
|
||||||
return Traits::get(m_depth_stencil_storage[address]);
|
|
||||||
}
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Update bound color and depth surface.
|
|
||||||
* Must be called everytime surface format, clip, or addresses changes.
|
|
||||||
*/
|
|
||||||
template <typename ...Args>
|
|
||||||
void prepare_render_target(
|
|
||||||
command_list_type command_list,
|
|
||||||
surface_color_format color_format, surface_depth_format depth_format,
|
|
||||||
u32 clip_horizontal_reg, u32 clip_vertical_reg,
|
|
||||||
surface_target set_surface_target,
|
|
||||||
surface_antialiasing antialias,
|
|
||||||
const std::array<u32, 4> &surface_addresses, u32 address_z,
|
|
||||||
const std::array<u32, 4> &surface_pitch, u32 zeta_pitch,
|
|
||||||
Args&&... extra_params)
|
|
||||||
{
|
|
||||||
u32 clip_width = clip_horizontal_reg;
|
|
||||||
u32 clip_height = clip_vertical_reg;
|
|
||||||
|
|
||||||
// Make previous RTTs sampleable
|
|
||||||
for (int i = m_bound_render_targets_config.first, count = 0;
|
|
||||||
count < m_bound_render_targets_config.second;
|
|
||||||
++i, ++count)
|
|
||||||
{
|
|
||||||
auto &rtt = m_bound_render_targets[i];
|
|
||||||
Traits::prepare_rtt_for_sampling(command_list, std::get<1>(rtt));
|
|
||||||
rtt = std::make_pair(0, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto rtt_indices = utility::get_rtt_indexes(set_surface_target);
|
|
||||||
if (LIKELY(!rtt_indices.empty()))
|
|
||||||
{
|
|
||||||
m_bound_render_targets_config = { rtt_indices.front(), 0 };
|
|
||||||
|
|
||||||
// Create/Reuse requested rtts
|
|
||||||
for (u8 surface_index : rtt_indices)
|
|
||||||
{
|
|
||||||
if (surface_addresses[surface_index] == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
m_bound_render_targets[surface_index] = std::make_pair(surface_addresses[surface_index],
|
|
||||||
bind_address_as_render_targets(command_list, surface_addresses[surface_index], color_format, antialias,
|
|
||||||
clip_width, clip_height, surface_pitch[surface_index], std::forward<Args>(extra_params)...));
|
|
||||||
|
|
||||||
m_bound_render_targets_config.second++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_bound_render_targets_config = { 0, 0 };
|
|
||||||
}
|
|
||||||
|
|
||||||
// Same for depth buffer
|
|
||||||
if (std::get<1>(m_bound_depth_stencil) != nullptr)
|
|
||||||
Traits::prepare_ds_for_sampling(command_list, std::get<1>(m_bound_depth_stencil));
|
|
||||||
|
|
||||||
m_bound_depth_stencil = std::make_pair(0, nullptr);
|
|
||||||
|
|
||||||
if (!address_z)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_bound_depth_stencil = std::make_pair(address_z,
|
|
||||||
bind_address_as_depth_stencil(command_list, address_z, depth_format, antialias,
|
|
||||||
clip_width, clip_height, zeta_pitch, std::forward<Args>(extra_params)...));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Search for given address in stored color surface
|
|
||||||
* Return an empty surface_type otherwise.
|
|
||||||
*/
|
|
||||||
surface_type get_texture_from_render_target_if_applicable(u32 address)
|
|
||||||
{
|
|
||||||
auto It = m_render_targets_storage.find(address);
|
|
||||||
if (It != m_render_targets_storage.end())
|
|
||||||
return Traits::get(It->second);
|
|
||||||
return surface_type();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Search for given address in stored depth stencil surface
|
|
||||||
* Return an empty surface_type otherwise.
|
|
||||||
*/
|
|
||||||
surface_type get_texture_from_depth_stencil_if_applicable(u32 address)
|
|
||||||
{
|
|
||||||
auto It = m_depth_stencil_storage.find(address);
|
|
||||||
if (It != m_depth_stencil_storage.end())
|
|
||||||
return Traits::get(It->second);
|
|
||||||
return surface_type();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get bound color surface raw data.
|
|
||||||
*/
|
|
||||||
template <typename... Args>
|
|
||||||
std::array<std::vector<gsl::byte>, 4> get_render_targets_data(
|
|
||||||
surface_color_format color_format, size_t width, size_t height,
|
|
||||||
Args&& ...args
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get bound color surface raw data.
|
|
||||||
*/
|
|
||||||
template <typename... Args>
|
|
||||||
std::array<std::vector<gsl::byte>, 2> get_depth_stencil_data(
|
|
||||||
surface_depth_format depth_format, size_t width, size_t height,
|
|
||||||
Args&& ...args
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct render_target_traits
|
|
||||||
{
|
|
||||||
using surface_storage_type = ComPtr<ID3D12Resource>;
|
|
||||||
using surface_type = ID3D12Resource*;
|
|
||||||
using command_list_type = ID3D12GraphicsCommandList*;
|
|
||||||
using download_buffer_object = std::tuple<size_t, size_t, size_t, ComPtr<ID3D12Fence>, HANDLE>; // heap offset, size, last_put_pos, fence, handle
|
|
||||||
|
|
||||||
//TODO: Move this somewhere else
|
|
||||||
bool depth_is_dirty = false;
|
|
||||||
|
|
||||||
static
|
|
||||||
ComPtr<ID3D12Resource> create_new_surface(
|
|
||||||
u32 address,
|
|
||||||
surface_color_format color_format, size_t width, size_t height, size_t /*pitch*/,
|
|
||||||
ID3D12Device* device, const std::array<float, 4> &clear_color, float, u8)
|
|
||||||
{
|
|
||||||
DXGI_FORMAT dxgi_format = get_color_surface_format(color_format);
|
|
||||||
ComPtr<ID3D12Resource> rtt;
|
|
||||||
LOG_WARNING(RSX, "Creating RTT");
|
|
||||||
|
|
||||||
D3D12_CLEAR_VALUE clear_color_value = {};
|
|
||||||
clear_color_value.Format = dxgi_format;
|
|
||||||
clear_color_value.Color[0] = clear_color[0];
|
|
||||||
clear_color_value.Color[1] = clear_color[1];
|
|
||||||
clear_color_value.Color[2] = clear_color[2];
|
|
||||||
clear_color_value.Color[3] = clear_color[3];
|
|
||||||
|
|
||||||
device->CreateCommittedResource(
|
|
||||||
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
|
|
||||||
D3D12_HEAP_FLAG_NONE,
|
|
||||||
&CD3DX12_RESOURCE_DESC::Tex2D(dxgi_format, (UINT)width, (UINT)height, 1, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET),
|
|
||||||
D3D12_RESOURCE_STATE_RENDER_TARGET,
|
|
||||||
&clear_color_value,
|
|
||||||
IID_PPV_ARGS(rtt.GetAddressOf())
|
|
||||||
);
|
|
||||||
|
|
||||||
std::wstring name = L"rtt_@" + std::to_wstring(address);
|
|
||||||
rtt->SetName(name.c_str());
|
|
||||||
|
|
||||||
return rtt;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
void prepare_rtt_for_drawing(
|
|
||||||
ID3D12GraphicsCommandList* command_list,
|
|
||||||
ID3D12Resource* rtt)
|
|
||||||
{
|
|
||||||
command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(rtt, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET));
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
void prepare_rtt_for_sampling(
|
|
||||||
ID3D12GraphicsCommandList* command_list,
|
|
||||||
ID3D12Resource* rtt)
|
|
||||||
{
|
|
||||||
command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(rtt, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_GENERIC_READ));
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
ComPtr<ID3D12Resource> create_new_surface(
|
|
||||||
u32 address,
|
|
||||||
surface_depth_format surfaceDepthFormat, size_t width, size_t height, size_t /*pitch*/,
|
|
||||||
ID3D12Device* device, const std::array<float, 4>& , float clear_depth, u8 clear_stencil)
|
|
||||||
{
|
|
||||||
D3D12_CLEAR_VALUE clear_depth_value = {};
|
|
||||||
clear_depth_value.DepthStencil.Depth = clear_depth;
|
|
||||||
clear_depth_value.DepthStencil.Stencil = clear_stencil;
|
|
||||||
|
|
||||||
DXGI_FORMAT dxgi_format = get_depth_stencil_typeless_surface_format(surfaceDepthFormat);
|
|
||||||
clear_depth_value.Format = get_depth_stencil_surface_clear_format(surfaceDepthFormat);
|
|
||||||
|
|
||||||
ComPtr<ID3D12Resource> new_depth_stencil;
|
|
||||||
device->CreateCommittedResource(
|
|
||||||
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
|
|
||||||
D3D12_HEAP_FLAG_NONE,
|
|
||||||
&CD3DX12_RESOURCE_DESC::Tex2D(dxgi_format, (UINT)width, (UINT)height, 1, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL),
|
|
||||||
D3D12_RESOURCE_STATE_DEPTH_WRITE,
|
|
||||||
&clear_depth_value,
|
|
||||||
IID_PPV_ARGS(new_depth_stencil.GetAddressOf())
|
|
||||||
);
|
|
||||||
std::wstring name = L"ds_@" + std::to_wstring(address);
|
|
||||||
new_depth_stencil->SetName(name.c_str());
|
|
||||||
|
|
||||||
return new_depth_stencil;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
void prepare_ds_for_drawing(
|
|
||||||
ID3D12GraphicsCommandList* command_list,
|
|
||||||
ID3D12Resource* ds)
|
|
||||||
{
|
|
||||||
// set the resource as depth write
|
|
||||||
command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(ds, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_DEPTH_WRITE));
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
void prepare_ds_for_sampling(
|
|
||||||
ID3D12GraphicsCommandList* command_list,
|
|
||||||
ID3D12Resource* ds)
|
|
||||||
{
|
|
||||||
command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(ds, D3D12_RESOURCE_STATE_DEPTH_WRITE, D3D12_RESOURCE_STATE_GENERIC_READ));
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
bool rtt_has_format_width_height(const ComPtr<ID3D12Resource> &rtt, surface_color_format surface_color_format, size_t width, size_t height, bool=false)
|
|
||||||
{
|
|
||||||
DXGI_FORMAT dxgi_format = get_color_surface_format(surface_color_format);
|
|
||||||
return rtt->GetDesc().Format == dxgi_format && rtt->GetDesc().Width == width && rtt->GetDesc().Height == height;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
bool ds_has_format_width_height(const ComPtr<ID3D12Resource> &rtt, surface_depth_format, size_t width, size_t height, bool=false)
|
|
||||||
{
|
|
||||||
//TODO: Check format
|
|
||||||
return rtt->GetDesc().Width == width && rtt->GetDesc().Height == height;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
std::tuple<size_t, size_t, size_t, ComPtr<ID3D12Fence>, HANDLE> issue_download_command(
|
|
||||||
ID3D12Resource* rtt,
|
|
||||||
surface_color_format color_format, size_t width, size_t height,
|
|
||||||
ID3D12Device* device, ID3D12CommandQueue* command_queue, d3d12_data_heap &readback_heap, resource_storage &res_store
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
std::tuple<size_t, size_t, size_t, ComPtr<ID3D12Fence>, HANDLE> issue_depth_download_command(
|
|
||||||
ID3D12Resource* ds,
|
|
||||||
surface_depth_format depth_format, size_t width, size_t height,
|
|
||||||
ID3D12Device* device, ID3D12CommandQueue* command_queue, d3d12_data_heap &readback_heap, resource_storage &res_store
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
std::tuple<size_t, size_t, size_t, ComPtr<ID3D12Fence>, HANDLE> issue_stencil_download_command(
|
|
||||||
ID3D12Resource* stencil,
|
|
||||||
size_t width, size_t height,
|
|
||||||
ID3D12Device* device, ID3D12CommandQueue* command_queue, d3d12_data_heap &readback_heap, resource_storage &res_store
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
gsl::span<const gsl::byte> map_downloaded_buffer(const std::tuple<size_t, size_t, size_t, ComPtr<ID3D12Fence>, HANDLE> &sync_data,
|
|
||||||
ID3D12Device*, ID3D12CommandQueue*, d3d12_data_heap &readback_heap, resource_storage&)
|
|
||||||
{
|
|
||||||
size_t offset;
|
|
||||||
size_t buffer_size;
|
|
||||||
size_t current_put_pos_minus_one;
|
|
||||||
HANDLE handle;
|
|
||||||
std::tie(offset, buffer_size, current_put_pos_minus_one, std::ignore, handle) = sync_data;
|
|
||||||
WaitForSingleObjectEx(handle, INFINITE, FALSE);
|
|
||||||
CloseHandle(handle);
|
|
||||||
|
|
||||||
readback_heap.m_get_pos = current_put_pos_minus_one;
|
|
||||||
const gsl::byte *mapped_buffer = readback_heap.map<const gsl::byte>(CD3DX12_RANGE(offset, offset + buffer_size));
|
|
||||||
return { mapped_buffer , ::narrow<int>(buffer_size) };
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
void unmap_downloaded_buffer(const std::tuple<size_t, size_t, size_t, ComPtr<ID3D12Fence>, HANDLE> &,
|
|
||||||
ID3D12Device*, ID3D12CommandQueue*, d3d12_data_heap &readback_heap, resource_storage&)
|
|
||||||
{
|
|
||||||
readback_heap.unmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
static ID3D12Resource* get(const ComPtr<ID3D12Resource> &in)
|
|
||||||
{
|
|
||||||
return in.Get();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct render_targets : public rsx::surface_store_deprecated<render_target_traits>
|
|
||||||
{
|
|
||||||
INT g_descriptor_stride_rtv;
|
|
||||||
|
|
||||||
D3D12_CPU_DESCRIPTOR_HANDLE current_rtts_handle;
|
|
||||||
D3D12_CPU_DESCRIPTOR_HANDLE current_ds_handle;
|
|
||||||
|
|
||||||
void init(ID3D12Device *device);
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,498 +0,0 @@
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "stdafx_d3d12.h"
|
|
||||||
#include "D3D12GSRender.h"
|
|
||||||
#include "d3dx12.h"
|
|
||||||
#include "../Common/TextureUtils.h"
|
|
||||||
// For clarity this code deals with texture but belongs to D3D12GSRender class
|
|
||||||
#include "D3D12Formats.h"
|
|
||||||
#include "../rsx_methods.h"
|
|
||||||
|
|
||||||
bool is_dxtc_format(u32 texture_format)
|
|
||||||
{
|
|
||||||
switch (texture_format)
|
|
||||||
{
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_DXT1:
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_DXT23:
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_DXT45:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
D3D12_COMPARISON_FUNC get_sampler_compare_func[] =
|
|
||||||
{
|
|
||||||
D3D12_COMPARISON_FUNC_NEVER,
|
|
||||||
D3D12_COMPARISON_FUNC_LESS,
|
|
||||||
D3D12_COMPARISON_FUNC_EQUAL,
|
|
||||||
D3D12_COMPARISON_FUNC_LESS_EQUAL,
|
|
||||||
D3D12_COMPARISON_FUNC_GREATER,
|
|
||||||
D3D12_COMPARISON_FUNC_NOT_EQUAL,
|
|
||||||
D3D12_COMPARISON_FUNC_GREATER_EQUAL,
|
|
||||||
D3D12_COMPARISON_FUNC_ALWAYS
|
|
||||||
};
|
|
||||||
|
|
||||||
D3D12_SAMPLER_DESC get_sampler_desc(const rsx::fragment_texture &texture)
|
|
||||||
{
|
|
||||||
D3D12_SAMPLER_DESC samplerDesc = {};
|
|
||||||
samplerDesc.Filter = get_texture_filter(texture.min_filter(), texture.mag_filter());
|
|
||||||
samplerDesc.AddressU = get_texture_wrap_mode(texture.wrap_s());
|
|
||||||
samplerDesc.AddressV = get_texture_wrap_mode(texture.wrap_t());
|
|
||||||
samplerDesc.AddressW = get_texture_wrap_mode(texture.wrap_r());
|
|
||||||
samplerDesc.ComparisonFunc = get_sampler_compare_func[static_cast<u8>(texture.zfunc())];
|
|
||||||
samplerDesc.MaxAnisotropy = get_texture_max_aniso(texture.max_aniso());
|
|
||||||
samplerDesc.MipLODBias = texture.bias();
|
|
||||||
samplerDesc.BorderColor[0] = (FLOAT)texture.border_color();
|
|
||||||
samplerDesc.BorderColor[1] = (FLOAT)texture.border_color();
|
|
||||||
samplerDesc.BorderColor[2] = (FLOAT)texture.border_color();
|
|
||||||
samplerDesc.BorderColor[3] = (FLOAT)texture.border_color();
|
|
||||||
samplerDesc.MinLOD = (FLOAT)(texture.min_lod());
|
|
||||||
samplerDesc.MaxLOD = (FLOAT)(texture.max_lod());
|
|
||||||
return samplerDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
CD3DX12_RESOURCE_DESC get_texture_description(const rsx::fragment_texture &texture)
|
|
||||||
{
|
|
||||||
const u8 format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
|
|
||||||
DXGI_FORMAT dxgi_format = get_texture_format(format);
|
|
||||||
u16 width = texture.width();
|
|
||||||
u16 height = texture.height();
|
|
||||||
u16 depth = texture.depth();
|
|
||||||
u16 miplevels = texture.get_exact_mipmap_count();
|
|
||||||
|
|
||||||
// DXTC uses 4x4 block texture and align to multiple of 4.
|
|
||||||
if (is_dxtc_format(format))
|
|
||||||
{
|
|
||||||
width = align(width, 4);
|
|
||||||
height = align(height, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (texture.get_extended_texture_dimension())
|
|
||||||
{
|
|
||||||
case rsx::texture_dimension_extended::texture_dimension_1d:
|
|
||||||
return CD3DX12_RESOURCE_DESC::Tex1D(dxgi_format, width, 1, miplevels);
|
|
||||||
case rsx::texture_dimension_extended::texture_dimension_2d:
|
|
||||||
return CD3DX12_RESOURCE_DESC::Tex2D(dxgi_format, width, height, 1, miplevels);
|
|
||||||
case rsx::texture_dimension_extended::texture_dimension_cubemap:
|
|
||||||
return CD3DX12_RESOURCE_DESC::Tex2D(dxgi_format, width, height, 6, miplevels);
|
|
||||||
case rsx::texture_dimension_extended::texture_dimension_3d:
|
|
||||||
return CD3DX12_RESOURCE_DESC::Tex3D(dxgi_format, width, height, depth, miplevels);
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Unknown texture dimension" HERE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
/**
|
|
||||||
* Allocate buffer in texture_buffer_heap big enough and upload data into existing_texture which should be in COPY_DEST state
|
|
||||||
*/
|
|
||||||
void update_existing_texture(
|
|
||||||
const rsx::fragment_texture &texture,
|
|
||||||
ID3D12GraphicsCommandList *command_list,
|
|
||||||
d3d12_data_heap &texture_buffer_heap,
|
|
||||||
ID3D12Resource *existing_texture)
|
|
||||||
{
|
|
||||||
size_t w = texture.width(), h = texture.height();
|
|
||||||
|
|
||||||
const u8 format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
|
|
||||||
DXGI_FORMAT dxgi_format = get_texture_format(format);
|
|
||||||
|
|
||||||
size_t buffer_size = get_placed_texture_storage_size(texture, 256);
|
|
||||||
size_t heap_offset = texture_buffer_heap.alloc<D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT>(buffer_size);
|
|
||||||
size_t mip_level = 0;
|
|
||||||
|
|
||||||
void *mapped_buffer_ptr = texture_buffer_heap.map<void>(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
gsl::span<gsl::byte> mapped_buffer{ (gsl::byte*)mapped_buffer_ptr, ::narrow<int>(buffer_size) };
|
|
||||||
std::vector<rsx_subresource_layout> input_layouts = get_subresources_layout(texture);
|
|
||||||
u8 block_size_in_bytes = get_format_block_size_in_bytes(format);
|
|
||||||
u8 block_size_in_texel = get_format_block_size_in_texel(format);
|
|
||||||
bool is_swizzled = !(texture.format() & CELL_GCM_TEXTURE_LN);
|
|
||||||
size_t offset_in_buffer = 0;
|
|
||||||
for (const rsx_subresource_layout &layout : input_layouts)
|
|
||||||
{
|
|
||||||
texture_uploader_capabilities caps{ false, false, 256 };
|
|
||||||
upload_texture_subresource(mapped_buffer.subspan(offset_in_buffer), layout, format, is_swizzled, caps);
|
|
||||||
UINT row_pitch = align(layout.width_in_block * block_size_in_bytes, 256);
|
|
||||||
command_list->CopyTextureRegion(&CD3DX12_TEXTURE_COPY_LOCATION(existing_texture, (UINT)mip_level), 0, 0, 0,
|
|
||||||
&CD3DX12_TEXTURE_COPY_LOCATION(texture_buffer_heap.get_heap(),
|
|
||||||
{ heap_offset + offset_in_buffer,
|
|
||||||
{
|
|
||||||
dxgi_format,
|
|
||||||
(UINT)layout.width_in_block * block_size_in_texel,
|
|
||||||
(UINT)layout.height_in_block * block_size_in_texel,
|
|
||||||
(UINT)layout.depth,
|
|
||||||
row_pitch
|
|
||||||
}
|
|
||||||
}), nullptr);
|
|
||||||
|
|
||||||
offset_in_buffer += row_pitch * layout.height_in_block * layout.depth;
|
|
||||||
offset_in_buffer = align(offset_in_buffer, 512);
|
|
||||||
mip_level++;
|
|
||||||
}
|
|
||||||
texture_buffer_heap.unmap(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
|
||||||
|
|
||||||
command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(existing_texture, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_GENERIC_READ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a texture residing in default heap and generate uploads commands in commandList,
|
|
||||||
* using a temporary texture buffer.
|
|
||||||
*/
|
|
||||||
ComPtr<ID3D12Resource> upload_single_texture(
|
|
||||||
const rsx::fragment_texture &texture,
|
|
||||||
ID3D12Device *device,
|
|
||||||
ID3D12GraphicsCommandList *command_list,
|
|
||||||
d3d12_data_heap &texture_buffer_heap)
|
|
||||||
{
|
|
||||||
ComPtr<ID3D12Resource> result;
|
|
||||||
CHECK_HRESULT(device->CreateCommittedResource(
|
|
||||||
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
|
|
||||||
D3D12_HEAP_FLAG_NONE,
|
|
||||||
&get_texture_description(texture),
|
|
||||||
D3D12_RESOURCE_STATE_COPY_DEST,
|
|
||||||
nullptr,
|
|
||||||
IID_PPV_ARGS(result.GetAddressOf())
|
|
||||||
));
|
|
||||||
|
|
||||||
update_existing_texture(texture, command_list, texture_buffer_heap, result.Get());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
D3D12_SHADER_RESOURCE_VIEW_DESC get_srv_descriptor_with_dimensions(const rsx::fragment_texture &tex)
|
|
||||||
{
|
|
||||||
D3D12_SHADER_RESOURCE_VIEW_DESC shared_resource_view_desc = {};
|
|
||||||
switch (tex.get_extended_texture_dimension())
|
|
||||||
{
|
|
||||||
case rsx::texture_dimension_extended::texture_dimension_1d:
|
|
||||||
shared_resource_view_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE1D;
|
|
||||||
shared_resource_view_desc.Texture1D.MipLevels = tex.get_exact_mipmap_count();
|
|
||||||
return shared_resource_view_desc;
|
|
||||||
case rsx::texture_dimension_extended::texture_dimension_2d:
|
|
||||||
shared_resource_view_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
|
|
||||||
shared_resource_view_desc.Texture2D.MipLevels = tex.get_exact_mipmap_count();
|
|
||||||
return shared_resource_view_desc;
|
|
||||||
case rsx::texture_dimension_extended::texture_dimension_cubemap:
|
|
||||||
shared_resource_view_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBE;
|
|
||||||
shared_resource_view_desc.TextureCube.MipLevels = tex.get_exact_mipmap_count();
|
|
||||||
return shared_resource_view_desc;
|
|
||||||
case rsx::texture_dimension_extended::texture_dimension_3d:
|
|
||||||
shared_resource_view_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE3D;
|
|
||||||
shared_resource_view_desc.Texture3D.MipLevels = tex.get_exact_mipmap_count();
|
|
||||||
return shared_resource_view_desc;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Wrong texture dimension" HERE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12GSRender::upload_textures(ID3D12GraphicsCommandList *command_list, size_t texture_count)
|
|
||||||
{
|
|
||||||
for (u32 i = 0; i < texture_count; ++i)
|
|
||||||
{
|
|
||||||
if (!m_textures_dirty[i])
|
|
||||||
continue;
|
|
||||||
m_textures_dirty[i] = false;
|
|
||||||
|
|
||||||
if (!rsx::method_registers.fragment_textures[i].enabled())
|
|
||||||
{
|
|
||||||
// Now fill remaining texture slots with dummy texture/sampler
|
|
||||||
|
|
||||||
D3D12_SHADER_RESOURCE_VIEW_DESC shader_resource_view_desc = {};
|
|
||||||
shader_resource_view_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
|
|
||||||
shader_resource_view_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
||||||
shader_resource_view_desc.Texture2D.MipLevels = 1;
|
|
||||||
shader_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0);
|
|
||||||
|
|
||||||
m_device->CreateShaderResourceView(m_dummy_texture, &shader_resource_view_desc,
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(m_current_texture_descriptors->GetCPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((UINT)i, m_descriptor_stride_srv_cbv_uav)
|
|
||||||
);
|
|
||||||
|
|
||||||
D3D12_SAMPLER_DESC sampler_desc = {};
|
|
||||||
sampler_desc.Filter = D3D12_FILTER_MIN_MAG_MIP_POINT;
|
|
||||||
sampler_desc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
|
||||||
sampler_desc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
|
||||||
sampler_desc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
|
||||||
|
|
||||||
m_device->CreateSampler(&sampler_desc,
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(m_current_sampler_descriptors->GetCPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((UINT)i, m_descriptor_stride_samplers));
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
size_t w = rsx::method_registers.fragment_textures[i].width(), h = rsx::method_registers.fragment_textures[i].height();
|
|
||||||
|
|
||||||
if (!w || !h)
|
|
||||||
{
|
|
||||||
LOG_ERROR(RSX, "Texture upload requested but invalid texture dimensions passed");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const u32 texaddr = rsx::get_address(rsx::method_registers.fragment_textures[i].offset(), rsx::method_registers.fragment_textures[i].location());
|
|
||||||
|
|
||||||
const u8 format = rsx::method_registers.fragment_textures[i].format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
|
|
||||||
bool is_swizzled = !(rsx::method_registers.fragment_textures[i].format() & CELL_GCM_TEXTURE_LN);
|
|
||||||
|
|
||||||
ID3D12Resource *vram_texture;
|
|
||||||
std::pair<texture_entry, ComPtr<ID3D12Resource> > *cached_texture = m_texture_cache.find_data_if_available(texaddr);
|
|
||||||
bool is_render_target = false, is_depth_stencil_texture = false;
|
|
||||||
|
|
||||||
if (vram_texture = m_rtts.get_texture_from_render_target_if_applicable(texaddr))
|
|
||||||
{
|
|
||||||
is_render_target = true;
|
|
||||||
}
|
|
||||||
else if (vram_texture = m_rtts.get_texture_from_depth_stencil_if_applicable(texaddr))
|
|
||||||
{
|
|
||||||
is_depth_stencil_texture = true;
|
|
||||||
}
|
|
||||||
else if (cached_texture != nullptr && (cached_texture->first == texture_entry(format, w, h, rsx::method_registers.fragment_textures[i].depth(), rsx::method_registers.fragment_textures[i].get_exact_mipmap_count())))
|
|
||||||
{
|
|
||||||
if (cached_texture->first.m_is_dirty)
|
|
||||||
{
|
|
||||||
command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(cached_texture->second.Get(), D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_COPY_DEST));
|
|
||||||
update_existing_texture(rsx::method_registers.fragment_textures[i], command_list, m_buffer_data, cached_texture->second.Get());
|
|
||||||
m_texture_cache.protect_data(texaddr, texaddr, get_texture_size(rsx::method_registers.fragment_textures[i]));
|
|
||||||
}
|
|
||||||
vram_texture = cached_texture->second.Get();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (cached_texture != nullptr)
|
|
||||||
get_current_resource_storage().dirty_textures.push_back(m_texture_cache.remove_from_cache(texaddr));
|
|
||||||
ComPtr<ID3D12Resource> tex = upload_single_texture(rsx::method_registers.fragment_textures[i], m_device.Get(), command_list, m_buffer_data);
|
|
||||||
std::wstring name = L"texture_@" + std::to_wstring(texaddr);
|
|
||||||
tex->SetName(name.c_str());
|
|
||||||
vram_texture = tex.Get();
|
|
||||||
m_texture_cache.store_and_protect_data(texaddr, texaddr, get_texture_size(rsx::method_registers.fragment_textures[i]), format, w, h, rsx::method_registers.fragment_textures[i].depth(), rsx::method_registers.fragment_textures[i].get_exact_mipmap_count(), tex);
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_SHADER_RESOURCE_VIEW_DESC shared_resource_view_desc = get_srv_descriptor_with_dimensions(rsx::method_registers.fragment_textures[i]);
|
|
||||||
shared_resource_view_desc.Format = get_texture_format(format);
|
|
||||||
|
|
||||||
bool requires_remap = false;
|
|
||||||
std::array<INT, 4> channel_mapping = {};
|
|
||||||
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
LOG_ERROR(RSX, "Unimplemented mapping for texture format: 0x%x", format);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_HILO8:
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_DXT1:
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_DXT23:
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_DXT45:
|
|
||||||
case CELL_GCM_TEXTURE_DEPTH24_D8:
|
|
||||||
case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT:
|
|
||||||
case CELL_GCM_TEXTURE_DEPTH16:
|
|
||||||
case CELL_GCM_TEXTURE_DEPTH16_FLOAT:
|
|
||||||
case CELL_GCM_TEXTURE_X32_FLOAT:
|
|
||||||
case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
|
|
||||||
case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT:
|
|
||||||
case CELL_GCM_TEXTURE_R5G5B5A1:
|
|
||||||
case CELL_GCM_TEXTURE_D1R5G5B5:
|
|
||||||
case CELL_GCM_TEXTURE_A1R5G5B5:
|
|
||||||
case CELL_GCM_TEXTURE_A4R4G4B4:
|
|
||||||
case CELL_GCM_TEXTURE_R5G6B5:
|
|
||||||
shared_resource_view_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CELL_GCM_TEXTURE_B8:
|
|
||||||
shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CELL_GCM_TEXTURE_G8B8:
|
|
||||||
{
|
|
||||||
u8 remap_a = rsx::method_registers.fragment_textures[i].remap() & 0x3;
|
|
||||||
u8 remap_r = (rsx::method_registers.fragment_textures[i].remap() >> 2) & 0x3;
|
|
||||||
u8 remap_g = (rsx::method_registers.fragment_textures[i].remap() >> 4) & 0x3;
|
|
||||||
u8 remap_b = (rsx::method_registers.fragment_textures[i].remap() >> 6) & 0x3;
|
|
||||||
|
|
||||||
if (is_render_target)
|
|
||||||
{
|
|
||||||
// ARGB format
|
|
||||||
// Data comes from RTT, stored as RGBA already
|
|
||||||
const int RemapValue[4] =
|
|
||||||
{
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2
|
|
||||||
};
|
|
||||||
|
|
||||||
channel_mapping = { RemapValue[remap_r], RemapValue[remap_g], RemapValue[remap_b], RemapValue[remap_a] };
|
|
||||||
requires_remap = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// ARGB format
|
|
||||||
// Data comes from RSX mem, stored as ARGB already
|
|
||||||
const int RemapValue[4] =
|
|
||||||
{
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1
|
|
||||||
};
|
|
||||||
|
|
||||||
channel_mapping = { RemapValue[remap_r], RemapValue[remap_g], RemapValue[remap_b], RemapValue[remap_a] };
|
|
||||||
requires_remap = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case CELL_GCM_TEXTURE_R6G5B5: // TODO: Remap it to another format here, so it's not glitched out
|
|
||||||
shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CELL_GCM_TEXTURE_X16:
|
|
||||||
shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CELL_GCM_TEXTURE_Y16_X16:
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8:
|
|
||||||
shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CELL_GCM_TEXTURE_Y16_X16_FLOAT:
|
|
||||||
shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8:
|
|
||||||
shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CELL_GCM_TEXTURE_D8R8G8B8:
|
|
||||||
shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CELL_GCM_TEXTURE_A8R8G8B8:
|
|
||||||
{
|
|
||||||
u8 remap_a = rsx::method_registers.fragment_textures[i].remap() & 0x3;
|
|
||||||
u8 remap_r = (rsx::method_registers.fragment_textures[i].remap() >> 2) & 0x3;
|
|
||||||
u8 remap_g = (rsx::method_registers.fragment_textures[i].remap() >> 4) & 0x3;
|
|
||||||
u8 remap_b = (rsx::method_registers.fragment_textures[i].remap() >> 6) & 0x3;
|
|
||||||
|
|
||||||
if (is_render_target)
|
|
||||||
{
|
|
||||||
// ARGB format
|
|
||||||
// Data comes from RTT, stored as RGBA already
|
|
||||||
const int RemapValue[4] =
|
|
||||||
{
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2
|
|
||||||
};
|
|
||||||
|
|
||||||
channel_mapping = { RemapValue[remap_r], RemapValue[remap_g], RemapValue[remap_b], RemapValue[remap_a] };
|
|
||||||
requires_remap = true;
|
|
||||||
}
|
|
||||||
else if (is_depth_stencil_texture)
|
|
||||||
{
|
|
||||||
shared_resource_view_desc.Format = DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
|
|
||||||
shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// ARGB format
|
|
||||||
// Data comes from RSX mem, stored as ARGB already
|
|
||||||
const int RemapValue[4] =
|
|
||||||
{
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2,
|
|
||||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3
|
|
||||||
};
|
|
||||||
|
|
||||||
channel_mapping = { RemapValue[remap_r], RemapValue[remap_g], RemapValue[remap_b], RemapValue[remap_a] };
|
|
||||||
requires_remap = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (requires_remap)
|
|
||||||
{
|
|
||||||
auto decoded_remap = rsx::method_registers.fragment_textures[i].decoded_remap();
|
|
||||||
u8 remapped_inputs[] = { decoded_remap.second[1], decoded_remap.second[2], decoded_remap.second[3], decoded_remap.second[0] };
|
|
||||||
|
|
||||||
for (u8 channel = 0; channel < 4; channel++)
|
|
||||||
{
|
|
||||||
switch (remapped_inputs[channel])
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
case CELL_GCM_TEXTURE_REMAP_REMAP:
|
|
||||||
break;
|
|
||||||
case CELL_GCM_TEXTURE_REMAP_ONE:
|
|
||||||
channel_mapping[channel] = D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1;
|
|
||||||
break;
|
|
||||||
case CELL_GCM_TEXTURE_REMAP_ZERO:
|
|
||||||
channel_mapping[channel] = D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
|
||||||
channel_mapping[0],
|
|
||||||
channel_mapping[1],
|
|
||||||
channel_mapping[2],
|
|
||||||
channel_mapping[3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_device->CreateShaderResourceView(vram_texture, &shared_resource_view_desc,
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(m_current_texture_descriptors->GetCPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((UINT)i, m_descriptor_stride_srv_cbv_uav)
|
|
||||||
);
|
|
||||||
|
|
||||||
m_device->CreateSampler(&get_sampler_desc(rsx::method_registers.fragment_textures[i]),
|
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(m_current_sampler_descriptors->GetCPUDescriptorHandleForHeapStart())
|
|
||||||
.Offset((UINT)i, m_descriptor_stride_samplers));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,177 +0,0 @@
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "stdafx_d3d12.h"
|
|
||||||
#include "D3D12GSRender.h"
|
|
||||||
#include "d3dx12.h"
|
|
||||||
#define STRINGIFY(x) #x
|
|
||||||
|
|
||||||
extern PFN_D3D12_SERIALIZE_ROOT_SIGNATURE wrapD3D12SerializeRootSignature;
|
|
||||||
extern pD3DCompile wrapD3DCompile;
|
|
||||||
|
|
||||||
void D3D12GSRender::shader::init(ID3D12Device *device, ID3D12CommandQueue *gfx_command_queue)
|
|
||||||
{
|
|
||||||
const char *fsCode = STRINGIFY(
|
|
||||||
Texture2D InputTexture : register(t0); \n
|
|
||||||
sampler bilinearSampler : register(s0); \n
|
|
||||||
|
|
||||||
struct PixelInput \n
|
|
||||||
{ \n
|
|
||||||
float4 Pos : SV_POSITION; \n
|
|
||||||
float2 TexCoords : TEXCOORDS0; \n
|
|
||||||
}; \n
|
|
||||||
|
|
||||||
float4 main(PixelInput In) : SV_TARGET \n
|
|
||||||
{ \n
|
|
||||||
return InputTexture.Sample(bilinearSampler, In.TexCoords); \n
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
Microsoft::WRL::ComPtr<ID3DBlob> fsBytecode;
|
|
||||||
Microsoft::WRL::ComPtr<ID3DBlob> errorBlob;
|
|
||||||
CHECK_HRESULT(wrapD3DCompile(fsCode, strlen(fsCode), "test", nullptr, nullptr, "main", "ps_5_0", 0, 0, &fsBytecode, errorBlob.GetAddressOf()));
|
|
||||||
|
|
||||||
const char *vsCode = STRINGIFY(
|
|
||||||
struct VertexInput \n
|
|
||||||
{ \n
|
|
||||||
float2 Pos : POSITION; \n
|
|
||||||
float2 TexCoords : TEXCOORDS0; \n
|
|
||||||
}; \n
|
|
||||||
|
|
||||||
struct PixelInput \n
|
|
||||||
{ \n
|
|
||||||
float4 Pos : SV_POSITION; \n
|
|
||||||
float2 TexCoords : TEXCOORDS0; \n
|
|
||||||
}; \n
|
|
||||||
|
|
||||||
PixelInput main(VertexInput In) \n
|
|
||||||
{ \n
|
|
||||||
PixelInput Out; \n
|
|
||||||
Out.Pos = float4(In.Pos, 0., 1.); \n
|
|
||||||
Out.TexCoords = In.TexCoords; \n
|
|
||||||
return Out; \n
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
Microsoft::WRL::ComPtr<ID3DBlob> vsBytecode;
|
|
||||||
CHECK_HRESULT(wrapD3DCompile(vsCode, strlen(vsCode), "test", nullptr, nullptr, "main", "vs_5_0", 0, 0, &vsBytecode, errorBlob.GetAddressOf()));
|
|
||||||
|
|
||||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {};
|
|
||||||
psoDesc.PS.BytecodeLength = fsBytecode->GetBufferSize();
|
|
||||||
psoDesc.PS.pShaderBytecode = fsBytecode->GetBufferPointer();
|
|
||||||
psoDesc.VS.BytecodeLength = vsBytecode->GetBufferSize();
|
|
||||||
psoDesc.VS.pShaderBytecode = vsBytecode->GetBufferPointer();
|
|
||||||
psoDesc.NumRenderTargets = 1;
|
|
||||||
psoDesc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
||||||
psoDesc.SampleDesc.Count = 1;
|
|
||||||
psoDesc.SampleMask = UINT_MAX;
|
|
||||||
|
|
||||||
D3D12_INPUT_ELEMENT_DESC IADesc[2] = {};
|
|
||||||
IADesc[0].SemanticName = "POSITION";
|
|
||||||
IADesc[0].Format = DXGI_FORMAT_R32G32_FLOAT;
|
|
||||||
IADesc[1].SemanticName = "TEXCOORDS";
|
|
||||||
IADesc[1].Format = DXGI_FORMAT_R32G32_FLOAT;
|
|
||||||
IADesc[1].AlignedByteOffset = 2 * sizeof(float);
|
|
||||||
|
|
||||||
psoDesc.InputLayout.NumElements = 2;
|
|
||||||
psoDesc.InputLayout.pInputElementDescs = IADesc;
|
|
||||||
|
|
||||||
psoDesc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
|
|
||||||
psoDesc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID;
|
|
||||||
|
|
||||||
D3D12_DESCRIPTOR_RANGE descriptorRange[2] = {};
|
|
||||||
// Textures
|
|
||||||
descriptorRange[0].BaseShaderRegister = 0;
|
|
||||||
descriptorRange[0].NumDescriptors = 1;
|
|
||||||
descriptorRange[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
|
|
||||||
descriptorRange[1].BaseShaderRegister = 0;
|
|
||||||
descriptorRange[1].NumDescriptors = 1;
|
|
||||||
descriptorRange[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER;
|
|
||||||
D3D12_ROOT_PARAMETER RP[2] = {};
|
|
||||||
RP[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
|
|
||||||
RP[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
|
|
||||||
RP[0].DescriptorTable.pDescriptorRanges = &descriptorRange[0];
|
|
||||||
RP[0].DescriptorTable.NumDescriptorRanges = 1;
|
|
||||||
RP[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
|
|
||||||
RP[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
|
|
||||||
RP[1].DescriptorTable.pDescriptorRanges = &descriptorRange[1];
|
|
||||||
RP[1].DescriptorTable.NumDescriptorRanges = 1;
|
|
||||||
|
|
||||||
D3D12_ROOT_SIGNATURE_DESC rootSignatureDesc = {};
|
|
||||||
rootSignatureDesc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT;
|
|
||||||
rootSignatureDesc.NumParameters = 2;
|
|
||||||
rootSignatureDesc.pParameters = RP;
|
|
||||||
|
|
||||||
Microsoft::WRL::ComPtr<ID3DBlob> rootSignatureBlob;
|
|
||||||
|
|
||||||
CHECK_HRESULT(wrapD3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &rootSignatureBlob, &errorBlob));
|
|
||||||
CHECK_HRESULT(device->CreateRootSignature(0, rootSignatureBlob->GetBufferPointer(), rootSignatureBlob->GetBufferSize(), IID_PPV_ARGS(&root_signature)));
|
|
||||||
|
|
||||||
psoDesc.pRootSignature = root_signature;
|
|
||||||
psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
|
||||||
psoDesc.BlendState.RenderTarget[0].RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE_ALL;
|
|
||||||
|
|
||||||
CHECK_HRESULT(device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&pso)));
|
|
||||||
|
|
||||||
D3D12_DESCRIPTOR_HEAP_DESC textureHeapDesc = { D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV , 2, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE };
|
|
||||||
CHECK_HRESULT(
|
|
||||||
device->CreateDescriptorHeap(&textureHeapDesc, IID_PPV_ARGS(&texture_descriptor_heap))
|
|
||||||
);
|
|
||||||
D3D12_DESCRIPTOR_HEAP_DESC samplerHeapDesc = { D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER , 2, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE };
|
|
||||||
CHECK_HRESULT(
|
|
||||||
device->CreateDescriptorHeap(&samplerHeapDesc, IID_PPV_ARGS(&sampler_descriptor_heap))
|
|
||||||
);
|
|
||||||
|
|
||||||
ComPtr<ID3D12Fence> fence;
|
|
||||||
CHECK_HRESULT(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(fence.GetAddressOf())));
|
|
||||||
HANDLE handle = CreateEventEx(nullptr, FALSE, FALSE, EVENT_ALL_ACCESS);
|
|
||||||
fence->SetEventOnCompletion(1, handle);
|
|
||||||
|
|
||||||
float quadVertex[16] = {
|
|
||||||
-1., -1., 0., 1.,
|
|
||||||
-1., 1., 0., 0.,
|
|
||||||
1., -1., 1., 1.,
|
|
||||||
1., 1., 1., 0.,
|
|
||||||
};
|
|
||||||
|
|
||||||
ComPtr<ID3D12CommandAllocator> cmdlistAllocator;
|
|
||||||
CHECK_HRESULT(
|
|
||||||
device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(cmdlistAllocator.GetAddressOf()))
|
|
||||||
);
|
|
||||||
ComPtr<ID3D12GraphicsCommandList> cmdList;
|
|
||||||
CHECK_HRESULT(
|
|
||||||
device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, cmdlistAllocator.Get(),nullptr, IID_PPV_ARGS(cmdList.GetAddressOf()))
|
|
||||||
);
|
|
||||||
ComPtr<ID3D12Resource> intermediateBuffer;
|
|
||||||
CHECK_HRESULT(device->CreateCommittedResource(
|
|
||||||
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD),
|
|
||||||
D3D12_HEAP_FLAG_NONE,
|
|
||||||
&CD3DX12_RESOURCE_DESC::Buffer(16 * sizeof(float)),
|
|
||||||
D3D12_RESOURCE_STATE_GENERIC_READ,
|
|
||||||
nullptr,
|
|
||||||
IID_PPV_ARGS(intermediateBuffer.GetAddressOf())
|
|
||||||
));
|
|
||||||
|
|
||||||
CHECK_HRESULT(
|
|
||||||
device->CreateCommittedResource(
|
|
||||||
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
|
|
||||||
D3D12_HEAP_FLAG_NONE,
|
|
||||||
&CD3DX12_RESOURCE_DESC::Buffer(16 * sizeof(float)),
|
|
||||||
D3D12_RESOURCE_STATE_COPY_DEST,
|
|
||||||
nullptr,
|
|
||||||
IID_PPV_ARGS(&vertex_buffer)
|
|
||||||
));
|
|
||||||
|
|
||||||
D3D12_SUBRESOURCE_DATA vertexData = { reinterpret_cast<BYTE*>(quadVertex), 16 * sizeof(float), 1 };
|
|
||||||
|
|
||||||
UpdateSubresources(cmdList.Get(), vertex_buffer, intermediateBuffer.Get(), 0, 0, 1, &vertexData);
|
|
||||||
cmdList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(vertex_buffer, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER));
|
|
||||||
CHECK_HRESULT(cmdList->Close());
|
|
||||||
|
|
||||||
gfx_command_queue->ExecuteCommandLists(1, CommandListCast(cmdList.GetAddressOf()));
|
|
||||||
|
|
||||||
// Now wait until upload has completed
|
|
||||||
gfx_command_queue->Signal(fence.Get(), 1);
|
|
||||||
WaitForSingleObjectEx(handle, INFINITE, FALSE);
|
|
||||||
CloseHandle(handle);
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,74 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <d3d12.h>
|
|
||||||
#include <cassert>
|
|
||||||
#include <wrl/client.h>
|
|
||||||
#include "Emu/Memory/vm.h"
|
|
||||||
#include "Emu/RSX/GCM.h"
|
|
||||||
#include <locale>
|
|
||||||
#include <comdef.h>
|
|
||||||
|
|
||||||
|
|
||||||
using namespace Microsoft::WRL;
|
|
||||||
extern ID3D12Device* g_d3d12_device;
|
|
||||||
|
|
||||||
inline std::string get_hresult_message(HRESULT hr)
|
|
||||||
{
|
|
||||||
if (hr == DXGI_ERROR_DEVICE_REMOVED)
|
|
||||||
{
|
|
||||||
hr = g_d3d12_device->GetDeviceRemovedReason();
|
|
||||||
return fmt::format("D3D12 device was removed with error status 0x%X", hr);
|
|
||||||
}
|
|
||||||
|
|
||||||
_com_error error(hr);
|
|
||||||
#ifndef UNICODE
|
|
||||||
return error.ErrorMessage();
|
|
||||||
#else
|
|
||||||
using convert_type = std::codecvt<wchar_t, char, std::mbstate_t>;
|
|
||||||
return std::wstring_convert<convert_type>().to_bytes(error.ErrorMessage());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#define CHECK_HRESULT(expr) { HRESULT hr = (expr); if (FAILED(hr)) fmt::throw_exception("HRESULT = %s" HERE, get_hresult_message(hr)); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send data to dst pointer without polluting cache.
|
|
||||||
* Useful to write to mapped memory from upload heap.
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
void streamToBuffer(void* dst, void* src, size_t sizeInBytes)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < sizeInBytes / 16; i++)
|
|
||||||
{
|
|
||||||
const __m128i &srcPtr = _mm_loadu_si128((__m128i*) ((char*)src + i * 16));
|
|
||||||
_mm_stream_si128((__m128i*)((char*)dst + i * 16), srcPtr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* copy src to dst pointer without polluting cache.
|
|
||||||
* Useful to write to mapped memory from upload heap.
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
void streamBuffer(void* dst, void* src, size_t sizeInBytes)
|
|
||||||
{
|
|
||||||
// Assume 64 bytes cache line
|
|
||||||
int offset = 0;
|
|
||||||
bool isAligned = !((size_t)src & 15);
|
|
||||||
for (offset = 0; offset < sizeInBytes - 64; offset += 64)
|
|
||||||
{
|
|
||||||
char *line = (char*)src + offset;
|
|
||||||
char *dstline = (char*)dst + offset;
|
|
||||||
// prefetch next line
|
|
||||||
_mm_prefetch(line + 16, _MM_HINT_NTA);
|
|
||||||
__m128i srcPtr = isAligned ? _mm_load_si128((__m128i *)line) : _mm_loadu_si128((__m128i *)line);
|
|
||||||
_mm_stream_si128((__m128i*)dstline, srcPtr);
|
|
||||||
srcPtr = isAligned ? _mm_load_si128((__m128i *)(line + 16)) : _mm_loadu_si128((__m128i *)(line + 16));
|
|
||||||
_mm_stream_si128((__m128i*)(dstline + 16), srcPtr);
|
|
||||||
srcPtr = isAligned ? _mm_load_si128((__m128i *)(line + 32)) : _mm_loadu_si128((__m128i *)(line + 32));
|
|
||||||
_mm_stream_si128((__m128i*)(dstline + 32), srcPtr);
|
|
||||||
srcPtr = isAligned ? _mm_load_si128((__m128i *)(line + 48)) : _mm_loadu_si128((__m128i *)(line + 48));
|
|
||||||
_mm_stream_si128((__m128i*)(dstline + 48), srcPtr);
|
|
||||||
}
|
|
||||||
memcpy((char*)dst + offset, (char*)src + offset, sizeInBytes - offset);
|
|
||||||
}
|
|
|
@ -1,271 +0,0 @@
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "stdafx_d3d12.h"
|
|
||||||
#include "D3D12VertexProgramDecompiler.h"
|
|
||||||
#include "D3D12CommonDecompiler.h"
|
|
||||||
#include "Emu/System.h"
|
|
||||||
|
|
||||||
|
|
||||||
std::string D3D12VertexProgramDecompiler::getFloatTypeName(size_t elementCount)
|
|
||||||
{
|
|
||||||
return getFloatTypeNameImp(elementCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string D3D12VertexProgramDecompiler::getIntTypeName(size_t elementCount)
|
|
||||||
{
|
|
||||||
return "int4";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string D3D12VertexProgramDecompiler::getFunction(enum class FUNCTION f)
|
|
||||||
{
|
|
||||||
return getFunctionImp(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string D3D12VertexProgramDecompiler::compareFunction(COMPARE f, const std::string &Op0, const std::string &Op1, bool /*scalar*/)
|
|
||||||
{
|
|
||||||
return compareFunctionImp(f, Op0, Op1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12VertexProgramDecompiler::insertHeader(std::stringstream &OS)
|
|
||||||
{
|
|
||||||
OS << "cbuffer SCALE_OFFSET : register(b0)\n";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " float4x4 scaleOffsetMat;\n";
|
|
||||||
OS << " int4 userClipEnabled[2];\n";
|
|
||||||
OS << " float4 userClipFactor[2];\n";
|
|
||||||
OS << " float fog_param0;\n";
|
|
||||||
OS << " float fog_param1;\n";
|
|
||||||
OS << " int isAlphaTested;\n";
|
|
||||||
OS << " float alphaRef;\n";
|
|
||||||
OS << " float4 texture_parameters[16];\n";
|
|
||||||
OS << "};\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
bool declare_input(std::stringstream & OS, const std::tuple<size_t, std::string> &attribute, const std::vector<rsx_vertex_input> &inputs, size_t reg)
|
|
||||||
{
|
|
||||||
for (const auto &real_input : inputs)
|
|
||||||
{
|
|
||||||
if (static_cast<size_t>(real_input.location) != std::get<0>(attribute))
|
|
||||||
continue;
|
|
||||||
OS << "Buffer<" << (real_input.int_type ? "int4" : "float4") << "> " << std::get<1>(attribute) << "_buffer : register(t" << reg++ << ");\n";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12VertexProgramDecompiler::insertInputs(std::stringstream & OS, const std::vector<ParamType>& inputs)
|
|
||||||
{
|
|
||||||
std::vector<std::tuple<size_t, std::string>> input_data;
|
|
||||||
for (const ParamType PT : inputs)
|
|
||||||
{
|
|
||||||
for (const ParamItem &PI : PT.items)
|
|
||||||
{
|
|
||||||
input_data.push_back(std::make_tuple(PI.location, PI.name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::sort(input_data.begin(), input_data.end());
|
|
||||||
|
|
||||||
size_t t_register = 0;
|
|
||||||
for (const auto &attribute : input_data)
|
|
||||||
{
|
|
||||||
if (declare_input(OS, attribute, rsx_vertex_program.rsx_vertex_inputs, t_register))
|
|
||||||
t_register++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12VertexProgramDecompiler::insertConstants(std::stringstream & OS, const std::vector<ParamType> & constants)
|
|
||||||
{
|
|
||||||
OS << "cbuffer CONSTANT_BUFFER : register(b1)\n";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " float4 vc[468];\n";
|
|
||||||
OS << " uint transform_branch_bits;\n";
|
|
||||||
OS << "};\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12VertexProgramDecompiler::insertOutputs(std::stringstream & OS, const std::vector<ParamType> & outputs)
|
|
||||||
{
|
|
||||||
OS << "struct PixelInput\n";
|
|
||||||
OS << "{\n";
|
|
||||||
OS << " float4 dst_reg0 : SV_POSITION;\n";
|
|
||||||
OS << " float4 dst_reg1 : COLOR0;\n";
|
|
||||||
OS << " float4 dst_reg2 : COLOR1;\n";
|
|
||||||
OS << " float4 dst_reg3 : COLOR2;\n";
|
|
||||||
OS << " float4 dst_reg4 : COLOR3;\n";
|
|
||||||
OS << " float4 dst_reg5 : FOG;\n";
|
|
||||||
OS << " float4 dst_reg6 : TEXCOORD9;\n";
|
|
||||||
OS << " float4 dst_reg7 : TEXCOORD0;\n";
|
|
||||||
OS << " float4 dst_reg8 : TEXCOORD1;\n";
|
|
||||||
OS << " float4 dst_reg9 : TEXCOORD2;\n";
|
|
||||||
OS << " float4 dst_reg10 : TEXCOORD3;\n";
|
|
||||||
OS << " float4 dst_reg11 : TEXCOORD4;\n";
|
|
||||||
OS << " float4 dst_reg12 : TEXCOORD5;\n";
|
|
||||||
OS << " float4 dst_reg13 : TEXCOORD6;\n";
|
|
||||||
OS << " float4 dst_reg14 : TEXCOORD7;\n";
|
|
||||||
OS << " float4 dst_reg15 : TEXCOORD8;\n";
|
|
||||||
OS << " float4 dst_userClip0 : SV_ClipDistance0;\n";
|
|
||||||
OS << " float4 dst_userClip1 : SV_ClipDistance1;\n";
|
|
||||||
OS << "};\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
static const vertex_reg_info reg_table[] =
|
|
||||||
{
|
|
||||||
{ "gl_Position", false, "dst_reg0", "", false },
|
|
||||||
{ "diff_color", true, "dst_reg1", "", false },
|
|
||||||
{ "spec_color", true, "dst_reg2", "", false },
|
|
||||||
{ "front_diff_color", true, "dst_reg3", "", false },
|
|
||||||
{ "front_spec_color", true, "dst_reg4", "", false },
|
|
||||||
{ "fogc", true, "dst_reg5", ".xxxx", true },
|
|
||||||
{ "gl_ClipDistance[0]", false, "dst_reg5", ".y * userClipFactor[0].x", false, "userClipEnabled[0].x > 0", "0.5", "Out.dst_userClip0.x" },
|
|
||||||
{ "gl_ClipDistance[0]", false, "dst_reg5", ".z * userClipFactor[0].y", false, "userClipEnabled[0].y > 0", "0.5", "Out.dst_userClip0.y" },
|
|
||||||
{ "gl_ClipDistance[0]", false, "dst_reg5", ".w * userClipFactor[0].z", false, "userClipEnabled[0].z > 0", "0.5", "Out.dst_userClip0.z" },
|
|
||||||
//{ "gl_PointSize", false, "dst_reg6", ".x", false },
|
|
||||||
{ "gl_ClipDistance[0]", false, "dst_reg6", ".y * userClipFactor[0].w", false, "userClipEnabled[0].w > 0", "0.5", "Out.dst_userClip0.w" },
|
|
||||||
{ "gl_ClipDistance[0]", false, "dst_reg6", ".z * userClipFactor[1].x", false, "userClipEnabled[1].x > 0", "0.5", "Out.dst_userClip1.x" },
|
|
||||||
{ "gl_ClipDistance[0]", false, "dst_reg6", ".w * userClipFactor[1].y", false, "userClipEnabled[1].y > 0", "0.5", "Out.dst_userClip1.y" },
|
|
||||||
{ "tc9", false, "dst_reg6", "", false },
|
|
||||||
{ "tc0", true, "dst_reg7", "", false },
|
|
||||||
{ "tc1", true, "dst_reg8", "", false },
|
|
||||||
{ "tc2", true, "dst_reg9", "", false },
|
|
||||||
{ "tc3", true, "dst_reg10", "", false },
|
|
||||||
{ "tc4", true, "dst_reg11", "", false },
|
|
||||||
{ "tc5", true, "dst_reg12", "", false },
|
|
||||||
{ "tc6", true, "dst_reg13", "", false },
|
|
||||||
{ "tc7", true, "dst_reg14", "", false },
|
|
||||||
{ "tc8", true, "dst_reg15", "", false },
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
void add_input(std::stringstream & OS, const ParamItem &PI, const std::vector<rsx_vertex_input> &inputs)
|
|
||||||
{
|
|
||||||
for (const auto &real_input : inputs)
|
|
||||||
{
|
|
||||||
if (real_input.location != PI.location)
|
|
||||||
continue;
|
|
||||||
if (!real_input.is_array)
|
|
||||||
{
|
|
||||||
OS << " float4 " << PI.name << " = " << PI.name << "_buffer[0];\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (real_input.frequency > 1)
|
|
||||||
{
|
|
||||||
if (real_input.is_modulo)
|
|
||||||
{
|
|
||||||
OS << " float4 " << PI.name << " = " << PI.name << "_buffer[vertex_id % " << real_input.frequency << "];\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
OS << " float4 " << PI.name << " = " << PI.name << "_buffer[vertex_id / " << real_input.frequency << "];\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
OS << " float4 " << PI.name << " = " << PI.name << "_buffer[vertex_id];\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
OS << " float4 " << PI.name << " = float4(0., 0., 0., 1.);\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D12VertexProgramDecompiler::insertMainStart(std::stringstream & OS)
|
|
||||||
{
|
|
||||||
insert_d3d12_legacy_function(OS, false);
|
|
||||||
|
|
||||||
OS << "PixelInput main(uint vertex_id : SV_VertexID)\n";
|
|
||||||
OS << "{\n";
|
|
||||||
|
|
||||||
// Declare temp registers
|
|
||||||
for (const ParamType PT : m_parr.params[PF_PARAM_NONE])
|
|
||||||
{
|
|
||||||
for (const ParamItem &PI : PT.items)
|
|
||||||
{
|
|
||||||
OS << " " << PT.type << " " << PI.name;
|
|
||||||
if (!PI.value.empty())
|
|
||||||
OS << " = " << PI.value;
|
|
||||||
else
|
|
||||||
OS << " = " << "float4(0., 0., 0., 0.);";
|
|
||||||
OS << ";\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Declare outputs
|
|
||||||
for (const ParamType PT : m_parr.params[PF_PARAM_OUT])
|
|
||||||
{
|
|
||||||
for (const ParamItem &PI : PT.items)
|
|
||||||
{
|
|
||||||
OS << " " << PT.type << " " << PI.name;
|
|
||||||
if (!PI.value.empty())
|
|
||||||
OS << " = " << PI.value;
|
|
||||||
else
|
|
||||||
OS << " = " << "float4(0., 0., 0., 0.);";
|
|
||||||
OS << ";\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const ParamType PT : m_parr.params[PF_PARAM_IN])
|
|
||||||
{
|
|
||||||
for (const ParamItem &PI : PT.items)
|
|
||||||
{
|
|
||||||
add_input(OS, PI, rsx_vertex_program.rsx_vertex_inputs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void D3D12VertexProgramDecompiler::insertMainEnd(std::stringstream & OS)
|
|
||||||
{
|
|
||||||
OS << " PixelInput Out = (PixelInput)0;\n";
|
|
||||||
|
|
||||||
bool insert_front_diffuse = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTDIFFUSE) != 0;
|
|
||||||
bool insert_front_specular = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTSPECULAR) != 0;
|
|
||||||
|
|
||||||
bool insert_back_diffuse = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_BACKDIFFUSE) != 0;
|
|
||||||
bool insert_back_specular = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_BACKSPECULAR) != 0;
|
|
||||||
|
|
||||||
// Declare inside main function
|
|
||||||
for (auto &i : reg_table)
|
|
||||||
{
|
|
||||||
if (m_parr.HasParam(PF_PARAM_OUT, "float4", i.src_reg))
|
|
||||||
{
|
|
||||||
if (i.name == "front_diff_color")
|
|
||||||
insert_front_diffuse = false;
|
|
||||||
|
|
||||||
if (i.name == "front_spec_color")
|
|
||||||
insert_front_specular = false;
|
|
||||||
|
|
||||||
std::string condition = (!i.cond.empty()) ? "(" + i.cond + ") " : "";
|
|
||||||
std::string output_name = i.dst_alias.empty() ? "Out." + i.src_reg : i.dst_alias;
|
|
||||||
|
|
||||||
if (condition.empty() || i.default_val.empty())
|
|
||||||
{
|
|
||||||
if (!condition.empty()) condition = "if " + condition;
|
|
||||||
OS << " " << condition << output_name << " = " << i.src_reg << i.src_reg_mask << ";\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Condition and fallback values provided
|
|
||||||
OS << " " << output_name << " = " << condition << "? " << i.src_reg << i.src_reg_mask << ": " << i.default_val << ";\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//If 2 sided lighting is active and only back is written, copy the value to the front side (Outrun online arcade)
|
|
||||||
if (insert_front_diffuse && insert_back_diffuse)
|
|
||||||
if (m_parr.HasParam(PF_PARAM_OUT, "float4", "dst_reg1"))
|
|
||||||
OS << " Out.dst_reg3 = dst_reg1;\n";
|
|
||||||
|
|
||||||
if (insert_front_specular && insert_back_specular)
|
|
||||||
if (m_parr.HasParam(PF_PARAM_OUT, "float4", "dst_reg2"))
|
|
||||||
OS << " Out.dst_reg4 = dst_reg2;\n";
|
|
||||||
|
|
||||||
OS << " Out.dst_reg0 = mul(Out.dst_reg0, scaleOffsetMat);\n";
|
|
||||||
OS << " return Out;\n";
|
|
||||||
OS << "}\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12VertexProgramDecompiler::D3D12VertexProgramDecompiler(const RSXVertexProgram &prog) :
|
|
||||||
VertexProgramDecompiler(prog), rsx_vertex_program(prog)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,25 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <sstream>
|
|
||||||
#include "../Common/VertexProgramDecompiler.h"
|
|
||||||
|
|
||||||
struct D3D12VertexProgramDecompiler : public VertexProgramDecompiler
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
virtual std::string getFloatTypeName(size_t elementCount) override;
|
|
||||||
std::string getIntTypeName(size_t elementCount) override;
|
|
||||||
virtual std::string getFunction(enum FUNCTION) override;
|
|
||||||
virtual std::string compareFunction(enum COMPARE, const std::string &, const std::string &, bool scalar) override;
|
|
||||||
|
|
||||||
virtual void insertHeader(std::stringstream &OS);
|
|
||||||
virtual void insertInputs(std::stringstream &OS, const std::vector<ParamType> &inputs);
|
|
||||||
virtual void insertConstants(std::stringstream &OS, const std::vector<ParamType> &constants);
|
|
||||||
virtual void insertOutputs(std::stringstream &OS, const std::vector<ParamType> &outputs);
|
|
||||||
virtual void insertMainStart(std::stringstream &OS);
|
|
||||||
virtual void insertMainEnd(std::stringstream &OS);
|
|
||||||
|
|
||||||
const RSXVertexProgram &rsx_vertex_program;
|
|
||||||
public:
|
|
||||||
D3D12VertexProgramDecompiler(const RSXVertexProgram &prog);
|
|
||||||
};
|
|
File diff suppressed because it is too large
Load diff
|
@ -121,9 +121,6 @@ void fmt_class_string<video_renderer>::format(std::string& out, u64 arg)
|
||||||
case video_renderer::null: return "Null";
|
case video_renderer::null: return "Null";
|
||||||
case video_renderer::opengl: return "OpenGL";
|
case video_renderer::opengl: return "OpenGL";
|
||||||
case video_renderer::vulkan: return "Vulkan";
|
case video_renderer::vulkan: return "Vulkan";
|
||||||
#ifdef _MSC_VER
|
|
||||||
case video_renderer::dx12: return "D3D12";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return unknown;
|
return unknown;
|
||||||
|
|
|
@ -88,9 +88,6 @@ enum class video_renderer
|
||||||
null,
|
null,
|
||||||
opengl,
|
opengl,
|
||||||
vulkan,
|
vulkan,
|
||||||
#ifdef _MSC_VER
|
|
||||||
dx12,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class audio_renderer
|
enum class audio_renderer
|
||||||
|
@ -499,14 +496,6 @@ struct cfg_root : cfg::node
|
||||||
cfg::_int<0, 30000000> driver_recovery_timeout{this, "Driver Recovery Timeout", 1000000};
|
cfg::_int<0, 30000000> driver_recovery_timeout{this, "Driver Recovery Timeout", 1000000};
|
||||||
cfg::_int<1, 500> vblank_rate{this, "Vblank Rate", 60}; // Changing this from 60 may affect game speed in unexpected ways
|
cfg::_int<1, 500> vblank_rate{this, "Vblank Rate", 60}; // Changing this from 60 may affect game speed in unexpected ways
|
||||||
|
|
||||||
struct node_d3d12 : cfg::node
|
|
||||||
{
|
|
||||||
node_d3d12(cfg::node* _this) : cfg::node(_this, "D3D12") {}
|
|
||||||
|
|
||||||
cfg::string adapter{this, "Adapter"};
|
|
||||||
|
|
||||||
} d3d12{this};
|
|
||||||
|
|
||||||
struct node_vk : cfg::node
|
struct node_vk : cfg::node
|
||||||
{
|
{
|
||||||
node_vk(cfg::node* _this) : cfg::node(_this, "Vulkan") {}
|
node_vk(cfg::node* _this) : cfg::node(_this, "Vulkan") {}
|
||||||
|
|
|
@ -35,9 +35,7 @@
|
||||||
#include "Emu/RSX/GSRender.h"
|
#include "Emu/RSX/GSRender.h"
|
||||||
#include "Emu/RSX/Null/NullGSRender.h"
|
#include "Emu/RSX/Null/NullGSRender.h"
|
||||||
#include "Emu/RSX/GL/GLGSRender.h"
|
#include "Emu/RSX/GL/GLGSRender.h"
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include "Emu/RSX/D3D12/D3D12GSRender.h"
|
|
||||||
#endif
|
|
||||||
#if defined(_WIN32) || defined(HAVE_VULKAN)
|
#if defined(_WIN32) || defined(HAVE_VULKAN)
|
||||||
#include "Emu/RSX/VK/VKGSRender.h"
|
#include "Emu/RSX/VK/VKGSRender.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -136,13 +134,6 @@ EmuCallbacks main_application::CreateCallbacks()
|
||||||
g_fxo->init<rsx::thread, named_thread<VKGSRender>>();
|
g_fxo->init<rsx::thread, named_thread<VKGSRender>>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
case video_renderer::dx12:
|
|
||||||
{
|
|
||||||
g_fxo->init<rsx::thread, named_thread<D3D12GSRender>>();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
default: fmt::throw_exception("Invalid video renderer: %s" HERE, type);
|
default: fmt::throw_exception("Invalid video renderer: %s" HERE, type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,7 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>gdi32.lib;..\hidapi.lib;..\libusb-1.0.lib;winmm.lib;OpenAL.lib;XAudio.lib;D3D12GSRender.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;glslang.lib;OSDependent.lib;OGLCompiler.lib;SPIRV.lib;HLSL.lib;Advapi32.lib;user32.lib;zlib.lib;..\libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;$(QTDIR)\lib\qtmain.lib;shell32.lib;opengl32.lib;$(QTDIR)\lib\Qt5OpenGL.lib;$(QTDIR)\lib\Qt5Widgets.lib;$(QTDIR)\lib\Qt5Gui.lib;$(QTDIR)\lib\Qt5Qml.lib;$(QTDIR)\lib\Qt5Network.lib;$(QTDIR)\lib\Qt5Core.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Widgets.lib;Qt5WinExtras.lib;7zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>gdi32.lib;..\hidapi.lib;..\libusb-1.0.lib;winmm.lib;OpenAL.lib;XAudio.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;glslang.lib;OSDependent.lib;OGLCompiler.lib;SPIRV.lib;HLSL.lib;Advapi32.lib;user32.lib;zlib.lib;..\libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;$(QTDIR)\lib\qtmain.lib;shell32.lib;opengl32.lib;$(QTDIR)\lib\Qt5OpenGL.lib;$(QTDIR)\lib\Qt5Widgets.lib;$(QTDIR)\lib\Qt5Gui.lib;$(QTDIR)\lib\Qt5Qml.lib;$(QTDIR)\lib\Qt5Network.lib;$(QTDIR)\lib\Qt5Core.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Widgets.lib;Qt5WinExtras.lib;7zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>..\3rdparty\7z\7zlib\x64\Release\;$(VULKAN_SDK)\Lib;..\3rdparty\OpenAL\libs\Win64;..\Vulkan\glslang-build\hlsl\Release;..\Vulkan\glslang-build\SPIRV\Release;..\Vulkan\glslang-build\OGLCompilersDLL\Release;..\Vulkan\glslang-build\glslang\OSDependent\Windows\Release;..\Vulkan\glslang-build\glslang\Release;..\lib\$(CONFIGURATION)-$(PLATFORM);..\3rdparty\minidx12\Lib;..\3rdparty\discord-rpc\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>..\3rdparty\7z\7zlib\x64\Release\;$(VULKAN_SDK)\Lib;..\3rdparty\OpenAL\libs\Win64;..\Vulkan\glslang-build\hlsl\Release;..\Vulkan\glslang-build\SPIRV\Release;..\Vulkan\glslang-build\OGLCompilersDLL\Release;..\Vulkan\glslang-build\glslang\OSDependent\Windows\Release;..\Vulkan\glslang-build\glslang\Release;..\lib\$(CONFIGURATION)-$(PLATFORM);..\3rdparty\minidx12\Lib;..\3rdparty\discord-rpc\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
|
||||||
<DataExecutionPrevention>true</DataExecutionPrevention>
|
<DataExecutionPrevention>true</DataExecutionPrevention>
|
||||||
|
@ -2151,4 +2151,4 @@
|
||||||
<UserProperties MocDir=".\QTGeneratedFiles\$(ConfigurationName)" UicDir=".\QTGeneratedFiles" RccDir=".\QTGeneratedFiles" Qt5Version_x0020_x64="$(DefaultQtVersion)" />
|
<UserProperties MocDir=".\QTGeneratedFiles\$(ConfigurationName)" UicDir=".\QTGeneratedFiles" RccDir=".\QTGeneratedFiles" Qt5Version_x0020_x64="$(DefaultQtVersion)" />
|
||||||
</VisualStudio>
|
</VisualStudio>
|
||||||
</ProjectExtensions>
|
</ProjectExtensions>
|
||||||
</Project>
|
</Project>
|
|
@ -767,6 +767,9 @@
|
||||||
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_update_manager.cpp">
|
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_update_manager.cpp">
|
||||||
<Filter>Generated Files\Debug - LLVM</Filter>
|
<Filter>Generated Files\Debug - LLVM</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="display_sleep_control.cpp">
|
||||||
|
<Filter>Generated Files\Debug</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="\rpcs3qt\*.h">
|
<ClInclude Include="\rpcs3qt\*.h">
|
||||||
|
@ -859,6 +862,9 @@
|
||||||
<ClInclude Include="rpcs3qt\skylander_dialog.h">
|
<ClInclude Include="rpcs3qt\skylander_dialog.h">
|
||||||
<Filter>Gui\skylanders</Filter>
|
<Filter>Gui\skylanders</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="display_sleep_control.h">
|
||||||
|
<Filter>Generated Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="debug\moc_predefs.h.cbt">
|
<CustomBuild Include="debug\moc_predefs.h.cbt">
|
||||||
|
|
|
@ -13,14 +13,6 @@
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include <Windows.h>
|
|
||||||
#undef GetHwnd
|
|
||||||
#include <d3d12.h>
|
|
||||||
#include <wrl/client.h>
|
|
||||||
#include <dxgi1_4.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(HAVE_VULKAN)
|
#if defined(_WIN32) || defined(HAVE_VULKAN)
|
||||||
#include "Emu/RSX/VK/VKHelpers.h"
|
#include "Emu/RSX/VK/VKHelpers.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -124,36 +116,6 @@ static QStringList getOptions(cfg_location location)
|
||||||
|
|
||||||
emu_settings::Render_Creator::Render_Creator()
|
emu_settings::Render_Creator::Render_Creator()
|
||||||
{
|
{
|
||||||
// check for dx12 adapters
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
HMODULE D3D12Module = LoadLibrary(L"d3d12.dll");
|
|
||||||
|
|
||||||
if (D3D12Module != NULL)
|
|
||||||
{
|
|
||||||
Microsoft::WRL::ComPtr<IDXGIAdapter1> pAdapter;
|
|
||||||
Microsoft::WRL::ComPtr<IDXGIFactory1> dxgi_factory;
|
|
||||||
if (SUCCEEDED(CreateDXGIFactory1(IID_PPV_ARGS(&dxgi_factory))))
|
|
||||||
{
|
|
||||||
PFN_D3D12_CREATE_DEVICE wrapD3D12CreateDevice = (PFN_D3D12_CREATE_DEVICE)GetProcAddress(D3D12Module, "D3D12CreateDevice");
|
|
||||||
if (wrapD3D12CreateDevice != nullptr)
|
|
||||||
{
|
|
||||||
for (UINT adapterIndex = 0; DXGI_ERROR_NOT_FOUND != dxgi_factory->EnumAdapters1(adapterIndex, pAdapter.ReleaseAndGetAddressOf()); ++adapterIndex)
|
|
||||||
{
|
|
||||||
if (SUCCEEDED(wrapD3D12CreateDevice(pAdapter.Get(), D3D_FEATURE_LEVEL_11_0, _uuidof(ID3D12Device), nullptr)))
|
|
||||||
{
|
|
||||||
//A device with D3D12 support found. Init data
|
|
||||||
supportsD3D12 = true;
|
|
||||||
|
|
||||||
DXGI_ADAPTER_DESC desc;
|
|
||||||
if (SUCCEEDED(pAdapter->GetDesc(&desc)))
|
|
||||||
D3D12Adapters.append(QString::fromWCharArray(desc.Description));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(WIN32) || defined(HAVE_VULKAN)
|
#if defined(WIN32) || defined(HAVE_VULKAN)
|
||||||
// Some drivers can get stuck when checking for vulkan-compatible gpus, f.ex. if they're waiting for one to get
|
// Some drivers can get stuck when checking for vulkan-compatible gpus, f.ex. if they're waiting for one to get
|
||||||
// plugged in. This whole contraption is for showing an error message in case that happens, so that user has
|
// plugged in. This whole contraption is for showing an error message in case that happens, so that user has
|
||||||
|
@ -226,12 +188,11 @@ emu_settings::Render_Creator::Render_Creator()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Graphics Adapter
|
// Graphics Adapter
|
||||||
D3D12 = Render_Info(name_D3D12, D3D12Adapters, supportsD3D12, emu_settings::D3D12Adapter);
|
|
||||||
Vulkan = Render_Info(name_Vulkan, vulkanAdapters, supportsVulkan, emu_settings::VulkanAdapter);
|
Vulkan = Render_Info(name_Vulkan, vulkanAdapters, supportsVulkan, emu_settings::VulkanAdapter);
|
||||||
OpenGL = Render_Info(name_OpenGL);
|
OpenGL = Render_Info(name_OpenGL);
|
||||||
NullRender = Render_Info(name_Null);
|
NullRender = Render_Info(name_Null);
|
||||||
|
|
||||||
renderers = { &D3D12, &Vulkan, &OpenGL, &NullRender };
|
renderers = { &Vulkan, &OpenGL, &NullRender };
|
||||||
}
|
}
|
||||||
|
|
||||||
emu_settings::Microphone_Creator::Microphone_Creator()
|
emu_settings::Microphone_Creator::Microphone_Creator()
|
||||||
|
|
|
@ -176,9 +176,7 @@ public:
|
||||||
QStringList vulkanAdapters;
|
QStringList vulkanAdapters;
|
||||||
QString name_Null = tr("Disable Video Output");
|
QString name_Null = tr("Disable Video Output");
|
||||||
QString name_Vulkan = tr("Vulkan");
|
QString name_Vulkan = tr("Vulkan");
|
||||||
QString name_D3D12 = tr("D3D12[DO NOT USE]");
|
|
||||||
QString name_OpenGL = tr("OpenGL");
|
QString name_OpenGL = tr("OpenGL");
|
||||||
Render_Info D3D12;
|
|
||||||
Render_Info Vulkan;
|
Render_Info Vulkan;
|
||||||
Render_Info OpenGL;
|
Render_Info OpenGL;
|
||||||
Render_Info NullRender;
|
Render_Info NullRender;
|
||||||
|
|
|
@ -146,13 +146,6 @@ std::unique_ptr<gs_frame> gui_application::get_gs_frame()
|
||||||
frame = new gs_frame("Vulkan", frame_geometry, app_icon, m_gui_settings);
|
frame = new gs_frame("Vulkan", frame_geometry, app_icon, m_gui_settings);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef _MSC_VER
|
|
||||||
case video_renderer::dx12:
|
|
||||||
{
|
|
||||||
frame = new gs_frame("DirectX 12", frame_geometry, app_icon, m_gui_settings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
default: fmt::throw_exception("Invalid video renderer: %s" HERE, type);
|
default: fmt::throw_exception("Invalid video renderer: %s" HERE, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -474,7 +474,6 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
||||||
#endif
|
#endif
|
||||||
// Change displayed renderer names
|
// Change displayed renderer names
|
||||||
ui->renderBox->setItemText(ui->renderBox->findData("Null"), render_creator.name_Null);
|
ui->renderBox->setItemText(ui->renderBox->findData("Null"), render_creator.name_Null);
|
||||||
ui->renderBox->setItemText(ui->renderBox->findData("D3D12"), render_creator.name_D3D12);
|
|
||||||
|
|
||||||
xemu_settings->EnhanceComboBox(ui->resBox, emu_settings::Resolution);
|
xemu_settings->EnhanceComboBox(ui->resBox, emu_settings::Resolution);
|
||||||
SubscribeTooltip(ui->resBox, json_gpu_cbo["resBox"].toString());
|
SubscribeTooltip(ui->resBox, json_gpu_cbo["resBox"].toString());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue