Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: gpu/command_buffer/service/texture_manager.cc

Issue 2821913002: Force cube map texture complete on Linux AMD (Closed)
Patch Set: fix srgb Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | gpu/config/gpu_driver_bug_list.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer_->service_id()); 388 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer_->service_id());
389 } 389 }
390 } 390 }
391 391
392 private: 392 private:
393 Buffer* buffer_; 393 Buffer* buffer_;
394 }; 394 };
395 395
396 } // namespace anonymous 396 } // namespace anonymous
397 397
398 DecoderTextureState::DecoderTextureState(
399 const GpuDriverBugWorkarounds& workarounds)
400 : tex_image_failed(false),
401 texture_upload_count(0),
402 texsubimage_faster_than_teximage(
403 workarounds.texsubimage_faster_than_teximage),
404 force_cube_map_positive_x_allocation(
405 workarounds.force_cube_map_positive_x_allocation),
406 force_cube_complete(workarounds.force_cube_complete),
407 force_int_or_srgb_cube_texture_complete(
408 workarounds.force_int_or_srgb_cube_texture_complete),
409 unpack_alignment_workaround_with_unpack_buffer(
410 workarounds.unpack_alignment_workaround_with_unpack_buffer),
411 unpack_overlapping_rows_separately_unpack_buffer(
412 workarounds.unpack_overlapping_rows_separately_unpack_buffer),
413 unpack_image_height_workaround_with_unpack_buffer(
414 workarounds.unpack_image_height_workaround_with_unpack_buffer) {}
415
398 TextureManager::DestructionObserver::DestructionObserver() {} 416 TextureManager::DestructionObserver::DestructionObserver() {}
399 417
400 TextureManager::DestructionObserver::~DestructionObserver() {} 418 TextureManager::DestructionObserver::~DestructionObserver() {}
401 419
402 TextureManager::~TextureManager() { 420 TextureManager::~TextureManager() {
403 for (unsigned int i = 0; i < destruction_observers_.size(); i++) 421 for (unsigned int i = 0; i < destruction_observers_.size(); i++)
404 destruction_observers_[i]->OnTextureManagerDestroying(this); 422 destruction_observers_[i]->OnTextureManagerDestroying(this);
405 423
406 DCHECK(textures_.empty()); 424 DCHECK(textures_.empty());
407 425
(...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2520 ContextState* state, 2538 ContextState* state,
2521 DecoderFramebufferState* framebuffer_state, 2539 DecoderFramebufferState* framebuffer_state,
2522 TextureRef* texture_ref, 2540 TextureRef* texture_ref,
2523 const char* function_name, 2541 const char* function_name,
2524 const DoTexImageArguments& args) { 2542 const DoTexImageArguments& args) {
2525 // This workaround code does not work with an unpack buffer bound. 2543 // This workaround code does not work with an unpack buffer bound.
2526 ScopedResetPixelUnpackBuffer scoped_reset_pbo(state); 2544 ScopedResetPixelUnpackBuffer scoped_reset_pbo(state);
2527 2545
2528 std::vector<GLenum> undefined_faces; 2546 std::vector<GLenum> undefined_faces;
2529 Texture* texture = texture_ref->texture(); 2547 Texture* texture = texture_ref->texture();
2530 if (texture_state->force_cube_complete) { 2548 if (texture_state->force_cube_complete ||
2549 texture_state->force_int_or_srgb_cube_texture_complete) {
2531 int width = 0; 2550 int width = 0;
2532 int height = 0; 2551 int height = 0;
2533 for (unsigned i = 0; i < 6; i++) { 2552 for (unsigned i = 0; i < 6; i++) {
2534 GLenum target = static_cast<GLenum>(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i); 2553 GLenum target = static_cast<GLenum>(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i);
2535 bool defined = texture->GetLevelSize( 2554 bool defined = texture->GetLevelSize(
2536 target, args.level, &width, &height, nullptr); 2555 target, args.level, &width, &height, nullptr);
2556 defined = defined && width == args.width && height == args.height;
Zhenyao Mo 2017/04/19 17:11:53 I understand the issue, but still, I think modifyi
qiankun 2017/04/20 01:35:53 Sounds good. Removed it.
2537 if (!defined && target != args.target) 2557 if (!defined && target != args.target)
2538 undefined_faces.push_back(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i); 2558 undefined_faces.push_back(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i);
2539 } 2559 }
2540 } else { 2560 } else {
2541 DCHECK(args.target != GL_TEXTURE_CUBE_MAP_POSITIVE_X); 2561 DCHECK(args.target != GL_TEXTURE_CUBE_MAP_POSITIVE_X);
2542 int width = 0; 2562 int width = 0;
2543 int height = 0; 2563 int height = 0;
2544 if (!texture->GetLevelSize(GL_TEXTURE_CUBE_MAP_POSITIVE_X, args.level, 2564 if (!texture->GetLevelSize(GL_TEXTURE_CUBE_MAP_POSITIVE_X, args.level,
2545 &width, &height, nullptr)) { 2565 &width, &height, nullptr)) {
2546 undefined_faces.push_back(GL_TEXTURE_CUBE_MAP_POSITIVE_X); 2566 undefined_faces.push_back(GL_TEXTURE_CUBE_MAP_POSITIVE_X);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2578 Buffer* buffer = state->bound_pixel_unpack_buffer.get(); 2598 Buffer* buffer = state->bound_pixel_unpack_buffer.get();
2579 2599
2580 // ValidateTexImage is passed already. 2600 // ValidateTexImage is passed already.
2581 Texture* texture = texture_ref->texture(); 2601 Texture* texture = texture_ref->texture();
2582 bool need_cube_map_workaround = 2602 bool need_cube_map_workaround =
2583 !feature_info_->IsWebGL2OrES3Context() && 2603 !feature_info_->IsWebGL2OrES3Context() &&
2584 texture->target() == GL_TEXTURE_CUBE_MAP && 2604 texture->target() == GL_TEXTURE_CUBE_MAP &&
2585 (texture_state->force_cube_complete || 2605 (texture_state->force_cube_complete ||
2586 (texture_state->force_cube_map_positive_x_allocation && 2606 (texture_state->force_cube_map_positive_x_allocation &&
2587 args.target != GL_TEXTURE_CUBE_MAP_POSITIVE_X)); 2607 args.target != GL_TEXTURE_CUBE_MAP_POSITIVE_X));
2608 // Force integer or srgb cube map texture complete, see crbug.com/712117.
2609 need_cube_map_workaround =
2610 need_cube_map_workaround ||
2611 (feature_info_->IsWebGL2OrES3Context() &&
Zhenyao Mo 2017/04/19 17:11:53 This isn't correct. You can also get sRGB formats
qiankun 2017/04/20 01:35:53 What I meant is other platforms doesn't have such
qiankun 2017/04/20 02:12:31 Never mind. Please ignore my last comments. I remo
2612 texture->target() == GL_TEXTURE_CUBE_MAP &&
2613 texture_state->force_int_or_srgb_cube_texture_complete &&
2614 (GLES2Util::IsIntegerFormat(args.internal_format) ||
2615 GLES2Util::GetColorEncodingFromInternalFormat(args.internal_format) ==
2616 GL_SRGB));
2617
2588 if (need_cube_map_workaround && !buffer) { 2618 if (need_cube_map_workaround && !buffer) {
2589 DoCubeMapWorkaround(texture_state, state, framebuffer_state, 2619 DoCubeMapWorkaround(texture_state, state, framebuffer_state,
2590 texture_ref, function_name, args); 2620 texture_ref, function_name, args);
2591 } 2621 }
2592 2622
2593 if (texture_state->unpack_overlapping_rows_separately_unpack_buffer && 2623 if (texture_state->unpack_overlapping_rows_separately_unpack_buffer &&
2594 buffer) { 2624 buffer) {
2595 ContextState::Dimension dimension = 2625 ContextState::Dimension dimension =
2596 (args.command_type == DoTexImageArguments::kTexImage3D) 2626 (args.command_type == DoTexImageArguments::kTexImage3D)
2597 ? ContextState::k3D 2627 ? ContextState::k3D
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
3656 uint32_t TextureManager::GetServiceIdGeneration() const { 3686 uint32_t TextureManager::GetServiceIdGeneration() const {
3657 return current_service_id_generation_; 3687 return current_service_id_generation_;
3658 } 3688 }
3659 3689
3660 void TextureManager::IncrementServiceIdGeneration() { 3690 void TextureManager::IncrementServiceIdGeneration() {
3661 current_service_id_generation_++; 3691 current_service_id_generation_++;
3662 } 3692 }
3663 3693
3664 } // namespace gles2 3694 } // namespace gles2
3665 } // namespace gpu 3695 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | gpu/config/gpu_driver_bug_list.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698