Skip to content
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

Add NV12 and TEXTURE_EXTERNAL_OES target support in WR. #1150

Merged
merged 21 commits into from Apr 27, 2017
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
deeebf5
Remove the vStretchSize assignment in ps_image vertex shader
JerryShih Apr 19, 2017
06d7376
Add samplerExternalOES support.
JerryShih Apr 19, 2017
bfc555f
Remove the unused data member in YuvImage.
JerryShih Apr 19, 2017
9dfebbb
Add samplerExternalOES support in ps_image shader.
JerryShih Apr 20, 2017
a559829
Use preprocessor to select the yuv color matrix in ps_yuv_image shader.
JerryShih Apr 20, 2017
0f5a96f
Reorder some function calls in ps_yuv_image shader.
JerryShih Apr 20, 2017
c75bb28
Add samplerExternalOES, sampler2dRect target and NV12 format support …
JerryShih Apr 20, 2017
7f53f91
Add new package in webrender and webrender_traits.
JerryShih Apr 20, 2017
652735a
Add enum ImageBufferKind, ImageBufferKind and YuvColorSpace.
JerryShih Apr 20, 2017
5a65e6c
Update push_yuv_image() interface.
JerryShih Apr 20, 2017
f734c68
Remove the match of |_| with ExternalImageType type.
JerryShih Apr 20, 2017
41ce8dd
Pass ImageBufferKind, YuvFormat and YuvColorSpace in AlphaBatchKind t…
JerryShih Apr 20, 2017
9fe5754
Create the ps_image and ps_yuv_image arrays for different feature set…
JerryShih Apr 20, 2017
d3bd47e
Add yuv_image usage in sample.
JerryShih Apr 21, 2017
06ccad4
Set default yuv color space setting in ps_yuv_image.
JerryShih Apr 21, 2017
2e76503
Move the push_yuv_image() sample code from basic.rs to yuv.rs
JerryShih Apr 27, 2017
096f2c5
Update for review comment for ps_yuv_image shader.
JerryShih Apr 27, 2017
56b2d1d
Use a macro TEX_SAMPLE() to replace the different texture sampling fu…
JerryShih Apr 27, 2017
656303c
Remove the num::FromPrimitive usage for the enum YuvColorSpace, YuvFo…
JerryShih Apr 27, 2017
52b7331
Update for review comment.
JerryShih Apr 27, 2017
1d10e44
Add a YuvData type which contains the channel data and format informa…
JerryShih Apr 27, 2017
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Add enum ImageBufferKind, ImageBufferKind and YuvColorSpace.

Also use enum_from_primitive to convert a primitive to these enum value.
  • Loading branch information
JerryShih committed Apr 27, 2017
commit 652735a7a30c25bb4f43c95af889c42adbfa9a31
@@ -45,6 +45,10 @@ extern crate bitflags;
#[macro_use]
extern crate thread_profiler;

#[macro_use]
extern crate enum_primitive;
extern crate num;

mod border;
mod clip_scroll_node;
mod clip_scroll_tree;
@@ -81,6 +81,48 @@ const GPU_TAG_PRIM_BORDER_EDGE: GpuProfileTag = GpuProfileTag { label: "BorderEd
const GPU_TAG_PRIM_CACHE_IMAGE: GpuProfileTag = GpuProfileTag { label: "CacheImage", color: debug_colors::SILVER };
const GPU_TAG_BLUR: GpuProfileTag = GpuProfileTag { label: "Blur", color: debug_colors::VIOLET };

enum_from_primitive! {
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub enum ImageBufferKind {
Texture2D = 0,
TextureRect = 1,
TextureExternal = 2,
TotalNum = 3,
}
}

impl ImageBufferKind {
pub fn get_feature_string(&self) -> &'static str {
match *self {
ImageBufferKind::Texture2D => "",
ImageBufferKind::TextureRect => "TEXTURE_RECT",
ImageBufferKind::TextureExternal => "TEXTURE_EXTERNAL",
ImageBufferKind::TotalNum => "Invalid",
}
}

pub fn is_platform_support(&self, gl_type: &gl::GlType) -> bool {
match *gl_type {
gl::GlType::Gles => {
match *self {
ImageBufferKind::Texture2D => true,
ImageBufferKind::TextureRect => true,
ImageBufferKind::TextureExternal => true,
ImageBufferKind::TotalNum => false,
}
}
gl::GlType::Gl => {
match *self {
ImageBufferKind::Texture2D => true,
ImageBufferKind::TextureRect => true,
ImageBufferKind::TextureExternal => false,
ImageBufferKind::TotalNum => false,
}
}
}
}
}

#[derive(Debug, Copy, Clone)]
pub enum RendererKind {
Native,
@@ -17,6 +17,7 @@ use render_task::{AlphaRenderItem, MaskGeometryKind, MaskSegment, RenderTask, Re
use render_task::{RenderTaskId, RenderTaskIndex, RenderTaskKey, RenderTaskKind};
use render_task::RenderTaskLocation;
use renderer::BlendMode;
use renderer::ImageBufferKind;
use resource_cache::ResourceCache;
use std::{f32, i32, mem, usize};
use std::collections::HashMap;
@@ -361,11 +361,50 @@ pub struct YuvImageDisplayItem {
pub color_space: YuvColorSpace,
}

#[repr(u32)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub enum YuvColorSpace {
Rec601 = 1, // The values must match the ones in prim_shared.glsl
Rec709 = 2,
enum_from_primitive! {
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub enum YuvColorSpace {
Rec601 = 0,
Rec709 = 1,
TotalNum = 2,
}
}

impl YuvColorSpace {
pub fn get_feature_string(&self) -> &'static str {
match *self {
YuvColorSpace::Rec601 => "YUV_REC601",
YuvColorSpace::Rec709 => "YUV_REC709",
YuvColorSpace::TotalNum => "Invalid",
}
}
}

enum_from_primitive! {
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub enum YuvFormat {
NV12 = 0,
PlanarYCbCr = 1,
TotalNum = 2,
}
}

impl YuvFormat {
pub fn get_plane_num(&self) -> usize {
match *self {
YuvFormat::NV12 => 2,
YuvFormat::PlanarYCbCr => 3,
YuvFormat::TotalNum => 0,
}
}

pub fn get_feature_string(&self) -> &'static str {
match *self {
YuvFormat::NV12 => "NV12",
YuvFormat::PlanarYCbCr => "",
YuvFormat::TotalNum => "Invalid",
}
}
}

#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
@@ -31,6 +31,10 @@ extern crate core_graphics;
#[cfg(target_os = "windows")]
extern crate dwrote;

#[macro_use]
extern crate enum_primitive;
extern crate num;

mod units;
mod api;
mod color;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.