mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement texSubImage2D API
This commit is contained in:
parent
9dab669124
commit
9f563e9e43
2 changed files with 315 additions and 109 deletions
|
@ -109,13 +109,15 @@ impl WebGLTexture {
|
|||
height: u32,
|
||||
depth: u32,
|
||||
internal_format: u32,
|
||||
level: u32) -> WebGLResult<()> {
|
||||
level: u32,
|
||||
data_type: Option<u32>) -> WebGLResult<()> {
|
||||
let image_info = ImageInfo {
|
||||
width: width,
|
||||
height: height,
|
||||
depth: depth,
|
||||
internal_format: Some(internal_format),
|
||||
is_initialized: true,
|
||||
data_type: data_type,
|
||||
};
|
||||
|
||||
let face = match target {
|
||||
|
@ -274,6 +276,7 @@ impl WebGLTexture {
|
|||
depth: 0,
|
||||
internal_format: base_image_info.internal_format,
|
||||
is_initialized: base_image_info.is_initialized(),
|
||||
data_type: base_image_info.data_type,
|
||||
};
|
||||
|
||||
self.set_image_infos_at_level(level, image_info);
|
||||
|
@ -346,6 +349,7 @@ pub struct ImageInfo {
|
|||
depth: u32,
|
||||
internal_format: Option<u32>,
|
||||
is_initialized: bool,
|
||||
data_type: Option<u32>,
|
||||
}
|
||||
|
||||
impl ImageInfo {
|
||||
|
@ -356,6 +360,7 @@ impl ImageInfo {
|
|||
depth: 0,
|
||||
internal_format: None,
|
||||
is_initialized: false,
|
||||
data_type: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -371,6 +376,10 @@ impl ImageInfo {
|
|||
self.internal_format
|
||||
}
|
||||
|
||||
pub fn data_type(&self) -> Option<u32> {
|
||||
self.data_type
|
||||
}
|
||||
|
||||
fn is_power_of_two(&self) -> bool {
|
||||
self.width.is_power_of_two() && self.height.is_power_of_two() && self.depth.is_power_of_two()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue