Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Mesa 3-D graphics library
  3.  *
  4.  * Copyright (C) 2012-2013 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.
  23.  *
  24.  * Authors:
  25.  *    Chia-I Wu <olv@lunarg.com>
  26.  */
  27.  
  28. #ifndef ILO_SHADER_H
  29. #define ILO_SHADER_H
  30.  
  31. #include "ilo_common.h"
  32.  
  33. enum ilo_kernel_param {
  34.    ILO_KERNEL_INPUT_COUNT,
  35.    ILO_KERNEL_OUTPUT_COUNT,
  36.    ILO_KERNEL_SAMPLER_COUNT,
  37.    ILO_KERNEL_URB_DATA_START_REG,
  38.    ILO_KERNEL_SKIP_CBUF0_UPLOAD,
  39.    ILO_KERNEL_PCB_CBUF0_SIZE,
  40.  
  41.    ILO_KERNEL_SURFACE_TOTAL_COUNT,
  42.    ILO_KERNEL_SURFACE_TEX_BASE,
  43.    ILO_KERNEL_SURFACE_TEX_COUNT,
  44.    ILO_KERNEL_SURFACE_CONST_BASE,
  45.    ILO_KERNEL_SURFACE_CONST_COUNT,
  46.    ILO_KERNEL_SURFACE_RES_BASE,
  47.    ILO_KERNEL_SURFACE_RES_COUNT,
  48.  
  49.    ILO_KERNEL_VS_INPUT_INSTANCEID,
  50.    ILO_KERNEL_VS_INPUT_VERTEXID,
  51.    ILO_KERNEL_VS_INPUT_EDGEFLAG,
  52.    ILO_KERNEL_VS_PCB_UCP_SIZE,
  53.    ILO_KERNEL_VS_GEN6_SO,
  54.    ILO_KERNEL_VS_GEN6_SO_START_REG,
  55.    ILO_KERNEL_VS_GEN6_SO_POINT_OFFSET,
  56.    ILO_KERNEL_VS_GEN6_SO_LINE_OFFSET,
  57.    ILO_KERNEL_VS_GEN6_SO_TRI_OFFSET,
  58.    ILO_KERNEL_VS_GEN6_SO_SURFACE_COUNT,
  59.  
  60.    ILO_KERNEL_GS_DISCARD_ADJACENCY,
  61.    ILO_KERNEL_GS_GEN6_SVBI_POST_INC,
  62.    ILO_KERNEL_GS_GEN6_SURFACE_SO_BASE,
  63.    ILO_KERNEL_GS_GEN6_SURFACE_SO_COUNT,
  64.  
  65.    ILO_KERNEL_FS_INPUT_Z,
  66.    ILO_KERNEL_FS_INPUT_W,
  67.    ILO_KERNEL_FS_OUTPUT_Z,
  68.    ILO_KERNEL_FS_USE_KILL,
  69.    ILO_KERNEL_FS_BARYCENTRIC_INTERPOLATIONS,
  70.    ILO_KERNEL_FS_DISPATCH_16_OFFSET,
  71.    ILO_KERNEL_FS_SURFACE_RT_BASE,
  72.    ILO_KERNEL_FS_SURFACE_RT_COUNT,
  73.  
  74.    ILO_KERNEL_CS_LOCAL_SIZE,
  75.    ILO_KERNEL_CS_PRIVATE_SIZE,
  76.    ILO_KERNEL_CS_INPUT_SIZE,
  77.    ILO_KERNEL_CS_SIMD_SIZE,
  78.    ILO_KERNEL_CS_SURFACE_GLOBAL_BASE,
  79.    ILO_KERNEL_CS_SURFACE_GLOBAL_COUNT,
  80.  
  81.    ILO_KERNEL_PARAM_COUNT,
  82. };
  83.  
  84. struct ilo_kernel_routing {
  85.    uint32_t const_interp_enable;
  86.    uint32_t point_sprite_enable;
  87.    unsigned source_skip, source_len;
  88.  
  89.    bool swizzle_enable;
  90.    uint16_t swizzles[16];
  91. };
  92.  
  93. struct intel_bo;
  94. struct ilo_builder;
  95. struct ilo_rasterizer_state;
  96. struct ilo_shader_cache;
  97. struct ilo_shader_state;
  98. struct ilo_shader_cso;
  99. struct ilo_state_vector;
  100.  
  101. struct ilo_shader_cache *
  102. ilo_shader_cache_create(void);
  103.  
  104. void
  105. ilo_shader_cache_destroy(struct ilo_shader_cache *shc);
  106.  
  107. void
  108. ilo_shader_cache_add(struct ilo_shader_cache *shc,
  109.                      struct ilo_shader_state *shader);
  110.  
  111. void
  112. ilo_shader_cache_remove(struct ilo_shader_cache *shc,
  113.                         struct ilo_shader_state *shader);
  114.  
  115. void
  116. ilo_shader_cache_upload(struct ilo_shader_cache *shc,
  117.                         struct ilo_builder *builder);
  118.  
  119. void
  120. ilo_shader_cache_invalidate(struct ilo_shader_cache *shc);
  121.  
  122. struct ilo_shader_state *
  123. ilo_shader_create_vs(const struct ilo_dev *dev,
  124.                      const struct pipe_shader_state *state,
  125.                      const struct ilo_state_vector *precompile);
  126.  
  127. struct ilo_shader_state *
  128. ilo_shader_create_gs(const struct ilo_dev *dev,
  129.                      const struct pipe_shader_state *state,
  130.                      const struct ilo_state_vector *precompile);
  131.  
  132. struct ilo_shader_state *
  133. ilo_shader_create_fs(const struct ilo_dev *dev,
  134.                      const struct pipe_shader_state *state,
  135.                      const struct ilo_state_vector *precompile);
  136.  
  137. struct ilo_shader_state *
  138. ilo_shader_create_cs(const struct ilo_dev *dev,
  139.                      const struct pipe_compute_state *state,
  140.                      const struct ilo_state_vector *precompile);
  141.  
  142. void
  143. ilo_shader_destroy(struct ilo_shader_state *shader);
  144.  
  145. int
  146. ilo_shader_get_type(const struct ilo_shader_state *shader);
  147.  
  148. bool
  149. ilo_shader_select_kernel(struct ilo_shader_state *shader,
  150.                          const struct ilo_state_vector *vec,
  151.                          uint32_t dirty);
  152.  
  153. bool
  154. ilo_shader_select_kernel_routing(struct ilo_shader_state *shader,
  155.                                  const struct ilo_shader_state *source,
  156.                                  const struct ilo_rasterizer_state *rasterizer);
  157.  
  158. uint32_t
  159. ilo_shader_get_kernel_offset(const struct ilo_shader_state *shader);
  160.  
  161. int
  162. ilo_shader_get_kernel_param(const struct ilo_shader_state *shader,
  163.                             enum ilo_kernel_param param);
  164.  
  165. const struct ilo_shader_cso *
  166. ilo_shader_get_kernel_cso(const struct ilo_shader_state *shader);
  167.  
  168. const struct pipe_stream_output_info *
  169. ilo_shader_get_kernel_so_info(const struct ilo_shader_state *shader);
  170.  
  171. const struct ilo_kernel_routing *
  172. ilo_shader_get_kernel_routing(const struct ilo_shader_state *shader);
  173.  
  174. #endif /* ILO_SHADER_H */
  175.