gen8: Fix border color
The border color packet is specified as a 64-byte aligned address relative to dynamic state base address. The way the packing functions are currently set up, we need to provide it with (offset >> 6) because it just shoves the bits in where the PRM says they go and isn't really aware that it's an address.
This commit is contained in:
+12
-2
@@ -643,10 +643,19 @@ anv_state_pool_emit_data(struct anv_state_pool *pool, size_t size, size_t align,
|
||||
return state;
|
||||
}
|
||||
|
||||
struct gen8_border_color {
|
||||
union {
|
||||
float float32[4];
|
||||
uint32_t uint32[4];
|
||||
};
|
||||
/* Pad out to 64 bytes */
|
||||
uint32_t _pad[12];
|
||||
};
|
||||
|
||||
static void
|
||||
anv_device_init_border_colors(struct anv_device *device)
|
||||
{
|
||||
static const VkClearColorValue border_colors[] = {
|
||||
static const struct gen8_border_color border_colors[] = {
|
||||
[VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK] = { .float32 = { 0.0, 0.0, 0.0, 0.0 } },
|
||||
[VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK] = { .float32 = { 0.0, 0.0, 0.0, 1.0 } },
|
||||
[VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE] = { .float32 = { 1.0, 1.0, 1.0, 1.0 } },
|
||||
@@ -656,7 +665,8 @@ anv_device_init_border_colors(struct anv_device *device)
|
||||
};
|
||||
|
||||
device->border_colors = anv_state_pool_emit_data(&device->dynamic_state_pool,
|
||||
sizeof(border_colors), 32, border_colors);
|
||||
sizeof(border_colors), 64,
|
||||
border_colors);
|
||||
}
|
||||
|
||||
VkResult anv_CreateDevice(
|
||||
|
||||
@@ -380,6 +380,9 @@ VkResult genX(CreateSampler)(
|
||||
uint32_t filter = vk_to_gen_tex_filter(pCreateInfo->magFilter,
|
||||
pCreateInfo->anisotropyEnable);
|
||||
|
||||
uint32_t border_color_offset = device->border_colors.offset +
|
||||
pCreateInfo->borderColor * 64;
|
||||
|
||||
struct GENX(SAMPLER_STATE) sampler_state = {
|
||||
.SamplerDisable = false,
|
||||
.TextureBorderColorMode = DX10OGL,
|
||||
@@ -400,9 +403,7 @@ VkResult genX(CreateSampler)(
|
||||
.ShadowFunction = vk_to_gen_compare_op[pCreateInfo->compareOp],
|
||||
.CubeSurfaceControlMode = 0,
|
||||
|
||||
.IndirectStatePointer =
|
||||
device->border_colors.offset +
|
||||
pCreateInfo->borderColor * sizeof(float) * 4,
|
||||
.IndirectStatePointer = border_color_offset >> 6,
|
||||
|
||||
.LODClampMagnificationMode = MIPNONE,
|
||||
.MaximumAnisotropy = vk_to_gen_max_anisotropy(pCreateInfo->maxAnisotropy),
|
||||
|
||||
Reference in New Issue
Block a user