1/**************************************************************************
2 *
3 * Copyright 2010 Luca Barbieri
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 **************************************************************************/
26
27/* Header for all COM-based Gallium APIs and state trackers */
28
29import "oaidl.idl";
30import "ocidl.idl";
31
32[object, local, uuid("481c9372-795f-4630-bd5b-1f46d33cc28b")]
33interface IGalliumAdapter : IUnknown
34{
35	struct pipe_screen* GetGalliumScreen();
36	struct pipe_screen* GetGalliumReferenceSoftwareScreen();
37	struct pipe_screen* GetGalliumFastSoftwareScreen();
38}
39
40[object, local, uuid("2c0f7e72-d9fe-4e7b-9fee-d476695ad5d9")]
41interface IGalliumDevice : IUnknown
42{
43	// turn Gallium resource into API resource
44	HRESULT OpenGalliumResource(
45		[in] struct pipe_resource* resource,
46		[out] IUnknown** api_resource
47	);
48
49	/* returns the Gallium context used by the device
50	 * can return NULL if the device uses multiple contexts or doesn't want to implement GetGalliumContext()
51	 * we have this function because often using one context is faster than using more (or it's the only working option)
52	 */
53	struct pipe_context* GetGalliumContext();
54
55	// restore the context state after using the Gallium context for something else
56	// does nothing if GetGalliumContext returns null
57	void RestoreGalliumState();
58
59	/* like RestoreGalliumState, but ignores:
60	 * - constant buffers
61	 * - non-PS samplers and shader resource views
62	 * - blend color, sample mask
63	 * - scissor
64	 * - index buffer
65	 *
66	 * This is intended to restore state after a blit-like operation.
67	 */
68	void RestoreGalliumStateBlitOnly();
69};
70
71[object, local, uuid("61934787-7aea-412c-8c72-8afe6a33d622")]
72interface IGalliumResource : IUnknown
73{
74	struct pipe_resource* GetGalliumResource();
75};
76
77