~mmach/netext73/mesa-haswell

« back to all changes in this revision

Viewing changes to src/imagination/vulkan/pvr_tex_state.h

  • Committer: mmach
  • Date: 2022-09-22 19:56:13 UTC
  • Revision ID: netbit73@gmail.com-20220922195613-wtik9mmy20tmor0i
2022-09-22 21:17:09

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2022 Imagination Technologies Ltd.
3
 
 *
4
 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
5
 
 * of this software and associated documentation files (the "Software"), to deal
6
 
 * in the Software without restriction, including without limitation the rights
7
 
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
 
 * copies of the Software, and to permit persons to whom the Software is
9
 
 * 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 THE
18
 
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
 
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
 
 * SOFTWARE.
22
 
 */
23
 
 
24
 
#ifndef PVR_TEX_STATE_H
25
 
#define PVR_TEX_STATE_H
26
 
 
27
 
#include <stdint.h>
28
 
#include <vulkan/vulkan.h>
29
 
 
30
 
#include "hwdef/rogue_hw_defs.h"
31
 
#include "pvr_private.h"
32
 
#include "util/macros.h"
33
 
 
34
 
/**
35
 
 * Texture requires 32bit index lookups instead of texture coordinate access.
36
 
 */
37
 
#define PVR_TEXFLAGS_INDEX_LOOKUP BITFIELD_BIT(0U)
38
 
 
39
 
/** Texture has border texels present. */
40
 
#define PVR_TEXFLAGS_BORDER BITFIELD_BIT(1U)
41
 
 
42
 
/**
43
 
 * Resource is actually a buffer, not a texture, and therefore LOD is ignored.
44
 
 * Coordinates are integers.
45
 
 */
46
 
#define PVR_TEXFLAGS_BUFFER BITFIELD_BIT(2U)
47
 
 
48
 
/** Parameters for #pvr_pack_tex_state(). */
49
 
struct pvr_texture_state_info {
50
 
   VkFormat format;
51
 
   enum pvr_memlayout mem_layout;
52
 
   uint32_t flags;
53
 
   VkImageViewType type;
54
 
   bool is_cube;
55
 
   enum pvr_texture_state tex_state_type;
56
 
   VkExtent3D extent;
57
 
 
58
 
   /**
59
 
    * For array textures, this holds the array dimension, in elements. This can
60
 
    * be zero if texture is not an array.
61
 
    */
62
 
   uint32_t array_size;
63
 
 
64
 
   /** Base mipmap level. This is the miplevel you want as the top level. */
65
 
   uint32_t base_level;
66
 
 
67
 
   /**
68
 
    * Number of mipmap levels that should be accessed by HW. This is not
69
 
    * necessarily the number of levels that are in memory. (See
70
 
    * mipmaps_present)
71
 
    */
72
 
   uint32_t mip_levels;
73
 
 
74
 
   /**
75
 
    * True if the texture is mipmapped.
76
 
    * Note: This is based on the number of mip levels the texture contains, not
77
 
    * on the mip levels that are being used i.e. mip_levels.
78
 
    */
79
 
   bool mipmaps_present;
80
 
 
81
 
   /**
82
 
    * Number of samples per texel for multisampling. This should be 1 for none
83
 
    * multisampled textures.
84
 
    */
85
 
   uint32_t sample_count;
86
 
 
87
 
   /** Stride, in pixels. Only valid if mem_layout is stride or tiled. */
88
 
   uint32_t stride;
89
 
 
90
 
   /**
91
 
    * For buffers, where TPU_BUFFER_LOOKUP is present, this defines
92
 
    * the offset for the buffer, in texels.
93
 
    */
94
 
   uint32_t offset;
95
 
 
96
 
   /**
97
 
    * Precomputed (composed from createinfo->components and format swizzle)
98
 
    * swizzles to pass in to the texture state.
99
 
    */
100
 
   uint8_t swizzle[4];
101
 
 
102
 
   /** Address of texture, which must be aligned to at least 32bits. */
103
 
   pvr_dev_addr_t addr;
104
 
};
105
 
 
106
 
VkResult
107
 
pvr_pack_tex_state(struct pvr_device *device,
108
 
                   struct pvr_texture_state_info *info,
109
 
                   uint64_t state[static const ROGUE_NUM_TEXSTATE_IMAGE_WORDS]);
110
 
 
111
 
#endif /* PVR_TEX_STATE_H */