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 | |
404 GrGLvoid framebufferRenderbuffer(GrGLenum target, | 376 GrGLvoid framebufferRenderbuffer(GrGLenum target, |
405 GrGLenum attachment, | 377 GrGLenum attachment, |
406 GrGLenum renderbuffertarget, | 378 GrGLenum renderbuffertarget, |
407 GrGLuint renderBufferID) override { | 379 GrGLuint renderBufferID) override { |
408 | 380 |
409 GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); | 381 GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); |
410 GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || | 382 GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || |
411 GR_GL_DEPTH_ATTACHMENT == attachment || | 383 GR_GL_DEPTH_ATTACHMENT == attachment || |
412 GR_GL_STENCIL_ATTACHMENT == attachment); | 384 GR_GL_STENCIL_ATTACHMENT == attachment); |
413 GrAlwaysAssert(GR_GL_RENDERBUFFER == renderbuffertarget); | 385 GrAlwaysAssert(GR_GL_RENDERBUFFER == renderbuffertarget); |
(...skipping 17 matching lines...) Expand all Loading... |
431 case GR_GL_STENCIL_ATTACHMENT: | 403 case GR_GL_STENCIL_ATTACHMENT: |
432 framebuffer->setStencil(renderbuffer); | 404 framebuffer->setStencil(renderbuffer); |
433 break; | 405 break; |
434 default: | 406 default: |
435 GrAlwaysAssert(false); | 407 GrAlwaysAssert(false); |
436 break; | 408 break; |
437 }; | 409 }; |
438 | 410 |
439 } | 411 } |
440 | 412 |
441 GrGLvoid namedFramebufferRenderbuffer(GrGLuint framebuffer, GrGLenum attachm
ent, | |
442 GrGLenum renderbuffertarget, | |
443 GrGLuint renderbuffer) override { | |
444 SK_ABORT("Not implemented"); | |
445 } | |
446 | |
447 ////////////////////////////////////////////////////////////////////////////
//// | 413 ////////////////////////////////////////////////////////////////////////////
//// |
448 GrGLvoid framebufferTexture2D(GrGLenum target, GrGLenum attachment, GrGLenum
textarget, | 414 GrGLvoid framebufferTexture2D(GrGLenum target, GrGLenum attachment, GrGLenum
textarget, |
449 GrGLuint textureID, GrGLint level) override { | 415 GrGLuint textureID, GrGLint level) override { |
450 | 416 |
451 GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); | 417 GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); |
452 GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || | 418 GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || |
453 GR_GL_DEPTH_ATTACHMENT == attachment || | 419 GR_GL_DEPTH_ATTACHMENT == attachment || |
454 GR_GL_STENCIL_ATTACHMENT == attachment); | 420 GR_GL_STENCIL_ATTACHMENT == attachment); |
455 GrAlwaysAssert(GR_GL_TEXTURE_2D == textarget); | 421 GrAlwaysAssert(GR_GL_TEXTURE_2D == textarget); |
456 | 422 |
(...skipping 20 matching lines...) Expand all Loading... |
477 break; | 443 break; |
478 case GR_GL_STENCIL_ATTACHMENT: | 444 case GR_GL_STENCIL_ATTACHMENT: |
479 framebuffer->setStencil(texture); | 445 framebuffer->setStencil(texture); |
480 break; | 446 break; |
481 default: | 447 default: |
482 GrAlwaysAssert(false); | 448 GrAlwaysAssert(false); |
483 break; | 449 break; |
484 }; | 450 }; |
485 } | 451 } |
486 | 452 |
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 | |
511 GrGLuint createProgram() override { | 453 GrGLuint createProgram() override { |
512 | 454 |
513 GrProgramObj *program = CREATE(GrProgramObj, kProgram_ObjTypes); | 455 GrProgramObj *program = CREATE(GrProgramObj, kProgram_ObjTypes); |
514 | 456 |
515 return program->getID(); | 457 return program->getID(); |
516 } | 458 } |
517 | 459 |
518 GrGLuint createShader(GrGLenum type) override { | 460 GrGLuint createShader(GrGLenum type) override { |
519 | 461 |
520 GrAlwaysAssert(GR_GL_VERTEX_SHADER == type || | 462 GrAlwaysAssert(GR_GL_VERTEX_SHADER == type || |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 GrGLvoid getIntegerv(GrGLenum pname, GrGLint* params) override { | 523 GrGLvoid getIntegerv(GrGLenum pname, GrGLint* params) override { |
582 // TODO: remove from Ganesh the #defines for gets we don't use. | 524 // TODO: remove from Ganesh the #defines for gets we don't use. |
583 // We would like to minimize gets overall due to performance issues | 525 // We would like to minimize gets overall due to performance issues |
584 switch (pname) { | 526 switch (pname) { |
585 case GR_GL_CONTEXT_PROFILE_MASK: | 527 case GR_GL_CONTEXT_PROFILE_MASK: |
586 *params = GR_GL_CONTEXT_COMPATIBILITY_PROFILE_BIT; | 528 *params = GR_GL_CONTEXT_COMPATIBILITY_PROFILE_BIT; |
587 break; | 529 break; |
588 case GR_GL_STENCIL_BITS: | 530 case GR_GL_STENCIL_BITS: |
589 *params = 8; | 531 *params = 8; |
590 break; | 532 break; |
591 case GR_GL_SAMPLES: { | 533 case GR_GL_SAMPLES: |
592 GrFrameBufferObj* framebuffer = this->getFrameBuffer(); | 534 *params = 1; |
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; | |
609 break; | 535 break; |
610 } | |
611 case GR_GL_FRAMEBUFFER_BINDING: | 536 case GR_GL_FRAMEBUFFER_BINDING: |
612 *params = 0; | 537 *params = 0; |
613 break; | 538 break; |
614 case GR_GL_VIEWPORT: | 539 case GR_GL_VIEWPORT: |
615 params[0] = 0; | 540 params[0] = 0; |
616 params[1] = 0; | 541 params[1] = 0; |
617 params[2] = 800; | 542 params[2] = 800; |
618 params[3] = 600; | 543 params[3] = 600; |
619 break; | 544 break; |
620 case GR_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: | 545 case GR_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 namespace sk_gpu_test { | 1135 namespace sk_gpu_test { |
1211 GLTestContext* CreateDebugGLTestContext() { | 1136 GLTestContext* CreateDebugGLTestContext() { |
1212 GLTestContext* ctx = new DebugGLContext(); | 1137 GLTestContext* ctx = new DebugGLContext(); |
1213 if (ctx->isValid()) { | 1138 if (ctx->isValid()) { |
1214 return ctx; | 1139 return ctx; |
1215 } | 1140 } |
1216 delete ctx; | 1141 delete ctx; |
1217 return nullptr; | 1142 return nullptr; |
1218 } | 1143 } |
1219 } | 1144 } |
OLD | NEW |