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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLTexture.cpp

Issue 1856933002: WebGL GL_RGB emulation to support IOSurfaces on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Full client side implementation of GL_RGB emulation. Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 19 matching lines...) Expand all
30 30
31 namespace blink { 31 namespace blink {
32 32
33 WebGLTexture* WebGLTexture::create(WebGLRenderingContextBase* ctx) 33 WebGLTexture* WebGLTexture::create(WebGLRenderingContextBase* ctx)
34 { 34 {
35 return new WebGLTexture(ctx); 35 return new WebGLTexture(ctx);
36 } 36 }
37 37
38 WebGLTexture::WebGLTexture(WebGLRenderingContextBase* ctx) 38 WebGLTexture::WebGLTexture(WebGLRenderingContextBase* ctx)
39 : WebGLSharedPlatform3DObject(ctx) 39 : WebGLSharedPlatform3DObject(ctx)
40 , m_colorFormat(0)
40 , m_target(0) 41 , m_target(0)
41 { 42 {
42 GLuint texture; 43 GLuint texture;
43 ctx->contextGL()->GenTextures(1, &texture); 44 ctx->contextGL()->GenTextures(1, &texture);
44 setObject(texture); 45 setObject(texture);
45 } 46 }
46 47
47 WebGLTexture::~WebGLTexture() 48 WebGLTexture::~WebGLTexture()
48 { 49 {
49 // See the comment in WebGLObject::detachAndDeleteObject(). 50 // See the comment in WebGLObject::detachAndDeleteObject().
50 detachAndDeleteObject(); 51 detachAndDeleteObject();
51 } 52 }
52 53
53 void WebGLTexture::setTarget(GLenum target) 54 void WebGLTexture::setTarget(GLenum target)
54 { 55 {
55 if (!object()) 56 if (!object())
56 return; 57 return;
57 // Target is finalized the first time bindTexture() is called. 58 // Target is finalized the first time bindTexture() is called.
58 if (m_target) 59 if (m_target)
59 return; 60 return;
60 m_target = target; 61 m_target = target;
61 } 62 }
62 63
64 void WebGLTexture::setColorFormat(GLenum format)
65 {
66 if (!object())
67 return;
68 m_colorFormat = format;
69 }
70
63 void WebGLTexture::deleteObjectImpl(gpu::gles2::GLES2Interface* gl) 71 void WebGLTexture::deleteObjectImpl(gpu::gles2::GLES2Interface* gl)
64 { 72 {
65 gl->DeleteTextures(1, &m_object); 73 gl->DeleteTextures(1, &m_object);
66 m_object = 0; 74 m_object = 0;
67 } 75 }
68 76
69 int WebGLTexture::mapTargetToIndex(GLenum target) const 77 int WebGLTexture::mapTargetToIndex(GLenum target) const
70 { 78 {
71 if (m_target == GL_TEXTURE_2D) { 79 if (m_target == GL_TEXTURE_2D) {
72 if (target == GL_TEXTURE_2D) 80 if (target == GL_TEXTURE_2D)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 if (x) { 118 if (x) {
111 value = x; 119 value = x;
112 log += shift; 120 log += shift;
113 } 121 }
114 } 122 }
115 ASSERT(value == 1); 123 ASSERT(value == 1);
116 return log + 1; 124 return log + 1;
117 } 125 }
118 126
119 } // namespace blink 127 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698