Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 if (!desiredSize.isEmpty()) { | 214 if (!desiredSize.isEmpty()) { |
| 215 forciblyEvictedContexts().remove(0); | 215 forciblyEvictedContexts().remove(0); |
| 216 evictedContext->forceRestoreContext(); | 216 evictedContext->forceRestoreContext(); |
| 217 } | 217 } |
| 218 break; | 218 break; |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 namespace { | 222 namespace { |
| 223 | 223 |
| 224 // ScopedDrawingBufferBinder is used for ReadPixels/CopyTexImage2D/CopySubIm age2D to read from | 224 // ScopedDrawingBufferBinder is used for ReadPixels/CopyTexImage2D/CopySubImage2 D to read from |
|
Ken Russell (switch to Gerrit)
2015/08/01 00:11:56
Similar issue with indentation in this block. Coul
peria
2015/08/03 09:00:36
Acknowledged.
https://codereview.chromium.org/1258
| |
| 225 // a multisampled DrawingBuffer. In this situation, we need to blit to a sin gle sampled buffer | 225 // a multisampled DrawingBuffer. In this situation, we need to blit to a single sampled buffer |
| 226 // for reading, during which the bindings could be changed and need to be re covered. | 226 // for reading, during which the bindings could be changed and need to be recove red. |
| 227 class ScopedDrawingBufferBinder { | 227 class ScopedDrawingBufferBinder { |
| 228 STACK_ALLOCATED(); | 228 STACK_ALLOCATED(); |
| 229 public: | 229 public: |
| 230 ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer * framebufferBinding) | 230 ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer* fr amebufferBinding) |
| 231 : m_drawingBuffer(drawingBuffer) | 231 : m_drawingBuffer(drawingBuffer) |
| 232 , m_readFramebufferBinding(framebufferBinding) | 232 , m_readFramebufferBinding(framebufferBinding) |
| 233 { | 233 { |
| 234 // Commit DrawingBuffer if needed (e.g., for multisampling) | 234 // Commit DrawingBuffer if needed (e.g., for multisampling) |
| 235 if (!m_readFramebufferBinding && m_drawingBuffer) | 235 if (!m_readFramebufferBinding && m_drawingBuffer) |
| 236 m_drawingBuffer->commit(); | 236 m_drawingBuffer->commit(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 ~ScopedDrawingBufferBinder() | 239 ~ScopedDrawingBufferBinder() |
| 240 { | 240 { |
| 241 // Restore DrawingBuffer if needed | 241 // Restore DrawingBuffer if needed |
| 242 if (!m_readFramebufferBinding && m_drawingBuffer) | 242 if (!m_readFramebufferBinding && m_drawingBuffer) |
| 243 m_drawingBuffer->restoreFramebufferBindings(); | 243 m_drawingBuffer->restoreFramebufferBindings(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 private: | 246 private: |
| 247 DrawingBuffer* m_drawingBuffer; | 247 DrawingBuffer* m_drawingBuffer; |
| 248 RawPtrWillBeMember<WebGLFramebuffer> m_readFramebufferBinding; | 248 Member<WebGLFramebuffer> m_readFramebufferBinding; |
| 249 }; | |
| 250 | |
| 251 GLint clamp(GLint value, GLint min, GLint max) | |
| 252 { | |
| 253 if (value < min) | |
| 254 value = min; | |
| 255 if (value > max) | |
| 256 value = max; | |
| 257 return value; | |
| 258 } | |
| 259 | |
| 260 // Return true if a character belongs to the ASCII subset as defined in | |
| 261 // GLSL ES 1.0 spec section 3.1. | |
| 262 bool validateCharacter(unsigned char c) | |
| 263 { | |
| 264 // Printing characters are valid except " $ ` @ \ ' DEL. | |
| 265 if (c >= 32 && c <= 126 | |
| 266 && c != '"' && c != '$' && c != '`' && c != '@' && c != '\\' && c != '\' ') | |
| 267 return true; | |
| 268 // Horizontal tab, line feed, vertical tab, form feed, carriage return | |
| 269 // are also valid. | |
| 270 if (c >= 9 && c <= 13) | |
| 271 return true; | |
| 272 return false; | |
| 273 } | |
| 274 | |
| 275 bool isPrefixReserved(const String& name) | |
| 276 { | |
| 277 if (name.startsWith("gl_") || name.startsWith("webgl_") || name.startsWith(" _webgl_")) | |
| 278 return true; | |
| 279 return false; | |
| 280 } | |
| 281 | |
| 282 // Strips comments from shader text. This allows non-ASCII characters | |
| 283 // to be used in comments without potentially breaking OpenGL | |
| 284 // implementations not expecting characters outside the GLSL ES set. | |
| 285 class StripComments { | |
| 286 public: | |
| 287 StripComments(const String& str) | |
| 288 : m_parseState(BeginningOfLine) | |
| 289 , m_sourceString(str) | |
| 290 , m_length(str.length()) | |
| 291 , m_position(0) | |
| 292 { | |
| 293 parse(); | |
| 294 } | |
| 295 | |
| 296 String result() | |
| 297 { | |
| 298 return m_builder.toString(); | |
| 299 } | |
| 300 | |
| 301 private: | |
| 302 bool hasMoreCharacters() const | |
| 303 { | |
| 304 return (m_position < m_length); | |
| 305 } | |
| 306 | |
| 307 void parse() | |
| 308 { | |
| 309 while (hasMoreCharacters()) { | |
| 310 process(current()); | |
| 311 // process() might advance the position. | |
| 312 if (hasMoreCharacters()) | |
| 313 advance(); | |
| 314 } | |
| 315 } | |
| 316 | |
| 317 void process(UChar); | |
| 318 | |
| 319 bool peek(UChar& character) const | |
| 320 { | |
| 321 if (m_position + 1 >= m_length) | |
| 322 return false; | |
| 323 character = m_sourceString[m_position + 1]; | |
| 324 return true; | |
| 325 } | |
| 326 | |
| 327 UChar current() | |
| 328 { | |
| 329 ASSERT_WITH_SECURITY_IMPLICATION(m_position < m_length); | |
| 330 return m_sourceString[m_position]; | |
| 331 } | |
| 332 | |
| 333 void advance() | |
| 334 { | |
| 335 ++m_position; | |
| 336 } | |
| 337 | |
| 338 static bool isNewline(UChar character) | |
| 339 { | |
| 340 // Don't attempt to canonicalize newline related characters. | |
| 341 return (character == '\n' || character == '\r'); | |
| 342 } | |
| 343 | |
| 344 void emit(UChar character) | |
| 345 { | |
| 346 m_builder.append(character); | |
| 347 } | |
| 348 | |
| 349 enum ParseState { | |
| 350 // Have not seen an ASCII non-whitespace character yet on | |
| 351 // this line. Possible that we might see a preprocessor | |
| 352 // directive. | |
| 353 BeginningOfLine, | |
| 354 | |
| 355 // Have seen at least one ASCII non-whitespace character | |
| 356 // on this line. | |
| 357 MiddleOfLine, | |
| 358 | |
| 359 // Handling a preprocessor directive. Passes through all | |
| 360 // characters up to the end of the line. Disables comment | |
| 361 // processing. | |
| 362 InPreprocessorDirective, | |
| 363 | |
| 364 // Handling a single-line comment. The comment text is | |
| 365 // replaced with a single space. | |
| 366 InSingleLineComment, | |
| 367 | |
| 368 // Handling a multi-line comment. Newlines are passed | |
| 369 // through to preserve line numbers. | |
| 370 InMultiLineComment | |
| 249 }; | 371 }; |
| 250 | 372 |
| 251 GLint clamp(GLint value, GLint min, GLint max) | 373 ParseState m_parseState; |
| 252 { | 374 String m_sourceString; |
| 253 if (value < min) | 375 unsigned m_length; |
| 254 value = min; | 376 unsigned m_position; |
| 255 if (value > max) | 377 StringBuilder m_builder; |
| 256 value = max; | 378 }; |
| 257 return value; | 379 |
| 258 } | 380 void StripComments::process(UChar c) |
| 259 | 381 { |
| 260 // Return true if a character belongs to the ASCII subset as defined in | 382 if (isNewline(c)) { |
| 261 // GLSL ES 1.0 spec section 3.1. | 383 // No matter what state we are in, pass through newlines |
| 262 bool validateCharacter(unsigned char c) | 384 // so we preserve line numbers. |
| 263 { | 385 emit(c); |
| 264 // Printing characters are valid except " $ ` @ \ ' DEL. | 386 |
| 265 if (c >= 32 && c <= 126 | 387 if (m_parseState != InMultiLineComment) |
| 266 && c != '"' && c != '$' && c != '`' && c != '@' && c != '\\' && c != '\'') | 388 m_parseState = BeginningOfLine; |
| 267 return true; | 389 |
| 268 // Horizontal tab, line feed, vertical tab, form feed, carriage return | 390 return; |
| 269 // are also valid. | 391 } |
| 270 if (c >= 9 && c <= 13) | 392 |
| 271 return true; | 393 UChar temp = 0; |
| 272 return false; | 394 switch (m_parseState) { |
| 273 } | 395 case BeginningOfLine: |
| 274 | 396 if (WTF::isASCIISpace(c)) { |
| 275 bool isPrefixReserved(const String& name) | |
| 276 { | |
| 277 if (name.startsWith("gl_") || name.startsWith("webgl_") || name.startsWi th("_webgl_")) | |
| 278 return true; | |
| 279 return false; | |
| 280 } | |
| 281 | |
| 282 // Strips comments from shader text. This allows non-ASCII characters | |
| 283 // to be used in comments without potentially breaking OpenGL | |
| 284 // implementations not expecting characters outside the GLSL ES set. | |
| 285 class StripComments { | |
| 286 public: | |
| 287 StripComments(const String& str) | |
| 288 : m_parseState(BeginningOfLine) | |
| 289 , m_sourceString(str) | |
| 290 , m_length(str.length()) | |
| 291 , m_position(0) | |
| 292 { | |
| 293 parse(); | |
| 294 } | |
| 295 | |
| 296 String result() | |
| 297 { | |
| 298 return m_builder.toString(); | |
| 299 } | |
| 300 | |
| 301 private: | |
| 302 bool hasMoreCharacters() const | |
| 303 { | |
| 304 return (m_position < m_length); | |
| 305 } | |
| 306 | |
| 307 void parse() | |
| 308 { | |
| 309 while (hasMoreCharacters()) { | |
| 310 process(current()); | |
| 311 // process() might advance the position. | |
| 312 if (hasMoreCharacters()) | |
| 313 advance(); | |
| 314 } | |
| 315 } | |
| 316 | |
| 317 void process(UChar); | |
| 318 | |
| 319 bool peek(UChar& character) const | |
| 320 { | |
| 321 if (m_position + 1 >= m_length) | |
| 322 return false; | |
| 323 character = m_sourceString[m_position + 1]; | |
| 324 return true; | |
| 325 } | |
| 326 | |
| 327 UChar current() | |
| 328 { | |
| 329 ASSERT_WITH_SECURITY_IMPLICATION(m_position < m_length); | |
| 330 return m_sourceString[m_position]; | |
| 331 } | |
| 332 | |
| 333 void advance() | |
| 334 { | |
| 335 ++m_position; | |
| 336 } | |
| 337 | |
| 338 static bool isNewline(UChar character) | |
| 339 { | |
| 340 // Don't attempt to canonicalize newline related characters. | |
| 341 return (character == '\n' || character == '\r'); | |
| 342 } | |
| 343 | |
| 344 void emit(UChar character) | |
| 345 { | |
| 346 m_builder.append(character); | |
| 347 } | |
| 348 | |
| 349 enum ParseState { | |
| 350 // Have not seen an ASCII non-whitespace character yet on | |
| 351 // this line. Possible that we might see a preprocessor | |
| 352 // directive. | |
| 353 BeginningOfLine, | |
| 354 | |
| 355 // Have seen at least one ASCII non-whitespace character | |
| 356 // on this line. | |
| 357 MiddleOfLine, | |
| 358 | |
| 359 // Handling a preprocessor directive. Passes through all | |
| 360 // characters up to the end of the line. Disables comment | |
| 361 // processing. | |
| 362 InPreprocessorDirective, | |
| 363 | |
| 364 // Handling a single-line comment. The comment text is | |
| 365 // replaced with a single space. | |
| 366 InSingleLineComment, | |
| 367 | |
| 368 // Handling a multi-line comment. Newlines are passed | |
| 369 // through to preserve line numbers. | |
| 370 InMultiLineComment | |
| 371 }; | |
| 372 | |
| 373 ParseState m_parseState; | |
| 374 String m_sourceString; | |
| 375 unsigned m_length; | |
| 376 unsigned m_position; | |
| 377 StringBuilder m_builder; | |
| 378 }; | |
| 379 | |
| 380 void StripComments::process(UChar c) | |
| 381 { | |
| 382 if (isNewline(c)) { | |
| 383 // No matter what state we are in, pass through newlines | |
| 384 // so we preserve line numbers. | |
| 385 emit(c); | |
| 386 | |
| 387 if (m_parseState != InMultiLineComment) | |
| 388 m_parseState = BeginningOfLine; | |
| 389 | |
| 390 return; | |
| 391 } | |
| 392 | |
| 393 UChar temp = 0; | |
| 394 switch (m_parseState) { | |
| 395 case BeginningOfLine: | |
| 396 if (WTF::isASCIISpace(c)) { | |
| 397 emit(c); | |
| 398 break; | |
| 399 } | |
| 400 | |
| 401 if (c == '#') { | |
| 402 m_parseState = InPreprocessorDirective; | |
| 403 emit(c); | |
| 404 break; | |
| 405 } | |
| 406 | |
| 407 // Transition to normal state and re-handle character. | |
| 408 m_parseState = MiddleOfLine; | |
| 409 process(c); | |
| 410 break; | |
| 411 | |
| 412 case MiddleOfLine: | |
| 413 if (c == '/' && peek(temp)) { | |
| 414 if (temp == '/') { | |
| 415 m_parseState = InSingleLineComment; | |
| 416 emit(' '); | |
| 417 advance(); | |
| 418 break; | |
| 419 } | |
| 420 | |
| 421 if (temp == '*') { | |
| 422 m_parseState = InMultiLineComment; | |
| 423 // Emit the comment start in case the user has | |
| 424 // an unclosed comment and we want to later | |
| 425 // signal an error. | |
| 426 emit('/'); | |
| 427 emit('*'); | |
| 428 advance(); | |
| 429 break; | |
| 430 } | |
| 431 } | |
| 432 | |
| 433 emit(c); | 397 emit(c); |
| 434 break; | 398 break; |
| 435 | 399 } |
| 436 case InPreprocessorDirective: | 400 |
| 437 // No matter what the character is, just pass it | 401 if (c == '#') { |
| 438 // through. Do not parse comments in this state. This | 402 m_parseState = InPreprocessorDirective; |
| 439 // might not be the right thing to do long term, but it | |
| 440 // should handle the #error preprocessor directive. | |
| 441 emit(c); | 403 emit(c); |
| 442 break; | 404 break; |
| 443 | 405 } |
| 444 case InSingleLineComment: | 406 |
| 445 // The newline code at the top of this function takes care | 407 // Transition to normal state and re-handle character. |
| 446 // of resetting our state when we get out of the | 408 m_parseState = MiddleOfLine; |
| 447 // single-line comment. Swallow all other characters. | 409 process(c); |
| 448 break; | 410 break; |
| 449 | 411 |
| 450 case InMultiLineComment: | 412 case MiddleOfLine: |
| 451 if (c == '*' && peek(temp) && temp == '/') { | 413 if (c == '/' && peek(temp)) { |
| 452 emit('*'); | 414 if (temp == '/') { |
| 453 emit('/'); | 415 m_parseState = InSingleLineComment; |
| 454 m_parseState = MiddleOfLine; | 416 emit(' '); |
| 455 advance(); | 417 advance(); |
| 456 break; | 418 break; |
| 457 } | 419 } |
| 458 | 420 |
| 459 // Swallow all other characters. Unclear whether we may | 421 if (temp == '*') { |
| 460 // want or need to just emit a space per character to try | 422 m_parseState = InMultiLineComment; |
| 461 // to preserve column numbers for debugging purposes. | 423 // Emit the comment start in case the user has |
| 424 // an unclosed comment and we want to later | |
| 425 // signal an error. | |
| 426 emit('/'); | |
| 427 emit('*'); | |
| 428 advance(); | |
| 429 break; | |
| 430 } | |
| 431 } | |
| 432 | |
| 433 emit(c); | |
| 434 break; | |
| 435 | |
| 436 case InPreprocessorDirective: | |
| 437 // No matter what the character is, just pass it | |
| 438 // through. Do not parse comments in this state. This | |
| 439 // might not be the right thing to do long term, but it | |
| 440 // should handle the #error preprocessor directive. | |
| 441 emit(c); | |
| 442 break; | |
| 443 | |
| 444 case InSingleLineComment: | |
| 445 // The newline code at the top of this function takes care | |
| 446 // of resetting our state when we get out of the | |
| 447 // single-line comment. Swallow all other characters. | |
| 448 break; | |
| 449 | |
| 450 case InMultiLineComment: | |
| 451 if (c == '*' && peek(temp) && temp == '/') { | |
| 452 emit('*'); | |
| 453 emit('/'); | |
| 454 m_parseState = MiddleOfLine; | |
| 455 advance(); | |
| 462 break; | 456 break; |
| 463 } | 457 } |
| 464 } | 458 |
| 465 | 459 // Swallow all other characters. Unclear whether we may |
| 466 static bool shouldFailContextCreationForTesting = false; | 460 // want or need to just emit a space per character to try |
| 461 // to preserve column numbers for debugging purposes. | |
| 462 break; | |
| 463 } | |
| 464 } | |
| 465 | |
| 466 static bool shouldFailContextCreationForTesting = false; | |
| 467 } // namespace anonymous | 467 } // namespace anonymous |
| 468 | 468 |
| 469 class ScopedTexture2DRestorer { | 469 class ScopedTexture2DRestorer { |
| 470 STACK_ALLOCATED(); | 470 STACK_ALLOCATED(); |
| 471 public: | 471 public: |
| 472 explicit ScopedTexture2DRestorer(WebGLRenderingContextBase* context) | 472 explicit ScopedTexture2DRestorer(WebGLRenderingContextBase* context) |
| 473 : m_context(context) | 473 : m_context(context) |
| 474 { | 474 { |
| 475 } | 475 } |
| 476 | 476 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 493 | 493 |
| 494 ~ScopedFramebufferRestorer() | 494 ~ScopedFramebufferRestorer() |
| 495 { | 495 { |
| 496 m_context->restoreCurrentFramebuffer(); | 496 m_context->restoreCurrentFramebuffer(); |
| 497 } | 497 } |
| 498 | 498 |
| 499 private: | 499 private: |
| 500 RawPtrWillBeMember<WebGLRenderingContextBase> m_context; | 500 RawPtrWillBeMember<WebGLRenderingContextBase> m_context; |
| 501 }; | 501 }; |
| 502 | 502 |
| 503 class WebGLRenderingContextLostCallback final : public NoBaseWillBeGarbageCollec tedFinalized<WebGLRenderingContextLostCallback>, public WebGraphicsContext3D::We bGraphicsContextLostCallback { | 503 class WebGLRenderingContextLostCallback final : public GarbageCollectedFinalized <WebGLRenderingContextLostCallback>, public WebGraphicsContext3D::WebGraphicsCon textLostCallback { |
| 504 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLRenderingContextLostCallback); | |
| 505 public: | 504 public: |
| 506 static PassOwnPtrWillBeRawPtr<WebGLRenderingContextLostCallback> create(WebG LRenderingContextBase* context) | 505 static WebGLRenderingContextLostCallback* create(WebGLRenderingContextBase* context) |
| 507 { | 506 { |
| 508 return adoptPtrWillBeNoop(new WebGLRenderingContextLostCallback(context) ); | 507 return new WebGLRenderingContextLostCallback(context); |
| 509 } | 508 } |
| 510 | 509 |
| 511 ~WebGLRenderingContextLostCallback() override { } | 510 ~WebGLRenderingContextLostCallback() override { } |
| 512 | 511 |
| 513 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon textBase::RealLostContext, WebGLRenderingContextBase::Auto); } | 512 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon textBase::RealLostContext, WebGLRenderingContextBase::Auto); } |
| 514 | 513 |
| 515 DEFINE_INLINE_TRACE() | 514 DEFINE_INLINE_TRACE() |
| 516 { | 515 { |
| 517 visitor->trace(m_context); | 516 visitor->trace(m_context); |
| 518 } | 517 } |
| 519 | 518 |
| 520 private: | 519 private: |
| 521 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* contex t) | 520 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* contex t) |
| 522 : m_context(context) { } | 521 : m_context(context) { } |
| 523 | 522 |
| 524 RawPtrWillBeMember<WebGLRenderingContextBase> m_context; | 523 RawPtrWillBeMember<WebGLRenderingContextBase> m_context; |
| 525 }; | 524 }; |
| 526 | 525 |
| 527 class WebGLRenderingContextErrorMessageCallback final : public NoBaseWillBeGarba geCollectedFinalized<WebGLRenderingContextErrorMessageCallback>, public WebGraph icsContext3D::WebGraphicsErrorMessageCallback { | 526 class WebGLRenderingContextErrorMessageCallback final : public GarbageCollectedF inalized<WebGLRenderingContextErrorMessageCallback>, public WebGraphicsContext3D ::WebGraphicsErrorMessageCallback { |
| 528 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLRenderingContextErrorMessageCal lback); | |
| 529 public: | 527 public: |
| 530 static PassOwnPtrWillBeRawPtr<WebGLRenderingContextErrorMessageCallback> cre ate(WebGLRenderingContextBase* context) | 528 static WebGLRenderingContextErrorMessageCallback* create(WebGLRenderingConte xtBase* context) |
| 531 { | 529 { |
| 532 return adoptPtrWillBeNoop(new WebGLRenderingContextErrorMessageCallback( context)); | 530 return new WebGLRenderingContextErrorMessageCallback(context); |
| 533 } | 531 } |
| 534 | 532 |
| 535 ~WebGLRenderingContextErrorMessageCallback() override { } | 533 ~WebGLRenderingContextErrorMessageCallback() override { } |
| 536 | 534 |
| 537 virtual void onErrorMessage(const WebString& message, WGC3Dint) | 535 virtual void onErrorMessage(const WebString& message, WGC3Dint) |
| 538 { | 536 { |
| 539 if (m_context->m_synthesizedErrorsToConsole) | 537 if (m_context->m_synthesizedErrorsToConsole) |
| 540 m_context->printGLErrorToConsole(message); | 538 m_context->printGLErrorToConsole(message); |
| 541 InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas() , message); | 539 InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas() , message); |
| 542 } | 540 } |
| (...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1910 return; | 1908 return; |
| 1911 } | 1909 } |
| 1912 WebGLFramebuffer* readFramebufferBinding = nullptr; | 1910 WebGLFramebuffer* readFramebufferBinding = nullptr; |
| 1913 if (!validateReadBufferAndGetInfo("copyTexSubImage2D", readFramebufferBindin g, nullptr, nullptr)) | 1911 if (!validateReadBufferAndGetInfo("copyTexSubImage2D", readFramebufferBindin g, nullptr, nullptr)) |
| 1914 return; | 1912 return; |
| 1915 clearIfComposited(); | 1913 clearIfComposited(); |
| 1916 ScopedDrawingBufferBinder binder(drawingBuffer(), readFramebufferBinding); | 1914 ScopedDrawingBufferBinder binder(drawingBuffer(), readFramebufferBinding); |
| 1917 webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width , height); | 1915 webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width , height); |
| 1918 } | 1916 } |
| 1919 | 1917 |
| 1920 PassRefPtrWillBeRawPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer() | 1918 WebGLBuffer* WebGLRenderingContextBase::createBuffer() |
| 1921 { | 1919 { |
| 1922 if (isContextLost()) | 1920 if (isContextLost()) |
| 1923 return nullptr; | 1921 return nullptr; |
| 1924 RefPtrWillBeRawPtr<WebGLBuffer> o = WebGLBuffer::create(this); | 1922 WebGLBuffer* o = WebGLBuffer::create(this); |
| 1925 addSharedObject(o.get()); | 1923 addSharedObject(o); |
| 1926 return o.release(); | 1924 return o; |
| 1927 } | 1925 } |
| 1928 | 1926 |
| 1929 PassRefPtrWillBeRawPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFrameb uffer() | 1927 WebGLFramebuffer* WebGLRenderingContextBase::createFramebuffer() |
| 1930 { | 1928 { |
| 1931 if (isContextLost()) | 1929 if (isContextLost()) |
| 1932 return nullptr; | 1930 return nullptr; |
| 1933 RefPtrWillBeRawPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this); | 1931 WebGLFramebuffer* o = WebGLFramebuffer::create(this); |
| 1934 addContextObject(o.get()); | 1932 addContextObject(o); |
| 1935 return o.release(); | 1933 return o; |
| 1936 } | 1934 } |
| 1937 | 1935 |
| 1938 PassRefPtrWillBeRawPtr<WebGLTexture> WebGLRenderingContextBase::createTexture() | 1936 WebGLTexture* WebGLRenderingContextBase::createTexture() |
| 1939 { | 1937 { |
| 1940 if (isContextLost()) | 1938 if (isContextLost()) |
| 1941 return nullptr; | 1939 return nullptr; |
| 1942 RefPtrWillBeRawPtr<WebGLTexture> o = WebGLTexture::create(this); | 1940 WebGLTexture* o = WebGLTexture::create(this); |
| 1943 addSharedObject(o.get()); | 1941 addSharedObject(o); |
| 1944 return o.release(); | 1942 return o; |
| 1945 } | 1943 } |
| 1946 | 1944 |
| 1947 PassRefPtrWillBeRawPtr<WebGLProgram> WebGLRenderingContextBase::createProgram() | 1945 WebGLProgram* WebGLRenderingContextBase::createProgram() |
| 1948 { | 1946 { |
| 1949 if (isContextLost()) | 1947 if (isContextLost()) |
| 1950 return nullptr; | 1948 return nullptr; |
| 1951 RefPtrWillBeRawPtr<WebGLProgram> o = WebGLProgram::create(this); | 1949 WebGLProgram* o = WebGLProgram::create(this); |
| 1952 addSharedObject(o.get()); | 1950 addSharedObject(o); |
| 1953 return o.release(); | 1951 return o; |
| 1954 } | 1952 } |
| 1955 | 1953 |
| 1956 PassRefPtrWillBeRawPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRende rbuffer() | 1954 WebGLRenderbuffer* WebGLRenderingContextBase::createRenderbuffer() |
| 1957 { | 1955 { |
| 1958 if (isContextLost()) | 1956 if (isContextLost()) |
| 1959 return nullptr; | 1957 return nullptr; |
| 1960 RefPtrWillBeRawPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this); | 1958 WebGLRenderbuffer* o = WebGLRenderbuffer::create(this); |
| 1961 addSharedObject(o.get()); | 1959 addSharedObject(o); |
| 1962 return o.release(); | 1960 return o; |
| 1963 } | 1961 } |
| 1964 | 1962 |
| 1965 WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer) | 1963 WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer) |
| 1966 { | 1964 { |
| 1967 if (isContextLost()) | 1965 if (isContextLost()) |
| 1968 return nullptr; | 1966 return nullptr; |
| 1969 if (!renderbuffer->emulatedStencilBuffer()) { | 1967 if (!renderbuffer->emulatedStencilBuffer()) { |
| 1970 renderbuffer->setEmulatedStencilBuffer(createRenderbuffer()); | 1968 renderbuffer->setEmulatedStencilBuffer(createRenderbuffer()); |
| 1971 webContext()->bindRenderbuffer(target, objectOrZero(renderbuffer->emulat edStencilBuffer())); | 1969 webContext()->bindRenderbuffer(target, objectOrZero(renderbuffer->emulat edStencilBuffer())); |
| 1972 webContext()->bindRenderbuffer(target, objectOrZero(m_renderbufferBindin g.get())); | 1970 webContext()->bindRenderbuffer(target, objectOrZero(m_renderbufferBindin g.get())); |
| 1973 } | 1971 } |
| 1974 return renderbuffer->emulatedStencilBuffer(); | 1972 return renderbuffer->emulatedStencilBuffer(); |
| 1975 } | 1973 } |
| 1976 | 1974 |
| 1977 PassRefPtrWillBeRawPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLen um type) | 1975 WebGLShader* WebGLRenderingContextBase::createShader(GLenum type) |
| 1978 { | 1976 { |
| 1979 if (isContextLost()) | 1977 if (isContextLost()) |
| 1980 return nullptr; | 1978 return nullptr; |
| 1981 if (type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER) { | 1979 if (type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER) { |
| 1982 synthesizeGLError(GL_INVALID_ENUM, "createShader", "invalid shader type" ); | 1980 synthesizeGLError(GL_INVALID_ENUM, "createShader", "invalid shader type" ); |
| 1983 return nullptr; | 1981 return nullptr; |
| 1984 } | 1982 } |
| 1985 | 1983 |
| 1986 RefPtrWillBeRawPtr<WebGLShader> o = WebGLShader::create(this, type); | 1984 WebGLShader* o = WebGLShader::create(this, type); |
| 1987 addSharedObject(o.get()); | 1985 addSharedObject(o); |
| 1988 return o.release(); | 1986 return o; |
| 1989 } | 1987 } |
| 1990 | 1988 |
| 1991 void WebGLRenderingContextBase::cullFace(GLenum mode) | 1989 void WebGLRenderingContextBase::cullFace(GLenum mode) |
| 1992 { | 1990 { |
| 1993 if (isContextLost()) | 1991 if (isContextLost()) |
| 1994 return; | 1992 return; |
| 1995 switch (mode) { | 1993 switch (mode) { |
| 1996 case GL_FRONT_AND_BACK: | 1994 case GL_FRONT_AND_BACK: |
| 1997 case GL_FRONT: | 1995 case GL_FRONT: |
| 1998 case GL_BACK: | 1996 case GL_BACK: |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2434 } | 2432 } |
| 2435 #endif | 2433 #endif |
| 2436 webContext()->generateMipmap(target); | 2434 webContext()->generateMipmap(target); |
| 2437 #if OS(MACOSX) | 2435 #if OS(MACOSX) |
| 2438 if (needToResetMinFilter) | 2436 if (needToResetMinFilter) |
| 2439 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi lter()); | 2437 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi lter()); |
| 2440 #endif | 2438 #endif |
| 2441 tex->generateMipmapLevelInfo(); | 2439 tex->generateMipmapLevelInfo(); |
| 2442 } | 2440 } |
| 2443 | 2441 |
| 2444 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttr ib(WebGLProgram* program, GLuint index) | 2442 WebGLActiveInfo* WebGLRenderingContextBase::getActiveAttrib(WebGLProgram* progra m, GLuint index) |
| 2445 { | 2443 { |
| 2446 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) | 2444 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) |
| 2447 return nullptr; | 2445 return nullptr; |
| 2448 WebGraphicsContext3D::ActiveInfo info; | 2446 WebGraphicsContext3D::ActiveInfo info; |
| 2449 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info)) | 2447 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info)) |
| 2450 return nullptr; | 2448 return nullptr; |
| 2451 return WebGLActiveInfo::create(info.name, info.type, info.size); | 2449 return WebGLActiveInfo::create(info.name, info.type, info.size); |
| 2452 } | 2450 } |
| 2453 | 2451 |
| 2454 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUnif orm(WebGLProgram* program, GLuint index) | 2452 WebGLActiveInfo* WebGLRenderingContextBase::getActiveUniform(WebGLProgram* progr am, GLuint index) |
| 2455 { | 2453 { |
| 2456 if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) | 2454 if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) |
| 2457 return nullptr; | 2455 return nullptr; |
| 2458 WebGraphicsContext3D::ActiveInfo info; | 2456 WebGraphicsContext3D::ActiveInfo info; |
| 2459 if (!webContext()->getActiveUniform(objectOrZero(program), index, info)) | 2457 if (!webContext()->getActiveUniform(objectOrZero(program), index, info)) |
| 2460 return nullptr; | 2458 return nullptr; |
| 2461 return WebGLActiveInfo::create(info.name, info.type, info.size); | 2459 return WebGLActiveInfo::create(info.name, info.type, info.size); |
| 2462 } | 2460 } |
| 2463 | 2461 |
| 2464 Nullable<WillBeHeapVector<RefPtrWillBeMember<WebGLShader>>> WebGLRenderingContex tBase::getAttachedShaders(WebGLProgram* program) | 2462 Nullable<HeapVector<Member<WebGLShader>>> WebGLRenderingContextBase::getAttached Shaders(WebGLProgram* program) |
| 2465 { | 2463 { |
| 2466 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program)) | 2464 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program)) |
| 2467 return nullptr; | 2465 return nullptr; |
| 2468 | 2466 |
| 2469 WillBeHeapVector<RefPtrWillBeMember<WebGLShader>> shaderObjects; | 2467 HeapVector<Member<WebGLShader>> shaderObjects; |
| 2470 const GLenum shaderType[] = { | 2468 const GLenum shaderType[] = { |
| 2471 GL_VERTEX_SHADER, | 2469 GL_VERTEX_SHADER, |
| 2472 GL_FRAGMENT_SHADER | 2470 GL_FRAGMENT_SHADER |
| 2473 }; | 2471 }; |
| 2474 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) { | 2472 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) { |
| 2475 WebGLShader* shader = program->getAttachedShader(shaderType[i]); | 2473 WebGLShader* shader = program->getAttachedShader(shaderType[i]); |
| 2476 if (shader) | 2474 if (shader) |
| 2477 shaderObjects.append(shader); | 2475 shaderObjects.append(shader); |
| 2478 } | 2476 } |
| 2479 return shaderObjects; | 2477 return shaderObjects; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2585 { | 2583 { |
| 2586 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled ()) | 2584 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled ()) |
| 2587 return false; | 2585 return false; |
| 2588 if (!tracker->supported(this)) | 2586 if (!tracker->supported(this)) |
| 2589 return false; | 2587 return false; |
| 2590 return true; | 2588 return true; |
| 2591 } | 2589 } |
| 2592 | 2590 |
| 2593 ScriptValue WebGLRenderingContextBase::getExtension(ScriptState* scriptState, co nst String& name) | 2591 ScriptValue WebGLRenderingContextBase::getExtension(ScriptState* scriptState, co nst String& name) |
| 2594 { | 2592 { |
| 2595 RefPtrWillBeRawPtr<WebGLExtension> extension = nullptr; | 2593 WebGLExtension* extension = nullptr; |
| 2596 | 2594 |
| 2597 if (!isContextLost()) { | 2595 if (!isContextLost()) { |
| 2598 for (size_t i = 0; i < m_extensions.size(); ++i) { | 2596 for (size_t i = 0; i < m_extensions.size(); ++i) { |
| 2599 ExtensionTracker* tracker = m_extensions[i].get(); | 2597 ExtensionTracker* tracker = m_extensions[i].get(); |
| 2600 if (tracker->matchesNameWithPrefixes(name)) { | 2598 if (tracker->matchesNameWithPrefixes(name)) { |
| 2601 if (extensionSupportedAndAllowed(tracker)) { | 2599 if (extensionSupportedAndAllowed(tracker)) { |
| 2602 extension = tracker->getExtension(this); | 2600 extension = tracker->getExtension(this); |
| 2603 if (extension) | 2601 if (extension) |
| 2604 m_extensionEnabled[extension->name()] = true; | 2602 m_extensionEnabled[extension->name()] = true; |
| 2605 } | 2603 } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 2630 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name"); | 2628 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name"); |
| 2631 return ScriptValue::createNull(scriptState); | 2629 return ScriptValue::createNull(scriptState); |
| 2632 } | 2630 } |
| 2633 | 2631 |
| 2634 ASSERT(attachmentObject->isTexture() || attachmentObject->isRenderbuffer()); | 2632 ASSERT(attachmentObject->isTexture() || attachmentObject->isRenderbuffer()); |
| 2635 if (attachmentObject->isTexture()) { | 2633 if (attachmentObject->isTexture()) { |
| 2636 switch (pname) { | 2634 switch (pname) { |
| 2637 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: | 2635 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2638 return WebGLAny(scriptState, GL_TEXTURE); | 2636 return WebGLAny(scriptState, GL_TEXTURE); |
| 2639 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: | 2637 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2640 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(att achmentObject)); | 2638 return WebGLAny(scriptState, attachmentObject); |
| 2641 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: | 2639 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2642 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: | 2640 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2643 { | 2641 { |
| 2644 GLint value = 0; | 2642 GLint value = 0; |
| 2645 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); | 2643 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); |
| 2646 return WebGLAny(scriptState, value); | 2644 return WebGLAny(scriptState, value); |
| 2647 } | 2645 } |
| 2648 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: | 2646 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: |
| 2649 if (extensionEnabled(EXTsRGBName)) { | 2647 if (extensionEnabled(EXTsRGBName)) { |
| 2650 GLint value = 0; | 2648 GLint value = 0; |
| 2651 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); | 2649 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); |
| 2652 return WebGLAny(scriptState, static_cast<unsigned>(value)); | 2650 return WebGLAny(scriptState, static_cast<unsigned>(value)); |
| 2653 } | 2651 } |
| 2654 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); | 2652 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); |
| 2655 return ScriptValue::createNull(scriptState); | 2653 return ScriptValue::createNull(scriptState); |
| 2656 default: | 2654 default: |
| 2657 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for texture attachment"); | 2655 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for texture attachment"); |
| 2658 return ScriptValue::createNull(scriptState); | 2656 return ScriptValue::createNull(scriptState); |
| 2659 } | 2657 } |
| 2660 } else { | 2658 } else { |
| 2661 switch (pname) { | 2659 switch (pname) { |
| 2662 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: | 2660 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2663 return WebGLAny(scriptState, GL_RENDERBUFFER); | 2661 return WebGLAny(scriptState, GL_RENDERBUFFER); |
| 2664 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: | 2662 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2665 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(att achmentObject)); | 2663 return WebGLAny(scriptState, attachmentObject); |
| 2666 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: | 2664 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: |
| 2667 if (extensionEnabled(EXTsRGBName) || isWebGL2OrHigher()) { | 2665 if (extensionEnabled(EXTsRGBName) || isWebGL2OrHigher()) { |
| 2668 GLint value = 0; | 2666 GLint value = 0; |
| 2669 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); | 2667 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); |
| 2670 return WebGLAny(scriptState, value); | 2668 return WebGLAny(scriptState, value); |
| 2671 } | 2669 } |
| 2672 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); | 2670 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); |
| 2673 return ScriptValue::createNull(scriptState); | 2671 return ScriptValue::createNull(scriptState); |
| 2674 default: | 2672 default: |
| 2675 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); | 2673 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 2686 switch (pname) { | 2684 switch (pname) { |
| 2687 case GL_ACTIVE_TEXTURE: | 2685 case GL_ACTIVE_TEXTURE: |
| 2688 return getUnsignedIntParameter(scriptState, pname); | 2686 return getUnsignedIntParameter(scriptState, pname); |
| 2689 case GL_ALIASED_LINE_WIDTH_RANGE: | 2687 case GL_ALIASED_LINE_WIDTH_RANGE: |
| 2690 return getWebGLFloatArrayParameter(scriptState, pname); | 2688 return getWebGLFloatArrayParameter(scriptState, pname); |
| 2691 case GL_ALIASED_POINT_SIZE_RANGE: | 2689 case GL_ALIASED_POINT_SIZE_RANGE: |
| 2692 return getWebGLFloatArrayParameter(scriptState, pname); | 2690 return getWebGLFloatArrayParameter(scriptState, pname); |
| 2693 case GL_ALPHA_BITS: | 2691 case GL_ALPHA_BITS: |
| 2694 return getIntParameter(scriptState, pname); | 2692 return getIntParameter(scriptState, pname); |
| 2695 case GL_ARRAY_BUFFER_BINDING: | 2693 case GL_ARRAY_BUFFER_BINDING: |
| 2696 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound ArrayBuffer.get())); | 2694 return WebGLAny(scriptState, m_boundArrayBuffer.get()); |
| 2697 case GL_BLEND: | 2695 case GL_BLEND: |
| 2698 return getBooleanParameter(scriptState, pname); | 2696 return getBooleanParameter(scriptState, pname); |
| 2699 case GL_BLEND_COLOR: | 2697 case GL_BLEND_COLOR: |
| 2700 return getWebGLFloatArrayParameter(scriptState, pname); | 2698 return getWebGLFloatArrayParameter(scriptState, pname); |
| 2701 case GL_BLEND_DST_ALPHA: | 2699 case GL_BLEND_DST_ALPHA: |
| 2702 return getUnsignedIntParameter(scriptState, pname); | 2700 return getUnsignedIntParameter(scriptState, pname); |
| 2703 case GL_BLEND_DST_RGB: | 2701 case GL_BLEND_DST_RGB: |
| 2704 return getUnsignedIntParameter(scriptState, pname); | 2702 return getUnsignedIntParameter(scriptState, pname); |
| 2705 case GL_BLEND_EQUATION_ALPHA: | 2703 case GL_BLEND_EQUATION_ALPHA: |
| 2706 return getUnsignedIntParameter(scriptState, pname); | 2704 return getUnsignedIntParameter(scriptState, pname); |
| 2707 case GL_BLEND_EQUATION_RGB: | 2705 case GL_BLEND_EQUATION_RGB: |
| 2708 return getUnsignedIntParameter(scriptState, pname); | 2706 return getUnsignedIntParameter(scriptState, pname); |
| 2709 case GL_BLEND_SRC_ALPHA: | 2707 case GL_BLEND_SRC_ALPHA: |
| 2710 return getUnsignedIntParameter(scriptState, pname); | 2708 return getUnsignedIntParameter(scriptState, pname); |
| 2711 case GL_BLEND_SRC_RGB: | 2709 case GL_BLEND_SRC_RGB: |
| 2712 return getUnsignedIntParameter(scriptState, pname); | 2710 return getUnsignedIntParameter(scriptState, pname); |
| 2713 case GL_BLUE_BITS: | 2711 case GL_BLUE_BITS: |
| 2714 return getIntParameter(scriptState, pname); | 2712 return getIntParameter(scriptState, pname); |
| 2715 case GL_COLOR_CLEAR_VALUE: | 2713 case GL_COLOR_CLEAR_VALUE: |
| 2716 return getWebGLFloatArrayParameter(scriptState, pname); | 2714 return getWebGLFloatArrayParameter(scriptState, pname); |
| 2717 case GL_COLOR_WRITEMASK: | 2715 case GL_COLOR_WRITEMASK: |
| 2718 return getBooleanArrayParameter(scriptState, pname); | 2716 return getBooleanArrayParameter(scriptState, pname); |
| 2719 case GL_COMPRESSED_TEXTURE_FORMATS: | 2717 case GL_COMPRESSED_TEXTURE_FORMATS: |
| 2720 return WebGLAny(scriptState, DOMUint32Array::create(m_compressedTextureF ormats.data(), m_compressedTextureFormats.size())); | 2718 return WebGLAny(scriptState, DOMUint32Array::create(m_compressedTextureF ormats.data(), m_compressedTextureFormats.size())); |
| 2721 case GL_CULL_FACE: | 2719 case GL_CULL_FACE: |
| 2722 return getBooleanParameter(scriptState, pname); | 2720 return getBooleanParameter(scriptState, pname); |
| 2723 case GL_CULL_FACE_MODE: | 2721 case GL_CULL_FACE_MODE: |
| 2724 return getUnsignedIntParameter(scriptState, pname); | 2722 return getUnsignedIntParameter(scriptState, pname); |
| 2725 case GL_CURRENT_PROGRAM: | 2723 case GL_CURRENT_PROGRAM: |
| 2726 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_curre ntProgram.get())); | 2724 return WebGLAny(scriptState, m_currentProgram.get()); |
| 2727 case GL_DEPTH_BITS: | 2725 case GL_DEPTH_BITS: |
| 2728 if (!m_framebufferBinding && !m_requestedAttributes.depth()) | 2726 if (!m_framebufferBinding && !m_requestedAttributes.depth()) |
| 2729 return WebGLAny(scriptState, intZero); | 2727 return WebGLAny(scriptState, intZero); |
| 2730 return getIntParameter(scriptState, pname); | 2728 return getIntParameter(scriptState, pname); |
| 2731 case GL_DEPTH_CLEAR_VALUE: | 2729 case GL_DEPTH_CLEAR_VALUE: |
| 2732 return getFloatParameter(scriptState, pname); | 2730 return getFloatParameter(scriptState, pname); |
| 2733 case GL_DEPTH_FUNC: | 2731 case GL_DEPTH_FUNC: |
| 2734 return getUnsignedIntParameter(scriptState, pname); | 2732 return getUnsignedIntParameter(scriptState, pname); |
| 2735 case GL_DEPTH_RANGE: | 2733 case GL_DEPTH_RANGE: |
| 2736 return getWebGLFloatArrayParameter(scriptState, pname); | 2734 return getWebGLFloatArrayParameter(scriptState, pname); |
| 2737 case GL_DEPTH_TEST: | 2735 case GL_DEPTH_TEST: |
| 2738 return getBooleanParameter(scriptState, pname); | 2736 return getBooleanParameter(scriptState, pname); |
| 2739 case GL_DEPTH_WRITEMASK: | 2737 case GL_DEPTH_WRITEMASK: |
| 2740 return getBooleanParameter(scriptState, pname); | 2738 return getBooleanParameter(scriptState, pname); |
| 2741 case GL_DITHER: | 2739 case GL_DITHER: |
| 2742 return getBooleanParameter(scriptState, pname); | 2740 return getBooleanParameter(scriptState, pname); |
| 2743 case GL_ELEMENT_ARRAY_BUFFER_BINDING: | 2741 case GL_ELEMENT_ARRAY_BUFFER_BINDING: |
| 2744 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound VertexArrayObject->boundElementArrayBuffer())); | 2742 return WebGLAny(scriptState, m_boundVertexArrayObject->boundElementArray Buffer()); |
| 2745 case GL_FRAMEBUFFER_BINDING: | 2743 case GL_FRAMEBUFFER_BINDING: |
| 2746 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_frame bufferBinding.get())); | 2744 return WebGLAny(scriptState, m_framebufferBinding.get()); |
| 2747 case GL_FRONT_FACE: | 2745 case GL_FRONT_FACE: |
| 2748 return getUnsignedIntParameter(scriptState, pname); | 2746 return getUnsignedIntParameter(scriptState, pname); |
| 2749 case GL_GENERATE_MIPMAP_HINT: | 2747 case GL_GENERATE_MIPMAP_HINT: |
| 2750 return getUnsignedIntParameter(scriptState, pname); | 2748 return getUnsignedIntParameter(scriptState, pname); |
| 2751 case GL_GREEN_BITS: | 2749 case GL_GREEN_BITS: |
| 2752 return getIntParameter(scriptState, pname); | 2750 return getIntParameter(scriptState, pname); |
| 2753 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: | 2751 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: |
| 2754 return getIntParameter(scriptState, pname); | 2752 return getIntParameter(scriptState, pname); |
| 2755 case GL_IMPLEMENTATION_COLOR_READ_TYPE: | 2753 case GL_IMPLEMENTATION_COLOR_READ_TYPE: |
| 2756 return getIntParameter(scriptState, pname); | 2754 return getIntParameter(scriptState, pname); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 2785 return getIntParameter(scriptState, pname); | 2783 return getIntParameter(scriptState, pname); |
| 2786 case GL_POLYGON_OFFSET_FACTOR: | 2784 case GL_POLYGON_OFFSET_FACTOR: |
| 2787 return getFloatParameter(scriptState, pname); | 2785 return getFloatParameter(scriptState, pname); |
| 2788 case GL_POLYGON_OFFSET_FILL: | 2786 case GL_POLYGON_OFFSET_FILL: |
| 2789 return getBooleanParameter(scriptState, pname); | 2787 return getBooleanParameter(scriptState, pname); |
| 2790 case GL_POLYGON_OFFSET_UNITS: | 2788 case GL_POLYGON_OFFSET_UNITS: |
| 2791 return getFloatParameter(scriptState, pname); | 2789 return getFloatParameter(scriptState, pname); |
| 2792 case GL_RED_BITS: | 2790 case GL_RED_BITS: |
| 2793 return getIntParameter(scriptState, pname); | 2791 return getIntParameter(scriptState, pname); |
| 2794 case GL_RENDERBUFFER_BINDING: | 2792 case GL_RENDERBUFFER_BINDING: |
| 2795 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_rende rbufferBinding.get())); | 2793 return WebGLAny(scriptState, m_renderbufferBinding.get()); |
| 2796 case GL_RENDERER: | 2794 case GL_RENDERER: |
| 2797 return WebGLAny(scriptState, String("WebKit WebGL")); | 2795 return WebGLAny(scriptState, String("WebKit WebGL")); |
| 2798 case GL_SAMPLE_BUFFERS: | 2796 case GL_SAMPLE_BUFFERS: |
| 2799 return getIntParameter(scriptState, pname); | 2797 return getIntParameter(scriptState, pname); |
| 2800 case GL_SAMPLE_COVERAGE_INVERT: | 2798 case GL_SAMPLE_COVERAGE_INVERT: |
| 2801 return getBooleanParameter(scriptState, pname); | 2799 return getBooleanParameter(scriptState, pname); |
| 2802 case GL_SAMPLE_COVERAGE_VALUE: | 2800 case GL_SAMPLE_COVERAGE_VALUE: |
| 2803 return getFloatParameter(scriptState, pname); | 2801 return getFloatParameter(scriptState, pname); |
| 2804 case GL_SAMPLES: | 2802 case GL_SAMPLES: |
| 2805 return getIntParameter(scriptState, pname); | 2803 return getIntParameter(scriptState, pname); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2841 return getIntParameter(scriptState, pname); | 2839 return getIntParameter(scriptState, pname); |
| 2842 case GL_STENCIL_TEST: | 2840 case GL_STENCIL_TEST: |
| 2843 return getBooleanParameter(scriptState, pname); | 2841 return getBooleanParameter(scriptState, pname); |
| 2844 case GL_STENCIL_VALUE_MASK: | 2842 case GL_STENCIL_VALUE_MASK: |
| 2845 return getUnsignedIntParameter(scriptState, pname); | 2843 return getUnsignedIntParameter(scriptState, pname); |
| 2846 case GL_STENCIL_WRITEMASK: | 2844 case GL_STENCIL_WRITEMASK: |
| 2847 return getUnsignedIntParameter(scriptState, pname); | 2845 return getUnsignedIntParameter(scriptState, pname); |
| 2848 case GL_SUBPIXEL_BITS: | 2846 case GL_SUBPIXEL_BITS: |
| 2849 return getIntParameter(scriptState, pname); | 2847 return getIntParameter(scriptState, pname); |
| 2850 case GL_TEXTURE_BINDING_2D: | 2848 case GL_TEXTURE_BINDING_2D: |
| 2851 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_textu reUnits[m_activeTextureUnit].m_texture2DBinding.get())); | 2849 return WebGLAny(scriptState, m_textureUnits[m_activeTextureUnit].m_textu re2DBinding.get()); |
| 2852 case GL_TEXTURE_BINDING_CUBE_MAP: | 2850 case GL_TEXTURE_BINDING_CUBE_MAP: |
| 2853 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_textu reUnits[m_activeTextureUnit].m_textureCubeMapBinding.get())); | 2851 return WebGLAny(scriptState, m_textureUnits[m_activeTextureUnit].m_textu reCubeMapBinding.get()); |
| 2854 case GL_UNPACK_ALIGNMENT: | 2852 case GL_UNPACK_ALIGNMENT: |
| 2855 return getIntParameter(scriptState, pname); | 2853 return getIntParameter(scriptState, pname); |
| 2856 case GC3D_UNPACK_FLIP_Y_WEBGL: | 2854 case GC3D_UNPACK_FLIP_Y_WEBGL: |
| 2857 return WebGLAny(scriptState, m_unpackFlipY); | 2855 return WebGLAny(scriptState, m_unpackFlipY); |
| 2858 case GC3D_UNPACK_PREMULTIPLY_ALPHA_WEBGL: | 2856 case GC3D_UNPACK_PREMULTIPLY_ALPHA_WEBGL: |
| 2859 return WebGLAny(scriptState, m_unpackPremultiplyAlpha); | 2857 return WebGLAny(scriptState, m_unpackPremultiplyAlpha); |
| 2860 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL: | 2858 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL: |
| 2861 return WebGLAny(scriptState, m_unpackColorspaceConversion); | 2859 return WebGLAny(scriptState, m_unpackColorspaceConversion); |
| 2862 case GL_VENDOR: | 2860 case GL_VENDOR: |
| 2863 return WebGLAny(scriptState, String("WebKit")); | 2861 return WebGLAny(scriptState, String("WebKit")); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 2876 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); | 2874 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); |
| 2877 return ScriptValue::createNull(scriptState); | 2875 return ScriptValue::createNull(scriptState); |
| 2878 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL: | 2876 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL: |
| 2879 if (extensionEnabled(WebGLDebugRendererInfoName)) | 2877 if (extensionEnabled(WebGLDebugRendererInfoName)) |
| 2880 return WebGLAny(scriptState, webContext()->getString(GL_VENDOR)); | 2878 return WebGLAny(scriptState, webContext()->getString(GL_VENDOR)); |
| 2881 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); | 2879 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); |
| 2882 return ScriptValue::createNull(scriptState); | 2880 return ScriptValue::createNull(scriptState); |
| 2883 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object | 2881 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object |
| 2884 if (extensionEnabled(OESVertexArrayObjectName) || isWebGL2OrHigher()) { | 2882 if (extensionEnabled(OESVertexArrayObjectName) || isWebGL2OrHigher()) { |
| 2885 if (!m_boundVertexArrayObject->isDefaultObject()) | 2883 if (!m_boundVertexArrayObject->isDefaultObject()) |
| 2886 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject> (m_boundVertexArrayObject.get())); | 2884 return WebGLAny(scriptState, m_boundVertexArrayObject.get()); |
| 2887 return ScriptValue::createNull(scriptState); | 2885 return ScriptValue::createNull(scriptState); |
| 2888 } | 2886 } |
| 2889 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_vertex_array_object not enabled"); | 2887 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_vertex_array_object not enabled"); |
| 2890 return ScriptValue::createNull(scriptState); | 2888 return ScriptValue::createNull(scriptState); |
| 2891 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic | 2889 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic |
| 2892 if (extensionEnabled(EXTTextureFilterAnisotropicName)) | 2890 if (extensionEnabled(EXTTextureFilterAnisotropicName)) |
| 2893 return getUnsignedIntParameter(scriptState, GL_MAX_TEXTURE_MAX_ANISO TROPY_EXT); | 2891 return getUnsignedIntParameter(scriptState, GL_MAX_TEXTURE_MAX_ANISO TROPY_EXT); |
| 2894 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, EXT_texture_filter_anisotropic not enabled"); | 2892 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, EXT_texture_filter_anisotropic not enabled"); |
| 2895 return ScriptValue::createNull(scriptState); | 2893 return ScriptValue::createNull(scriptState); |
| 2896 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN | 2894 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3028 } | 3026 } |
| 3029 } | 3027 } |
| 3030 | 3028 |
| 3031 String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader) | 3029 String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader) |
| 3032 { | 3030 { |
| 3033 if (isContextLost() || !validateWebGLObject("getShaderInfoLog", shader)) | 3031 if (isContextLost() || !validateWebGLObject("getShaderInfoLog", shader)) |
| 3034 return String(); | 3032 return String(); |
| 3035 return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader))); | 3033 return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader))); |
| 3036 } | 3034 } |
| 3037 | 3035 |
| 3038 PassRefPtrWillBeRawPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::ge tShaderPrecisionFormat(GLenum shaderType, GLenum precisionType) | 3036 WebGLShaderPrecisionFormat* WebGLRenderingContextBase::getShaderPrecisionFormat( GLenum shaderType, GLenum precisionType) |
| 3039 { | 3037 { |
| 3040 if (isContextLost()) | 3038 if (isContextLost()) |
| 3041 return nullptr; | 3039 return nullptr; |
| 3042 switch (shaderType) { | 3040 switch (shaderType) { |
| 3043 case GL_VERTEX_SHADER: | 3041 case GL_VERTEX_SHADER: |
| 3044 case GL_FRAGMENT_SHADER: | 3042 case GL_FRAGMENT_SHADER: |
| 3045 break; | 3043 break; |
| 3046 default: | 3044 default: |
| 3047 synthesizeGLError(GL_INVALID_ENUM, "getShaderPrecisionFormat", "invalid shader type"); | 3045 synthesizeGLError(GL_INVALID_ENUM, "getShaderPrecisionFormat", "invalid shader type"); |
| 3048 return nullptr; | 3046 return nullptr; |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3324 notImplemented(); | 3322 notImplemented(); |
| 3325 } | 3323 } |
| 3326 } | 3324 } |
| 3327 } | 3325 } |
| 3328 } | 3326 } |
| 3329 // If we get here, something went wrong in our unfortunately complex logic a bove | 3327 // If we get here, something went wrong in our unfortunately complex logic a bove |
| 3330 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error"); | 3328 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error"); |
| 3331 return ScriptValue::createNull(scriptState); | 3329 return ScriptValue::createNull(scriptState); |
| 3332 } | 3330 } |
| 3333 | 3331 |
| 3334 PassRefPtrWillBeRawPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUnifo rmLocation(WebGLProgram* program, const String& name) | 3332 WebGLUniformLocation* WebGLRenderingContextBase::getUniformLocation(WebGLProgram * program, const String& name) |
| 3335 { | 3333 { |
| 3336 if (isContextLost() || !validateWebGLObject("getUniformLocation", program)) | 3334 if (isContextLost() || !validateWebGLObject("getUniformLocation", program)) |
| 3337 return nullptr; | 3335 return nullptr; |
| 3338 if (!validateLocationLength("getUniformLocation", name)) | 3336 if (!validateLocationLength("getUniformLocation", name)) |
| 3339 return nullptr; | 3337 return nullptr; |
| 3340 if (!validateString("getUniformLocation", name)) | 3338 if (!validateString("getUniformLocation", name)) |
| 3341 return nullptr; | 3339 return nullptr; |
| 3342 if (isPrefixReserved(name)) | 3340 if (isPrefixReserved(name)) |
| 3343 return nullptr; | 3341 return nullptr; |
| 3344 if (!program->linkStatus()) { | 3342 if (!program->linkStatus()) { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 3362 const WebGLVertexArrayObjectBase::VertexAttribState* state = m_boundVertexAr rayObject->getVertexAttribState(index); | 3360 const WebGLVertexArrayObjectBase::VertexAttribState* state = m_boundVertexAr rayObject->getVertexAttribState(index); |
| 3363 | 3361 |
| 3364 if ((extensionEnabled(ANGLEInstancedArraysName) || isWebGL2OrHigher()) | 3362 if ((extensionEnabled(ANGLEInstancedArraysName) || isWebGL2OrHigher()) |
| 3365 && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) | 3363 && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) |
| 3366 return WebGLAny(scriptState, state->divisor); | 3364 return WebGLAny(scriptState, state->divisor); |
| 3367 | 3365 |
| 3368 switch (pname) { | 3366 switch (pname) { |
| 3369 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: | 3367 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: |
| 3370 if (!state->bufferBinding || !state->bufferBinding->object()) | 3368 if (!state->bufferBinding || !state->bufferBinding->object()) |
| 3371 return ScriptValue::createNull(scriptState); | 3369 return ScriptValue::createNull(scriptState); |
| 3372 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(state-> bufferBinding.get())); | 3370 return WebGLAny(scriptState, state->bufferBinding.get()); |
| 3373 case GL_VERTEX_ATTRIB_ARRAY_ENABLED: | 3371 case GL_VERTEX_ATTRIB_ARRAY_ENABLED: |
| 3374 return WebGLAny(scriptState, state->enabled); | 3372 return WebGLAny(scriptState, state->enabled); |
| 3375 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: | 3373 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: |
| 3376 return WebGLAny(scriptState, state->normalized); | 3374 return WebGLAny(scriptState, state->normalized); |
| 3377 case GL_VERTEX_ATTRIB_ARRAY_SIZE: | 3375 case GL_VERTEX_ATTRIB_ARRAY_SIZE: |
| 3378 return WebGLAny(scriptState, state->size); | 3376 return WebGLAny(scriptState, state->size); |
| 3379 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: | 3377 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: |
| 3380 return WebGLAny(scriptState, state->originalStride); | 3378 return WebGLAny(scriptState, state->originalStride); |
| 3381 case GL_VERTEX_ATTRIB_ARRAY_TYPE: | 3379 case GL_VERTEX_ATTRIB_ARRAY_TYPE: |
| 3382 return WebGLAny(scriptState, state->type); | 3380 return WebGLAny(scriptState, state->type); |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3956 webContext()->stencilOp(fail, zfail, zpass); | 3954 webContext()->stencilOp(fail, zfail, zpass); |
| 3957 } | 3955 } |
| 3958 | 3956 |
| 3959 void WebGLRenderingContextBase::stencilOpSeparate(GLenum face, GLenum fail, GLen um zfail, GLenum zpass) | 3957 void WebGLRenderingContextBase::stencilOpSeparate(GLenum face, GLenum fail, GLen um zfail, GLenum zpass) |
| 3960 { | 3958 { |
| 3961 if (isContextLost()) | 3959 if (isContextLost()) |
| 3962 return; | 3960 return; |
| 3963 webContext()->stencilOpSeparate(face, fail, zfail, zpass); | 3961 webContext()->stencilOpSeparate(face, fail, zfail, zpass); |
| 3964 } | 3962 } |
| 3965 | 3963 |
| 3966 PassRefPtrWillBeRawPtr<CHROMIUMValuebuffer> WebGLRenderingContextBase::createVal uebufferCHROMIUM() | 3964 CHROMIUMValuebuffer* WebGLRenderingContextBase::createValuebufferCHROMIUM() |
| 3967 { | 3965 { |
| 3968 if (isContextLost()) | 3966 if (isContextLost()) |
| 3969 return nullptr; | 3967 return nullptr; |
| 3970 RefPtrWillBeRawPtr<CHROMIUMValuebuffer> o = CHROMIUMValuebuffer::create(this ); | 3968 CHROMIUMValuebuffer* o = CHROMIUMValuebuffer::create(this); |
| 3971 addSharedObject(o.get()); | 3969 addSharedObject(o); |
| 3972 return o.release(); | 3970 return o; |
| 3973 } | 3971 } |
| 3974 | 3972 |
| 3975 void WebGLRenderingContextBase::deleteValuebufferCHROMIUM(CHROMIUMValuebuffer *v aluebuffer) | 3973 void WebGLRenderingContextBase::deleteValuebufferCHROMIUM(CHROMIUMValuebuffer *v aluebuffer) |
| 3976 { | 3974 { |
| 3977 if (!deleteObject(valuebuffer)) | 3975 if (!deleteObject(valuebuffer)) |
| 3978 return; | 3976 return; |
| 3979 if (valuebuffer == m_valuebufferBinding) | 3977 if (valuebuffer == m_valuebufferBinding) |
| 3980 m_valuebufferBinding = nullptr; | 3978 m_valuebufferBinding = nullptr; |
| 3981 } | 3979 } |
| 3982 | 3980 |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5138 | 5136 |
| 5139 void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object) | 5137 void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object) |
| 5140 { | 5138 { |
| 5141 ASSERT(!isContextLost()); | 5139 ASSERT(!isContextLost()); |
| 5142 m_contextObjects.add(object); | 5140 m_contextObjects.add(object); |
| 5143 } | 5141 } |
| 5144 | 5142 |
| 5145 void WebGLRenderingContextBase::detachAndRemoveAllObjects() | 5143 void WebGLRenderingContextBase::detachAndRemoveAllObjects() |
| 5146 { | 5144 { |
| 5147 while (m_contextObjects.size() > 0) { | 5145 while (m_contextObjects.size() > 0) { |
| 5148 WillBeHeapHashSet<RawPtrWillBeWeakMember<WebGLContextObject>>::iterator it = m_contextObjects.begin(); | 5146 auto it = m_contextObjects.begin(); |
| 5149 (*it)->detachContext(); | 5147 (*it)->detachContext(); |
| 5150 } | 5148 } |
| 5151 } | 5149 } |
| 5152 | 5150 |
| 5153 void WebGLRenderingContextBase::stop() | 5151 void WebGLRenderingContextBase::stop() |
| 5154 { | 5152 { |
| 5155 if (!isContextLost()) { | 5153 if (!isContextLost()) { |
| 5156 // Never attempt to restore the context because the page is being torn d own. | 5154 // Never attempt to restore the context because the page is being torn d own. |
| 5157 forceLostContext(SyntheticLostContext, Manual); | 5155 forceLostContext(SyntheticLostContext, Manual); |
| 5158 } | 5156 } |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6016 return false; | 6014 return false; |
| 6017 } | 6015 } |
| 6018 return true; | 6016 return true; |
| 6019 } | 6017 } |
| 6020 | 6018 |
| 6021 WebGLBuffer* WebGLRenderingContextBase::validateBufferDataTarget(const char* fun ctionName, GLenum target) | 6019 WebGLBuffer* WebGLRenderingContextBase::validateBufferDataTarget(const char* fun ctionName, GLenum target) |
| 6022 { | 6020 { |
| 6023 WebGLBuffer* buffer = nullptr; | 6021 WebGLBuffer* buffer = nullptr; |
| 6024 switch (target) { | 6022 switch (target) { |
| 6025 case GL_ELEMENT_ARRAY_BUFFER: | 6023 case GL_ELEMENT_ARRAY_BUFFER: |
| 6026 buffer = m_boundVertexArrayObject->boundElementArrayBuffer().get(); | 6024 buffer = m_boundVertexArrayObject->boundElementArrayBuffer(); |
| 6027 break; | 6025 break; |
| 6028 case GL_ARRAY_BUFFER: | 6026 case GL_ARRAY_BUFFER: |
| 6029 buffer = m_boundArrayBuffer.get(); | 6027 buffer = m_boundArrayBuffer.get(); |
| 6030 break; | 6028 break; |
| 6031 default: | 6029 default: |
| 6032 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target"); | 6030 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target"); |
| 6033 return nullptr; | 6031 return nullptr; |
| 6034 } | 6032 } |
| 6035 if (!buffer) { | 6033 if (!buffer) { |
| 6036 synthesizeGLError(GL_INVALID_OPERATION, functionName, "no buffer"); | 6034 synthesizeGLError(GL_INVALID_OPERATION, functionName, "no buffer"); |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6542 DEFINE_TRACE(WebGLRenderingContextBase::TextureUnitState) | 6540 DEFINE_TRACE(WebGLRenderingContextBase::TextureUnitState) |
| 6543 { | 6541 { |
| 6544 visitor->trace(m_texture2DBinding); | 6542 visitor->trace(m_texture2DBinding); |
| 6545 visitor->trace(m_textureCubeMapBinding); | 6543 visitor->trace(m_textureCubeMapBinding); |
| 6546 visitor->trace(m_texture3DBinding); | 6544 visitor->trace(m_texture3DBinding); |
| 6547 visitor->trace(m_texture2DArrayBinding); | 6545 visitor->trace(m_texture2DArrayBinding); |
| 6548 } | 6546 } |
| 6549 | 6547 |
| 6550 DEFINE_TRACE(WebGLRenderingContextBase) | 6548 DEFINE_TRACE(WebGLRenderingContextBase) |
| 6551 { | 6549 { |
| 6552 #if ENABLE(OILPAN) | |
| 6553 visitor->trace(m_contextObjects); | 6550 visitor->trace(m_contextObjects); |
| 6554 visitor->trace(m_contextLostCallbackAdapter); | 6551 visitor->trace(m_contextLostCallbackAdapter); |
| 6555 visitor->trace(m_errorMessageCallbackAdapter); | 6552 visitor->trace(m_errorMessageCallbackAdapter); |
| 6556 visitor->trace(m_boundArrayBuffer); | 6553 visitor->trace(m_boundArrayBuffer); |
| 6557 visitor->trace(m_defaultVertexArrayObject); | 6554 visitor->trace(m_defaultVertexArrayObject); |
| 6558 visitor->trace(m_boundVertexArrayObject); | 6555 visitor->trace(m_boundVertexArrayObject); |
| 6559 visitor->trace(m_vertexAttrib0Buffer); | 6556 visitor->trace(m_vertexAttrib0Buffer); |
| 6560 visitor->trace(m_currentProgram); | 6557 visitor->trace(m_currentProgram); |
| 6561 visitor->trace(m_framebufferBinding); | 6558 visitor->trace(m_framebufferBinding); |
| 6562 visitor->trace(m_renderbufferBinding); | 6559 visitor->trace(m_renderbufferBinding); |
| 6563 visitor->trace(m_valuebufferBinding); | 6560 visitor->trace(m_valuebufferBinding); |
| 6564 visitor->trace(m_textureUnits); | 6561 visitor->trace(m_textureUnits); |
| 6565 visitor->trace(m_blackTexture2D); | 6562 visitor->trace(m_blackTexture2D); |
| 6566 visitor->trace(m_blackTextureCubeMap); | 6563 visitor->trace(m_blackTextureCubeMap); |
| 6567 visitor->trace(m_requestedAttributes); | |
| 6568 visitor->trace(m_extensions); | 6564 visitor->trace(m_extensions); |
| 6569 #endif | |
| 6570 CanvasRenderingContext::trace(visitor); | 6565 CanvasRenderingContext::trace(visitor); |
| 6571 } | 6566 } |
| 6572 | 6567 |
| 6573 int WebGLRenderingContextBase::externallyAllocatedBytesPerPixel() | 6568 int WebGLRenderingContextBase::externallyAllocatedBytesPerPixel() |
| 6574 { | 6569 { |
| 6575 if (isContextLost()) | 6570 if (isContextLost()) |
| 6576 return 0; | 6571 return 0; |
| 6577 | 6572 |
| 6578 int bytesPerPixel = 4; | 6573 int bytesPerPixel = 4; |
| 6579 int totalBytesPerPixel = bytesPerPixel * 2; // WebGL's front and back color buffers. | 6574 int totalBytesPerPixel = bytesPerPixel * 2; // WebGL's front and back color buffers. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 6595 | 6590 |
| 6596 return totalBytesPerPixel; | 6591 return totalBytesPerPixel; |
| 6597 } | 6592 } |
| 6598 | 6593 |
| 6599 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 6594 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
| 6600 { | 6595 { |
| 6601 return m_drawingBuffer.get(); | 6596 return m_drawingBuffer.get(); |
| 6602 } | 6597 } |
| 6603 | 6598 |
| 6604 } // namespace blink | 6599 } // namespace blink |
| OLD | NEW |