}
}
+/******************************************************************************
+ TEXSTATE
+ ******************************************************************************/
+
+static inline enum PVRX(TEXSTATE_CMP_MODE) pvr_texstate_cmpmode(VkCompareOp op)
+{
+ /* enum values are identical, so we can just cast the input directly. */
+ return (enum PVRX(TEXSTATE_CMP_MODE))op;
+}
+
#endif /* PVR_CSB_ENUM_HELPERS_H */
*/
static const struct pvr_descriptor_size_info template_size_infos[] = {
/* VK_DESCRIPTOR_TYPE_SAMPLER */
- { 4, 0, 4 },
+ { PVR_SAMPLER_DESCRIPTOR_SIZE, 0, 4 },
/* VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER */
- { 8, UINT_MAX, 4 },
+ { PVR_SAMPLER_DESCRIPTOR_SIZE + 4, UINT_MAX, 4 },
/* VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE */
{ 4, UINT_MAX, 4 },
/* VK_DESCRIPTOR_TYPE_STORAGE_IMAGE */
return (uint16_t)offset;
}
-static void pvr_write_sampler_descriptor(uint32_t *primary,
- const struct pvr_sampler *sampler)
-{
- /* TODO: Implement based on WriteSamplerDescriptor. */
- pvr_finishme("Implement after vkCreateSampler API.");
-}
-
#define PVR_MAX_DESCRIPTOR_MEM_SIZE_IN_DWORDS (4 * 1024)
static VkResult
* for max descriptors supported by pool as done by v3dv. Also check the
* possibility if this can be removed from here and done on need basis.
*/
+
if (layout->binding_count > 0) {
const uint32_t cache_line_size =
rogue_get_slc_cache_line_size(&device->pdevice->dev_info);
if (binding->type == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)
offset_in_dwords += 4;
- pvr_write_sampler_descriptor(map +
- offset_in_dwords * sizeof(uint32_t),
- sampler);
+ memcpy((uint8_t *)map + offset_in_dwords * sizeof(uint32_t),
+ sampler->descriptor.words,
+ sizeof(sampler->descriptor.words));
}
}
}
#include "hwdef/rogue_hw_utils.h"
#include "pvr_bo.h"
#include "pvr_csb.h"
+#include "pvr_csb_enum_helpers.h"
#include "pvr_device_info.h"
#include "pvr_job_render.h"
#include "pvr_limits.h"
float min_lod;
float max_lod;
+ STATIC_ASSERT(sizeof(((union pvr_sampler_descriptor *)NULL)->data) ==
+ sizeof(((union pvr_sampler_descriptor *)NULL)->words));
+
sampler = vk_object_alloc(&device->vk,
pAllocator,
sizeof(*sampler),
}
}
- pvr_csb_pack (&sampler->sampler_word, TEXSTATE_SAMPLER, word) {
+ if (pCreateInfo->compareEnable) {
+ sampler->descriptor.data.compare_op =
+ (uint32_t)pvr_texstate_cmpmode(pCreateInfo->compareOp);
+ } else {
+ sampler->descriptor.data.compare_op =
+ (uint32_t)pvr_texstate_cmpmode(VK_COMPARE_OP_NEVER);
+ }
+
+ sampler->descriptor.data.word3 = 0;
+ pvr_csb_pack (&sampler->descriptor.data.sampler_word,
+ TEXSTATE_SAMPLER,
+ word) {
const struct pvr_device_info *dev_info = &device->pdevice->dev_info;
const float lod_clamp_max = (float)PVRX(TEXSTATE_CLAMP_MAX) /
(1 << PVRX(TEXSTATE_CLAMP_FRACTIONAL_BITS));
word.addrmode_w =
pvr_sampler_get_hw_addr_mode_from_vk(pCreateInfo->addressModeW);
+ /* TODO: Figure out defines for these. */
+ if (word.addrmode_u == PVRX(TEXSTATE_ADDRMODE_FLIP))
+ sampler->descriptor.data.word3 |= 0x40000000;
+
+ if (word.addrmode_v == PVRX(TEXSTATE_ADDRMODE_FLIP))
+ sampler->descriptor.data.word3 |= 0x20000000;
+
/* The Vulkan 1.0.205 spec says:
*
* The absolute value of mipLodBias must be less than or equal to
#define PVR_WORKGROUP_DIMENSIONS 3U
+#define PVR_SAMPLER_DESCRIPTOR_SIZE 4U
+
#define PVR_STATE_PBE_DWORDS 2U
#define PVR_PIPELINE_LAYOUT_SUPPORTED_DESCRIPTOR_TYPE_COUNT \
uint64_t texture_state[PVR_TEXTURE_STATE_MAX_ENUM][2];
};
+union pvr_sampler_descriptor {
+ uint32_t words[PVR_SAMPLER_DESCRIPTOR_SIZE];
+
+ struct {
+ /* Packed PVRX(TEXSTATE_SAMPLER). */
+ uint64_t sampler_word;
+ uint32_t compare_op;
+ /* TODO: Figure out what this word is for and rename.
+ * Sampler state word 1?
+ */
+ uint32_t word3;
+ } data;
+};
+
struct pvr_sampler {
struct vk_object_base base;
- uint64_t sampler_word;
+ union pvr_sampler_descriptor descriptor;
};
struct pvr_descriptor_size_info {