192617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri/**************************************************************************
292617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri *
392617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * Copyright 2010 Luca Barbieri
492617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri *
592617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * Permission is hereby granted, free of charge, to any person obtaining
692617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * a copy of this software and associated documentation files (the
792617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * "Software"), to deal in the Software without restriction, including
892617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * without limitation the rights to use, copy, modify, merge, publish,
992617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * distribute, sublicense, and/or sell copies of the Software, and to
1092617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * permit persons to whom the Software is furnished to do so, subject to
1192617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * the following conditions:
1292617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri *
1392617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * The above copyright notice and this permission notice (including the
1492617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * next paragraph) shall be included in all copies or substantial
1592617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * portions of the Software.
1692617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri *
1792617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1892617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1992617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2092617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
2192617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
2292617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2392617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2492617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri *
2592617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri **************************************************************************/
2692617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri
2792617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri/* Header for all COM-based Gallium APIs and state trackers */
2892617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri
2992617aeac109481258f0c3863d09c1b8903d438bLuca Barbieriimport "oaidl.idl";
3092617aeac109481258f0c3863d09c1b8903d438bLuca Barbieriimport "ocidl.idl";
3192617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri
3292617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri[object, local, uuid("481c9372-795f-4630-bd5b-1f46d33cc28b")]
3392617aeac109481258f0c3863d09c1b8903d438bLuca Barbieriinterface IGalliumAdapter : IUnknown
3492617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri{
3592617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	struct pipe_screen* GetGalliumScreen();
3692617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	struct pipe_screen* GetGalliumReferenceSoftwareScreen();
3792617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	struct pipe_screen* GetGalliumFastSoftwareScreen();
3892617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri}
3992617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri
4092617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri[object, local, uuid("2c0f7e72-d9fe-4e7b-9fee-d476695ad5d9")]
4192617aeac109481258f0c3863d09c1b8903d438bLuca Barbieriinterface IGalliumDevice : IUnknown
4292617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri{
4392617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	// turn Gallium resource into API resource
4492617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	HRESULT OpenGalliumResource(
456c598c78bd17642d731cf57b8369cc794f64ba2fLuca Barbieri		[in] struct pipe_resource* resource,
4692617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri		[out] IUnknown** api_resource
4792617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	);
4892617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri
4992617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	/* returns the Gallium context used by the device
5092617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	 * can return NULL if the device uses multiple contexts or doesn't want to implement GetGalliumContext()
5192617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	 * we have this function because often using one context is faster than using more (or it's the only working option)
5292617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	 */
5392617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	struct pipe_context* GetGalliumContext();
5492617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri
5592617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	// restore the context state after using the Gallium context for something else
5692617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	// does nothing if GetGalliumContext returns null
5792617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	void RestoreGalliumState();
5892617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri
5992617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	/* like RestoreGalliumState, but ignores:
6092617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	 * - constant buffers
6192617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	 * - non-PS samplers and shader resource views
6292617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	 * - blend color, sample mask
6392617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	 * - scissor
6492617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	 * - index buffer
6592617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	 *
6692617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	 * This is intended to restore state after a blit-like operation.
6792617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	 */
6892617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	void RestoreGalliumStateBlitOnly();
6992617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri};
7092617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri
7192617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri[object, local, uuid("61934787-7aea-412c-8c72-8afe6a33d622")]
7292617aeac109481258f0c3863d09c1b8903d438bLuca Barbieriinterface IGalliumResource : IUnknown
7392617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri{
7492617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri	struct pipe_resource* GetGalliumResource();
7592617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri};
7692617aeac109481258f0c3863d09c1b8903d438bLuca Barbieri
77