blob: 4aaca941ec8012555ba6bd35ba7a4b2b7ba5f5a9 [file] [log] [blame]
Courtney Goeltzenleuchter52ec3362014-08-19 11:52:02 -06001/*
2 * XGL
3 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
Chia-I Wu44e42362014-09-02 08:32:09 +080023 *
24 * Authors:
25 * Courtney Goeltzenleuchter <courtney@lunarg.com>
26 * Chia-I Wu <olv@lunarg.com>
Courtney Goeltzenleuchter52ec3362014-08-19 11:52:02 -060027 */
28
29#ifndef SHADER_H
30#define SHADER_H
31
32#include "intel.h"
33#include "obj.h"
Cody Northrop0eb5eea2014-09-19 15:11:52 -060034#include "compiler/mesa-utils/src/mesa/main/mtypes.h"
Courtney Goeltzenleuchter52ec3362014-08-19 11:52:02 -060035
Chia-I Wuc123b7f2014-08-28 12:18:43 +080036enum intel_shader_use {
Chia-I Wu8108b4f2014-08-29 15:07:19 +080037 INTEL_SHADER_USE_VID = (1 << 0),
38 INTEL_SHADER_USE_IID = (1 << 1),
39
40 INTEL_SHADER_USE_KILL = (1 << 2),
41 INTEL_SHADER_USE_COMPUTED_DEPTH = (1 << 3),
42 INTEL_SHADER_USE_DEPTH = (1 << 4),
43 INTEL_SHADER_USE_W = (1 << 5),
Chia-I Wuc123b7f2014-08-28 12:18:43 +080044};
45
Chia-I Wu9194a6d2014-08-28 11:36:48 +080046struct intel_ir {
47 void *kernel;
48 XGL_SIZE size;
Cody Northrop0eb5eea2014-09-19 15:11:52 -060049 struct gl_shader_program *shader_program;
Chia-I Wu9194a6d2014-08-28 11:36:48 +080050};
Courtney Goeltzenleuchter52ec3362014-08-19 11:52:02 -060051
52struct intel_shader {
53 struct intel_obj obj;
Courtney Goeltzenleuchter52ec3362014-08-19 11:52:02 -060054
Chia-I Wu9194a6d2014-08-28 11:36:48 +080055 struct intel_ir *ir;
Chia-I Wuc123b7f2014-08-28 12:18:43 +080056 XGL_FLAGS uses;
Chia-I Wu8108b4f2014-08-29 15:07:19 +080057
Chia-I Wuc123b7f2014-08-28 12:18:43 +080058 XGL_UINT in_count;
59 XGL_UINT out_count;
Chia-I Wu8108b4f2014-08-29 15:07:19 +080060
61 XGL_UINT sampler_count;
62 XGL_UINT surface_count;
63
64 XGL_UINT urb_grf_start;
65
66 XGL_FLAGS barycentric_interps;
Courtney Goeltzenleuchter52ec3362014-08-19 11:52:02 -060067};
68
Courtney Goeltzenleuchter52ec3362014-08-19 11:52:02 -060069static inline struct intel_shader *intel_shader(XGL_SHADER shader)
70{
71 return (struct intel_shader *) shader;
72}
73
74static inline struct intel_shader *intel_shader_from_obj(struct intel_obj *obj)
75{
76 return (struct intel_shader *) obj;
77}
78
Chia-I Wu9194a6d2014-08-28 11:36:48 +080079XGL_RESULT XGLAPI intelCreateShader(
80 XGL_DEVICE device,
81 const XGL_SHADER_CREATE_INFO* pCreateInfo,
82 XGL_SHADER* pShader);
83
84#endif /* SHADER_H */