1d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz/************************************************************************** 2d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * 3d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * Copyright 2009 VMware, Inc. 4d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * All Rights Reserved. 5d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * 6d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * Permission is hereby granted, free of charge, to any person obtaining a 7d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * copy of this software and associated documentation files (the 8d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * "Software"), to deal in the Software without restriction, including 9d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * without limitation the rights to use, copy, modify, merge, publish, 10d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * distribute, sub license, and/or sell copies of the Software, and to 11d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * permit persons to whom the Software is furnished to do so, subject to 12d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * the following conditions: 13d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * 14d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * The above copyright notice and this permission notice (including the 15d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * next paragraph) shall be included in all copies or substantial portions 16d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * of the Software. 17d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * 18d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz * 26d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz **************************************************************************/ 27d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 28d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz#ifndef ID_OBJECTS_H 29d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz#define ID_OBJECTS_H 30d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 31d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 32d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz#include "pipe/p_compiler.h" 33d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz#include "pipe/p_state.h" 34d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 35d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz#include "id_screen.h" 36d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 37b43c182f19c6291c88420fa12714f952c2b461fbKeith Whitwellstruct identity_context; 38d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 39d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 40287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellstruct identity_resource 41d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz{ 42287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_resource base; 43d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 44287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_resource *resource; 45d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz}; 46d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 47d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 48f6106566081978f663cf08e54bb8908cb58a5316Michal Krolstruct identity_sampler_view 49f6106566081978f663cf08e54bb8908cb58a5316Michal Krol{ 50f6106566081978f663cf08e54bb8908cb58a5316Michal Krol struct pipe_sampler_view base; 51f6106566081978f663cf08e54bb8908cb58a5316Michal Krol 52f6106566081978f663cf08e54bb8908cb58a5316Michal Krol struct pipe_sampler_view *sampler_view; 53f6106566081978f663cf08e54bb8908cb58a5316Michal Krol}; 54f6106566081978f663cf08e54bb8908cb58a5316Michal Krol 55f6106566081978f663cf08e54bb8908cb58a5316Michal Krol 56d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzstruct identity_surface 57d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz{ 58d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz struct pipe_surface base; 59d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 60d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz struct pipe_surface *surface; 61d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz}; 62d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 63d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 64d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzstruct identity_transfer 65d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz{ 66d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz struct pipe_transfer base; 67d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 68d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz struct pipe_transfer *transfer; 69d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz}; 70d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 71d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 72287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellstatic INLINE struct identity_resource * 73287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellidentity_resource(struct pipe_resource *_resource) 74d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz{ 75287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell if(!_resource) 76d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz return NULL; 77287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell (void)identity_screen(_resource->screen); 78287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell return (struct identity_resource *)_resource; 79d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz} 80d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 81f6106566081978f663cf08e54bb8908cb58a5316Michal Krolstatic INLINE struct identity_sampler_view * 82f6106566081978f663cf08e54bb8908cb58a5316Michal Krolidentity_sampler_view(struct pipe_sampler_view *_sampler_view) 83f6106566081978f663cf08e54bb8908cb58a5316Michal Krol{ 84f6106566081978f663cf08e54bb8908cb58a5316Michal Krol if (!_sampler_view) { 85f6106566081978f663cf08e54bb8908cb58a5316Michal Krol return NULL; 86f6106566081978f663cf08e54bb8908cb58a5316Michal Krol } 87f6106566081978f663cf08e54bb8908cb58a5316Michal Krol return (struct identity_sampler_view *)_sampler_view; 88f6106566081978f663cf08e54bb8908cb58a5316Michal Krol} 89f6106566081978f663cf08e54bb8908cb58a5316Michal Krol 90d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzstatic INLINE struct identity_surface * 91d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzidentity_surface(struct pipe_surface *_surface) 92d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz{ 93d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz if(!_surface) 94d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz return NULL; 95287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell (void)identity_resource(_surface->texture); 96d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz return (struct identity_surface *)_surface; 97d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz} 98d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 99d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzstatic INLINE struct identity_transfer * 100d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzidentity_transfer(struct pipe_transfer *_transfer) 101d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz{ 102d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz if(!_transfer) 103d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz return NULL; 104287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell (void)identity_resource(_transfer->resource); 105d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz return (struct identity_transfer *)_transfer; 106d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz} 107d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 108287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellstatic INLINE struct pipe_resource * 109287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellidentity_resource_unwrap(struct pipe_resource *_resource) 110d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz{ 111287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell if(!_resource) 112d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz return NULL; 113287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell return identity_resource(_resource)->resource; 114d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz} 115d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 116f6106566081978f663cf08e54bb8908cb58a5316Michal Krolstatic INLINE struct pipe_sampler_view * 117f6106566081978f663cf08e54bb8908cb58a5316Michal Krolidentity_sampler_view_unwrap(struct pipe_sampler_view *_sampler_view) 118f6106566081978f663cf08e54bb8908cb58a5316Michal Krol{ 119f6106566081978f663cf08e54bb8908cb58a5316Michal Krol if (!_sampler_view) { 120f6106566081978f663cf08e54bb8908cb58a5316Michal Krol return NULL; 121f6106566081978f663cf08e54bb8908cb58a5316Michal Krol } 122f6106566081978f663cf08e54bb8908cb58a5316Michal Krol return identity_sampler_view(_sampler_view)->sampler_view; 123f6106566081978f663cf08e54bb8908cb58a5316Michal Krol} 124f6106566081978f663cf08e54bb8908cb58a5316Michal Krol 125d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzstatic INLINE struct pipe_surface * 126d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzidentity_surface_unwrap(struct pipe_surface *_surface) 127d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz{ 128d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz if(!_surface) 129d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz return NULL; 130d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz return identity_surface(_surface)->surface; 131d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz} 132d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 133d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzstatic INLINE struct pipe_transfer * 134d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzidentity_transfer_unwrap(struct pipe_transfer *_transfer) 135d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz{ 136d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz if(!_transfer) 137d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz return NULL; 138d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz return identity_transfer(_transfer)->transfer; 139d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz} 140d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 141d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 142287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellstruct pipe_resource * 143287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellidentity_resource_create(struct identity_screen *id_screen, 144eda7c2506aff13726a265c70711d594ad8fddca3Jakob Bornecrantz struct pipe_resource *resource); 145d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 146d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzvoid 147287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellidentity_resource_destroy(struct identity_resource *id_resource); 148d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 149d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzstruct pipe_surface * 1504c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheideggeridentity_surface_create(struct identity_context *id_context, 1514c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger struct identity_resource *id_resource, 152d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz struct pipe_surface *surface); 153d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 154d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzvoid 1554c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheideggeridentity_surface_destroy(struct identity_context *id_context, 1564c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger struct identity_surface *id_surface); 157d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 158c2c1f60391113490f4f90efb2786544c599ac991Jakob Bornecrantzstruct pipe_sampler_view * 159c2c1f60391113490f4f90efb2786544c599ac991Jakob Bornecrantzidentity_sampler_view_create(struct identity_context *id_context, 160c2c1f60391113490f4f90efb2786544c599ac991Jakob Bornecrantz struct identity_resource *id_resource, 161c2c1f60391113490f4f90efb2786544c599ac991Jakob Bornecrantz struct pipe_sampler_view *view); 162c2c1f60391113490f4f90efb2786544c599ac991Jakob Bornecrantz 163c2c1f60391113490f4f90efb2786544c599ac991Jakob Bornecrantzvoid 164c2c1f60391113490f4f90efb2786544c599ac991Jakob Bornecrantzidentity_sampler_view_destroy(struct identity_context *id_context, 165c2c1f60391113490f4f90efb2786544c599ac991Jakob Bornecrantz struct identity_sampler_view *id_sampler_view); 166c2c1f60391113490f4f90efb2786544c599ac991Jakob Bornecrantz 167d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzstruct pipe_transfer * 168b43c182f19c6291c88420fa12714f952c2b461fbKeith Whitwellidentity_transfer_create(struct identity_context *id_context, 169eda7c2506aff13726a265c70711d594ad8fddca3Jakob Bornecrantz struct identity_resource *id_resource, 170d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz struct pipe_transfer *transfer); 171d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 172d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantzvoid 173d35ecca5ee231c072687578642e0c22c6c0590b1Keith Whitwellidentity_transfer_destroy(struct identity_context *id_context, 174d35ecca5ee231c072687578642e0c22c6c0590b1Keith Whitwell struct identity_transfer *id_transfer); 175d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 176d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz 177d60b2c68552a2729dfdb33c2bac4822453cf8ae2Jakob Bornecrantz#endif /* ID_OBJECTS_H */ 178