2 * Copyright 2022 Ziqing Hui for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 typedef HRESULT (__stdcall
*PD2D1_PROPERTY_SET_FUNCTION
)(IUnknown
*effect
,
22 const BYTE *data
, UINT32 data_size
);
24 typedef HRESULT (__stdcall
*PD2D1_PROPERTY_GET_FUNCTION
)(const IUnknown
*effect
,
25 BYTE *data
, UINT32 data_size
, UINT32
*actual_size
);
27 typedef enum D2D1_FILTER
29 D2D1_FILTER_MIN_MAG_MIP_POINT
= 0x00,
30 D2D1_FILTER_MIN_MAG_POINT_MIP_LINEAR
= 0x01,
31 D2D1_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT
= 0x04,
32 D2D1_FILTER_MIN_POINT_MAG_MIP_LINEAR
= 0x05,
33 D2D1_FILTER_MIN_LINEAR_MAG_MIP_POINT
= 0x10,
34 D2D1_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR
= 0x11,
35 D2D1_FILTER_MIN_MAG_LINEAR_MIP_POINT
= 0x14,
36 D2D1_FILTER_MIN_MAG_MIP_LINEAR
= 0x15,
37 D2D1_FILTER_ANISOTROPIC
= 0x55,
38 D2D1_FILTER_FORCE_DWORD
= 0xffffffff
41 typedef enum D2D1_FEATURE
43 D2D1_FEATURE_DOUBLES
= 0x0,
44 D2D1_FEATURE_D3D10_X_HARDWARE_OPTIONS
= 0x1,
45 D2D1_FEATURE_FORCE_DWORD
= 0xffffffff
48 typedef struct D2D1_PROPERTY_BINDING
50 const WCHAR
*propertyName
;
51 PD2D1_PROPERTY_SET_FUNCTION setFunction
;
52 PD2D1_PROPERTY_GET_FUNCTION getFunction
;
53 } D2D1_PROPERTY_BINDING
;
55 typedef enum D2D1_CHANNEL_DEPTH
57 D2D1_CHANNEL_DEPTH_DEFAULT
= 0x0,
58 D2D1_CHANNEL_DEPTH_1
= 0x1,
59 D2D1_CHANNEL_DEPTH_4
= 0x4,
60 D2D1_CHANNEL_DEPTH_FORCE_DWORD
= 0xffffffff
63 typedef enum D2D1_CHANGE_TYPE
65 D2D1_CHANGE_TYPE_NONE
= 0x0,
66 D2D1_CHANGE_TYPE_PROPERTIES
= 0x1,
67 D2D1_CHANGE_TYPE_CONTEXT
= 0x2,
68 D2D1_CHANGE_TYPE_GRAPH
= 0x3,
69 D2D1_CHANGE_TYPE_FORCE_DWORD
= 0xffffffff
72 typedef enum D2D1_PIXEL_OPTIONS
74 D2D1_PIXEL_OPTIONS_NONE
= 0x0,
75 D2D1_PIXEL_OPTIONS_TRIVIAL_SAMPLING
= 0x1,
76 D2D1_PIXEL_OPTIONS_FORCE_DWORD
= 0xffffffff
79 typedef enum D2D1_VERTEX_OPTIONS
81 D2D1_VERTEX_OPTIONS_NONE
= 0x0,
82 D2D1_VERTEX_OPTIONS_DO_NOT_CLEAR
= 0x1,
83 D2D1_VERTEX_OPTIONS_USE_DEPTH_BUFFER
= 0x2,
84 D2D1_VERTEX_OPTIONS_ASSUME_NO_OVERLAP
= 0x4,
85 D2D1_VERTEX_OPTIONS_FORCE_DWORD
= 0xffffffff
86 } D2D1_VERTEX_OPTIONS
;
88 typedef enum D2D1_VERTEX_USAGE
90 D2D1_VERTEX_USAGE_STATIC
= 0x0,
91 D2D1_VERTEX_USAGE_DYNAMIC
= 0x1,
92 D2D1_VERTEX_USAGE_FORCE_DWORD
= 0xffffffff
95 typedef enum D2D1_BLEND_OPERATION
97 D2D1_BLEND_OPERATION_ADD
= 0x1,
98 D2D1_BLEND_OPERATION_SUBTRACT
= 0x2,
99 D2D1_BLEND_OPERATION_REV_SUBTRACT
= 0x3,
100 D2D1_BLEND_OPERATION_MIN
= 0x4,
101 D2D1_BLEND_OPERATION_MAX
= 0x5,
102 D2D1_BLEND_OPERATION_FORCE_DWORD
= 0xffffffff
103 } D2D1_BLEND_OPERATION
;
105 typedef enum D2D1_BLEND
109 D2D1_BLEND_SRC_COLOR
= 3,
110 D2D1_BLEND_INV_SRC_COLOR
= 4,
111 D2D1_BLEND_SRC_ALPHA
= 5,
112 D2D1_BLEND_INV_SRC_ALPHA
= 6,
113 D2D1_BLEND_DEST_ALPHA
= 7,
114 D2D1_BLEND_INV_DEST_ALPHA
= 8,
115 D2D1_BLEND_DEST_COLOR
= 9,
116 D2D1_BLEND_INV_DEST_COLOR
= 10,
117 D2D1_BLEND_SRC_ALPHA_SAT
= 11,
118 D2D1_BLEND_BLEND_FACTOR
= 14,
119 D2D1_BLEND_INV_BLEND_FACTOR
= 15,
120 D2D1_BLEND_FORCE_DWORD
= 0xffffffff
123 typedef struct D2D1_INPUT_DESCRIPTION
126 UINT32 levelOfDetailCount
;
127 } D2D1_INPUT_DESCRIPTION
;
129 typedef struct D2D1_VERTEX_RANGE
135 typedef struct D2D1_BLEND_DESCRIPTION
137 D2D1_BLEND sourceBlend
;
138 D2D1_BLEND destinationBlend
;
139 D2D1_BLEND_OPERATION blendOperation
;
140 D2D1_BLEND sourceBlendAlpha
;
141 D2D1_BLEND destinationBlendAlpha
;
142 D2D1_BLEND_OPERATION blendOperationAlpha
;
143 float blendFactor
[4];
144 } D2D1_BLEND_DESCRIPTION
;
146 typedef struct D2D1_RESOURCE_TEXTURE_PROPERTIES
148 const UINT32
*extents
;
150 D2D1_BUFFER_PRECISION bufferPrecision
;
151 D2D1_CHANNEL_DEPTH channelDepth
;
153 const D2D1_EXTEND_MODE
*extendModes
;
154 } D2D1_RESOURCE_TEXTURE_PROPERTIES
;
156 typedef struct D2D1_INPUT_ELEMENT_DESC
158 const char *semanticName
;
159 UINT32 semanticIndex
;
162 UINT32 alignedByteOffset
;
163 } D2D1_INPUT_ELEMENT_DESC
;
165 typedef struct D2D1_VERTEX_BUFFER_PROPERTIES
168 D2D1_VERTEX_USAGE usage
;
171 } D2D1_VERTEX_BUFFER_PROPERTIES
;
173 typedef struct D2D1_CUSTOM_VERTEX_BUFFER_PROPERTIES
175 const BYTE *shaderBufferWithInputSignature
;
176 UINT32 shaderBufferSize
;
177 const D2D1_INPUT_ELEMENT_DESC
*inputElements
;
180 } D2D1_CUSTOM_VERTEX_BUFFER_PROPERTIES
;
184 uuid(9b8b1336
-00a5
-4668-92b7
-ced5d8bf9b7b
),
187 interface ID2D1VertexBuffer
: IUnknown
198 uuid(688d15c3
-02b0
-438d
-b13a
-d1b44c32c39a
),
201 interface ID2D1ResourceTexture
: IUnknown
204 [in] const UINT32
*min_extents
,
205 [in] const UINT32
*max_extents
,
206 [in] const UINT32
*strides
,
207 [in] UINT32 dimensions
,
208 [in] const BYTE *data
,
209 [in] UINT32 data_size
215 uuid(519ae1bd
-d19a
-420d
-b849
-364f594776b7
),
218 interface ID2D1RenderInfo
: IUnknown
220 HRESULT SetInputDescription
(
222 [in] D2D1_INPUT_DESCRIPTION description
224 HRESULT SetOutputBuffer
(
225 [in] D2D1_BUFFER_PRECISION precision
,
226 [in] D2D1_CHANNEL_DEPTH depth
231 void SetInstructionCountHint
(
238 uuid(693ce632
-7f2f
-45de
-93fe
-18d88b37aa21
),
241 interface ID2D1DrawInfo
: ID2D1RenderInfo
243 HRESULT SetPixelShaderConstantBuffer
(
244 [in] const BYTE *buffer
,
247 HRESULT SetResourceTexture
(
249 [in] ID2D1ResourceTexture
*texture
251 HRESULT SetVertexShaderConstantBuffer
(
252 [in] const BYTE *buffer
,
255 HRESULT SetPixelShader
(
257 [in] D2D1_PIXEL_OPTIONS options
259 HRESULT SetVertexProcessing
(
260 [in, optional] ID2D1VertexBuffer
*buffer
,
261 [in] D2D1_VERTEX_OPTIONS options
,
262 [in, optional] const D2D1_BLEND_DESCRIPTION
*description
,
263 [in, optional] const D2D1_VERTEX_RANGE
*range,
264 [in, optional] const GUID
*shader
270 uuid(5598b14b
-9fd7
-48b7
-9bdb
-8f0964eb38bc
),
273 interface ID2D1ComputeInfo
: ID2D1RenderInfo
275 HRESULT SetComputeShaderconstantBuffer
(
276 [in] const BYTE *buffer
,
279 HRESULT SetComputeShader
(
282 HRESULT SetResourceTexture
(
284 [in] ID2D1ResourceTexture
*texture
290 uuid(b2efe1e7
-729f
-4102-949f
-505fa21bf666
),
293 interface ID2D1TransformNode
: IUnknown
295 UINT32 GetInputCount
();
300 uuid(13d29038
-c3e6
-4034-9081-13b53a417992
),
303 interface ID2D1TransformGraph
: IUnknown
305 UINT32 GetInputCount
();
306 HRESULT SetSingleTransformNode
(
307 [in] ID2D1TransformNode
*node
310 [in] ID2D1TransformNode
*node
313 [in] ID2D1TransformNode
*node
315 HRESULT SetOutputNode
(
316 [in] ID2D1TransformNode
*node
319 [in] ID2D1TransformNode
*from_node
,
320 [in] ID2D1TransformNode
*to_node
,
323 HRESULT ConnectToEffectInput
(
324 [in] UINT32 input_index
,
325 [in] ID2D1TransformNode
*node
,
326 [in] UINT32 node_index
329 HRESULT SetPassthroughGraph
(
336 uuid(ef1a287d
-342a
-4f76
-8fdb
-da0d6ea9f92b
),
339 interface ID2D1Transform
: ID2D1TransformNode
341 HRESULT MapOutputRectToInputRects
(
342 [in] const D2D1_RECT_L
*output_rect
,
343 [out] D2D1_RECT_L
*input_rects
,
344 [in] UINT32 input_rects_count
346 HRESULT MapInputRectsToOutputRect
(
347 [in] const D2D1_RECT_L
*input_rects
,
348 [in] const D2D1_RECT_L
*input_opaque_rects
,
349 [in] UINT32 input_rect_count
,
350 [out] D2D1_RECT_L
*output_rect
,
351 [out] D2D1_RECT_L
*output_opaque_rect
353 HRESULT MapInvalidRect
(
355 [in] D2D1_RECT_L input_rect
,
356 [out] D2D1_RECT_L
*output_rect
362 uuid(36bfdcb6
-9739-435d
-a30d
-a653beff6a6f
),
365 interface ID2D1DrawTransform
: ID2D1Transform
368 [in] ID2D1DrawInfo
*info
374 uuid(0d85573c
-01e3
-4f7d
-bfd9
-0d60608bf3c3
),
377 interface ID2D1ComputeTransform
: ID2D1Transform
379 HRESULT SetComputeInfo
(
380 [in] ID2D1ComputeInfo
*info
382 HRESULT CalculateThreadgroups
(
383 [in] const D2D1_RECT_L
*output_rect
,
384 [out] UINT32
*dimension_x
,
385 [out] UINT32
*dimension_y
,
386 [out] UINT32
*dimension_z
392 uuid(0359dc30
-95e6
-4568-9055-27720d130e93
),
395 interface ID2D1AnalysisTransform
: IUnknown
397 HRESULT ProcessAnalysisResults
(
398 [in] const BYTE *data
,
405 uuid(db1800dd
-0c34
-4cf9
-be90
-31cc0a5653e1
),
408 interface ID2D1SourceTransform
: ID2D1Transform
410 HRESULT SetRenderInfo
(
411 [in] ID2D1RenderInfo
*info
414 [in] ID2D1Bitmap1
*target
,
415 [in] const D2D1_RECT_L
*draw_rect
,
416 [in] D2D1_POINT_2U target_origin
422 uuid(1a799d8a
-69f7
-4e4c
-9fed
-437ccc6684cc
),
425 interface ID2D1ConcreteTransform
: ID2D1TransformNode
427 HRESULT SetOutputBuffer
(
428 [in] D2D1_BUFFER_PRECISION precision
,
429 [in] D2D1_CHANNEL_DEPTH depth
438 uuid(63ac0b32
-ba44
-450f
-8806-7f4ca1ff2f1b
),
441 interface ID2D1BlendTransform
: ID2D1ConcreteTransform
444 [in] const D2D1_BLEND_DESCRIPTION
*description
447 [out] D2D1_BLEND_DESCRIPTION
*description
453 uuid(4998735c
-3a19
-473c
-9781-656847e3a347
),
456 interface ID2D1BorderTransform
: ID2D1ConcreteTransform
459 [in] D2D1_EXTEND_MODE mode
462 [in] D2D1_EXTEND_MODE mode
464 D2D1_EXTEND_MODE GetExtendModeX
();
465 D2D1_EXTEND_MODE GetExtendModeY
();
470 uuid(3fe6adea
-7643-4f53
-bd14
-a0ce63f24042
),
473 interface ID2D1OffsetTransform
: ID2D1TransformNode
476 [in] D2D1_POINT_2L offset
478 D2D1_POINT_2L GetOffset
();
483 uuid(90f732e2
-5092-4606-a819
-8651970baccd
),
486 interface ID2D1BoundsAdjustmentTransform
: ID2D1TransformNode
488 void SetOutputBounds
(
489 [in] const D2D1_RECT_L
*bounds
491 void GetOutputBounds
(
492 [out] D2D1_RECT_L
*bounds
498 uuid(3d9f916b
-27dc
-4ad7
-b4f1
-64945340f563
),
501 interface ID2D1EffectContext
: IUnknown
507 HRESULT CreateEffect
(
509 [out] ID2D1Effect
**effect
511 HRESULT GetMaximumSupportedFeatureLevel
(
512 [in] const D3D_FEATURE_LEVEL
*levels
,
513 [in] UINT32 level_count
,
514 [out] D3D_FEATURE_LEVEL
*max_level
516 HRESULT CreateTransformNodeFromEffect
(
517 [in] ID2D1Effect
*effect
,
518 [out] ID2D1TransformNode
**node
520 HRESULT CreateBlendTransform
(
521 [in] UINT32 num_inputs
,
522 [in] const D2D1_BLEND_DESCRIPTION
*description
,
523 [out] ID2D1BlendTransform
**transform
525 HRESULT CreateBorderTransform
(
526 [in] D2D1_EXTEND_MODE mode_x
,
527 [in] D2D1_EXTEND_MODE mode_y
,
528 [out] ID2D1BorderTransform
**transform
530 HRESULT CreateOffsetTransform
(
531 [in] D2D1_POINT_2L offset
,
532 [out] ID2D1OffsetTransform
**transform
534 HRESULT CreateBoundsAdjustmentTransform
(
535 [in] const D2D1_RECT_L
*output_rect
,
536 [out] ID2D1BoundsAdjustmentTransform
**transform
538 HRESULT LoadPixelShader
(
539 [in] REFGUID shader_id
,
540 [in] const BYTE *buffer
,
541 [in] UINT32 buffer_size
543 HRESULT LoadVertexShader
(
544 [in] REFGUID shader_id
,
545 [in] const BYTE *buffer
,
546 [in] UINT32 buffer_size
548 HRESULT LoadComputeShader
(
549 [in] REFGUID shader_id
,
550 [in] const BYTE *buffer
,
551 [in] UINT32 buffer_size
554 [in] REFGUID shader_id
556 HRESULT CreateResourceTexture
(
557 [in, optional] const GUID
*id,
558 [in] const D2D1_RESOURCE_TEXTURE_PROPERTIES
*texture_properties
,
559 [in] const BYTE *data
,
560 [in] const UINT32
*strides
,
561 [in] UINT32 data_size
,
562 [out] ID2D1ResourceTexture
**texture
564 HRESULT FindResourceTexture
(
566 [out] ID2D1ResourceTexture
**texture
568 HRESULT CreateVertexBuffer
(
569 [in] const D2D1_VERTEX_BUFFER_PROPERTIES
*buffer_properties
,
570 [in, optional] const GUID
*id,
571 [in, optional] const D2D1_CUSTOM_VERTEX_BUFFER_PROPERTIES
*custom_buffer_properties
,
572 [out] ID2D1VertexBuffer
**buffer
574 HRESULT FindVertexBuffer
(
576 [out] ID2D1VertexBuffer
**buffer
578 HRESULT CreateColorContext
(
579 [in] D2D1_COLOR_SPACE space
,
580 [in] const BYTE *profile
,
581 [in] UINT32 profile_size
,
582 [out] ID2D1ColorContext
**color_context
584 HRESULT CreateColorContextFromFilename
(
585 [in] const WCHAR
*filename
,
586 [out] ID2D1ColorContext
**color_context
588 HRESULT CreateColorContextFromWicColorContext
(
589 [in] IWICColorContext
*wic_color_context
,
590 [out] ID2D1ColorContext
**color_context
592 HRESULT CheckFeatureSupport
(
593 [in] D2D1_FEATURE feature
,
595 [in] UINT32 data_size
597 BOOL IsBufferPrecisionSupported
(
598 [in] D2D1_BUFFER_PRECISION precision
604 uuid(a248fd3f
-3e6c
-4e63
-9f03
-7f68ecc91db9
),
607 interface ID2D1EffectImpl
: IUnknown
610 [in] ID2D1EffectContext
*context
,
611 [in] ID2D1TransformGraph
*graph
613 HRESULT PrepareForRender
(
614 [in] D2D1_CHANGE_TYPE type
617 [in] ID2D1TransformGraph
*graph