| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "DebugGLTestContext.h" | 9 #include "DebugGLTestContext.h" |
| 10 | 10 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 GrAlwaysAssert(!buffer->getDepthBound()); | 366 GrAlwaysAssert(!buffer->getDepthBound()); |
| 367 // However, at GrContext destroy time we release all GrRsources and
so stencil buffers | 367 // However, at GrContext destroy time we release all GrRsources and
so stencil buffers |
| 368 // may get deleted before FBOs that refer to them. | 368 // may get deleted before FBOs that refer to them. |
| 369 //GrAlwaysAssert(!buffer->getStencilBound()); | 369 //GrAlwaysAssert(!buffer->getStencilBound()); |
| 370 | 370 |
| 371 GrAlwaysAssert(!buffer->getDeleted()); | 371 GrAlwaysAssert(!buffer->getDeleted()); |
| 372 buffer->deleteAction(); | 372 buffer->deleteAction(); |
| 373 } | 373 } |
| 374 } | 374 } |
| 375 | 375 |
| 376 GrGLvoid renderbufferStorage(GrGLenum target, GrGLenum internalformat, GrGLs
izei width, |
| 377 GrGLsizei height) override { |
| 378 GrAlwaysAssert(GR_GL_RENDERBUFFER == target); |
| 379 GrRenderBufferObj* renderBuffer = this->getRenderBuffer(); |
| 380 GrAlwaysAssert(renderBuffer); |
| 381 renderBuffer->setNumSamples(1); |
| 382 } |
| 383 |
| 384 GrGLvoid renderbufferStorageMultisample(GrGLenum target, GrGLsizei samples, |
| 385 GrGLenum internalformat, GrGLsizei w
idth, |
| 386 GrGLsizei height) override { |
| 387 GrAlwaysAssert(GR_GL_RENDERBUFFER == target); |
| 388 GrRenderBufferObj* renderBuffer = this->getRenderBuffer(); |
| 389 GrAlwaysAssert(renderBuffer); |
| 390 renderBuffer->setNumSamples(samples); |
| 391 } |
| 392 |
| 393 GrGLvoid namedRenderbufferStorage(GrGLuint renderbuffer, GrGLenum GrGLintern
alformat, |
| 394 GrGLsizei width, GrGLsizei height) overrid
e { |
| 395 SK_ABORT("Not implemented"); |
| 396 } |
| 397 |
| 398 GrGLvoid namedRenderbufferStorageMultisample(GrGLuint renderbuffer, GrGLsize
i samples, |
| 399 GrGLenum GrGLinternalformat, Gr
GLsizei width, |
| 400 GrGLsizei height) override { |
| 401 SK_ABORT("Not implemented"); |
| 402 } |
| 403 |
| 376 GrGLvoid framebufferRenderbuffer(GrGLenum target, | 404 GrGLvoid framebufferRenderbuffer(GrGLenum target, |
| 377 GrGLenum attachment, | 405 GrGLenum attachment, |
| 378 GrGLenum renderbuffertarget, | 406 GrGLenum renderbuffertarget, |
| 379 GrGLuint renderBufferID) override { | 407 GrGLuint renderBufferID) override { |
| 380 | 408 |
| 381 GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); | 409 GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); |
| 382 GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || | 410 GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || |
| 383 GR_GL_DEPTH_ATTACHMENT == attachment || | 411 GR_GL_DEPTH_ATTACHMENT == attachment || |
| 384 GR_GL_STENCIL_ATTACHMENT == attachment); | 412 GR_GL_STENCIL_ATTACHMENT == attachment); |
| 385 GrAlwaysAssert(GR_GL_RENDERBUFFER == renderbuffertarget); | 413 GrAlwaysAssert(GR_GL_RENDERBUFFER == renderbuffertarget); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 403 case GR_GL_STENCIL_ATTACHMENT: | 431 case GR_GL_STENCIL_ATTACHMENT: |
| 404 framebuffer->setStencil(renderbuffer); | 432 framebuffer->setStencil(renderbuffer); |
| 405 break; | 433 break; |
| 406 default: | 434 default: |
| 407 GrAlwaysAssert(false); | 435 GrAlwaysAssert(false); |
| 408 break; | 436 break; |
| 409 }; | 437 }; |
| 410 | 438 |
| 411 } | 439 } |
| 412 | 440 |
| 441 GrGLvoid namedFramebufferRenderbuffer(GrGLuint framebuffer, GrGLenum attachm
ent, |
| 442 GrGLenum renderbuffertarget, |
| 443 GrGLuint renderbuffer) override { |
| 444 SK_ABORT("Not implemented"); |
| 445 } |
| 446 |
| 413 ////////////////////////////////////////////////////////////////////////////
//// | 447 ////////////////////////////////////////////////////////////////////////////
//// |
| 414 GrGLvoid framebufferTexture2D(GrGLenum target, GrGLenum attachment, GrGLenum
textarget, | 448 GrGLvoid framebufferTexture2D(GrGLenum target, GrGLenum attachment, GrGLenum
textarget, |
| 415 GrGLuint textureID, GrGLint level) override { | 449 GrGLuint textureID, GrGLint level) override { |
| 416 | 450 |
| 417 GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); | 451 GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); |
| 418 GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || | 452 GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || |
| 419 GR_GL_DEPTH_ATTACHMENT == attachment || | 453 GR_GL_DEPTH_ATTACHMENT == attachment || |
| 420 GR_GL_STENCIL_ATTACHMENT == attachment); | 454 GR_GL_STENCIL_ATTACHMENT == attachment); |
| 421 GrAlwaysAssert(GR_GL_TEXTURE_2D == textarget); | 455 GrAlwaysAssert(GR_GL_TEXTURE_2D == textarget); |
| 422 | 456 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 443 break; | 477 break; |
| 444 case GR_GL_STENCIL_ATTACHMENT: | 478 case GR_GL_STENCIL_ATTACHMENT: |
| 445 framebuffer->setStencil(texture); | 479 framebuffer->setStencil(texture); |
| 446 break; | 480 break; |
| 447 default: | 481 default: |
| 448 GrAlwaysAssert(false); | 482 GrAlwaysAssert(false); |
| 449 break; | 483 break; |
| 450 }; | 484 }; |
| 451 } | 485 } |
| 452 | 486 |
| 487 GrGLvoid framebufferTexture2DMultisample(GrGLenum target, GrGLenum attachmen
t, |
| 488 GrGLenum textarget, GrGLuint textur
e, GrGLint level, |
| 489 GrGLsizei samples) override { |
| 490 SK_ABORT("Not implemented"); |
| 491 } |
| 492 |
| 493 GrGLvoid namedFramebufferTexture1D(GrGLuint framebuffer, GrGLenum attachment
, |
| 494 GrGLenum textarget, GrGLuint texture, |
| 495 GrGLint level) override { |
| 496 SK_ABORT("Not implemented"); |
| 497 } |
| 498 |
| 499 GrGLvoid namedFramebufferTexture2D(GrGLuint framebuffer, GrGLenum attachment
, |
| 500 GrGLenum textarget, GrGLuint texture, |
| 501 GrGLint level) override { |
| 502 SK_ABORT("Not implemented"); |
| 503 } |
| 504 |
| 505 GrGLvoid namedFramebufferTexture3D(GrGLuint framebuffer, GrGLenum attachment
, |
| 506 GrGLenum textarget, GrGLuint texture, GrG
Lint level, |
| 507 GrGLint zoffset) override { |
| 508 SK_ABORT("Not implemented"); |
| 509 } |
| 510 |
| 453 GrGLuint createProgram() override { | 511 GrGLuint createProgram() override { |
| 454 | 512 |
| 455 GrProgramObj *program = CREATE(GrProgramObj, kProgram_ObjTypes); | 513 GrProgramObj *program = CREATE(GrProgramObj, kProgram_ObjTypes); |
| 456 | 514 |
| 457 return program->getID(); | 515 return program->getID(); |
| 458 } | 516 } |
| 459 | 517 |
| 460 GrGLuint createShader(GrGLenum type) override { | 518 GrGLuint createShader(GrGLenum type) override { |
| 461 | 519 |
| 462 GrAlwaysAssert(GR_GL_VERTEX_SHADER == type || | 520 GrAlwaysAssert(GR_GL_VERTEX_SHADER == type || |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 GrGLvoid getIntegerv(GrGLenum pname, GrGLint* params) override { | 581 GrGLvoid getIntegerv(GrGLenum pname, GrGLint* params) override { |
| 524 // TODO: remove from Ganesh the #defines for gets we don't use. | 582 // TODO: remove from Ganesh the #defines for gets we don't use. |
| 525 // We would like to minimize gets overall due to performance issues | 583 // We would like to minimize gets overall due to performance issues |
| 526 switch (pname) { | 584 switch (pname) { |
| 527 case GR_GL_CONTEXT_PROFILE_MASK: | 585 case GR_GL_CONTEXT_PROFILE_MASK: |
| 528 *params = GR_GL_CONTEXT_COMPATIBILITY_PROFILE_BIT; | 586 *params = GR_GL_CONTEXT_COMPATIBILITY_PROFILE_BIT; |
| 529 break; | 587 break; |
| 530 case GR_GL_STENCIL_BITS: | 588 case GR_GL_STENCIL_BITS: |
| 531 *params = 8; | 589 *params = 8; |
| 532 break; | 590 break; |
| 533 case GR_GL_SAMPLES: | 591 case GR_GL_SAMPLES: { |
| 534 *params = 1; | 592 GrFrameBufferObj* framebuffer = this->getFrameBuffer(); |
| 593 GrAlwaysAssert(framebuffer); |
| 594 int numSamples = 0; |
| 595 |
| 596 if (GrFBBindableObj* stencil = framebuffer->getStencil()) { |
| 597 numSamples = stencil->numSamples(); |
| 598 } |
| 599 if (GrFBBindableObj* depth = framebuffer->getDepth()) { |
| 600 GrAlwaysAssert(!numSamples || numSamples == depth->numSample
s()); |
| 601 numSamples = depth->numSamples(); |
| 602 } |
| 603 if (GrFBBindableObj* color = framebuffer->getColor()) { |
| 604 GrAlwaysAssert(!numSamples || numSamples == color->numSample
s()); |
| 605 numSamples = color->numSamples(); |
| 606 } |
| 607 GrAlwaysAssert(numSamples); |
| 608 *params = numSamples; |
| 535 break; | 609 break; |
| 610 } |
| 536 case GR_GL_FRAMEBUFFER_BINDING: | 611 case GR_GL_FRAMEBUFFER_BINDING: |
| 537 *params = 0; | 612 *params = 0; |
| 538 break; | 613 break; |
| 539 case GR_GL_VIEWPORT: | 614 case GR_GL_VIEWPORT: |
| 540 params[0] = 0; | 615 params[0] = 0; |
| 541 params[1] = 0; | 616 params[1] = 0; |
| 542 params[2] = 800; | 617 params[2] = 800; |
| 543 params[3] = 600; | 618 params[3] = 600; |
| 544 break; | 619 break; |
| 545 case GR_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: | 620 case GR_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 namespace sk_gpu_test { | 1210 namespace sk_gpu_test { |
| 1136 GLTestContext* CreateDebugGLTestContext() { | 1211 GLTestContext* CreateDebugGLTestContext() { |
| 1137 GLTestContext* ctx = new DebugGLContext(); | 1212 GLTestContext* ctx = new DebugGLContext(); |
| 1138 if (ctx->isValid()) { | 1213 if (ctx->isValid()) { |
| 1139 return ctx; | 1214 return ctx; |
| 1140 } | 1215 } |
| 1141 delete ctx; | 1216 delete ctx; |
| 1142 return nullptr; | 1217 return nullptr; |
| 1143 } | 1218 } |
| 1144 } | 1219 } |
| OLD | NEW |