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
This commit is contained in:
@@ -982,9 +982,11 @@ void TransactionBuilder::AddExternalImage(ImageKey key,
|
||||
const ImageDescriptor& aDescriptor,
|
||||
ExternalImageId aExtID,
|
||||
wr::ExternalImageType aImageType,
|
||||
uint8_t aChannelIndex) {
|
||||
uint8_t aChannelIndex,
|
||||
bool aNormalizedUvs) {
|
||||
wr_resource_updates_add_external_image(mTxn, key, &aDescriptor, aExtID,
|
||||
&aImageType, aChannelIndex);
|
||||
&aImageType, aChannelIndex,
|
||||
aNormalizedUvs);
|
||||
}
|
||||
|
||||
void TransactionBuilder::AddExternalImageBuffer(
|
||||
@@ -1014,17 +1016,20 @@ void TransactionBuilder::UpdateExternalImage(ImageKey aKey,
|
||||
const ImageDescriptor& aDescriptor,
|
||||
ExternalImageId aExtID,
|
||||
wr::ExternalImageType aImageType,
|
||||
uint8_t aChannelIndex) {
|
||||
uint8_t aChannelIndex,
|
||||
bool aNormalizedUvs) {
|
||||
wr_resource_updates_update_external_image(mTxn, aKey, &aDescriptor, aExtID,
|
||||
&aImageType, aChannelIndex);
|
||||
&aImageType, aChannelIndex,
|
||||
aNormalizedUvs);
|
||||
}
|
||||
|
||||
void TransactionBuilder::UpdateExternalImageWithDirtyRect(
|
||||
ImageKey aKey, const ImageDescriptor& aDescriptor, ExternalImageId aExtID,
|
||||
wr::ExternalImageType aImageType, const wr::DeviceIntRect& aDirtyRect,
|
||||
uint8_t aChannelIndex) {
|
||||
uint8_t aChannelIndex, bool aNormalizedUvs) {
|
||||
wr_resource_updates_update_external_image_with_dirty_rect(
|
||||
mTxn, aKey, &aDescriptor, aExtID, &aImageType, aChannelIndex, aDirtyRect);
|
||||
mTxn, aKey, &aDescriptor, aExtID, &aImageType, aChannelIndex,
|
||||
aNormalizedUvs, aDirtyRect);
|
||||
}
|
||||
|
||||
void TransactionBuilder::SetBlobImageVisibleArea(
|
||||
|
||||
Reference in New Issue
Block a user