Hash :
57eded36
Author :
Date :
2024-04-03T23:02:39
Vulkan: Fix off-by-one error in compute-based stencil blit The coordinates used for sampling were calculated based on pixel's top-left (integer) coordinates and used with a NEAREST sampler. This resulted in two bugs: - When X was flipped, the bounds check rejected the first column - The sampling could pick the wrong pixel as the on-the-edge coordinates could map to either of 4 pixels that share that corner. This change moves the sampling coordinates to the pixel's center. Bug: angleproject:8652 Change-Id: I0b54fa0bad366f52f8e6c17bb0054fa373af8b5c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5420834 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
// GENERATED FILE - DO NOT EDIT.
// Generated by gen_vk_internal_shaders.py.
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// shaders/gen/BlitResolveStencilNoExport.comp.00000001.inc:
// Pre-generated shader for the ANGLE Vulkan back-end.
#pragma once
constexpr uint8_t kBlitResolveStencilNoExport_comp_00000001[] = {
0x1f,0x8b,0x08,0x00,0x00,0x00,0x00,0x00,0x02,0xff,0x6d,0x96,0xd9,0x6f,0x94,0x55,
0x18,0xc6,0xbf,0x99,0x69,0xa7,0x65,0xb4,0x2d,0xd5,0x16,0xb0,0x05,0x4a,0xad,0xc1,
0xa5,0x04,0x31,0x61,0x33,0x30,0x52,0x88,0x20,0xb6,0x44,0x2c,0xd8,0x09,0x06,0x95,
0x6a,0xbc,0x80,0x8b,0x2e,0x49,0x89,0xb5,0x0d,0x6a,0x4b,0x2b,0x22,0x16,0x0d,0x02,
0x2e,0x80,0x1a,0x8c,0xc4,0x34,0x9a,0x48,0x6d,0x82,0x60,0xa2,0xb2,0x68,0xbc,0x30,
0xf1,0x06,0x41,0xbc,0xc2,0x7f,0xc2,0x3d,0x46,0xdf,0xe7,0xcc,0xef,0x98,0x37,0x13,
0xbf,0xe4,0xe4,0xcc,0x79,0xde,0x7d,0x3b,0x67,0x32,0xe9,0x96,0x8a,0x24,0x49,0x25,
0xb9,0xa4,0x32,0xf9,0x39,0x29,0x7e,0xb5,0x49,0xda,0x90,0x24,0xb9,0x21,0xc9,0x86,
0xfd,0x81,0x4d,0x5b,0x37,0x2d,0x1e,0xd8,0xfd,0xf4,0xe2,0xa5,0xcb,0x96,0x88,0x5e,
0x9d,0x64,0x02,0x9f,0x68,0x35,0xc6,0x53,0x6e,0x7b,0x99,0xad,0x9e,0x27,0x77,0xf5,
0x0a,0xaf,0xb2,0x35,0xd3,0xf0,0xb2,0xa0,0x2b,0x31,0xcd,0xc5,0x15,0x74,0x19,0x5a,
0x15,0x74,0x27,0xc9,0x5c,0x5b,0x1b,0x4d,0x7a,0x1e,0x76,0x5b,0xd8,0x23,0x96,0x02,
0xab,0x74,0x58,0x1a,0x6c,0xa6,0xc3,0x32,0x60,0x73,0x1c,0x56,0x06,0xe6,0x6d,0x94,
0x83,0x2d,0x70,0x58,0x16,0x6c,0x89,0xc3,0x2a,0xc0,0x96,0x3a,0xac,0x12,0x6c,0xa5,
0xc3,0x66,0x80,0xad,0x0e,0x71,0x65,0xfe,0xf3,0x4f,0x31,0xee,0xb7,0xfd,0x56,0xe2,
0x89,0xe7,0x66,0x97,0x83,0x89,0x12,0xfa,0x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x6d,0x96,0x1f,0xbd,0xb7,0xef,0x12,0xc3,0x09,0xee,0xf7,0x41,0xf4,
0xa8,0xa7,0xde,0x83,0xae,0xef,0x5b,0xb0,0xf7,0xc1,0x4f,0xf2,0x66,0xc9,0xc7,0x0f,
0xe8,0xa1,0xce,0xf0,0xee,0x15,0xf9,0x4e,0xc1,0x2b,0xda,0x37,0x60,0x1f,0xd2,0xa7,
0xa7,0xa8,0x57,0xcc,0xf7,0xb8,0xeb,0xe3,0xeb,0xf0,0x0c,0xc3,0x3f,0xe6,0x62,0x9f,
0x64,0x56,0x46,0x89,0xf3,0x63,0xea,0x3f,0xe9,0xee,0x8c,0xcb,0xe0,0xd7,0xdc,0x3c,
0xf6,0x63,0xa7,0x9f,0x77,0x24,0xcb,0x1c,0x5c,0xfd,0x9f,0x79,0xeb,0x73,0xf5,0xf8,
0x8c,0x7a,0x9c,0x71,0xf5,0x38,0x0b,0xbe,0x87,0xbb,0xe4,0x1c,0x58,0x7c,0xbf,0x3f,
0xe7,0xdd,0x3d,0x87,0x2d,0x61,0x5f,0x80,0xd7,0x06,0xdd,0xd9,0xf0,0xff,0xe3,0x3c,
0xff,0x51,0xda,0xa0,0xdf,0x67,0x3d,0x79,0x9e,0xd8,0xfd,0xbb,0xa8,0xfd,0x6f,0xab,
0xe4,0x4a,0x5b,0xff,0x02,0x8d,0xed,0x49,0xea,0xfc,0x0d,0x00,0x00
};
// Generated from:
//
// #version 450 core
//
// layout(local_size_x = 8, local_size_y = 8, local_size_z = 1)in;
//
// layout(push_constant)uniform PushConstants {
//
// vec2 offset;
// vec2 stretch;
// vec2 invSrcExtent;
// int srcLayer;
// int srcWidth;
//
// ivec4 blitArea;
// int destPitch;
//
// bool flipX;
// bool flipY;
// bool rotateXY;
// } params;
//
// layout(set = 0, binding = 0)buffer dst
// {
//
// uint destData[];
// };
//
// layout(set = 0, binding = 1)uniform utexture2DArray stencil;
//
// layout(set = 0, binding = 2)uniform sampler blitSampler;
//
// void main()
// {
// ivec2 destSubImageCoords = ivec2(gl_GlobalInvocationID . x * 4, gl_GlobalInvocationID . y);
// if(any(lessThanEqual(params . blitArea . zw, destSubImageCoords)))
// {
// return;
// }
//
// destSubImageCoords += params . blitArea . xy;
// vec2 srcImageCoords = vec2(destSubImageCoords);
//
// srcImageCoords *= params . stretch;
// srcImageCoords += vec2(0.5);
//
// srcImageCoords -= params . offset;
//
// if(params . flipX)
// srcImageCoords . x = - srcImageCoords . x;
// if(params . flipY)
// srcImageCoords . y = - srcImageCoords . y;
// if(params . rotateXY)
// srcImageCoords . xy = srcImageCoords . yx;
//
// int xDir = params . flipX ? - 1 : 1;
//
// uint outStencils = 0;
//
// for(int i = 0;i < 4;++ i)
// {
//
// if(srcImageCoords . x >= 0 && srcImageCoords . x < params . srcWidth)
// {
//
// uint stencilValue = texture(usampler2DArray(stencil, blitSampler), vec3(srcImageCoords * params . invSrcExtent, params . srcLayer)). x;
//
// outStencils |=(stencilValue & 0xFF)<<(i * 8);
//
// }
//
// srcImageCoords . x += xDir;
// }
//
// destData[gl_GlobalInvocationID . y * params . destPitch + gl_GlobalInvocationID . x]= outStencils;
// }