LCOV - code coverage report
Current view: top level - src/glsl - utils.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 4 0.0 %
Date: 2025-03-29 09:04:10 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 6 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * This file is part of libplacebo.
       3                 :            :  *
       4                 :            :  * libplacebo is free software; you can redistribute it and/or
       5                 :            :  * modify it under the terms of the GNU Lesser General Public
       6                 :            :  * License as published by the Free Software Foundation; either
       7                 :            :  * version 2.1 of the License, or (at your option) any later version.
       8                 :            :  *
       9                 :            :  * libplacebo is distributed in the hope that it will be useful,
      10                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12                 :            :  * GNU Lesser General Public License for more details.
      13                 :            :  *
      14                 :            :  * You should have received a copy of the GNU Lesser General Public
      15                 :            :  * License along with libplacebo. If not, see <http://www.gnu.org/licenses/>.
      16                 :            :  */
      17                 :            : 
      18                 :            : #pragma once
      19                 :            : 
      20                 :            : #include <stdbool.h>
      21                 :            : #include <stdint.h>
      22                 :            : 
      23                 :            : #include <libplacebo/gpu.h>
      24                 :            : 
      25                 :            : #define PL_SPV_VERSION(major, minor) ((major) << 16 | (minor) << 8)
      26                 :            : #define PL_VLK_VERSION(major, minor) ((major) << 22 | (minor) << 12)
      27                 :            : 
      28                 :            : // Max version that can be used
      29                 :            : #define PL_MAX_SPIRV_VER PL_SPV_VERSION(1, 6)
      30                 :            : 
      31                 :            : struct pl_spirv_version {
      32                 :            :     uint32_t env_version;
      33                 :            :     uint32_t spv_version;
      34                 :            : };
      35                 :            : 
      36                 :            : // Returns minimum Vulkan version for given SPIR-V version
      37                 :            : static inline uint32_t pl_spirv_version_to_vulkan(uint32_t spirv_ver)
      38                 :            : {
      39         [ #  # ]:          0 :     if (spirv_ver >= PL_SPV_VERSION(1, 6))
      40                 :            :         return PL_VLK_VERSION(1, 3);
      41         [ #  # ]:          0 :     if (spirv_ver >= PL_SPV_VERSION(1, 4))
      42                 :            :         return PL_VLK_VERSION(1, 2);
      43         [ #  # ]:          0 :     if (spirv_ver >= PL_SPV_VERSION(1, 1))
      44                 :          0 :         return PL_VLK_VERSION(1, 1);
      45                 :            :     return PL_VLK_VERSION(1, 0);
      46                 :            : }
      47                 :            : 
      48                 :            : enum glsl_shader_stage {
      49                 :            :     GLSL_SHADER_VERTEX = 0,
      50                 :            :     GLSL_SHADER_FRAGMENT,
      51                 :            :     GLSL_SHADER_COMPUTE,
      52                 :            : };

Generated by: LCOV version 1.16