1bf215546Sopenharmony_ci/**********************************************************
2bf215546Sopenharmony_ci * Copyright 2009-2015 VMware, Inc.  All rights reserved.
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person
5bf215546Sopenharmony_ci * obtaining a copy of this software and associated documentation
6bf215546Sopenharmony_ci * files (the "Software"), to deal in the Software without
7bf215546Sopenharmony_ci * restriction, including without limitation the rights to use, copy,
8bf215546Sopenharmony_ci * modify, merge, publish, distribute, sublicense, and/or sell copies
9bf215546Sopenharmony_ci * of the Software, and to permit persons to whom the Software is
10bf215546Sopenharmony_ci * furnished to do so, subject to the following conditions:
11bf215546Sopenharmony_ci *
12bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be
13bf215546Sopenharmony_ci * included in all copies or substantial portions of the Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16bf215546Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18bf215546Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19bf215546Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20bf215546Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21bf215546Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22bf215546Sopenharmony_ci * SOFTWARE.
23bf215546Sopenharmony_ci *
24bf215546Sopenharmony_ci **********************************************************/
25bf215546Sopenharmony_ci
26bf215546Sopenharmony_ci/**
27bf215546Sopenharmony_ci * @file
28bf215546Sopenharmony_ci * Shaders for VMware SVGA winsys.
29bf215546Sopenharmony_ci *
30bf215546Sopenharmony_ci * @author Jose Fonseca <jfonseca@vmware.com>
31bf215546Sopenharmony_ci * @author Thomas Hellstrom <thellstrom@vmware.com>
32bf215546Sopenharmony_ci */
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ci#ifndef VMW_SHADER_H_
35bf215546Sopenharmony_ci#define VMW_SHADER_H_
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_ci#include "pipe/p_compiler.h"
38bf215546Sopenharmony_ci#include "util/u_atomic.h"
39bf215546Sopenharmony_ci#include "util/u_inlines.h"
40bf215546Sopenharmony_ci
41bf215546Sopenharmony_cistruct vmw_svga_winsys_shader
42bf215546Sopenharmony_ci{
43bf215546Sopenharmony_ci   int32_t validated;
44bf215546Sopenharmony_ci   struct pipe_reference refcnt;
45bf215546Sopenharmony_ci
46bf215546Sopenharmony_ci   struct vmw_winsys_screen *screen;
47bf215546Sopenharmony_ci   struct svga_winsys_buffer *buf;
48bf215546Sopenharmony_ci   uint32_t shid;
49bf215546Sopenharmony_ci};
50bf215546Sopenharmony_ci
51bf215546Sopenharmony_cistatic inline struct svga_winsys_gb_shader *
52bf215546Sopenharmony_cisvga_winsys_shader(struct vmw_svga_winsys_shader *shader)
53bf215546Sopenharmony_ci{
54bf215546Sopenharmony_ci   assert(!shader || shader->shid != SVGA3D_INVALID_ID);
55bf215546Sopenharmony_ci   return (struct svga_winsys_gb_shader *)shader;
56bf215546Sopenharmony_ci}
57bf215546Sopenharmony_ci
58bf215546Sopenharmony_cistatic inline struct vmw_svga_winsys_shader *
59bf215546Sopenharmony_civmw_svga_winsys_shader(struct svga_winsys_gb_shader *shader)
60bf215546Sopenharmony_ci{
61bf215546Sopenharmony_ci   return (struct vmw_svga_winsys_shader *)shader;
62bf215546Sopenharmony_ci}
63bf215546Sopenharmony_ci
64bf215546Sopenharmony_civoid
65bf215546Sopenharmony_civmw_svga_winsys_shader_reference(struct vmw_svga_winsys_shader **pdst,
66bf215546Sopenharmony_ci                                  struct vmw_svga_winsys_shader *src);
67bf215546Sopenharmony_ci
68bf215546Sopenharmony_cistruct vmw_svga_winsys_shader *
69bf215546Sopenharmony_civmw_svga_shader_create(struct svga_winsys_screen *sws,
70bf215546Sopenharmony_ci                       SVGA3dShaderType type,
71bf215546Sopenharmony_ci                       const uint32 *bytecode,
72bf215546Sopenharmony_ci                       uint32 bytecodeLen,
73bf215546Sopenharmony_ci                       const SVGA3dDXShaderSignatureHeader *sgnInfo,
74bf215546Sopenharmony_ci                       uint32 sgnLen);
75bf215546Sopenharmony_ci
76bf215546Sopenharmony_ci#endif /* VMW_SHADER_H_ */
77