Skip to content

Commit 1628c3c

Browse files
committed
Bug 1913568 - Add support for normalized UV coordinates to webrender. r=gfx-reviewers,nical
Some external images must be sampled from by providing normalized UV coordinates to webrender, but currently webrender only supports unnormalized UVs. This patch adds a flag to webrender's external image API that specifies whether the UV coordinates supplied when the texture is locked are normalized or unnormalized. This flag is plumbed through webrender to the required locations. We then add support for taking normalized UVs as inputs to the brush_image and cs_scale shaders. The only other shader that can be used with external textures is the composite shader, which already supports normalized UVs. This does not change any behaviour, that will happen in the next patch in this series. Differential Revision: https://phabricator.services.mozilla.com/D220581
1 parent a8bbf3a commit 1628c3c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/bindings.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,6 +2177,7 @@ pub extern "C" fn wr_resource_updates_add_external_image(
21772177
external_image_id: ExternalImageId,
21782178
image_type: &ExternalImageType,
21792179
channel_index: u8,
2180+
normalized_uvs: bool,
21802181
) {
21812182
txn.add_image(
21822183
image_key,
@@ -2185,6 +2186,7 @@ pub extern "C" fn wr_resource_updates_add_external_image(
21852186
id: external_image_id,
21862187
channel_index,
21872188
image_type: *image_type,
2189+
normalized_uvs,
21882190
}),
21892191
None,
21902192
);
@@ -2222,6 +2224,7 @@ pub extern "C" fn wr_resource_updates_update_external_image(
22222224
external_image_id: ExternalImageId,
22232225
image_type: &ExternalImageType,
22242226
channel_index: u8,
2227+
normalized_uvs: bool,
22252228
) {
22262229
txn.update_image(
22272230
key,
@@ -2230,6 +2233,7 @@ pub extern "C" fn wr_resource_updates_update_external_image(
22302233
id: external_image_id,
22312234
channel_index,
22322235
image_type: *image_type,
2236+
normalized_uvs,
22332237
}),
22342238
&DirtyRect::All,
22352239
);
@@ -2243,6 +2247,7 @@ pub extern "C" fn wr_resource_updates_update_external_image_with_dirty_rect(
22432247
external_image_id: ExternalImageId,
22442248
image_type: &ExternalImageType,
22452249
channel_index: u8,
2250+
normalized_uvs: bool,
22462251
dirty_rect: DeviceIntRect,
22472252
) {
22482253
txn.update_image(
@@ -2252,6 +2257,7 @@ pub extern "C" fn wr_resource_updates_update_external_image_with_dirty_rect(
22522257
id: external_image_id,
22532258
channel_index,
22542259
image_type: *image_type,
2260+
normalized_uvs,
22552261
}),
22562262
&DirtyRect::Partial(dirty_rect),
22572263
);

0 commit comments

Comments
 (0)