OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/texture_manager.h" | 5 #include "gpu/command_buffer/service/texture_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1493 | 1493 |
1494 UpdateCanRenderCondition(); | 1494 UpdateCanRenderCondition(); |
1495 UpdateHasImages(); | 1495 UpdateHasImages(); |
1496 UpdateEmulatingRGB(); | 1496 UpdateEmulatingRGB(); |
1497 } | 1497 } |
1498 | 1498 |
1499 void Texture::SetLevelImage(GLenum target, | 1499 void Texture::SetLevelImage(GLenum target, |
1500 GLint level, | 1500 GLint level, |
1501 gl::GLImage* image, | 1501 gl::GLImage* image, |
1502 ImageState state) { | 1502 ImageState state) { |
1503 SetStreamTextureServiceId(0); | |
liberato (no reviews please)
2016/06/01 14:10:44
maybe just clear it if image != whatever is bound
watk
2016/06/01 20:54:44
Sounds good. Done. The API is fairly consistent no
| |
1503 SetLevelImageInternal(target, level, image, nullptr, state); | 1504 SetLevelImageInternal(target, level, image, nullptr, state); |
1504 } | 1505 } |
1505 | 1506 |
1506 void Texture::SetLevelStreamTextureImage(GLenum target, | 1507 void Texture::SetLevelStreamTextureImage(GLenum target, |
1507 GLint level, | 1508 GLint level, |
1508 GLStreamTextureImage* image, | 1509 GLStreamTextureImage* image, |
1509 ImageState state) { | 1510 ImageState state, |
1511 GLuint service_id) { | |
1512 SetStreamTextureServiceId(service_id); | |
1510 SetLevelImageInternal(target, level, image, image, state); | 1513 SetLevelImageInternal(target, level, image, image, state); |
1511 } | 1514 } |
1512 | 1515 |
1513 const Texture::LevelInfo* Texture::GetLevelInfo(GLint target, | 1516 const Texture::LevelInfo* Texture::GetLevelInfo(GLint target, |
1514 GLint level) const { | 1517 GLint level) const { |
1515 if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES && | 1518 if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES && |
1516 target != GL_TEXTURE_RECTANGLE_ARB) { | 1519 target != GL_TEXTURE_RECTANGLE_ARB) { |
1517 return NULL; | 1520 return NULL; |
1518 } | 1521 } |
1519 | 1522 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1612 feature_info->validators()-> | 1615 feature_info->validators()-> |
1613 texture_sized_color_renderable_internal_format.IsValid( | 1616 texture_sized_color_renderable_internal_format.IsValid( |
1614 internal_format)); | 1617 internal_format)); |
1615 bool depth_renderable = feature_info->validators()-> | 1618 bool depth_renderable = feature_info->validators()-> |
1616 texture_depth_renderable_internal_format.IsValid(internal_format); | 1619 texture_depth_renderable_internal_format.IsValid(internal_format); |
1617 bool stencil_renderable = feature_info->validators()-> | 1620 bool stencil_renderable = feature_info->validators()-> |
1618 texture_stencil_renderable_internal_format.IsValid(internal_format); | 1621 texture_stencil_renderable_internal_format.IsValid(internal_format); |
1619 return (color_renderable || depth_renderable || stencil_renderable); | 1622 return (color_renderable || depth_renderable || stencil_renderable); |
1620 } | 1623 } |
1621 | 1624 |
1622 void Texture::SetUnownedServiceId(GLuint service_id) { | 1625 void Texture::SetStreamTextureServiceId(GLuint service_id) { |
1623 GLuint new_service_id = service_id; | 1626 GLuint new_service_id = service_id; |
1624 | 1627 |
1625 // Take no action if this isn't an OES_EXTERNAL texture. | 1628 // Take no action if this isn't an OES_EXTERNAL texture. |
1626 if (target_ && target_ != GL_TEXTURE_EXTERNAL_OES) | 1629 if (target_ && target_ != GL_TEXTURE_EXTERNAL_OES) |
1627 return; | 1630 return; |
1628 | 1631 |
1629 if (!service_id) | 1632 if (!service_id) |
1630 new_service_id = owned_service_id_; | 1633 new_service_id = owned_service_id_; |
1631 | 1634 |
1632 if (service_id_ != new_service_id) { | 1635 if (service_id_ != new_service_id) { |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2093 gl::GLImage* image, | 2096 gl::GLImage* image, |
2094 Texture::ImageState state) { | 2097 Texture::ImageState state) { |
2095 DCHECK(ref); | 2098 DCHECK(ref); |
2096 ref->texture()->SetLevelImage(target, level, image, state); | 2099 ref->texture()->SetLevelImage(target, level, image, state); |
2097 } | 2100 } |
2098 | 2101 |
2099 void TextureManager::SetLevelStreamTextureImage(TextureRef* ref, | 2102 void TextureManager::SetLevelStreamTextureImage(TextureRef* ref, |
2100 GLenum target, | 2103 GLenum target, |
2101 GLint level, | 2104 GLint level, |
2102 GLStreamTextureImage* image, | 2105 GLStreamTextureImage* image, |
2103 Texture::ImageState state) { | 2106 Texture::ImageState state, |
2107 GLuint service_id) { | |
2104 DCHECK(ref); | 2108 DCHECK(ref); |
2105 ref->texture()->SetLevelStreamTextureImage(target, level, image, state); | 2109 ref->texture()->SetLevelStreamTextureImage(target, level, image, state, |
2110 service_id); | |
2106 } | 2111 } |
2107 | 2112 |
2108 size_t TextureManager::GetSignatureSize() const { | 2113 size_t TextureManager::GetSignatureSize() const { |
2109 return sizeof(TextureTag) + sizeof(TextureSignature); | 2114 return sizeof(TextureTag) + sizeof(TextureSignature); |
2110 } | 2115 } |
2111 | 2116 |
2112 void TextureManager::AddToSignature( | 2117 void TextureManager::AddToSignature( |
2113 TextureRef* ref, | 2118 TextureRef* ref, |
2114 GLenum target, | 2119 GLenum target, |
2115 GLint level, | 2120 GLint level, |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3309 uint32_t TextureManager::GetServiceIdGeneration() const { | 3314 uint32_t TextureManager::GetServiceIdGeneration() const { |
3310 return current_service_id_generation_; | 3315 return current_service_id_generation_; |
3311 } | 3316 } |
3312 | 3317 |
3313 void TextureManager::IncrementServiceIdGeneration() { | 3318 void TextureManager::IncrementServiceIdGeneration() { |
3314 current_service_id_generation_++; | 3319 current_service_id_generation_++; |
3315 } | 3320 } |
3316 | 3321 |
3317 } // namespace gles2 | 3322 } // namespace gles2 |
3318 } // namespace gpu | 3323 } // namespace gpu |
OLD | NEW |