2
* Copyright © 2022 Imagination Technologies Ltd.
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:
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
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
24
#ifndef PVR_TEX_STATE_H
25
#define PVR_TEX_STATE_H
28
#include <vulkan/vulkan.h>
30
#include "hwdef/rogue_hw_defs.h"
31
#include "pvr_private.h"
32
#include "util/macros.h"
35
* Texture requires 32bit index lookups instead of texture coordinate access.
37
#define PVR_TEXFLAGS_INDEX_LOOKUP BITFIELD_BIT(0U)
39
/** Texture has border texels present. */
40
#define PVR_TEXFLAGS_BORDER BITFIELD_BIT(1U)
43
* Resource is actually a buffer, not a texture, and therefore LOD is ignored.
44
* Coordinates are integers.
46
#define PVR_TEXFLAGS_BUFFER BITFIELD_BIT(2U)
48
/** Parameters for #pvr_pack_tex_state(). */
49
struct pvr_texture_state_info {
51
enum pvr_memlayout mem_layout;
55
enum pvr_texture_state tex_state_type;
59
* For array textures, this holds the array dimension, in elements. This can
60
* be zero if texture is not an array.
64
/** Base mipmap level. This is the miplevel you want as the top level. */
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
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.
82
* Number of samples per texel for multisampling. This should be 1 for none
83
* multisampled textures.
85
uint32_t sample_count;
87
/** Stride, in pixels. Only valid if mem_layout is stride or tiled. */
91
* For buffers, where TPU_BUFFER_LOOKUP is present, this defines
92
* the offset for the buffer, in texels.
97
* Precomputed (composed from createinfo->components and format swizzle)
98
* swizzles to pass in to the texture state.
102
/** Address of texture, which must be aligned to at least 32bits. */
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]);
111
#endif /* PVR_TEX_STATE_H */