New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GL_TEXTURE_RECTANGLE texture target support #997
Merged
+305
−157
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
86b00a7
Use struct ExternalImageData to present the different external textur…
JerryShih 1305f38
Add new TextureTarget::Rect texture target type for external image Te…
JerryShih dec3102
Add a new TEXTURE_RECT_FEATURE feature in image shader for external i…
JerryShih bbfefcc
Update ImageData type in wrench.
JerryShih File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
Add a new TEXTURE_RECT_FEATURE feature in image shader for external i…
…mage TextureRectHandle.
- Loading branch information
commit dec3102d50d3fe339190748b3407338cebb56d8e
| @@ -65,6 +65,7 @@ const GPU_TAG_INIT: GpuProfileTag = GpuProfileTag { label: "Init", color: debug_ | ||
| const GPU_TAG_SETUP_TARGET: GpuProfileTag = GpuProfileTag { label: "Target", color: debug_colors::SLATEGREY }; | ||
| const GPU_TAG_PRIM_RECT: GpuProfileTag = GpuProfileTag { label: "Rect", color: debug_colors::RED }; | ||
| const GPU_TAG_PRIM_IMAGE: GpuProfileTag = GpuProfileTag { label: "Image", color: debug_colors::GREEN }; | ||
| const GPU_TAG_PRIM_IMAGE_RECT: GpuProfileTag = GpuProfileTag { label: "ImageRect", color: debug_colors::GREENYELLOW }; | ||
| const GPU_TAG_PRIM_YUV_IMAGE: GpuProfileTag = GpuProfileTag { label: "YuvImage", color: debug_colors::DARKGREEN }; | ||
| const GPU_TAG_PRIM_BLEND: GpuProfileTag = GpuProfileTag { label: "Blend", color: debug_colors::LIGHTBLUE }; | ||
| const GPU_TAG_PRIM_HW_COMPOSITE: GpuProfileTag = GpuProfileTag { label: "HwComposite", color: debug_colors::DODGERBLUE }; | ||
| @@ -223,6 +224,7 @@ pub type GradientDataStore = GpuStore<GradientData, GradientDataTextureLayout>; | ||
| const TRANSFORM_FEATURE: &'static str = "TRANSFORM"; | ||
| const SUBPIXEL_AA_FEATURE: &'static str = "SUBPIXEL_AA"; | ||
| const CLIP_FEATURE: &'static str = "CLIP"; | ||
| const TEXTURE_RECT_FEATURE: &'static str = "TEXTURE_RECT"; | ||
|
|
||
| enum ShaderKind { | ||
| Primitive, | ||
| @@ -465,6 +467,7 @@ pub struct Renderer { | ||
| ps_text_run: PrimitiveShader, | ||
| ps_text_run_subpixel: PrimitiveShader, | ||
| ps_image: PrimitiveShader, | ||
| ps_image_rect: PrimitiveShader, | ||
| ps_yuv_image: PrimitiveShader, | ||
| ps_border: PrimitiveShader, | ||
| ps_gradient: PrimitiveShader, | ||
| @@ -670,6 +673,13 @@ impl Renderer { | ||
| options.precache_shaders) | ||
| }; | ||
|
|
||
| let ps_image_rect = try!{ | ||
JerryShih
Author
Contributor
|
||
| PrimitiveShader::new("ps_image", | ||
| &mut device, | ||
| &[ TEXTURE_RECT_FEATURE ], | ||
| options.precache_shaders) | ||
| }; | ||
|
|
||
| let ps_yuv_image = try!{ | ||
| PrimitiveShader::new("ps_yuv_image", | ||
| &mut device, | ||
| @@ -912,6 +922,7 @@ impl Renderer { | ||
| ps_text_run: ps_text_run, | ||
| ps_text_run_subpixel: ps_text_run_subpixel, | ||
| ps_image: ps_image, | ||
| ps_image_rect: ps_image_rect, | ||
| ps_yuv_image: ps_yuv_image, | ||
| ps_border: ps_border, | ||
| ps_box_shadow: ps_box_shadow, | ||
| @@ -1346,6 +1357,10 @@ impl Renderer { | ||
| let shader = self.ps_image.get(&mut self.device, transform_kind); | ||
| (GPU_TAG_PRIM_IMAGE, shader) | ||
| } | ||
| AlphaBatchKind::ImageRect => { | ||
| let shader = self.ps_image_rect.get(&mut self.device, transform_kind); | ||
| (GPU_TAG_PRIM_IMAGE_RECT, shader) | ||
| } | ||
| AlphaBatchKind::YuvImage => { | ||
| let shader = self.ps_yuv_image.get(&mut self.device, transform_kind); | ||
| (GPU_TAG_PRIM_YUV_IMAGE, shader) | ||
| @@ -28,6 +28,7 @@ use webrender_traits::{DeviceIntSize, DeviceUintPoint}; | ||
| use webrender_traits::{DeviceUintSize, FontRenderMode, ImageRendering, LayerPoint, LayerRect}; | ||
| use webrender_traits::{LayerToWorldTransform, MixBlendMode, PipelineId, ScrollLayerId}; | ||
| use webrender_traits::{WorldPoint4D, WorldToLayerTransform}; | ||
| use webrender_traits::{ExternalImageType}; | ||
|
|
||
| // Special sentinel value recognized by the shader. It is considered to be | ||
| // a dummy task that doesn't mask out anything. | ||
| @@ -70,7 +71,24 @@ impl AlphaBatchHelpers for PrimitiveStore { | ||
| let batch_kind = match metadata.prim_kind { | ||
| PrimitiveKind::Border => AlphaBatchKind::Border, | ||
| PrimitiveKind::BoxShadow => AlphaBatchKind::BoxShadow, | ||
| PrimitiveKind::Image => AlphaBatchKind::Image, | ||
| PrimitiveKind::Image => { | ||
| let image_cpu = &self.cpu_images[metadata.cpu_prim_index.0]; | ||
|
|
||
| match image_cpu.color_texture_id { | ||
| SourceTexture::External(ext_image) => { | ||
| match ext_image.image_type { | ||
| ExternalImageType::Texture2DHandle => AlphaBatchKind::Image, | ||
| ExternalImageType::TextureRectHandle => AlphaBatchKind::ImageRect, | ||
JerryShih
Author
Contributor
|
||
| _ => { | ||
| panic!("Non-texture handle type should be handled in other way."); | ||
| } | ||
| } | ||
| } | ||
| _ => { | ||
| AlphaBatchKind::Image | ||
| } | ||
| } | ||
| } | ||
| PrimitiveKind::YuvImage => AlphaBatchKind::YuvImage, | ||
| PrimitiveKind::Rectangle => AlphaBatchKind::Rectangle, | ||
| PrimitiveKind::AlignedGradient => AlphaBatchKind::AlignedGradient, | ||
| @@ -274,7 +292,8 @@ impl AlphaBatchHelpers for PrimitiveStore { | ||
| }); | ||
| } | ||
| } | ||
| AlphaBatchKind::Image => { | ||
| AlphaBatchKind::Image | | ||
| AlphaBatchKind::ImageRect => { | ||
| let image_cpu = &self.cpu_images[metadata.cpu_prim_index.0]; | ||
|
|
||
| data.push(PrimitiveInstance { | ||
| @@ -1311,6 +1330,7 @@ pub enum AlphaBatchKind { | ||
| Rectangle, | ||
| TextRun, | ||
| Image, | ||
| ImageRect, | ||
| YuvImage, | ||
| Border, | ||
| AlignedGradient, | ||
| @@ -1441,6 +1461,7 @@ impl PrimitiveBatch { | ||
| AlphaBatchKind::Rectangle | | ||
| AlphaBatchKind::TextRun | | ||
| AlphaBatchKind::Image | | ||
| AlphaBatchKind::ImageRect | | ||
| AlphaBatchKind::YuvImage | | ||
| AlphaBatchKind::Border | | ||
| AlphaBatchKind::AlignedGradient | | ||
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
macIOSurface should use sampler2DRect