Home | History | Annotate | Download | only in core
      1 /****************************************************************************
      2 * Copyright (C) 2014-2015 Intel Corporation.   All Rights Reserved.
      3 *
      4 * Permission is hereby granted, free of charge, to any person obtaining a
      5 * copy of this software and associated documentation files (the "Software"),
      6 * to deal in the Software without restriction, including without limitation
      7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      8 * and/or sell copies of the Software, and to permit persons to whom the
      9 * Software is furnished to do so, subject to the following conditions:
     10 *
     11 * The above copyright notice and this permission notice (including the next
     12 * paragraph) shall be included in all copies or substantial portions of the
     13 * Software.
     14 *
     15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
     21 * IN THE SOFTWARE.
     22 *
     23 * @file tessellator.h
     24 *
     25 * @brief Tessellator fixed function unit interface definition
     26 *
     27 ******************************************************************************/
     28 #pragma once
     29 
     30 /// Allocate and initialize a new tessellation context
     31 HANDLE SWR_API TSInitCtx(
     32     SWR_TS_DOMAIN tsDomain,                     ///< [IN] Tessellation domain (isoline, quad, triangle)
     33     SWR_TS_PARTITIONING tsPartitioning,         ///< [IN] Tessellation partitioning algorithm
     34     SWR_TS_OUTPUT_TOPOLOGY tsOutputTopology,    ///< [IN] Tessellation output topology
     35     void* pContextMem,                          ///< [IN] Memory to use for the context
     36     size_t& memSize);                           ///< [INOUT] In: Amount of memory in pContextMem. Out: Mem required
     37 
     38 /// Destroy & de-allocate tessellation context
     39 void SWR_API TSDestroyCtx(
     40     HANDLE tsCtx);  ///< [IN] Tessellation context to be destroyed
     41 
     42 struct SWR_TS_TESSELLATED_DATA
     43 {
     44     uint32_t NumPrimitives;
     45     uint32_t NumDomainPoints;
     46 
     47     uint32_t* ppIndices[3];
     48     float* pDomainPointsU;
     49     float* pDomainPointsV;
     50     // For Tri: pDomainPointsW[i] = 1.0f - pDomainPointsU[i] - pDomainPointsV[i]
     51 };
     52 
     53 /// Perform Tessellation
     54 void SWR_API TSTessellate(
     55     HANDLE tsCtx,                                   ///< [IN] Tessellation Context
     56     const SWR_TESSELLATION_FACTORS& tsTessFactors,  ///< [IN] Tessellation Factors
     57     SWR_TS_TESSELLATED_DATA& tsTessellatedData);    ///< [OUT] Tessellated Data
     58 
     59 
     60 
     61 /// @TODO - Implement OSS tessellator
     62 
     63 INLINE HANDLE SWR_API TSInitCtx(
     64     SWR_TS_DOMAIN tsDomain,
     65     SWR_TS_PARTITIONING tsPartitioning,
     66     SWR_TS_OUTPUT_TOPOLOGY tsOutputTopology,
     67     void* pContextMem,
     68     size_t& memSize)
     69 {
     70     SWR_NOT_IMPL;
     71     return NULL;
     72 }
     73 
     74 
     75 INLINE void SWR_API TSDestroyCtx(HANDLE tsCtx)
     76 {
     77     SWR_NOT_IMPL;
     78 }
     79 
     80 
     81 INLINE void SWR_API TSTessellate(
     82     HANDLE tsCtx,
     83     const SWR_TESSELLATION_FACTORS& tsTessFactors,
     84     SWR_TS_TESSELLATED_DATA& tsTessellatedData)
     85 {
     86     SWR_NOT_IMPL;
     87 }
     88 
     89