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

Unified Diff: chrome/browser/android/vr_shell/vr_shell_renderer.cc

Issue 2837973002: VRShell: Composing Daydream controller textures from patches (Closed)
Patch Set: Separate patches and doing patching in CPU 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/vr_shell/vr_shell_renderer.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell_renderer.cc b/chrome/browser/android/vr_shell/vr_shell_renderer.cc
index b037a0b0cb76ce00ab5053fe25f39f9a3862ea39..e87c903a4f59ca3c1b14c056a34c0dc2790cdd10 100644
--- a/chrome/browser/android/vr_shell/vr_shell_renderer.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_renderer.cc
@@ -608,14 +608,19 @@ void ControllerRenderer::SetUp(std::unique_ptr<VrControllerModel> model) {
glGenTextures(VrControllerModel::STATE_COUNT, texture_handles_.data());
for (int i = 0; i < VrControllerModel::STATE_COUNT; i++) {
+ sk_sp<SkImage> texture = model->GetTexture(i);
+ SkPixmap pixmap;
+ if (!texture->peekPixels(&pixmap)) {
+ LOG(ERROR) << "Failed to read controller texture pixels";
+ continue;
+ }
glBindTexture(GL_TEXTURE_2D, texture_handles_[i]);
- const SkBitmap* bitmap = model->GetTexture(i);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bitmap->width(), bitmap->height(),
- 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap->getPixels());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pixmap.width(), pixmap.height(), 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, pixmap.addr());
}
const gltf::Accessor* accessor = model->PositionAccessor();

Powered by Google App Engine
This is Rietveld 408576698