Lines Matching defs:context
140 Framebuffer (sglr::Context& context, const FboConfig& config, int width, int height, deUint32 fbo = 0, deUint32 colorBuffer = 0, deUint32 depthStencilBuffer = 0);
193 static bool isExtensionSupported (sglr::Context& context, const char* name)
195 std::istringstream extensions(context.getString(GL_EXTENSIONS));
207 static bool isAnyExtensionSupported (sglr::Context& context, const std::vector<std::string>& requiredExts)
216 if (isExtensionSupported(context, extension.c_str()))
238 static void checkColorFormatSupport (sglr::Context& context, deUint32 sizedFormat)
242 if (!isAnyExtensionSupported(context, requiredExts))
251 Framebuffer::Framebuffer (sglr::Context& context, const FboConfig& config, int width, int height, deUint32 fbo, deUint32 colorBufferName, deUint32 depthStencilBufferName)
253 , m_context (context)
259 checkColorFormatSupport(context, config.colorFormat);
262 context.genFramebuffers(1, &m_framebuffer);
263 context.bindFramebuffer(GL_FRAMEBUFFER, m_framebuffer);
271 context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_colorBuffer, 0);
276 context.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_colorBuffer);
305 case GL_TEXTURE_2D: context.framebufferTexture2D(GL_FRAMEBUFFER, point, GL_TEXTURE_2D, m_depthStencilBuffer, 0); break;
306 case GL_RENDERBUFFER: context.framebufferRenderbuffer(GL_FRAMEBUFFER, point, GL_RENDERBUFFER, m_depthStencilBuffer); break;
316 context.bindFramebuffer(GL_FRAMEBUFFER, 0);
377 static void createMetaballsTex2D (sglr::Context& context, deUint32 name, GLenum format, GLenum dataType, int width, int height)
384 context.bindTexture(GL_TEXTURE_2D, name);
385 context.texImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, dataType, level.getAccess().getDataPtr());
386 context.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
389 static void createQuadsTex2D (sglr::Context& context, deUint32 name, GLenum format, GLenum dataType, int width, int height)
396 context.bindTexture(GL_TEXTURE_2D, name);
397 context.texImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, dataType, level.getAccess().getDataPtr());
398 context.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
404 FboRenderCase (Context& context, const char* name, const char* description, const FboConfig& config);
416 FboRenderCase::FboRenderCase (Context& context, const char* name, const char* description, const FboConfig& config)
417 : TestCase (context, name, description)
430 // Position & size for context
449 sglr::GLContext context(renderCtx, log, sglr::GLCONTEXT_LOG_CALLS, tcu::IVec4(x, y, width, height));
451 context.clearColor(clearColor.x(), clearColor.y(), clearColor.z(), clearColor.w());
452 context.clear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
454 render(context, gles3Frame); // Call actual render func
455 gles3Error = context.getError();
473 sglr::ReferenceContext context (sglr::ReferenceContextLimits(renderCtx), buffers.getColorbuffer(), buffers.getDepthbuffer(), buffers.getStencilbuffer());
475 context.clearColor(clearColor.x(), clearColor.y(), clearColor.z(), clearColor.w());
476 context.clear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
478 render(context, refFrame);
479 refError = context.getError();
518 StencilClearsTest (Context& context, const FboConfig& config);
521 void render (sglr::Context& context, Surface& dst);
524 StencilClearsTest::StencilClearsTest (Context& context, const FboConfig& config)
525 : FboRenderCase (context, config.getName().c_str(), "Stencil clears", config)
529 void StencilClearsTest::render (sglr::Context& context, Surface& dst)
541 deUint32 texToFboShaderID = context.createProgram(&texToFboShader);
542 deUint32 texFromFboShaderID = context.createProgram(&texFromFboShader);
552 createQuadsTex2D(context, quadsTex, GL_RGBA, GL_UNSIGNED_BYTE, width, height);
553 createMetaballsTex2D(context, metaballsTex, GL_RGBA, GL_UNSIGNED_BYTE, width, height);
555 Framebuffer fbo(context, m_config, width, height);
559 context.bindFramebuffer(GL_FRAMEBUFFER, fbo.getFramebuffer());
560 context.viewport(0, 0, width, height);
561 context.clearColor(0.0f, 0.0f, 0.0f, 1.0f);
562 context.clear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
565 context.enable(GL_SCISSOR_TEST);
566 context.scissor(10, 16, 32, 120);
567 context.clearStencil(1);
568 context.clear(GL_STENCIL_BUFFER_BIT);
569 context.scissor(16, 32, 100, 64);
570 context.clearStencil(2);
571 context.clear(GL_STENCIL_BUFFER_BIT);
572 context.disable(GL_SCISSOR_TEST);
575 context.enable(GL_STENCIL_TEST);
577 context.bindTexture(GL_TEXTURE_2D, quadsTex);
578 context.stencilFunc(GL_EQUAL, 1, 0xffu);
580 texToFboShader.setUniforms(context, texToFboShaderID);
581 sglr::drawQuad(context, texToFboShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(+1.0f, +1.0f, 0.0f));
583 context.bindTexture(GL_TEXTURE_2D, metaballsTex);
584 context.stencilFunc(GL_EQUAL, 2, 0xffu);
586 texToFboShader.setUniforms(context, texToFboShaderID);
587 sglr::drawQuad(context, texToFboShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(+1.0f, +1.0f, 0.0f));
589 context.disable(GL_STENCIL_TEST);
593 context.bindFramebuffer(GL_FRAMEBUFFER, 0);
594 context.bindTexture(GL_TEXTURE_2D, fbo.getColorBuffer());
595 context.viewport(0, 0, context.getWidth(), context.getHeight());
597 texFromFboShader.setUniforms(context, texFromFboShaderID);
598 sglr::drawQuad(context, texFromFboShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
600 context.readPixels(dst, 0, 0, context.getWidth(), context.getHeight());
603 readPixels(context, dst, 0, 0, width, height, colorFormat, fboRangeInfo.lookupScale, fboRangeInfo.lookupBias);
609 SharedColorbufferTest (Context& context, const FboConfig& config);
612 void render (sglr::Context& context, Surface& dst);
615 SharedColorbufferTest::SharedColorbufferTest (Context& context, const FboConfig& config)
616 : FboRenderCase (context, config.getName().c_str(), "Shared colorbuffer", config)
620 void SharedColorbufferTest::render (sglr::Context& context, Surface& dst)
624 deUint32 texShaderID = context.createProgram(&texShader);
625 deUint32 flatShaderID = context.createProgram(&flatShader);
633 context.disable(GL_DITHER);
636 createQuadsTex2D(context, quadsTex, GL_RGB, GL_UNSIGNED_BYTE, 64, 64);
637 createMetaballsTex2D(context, metaballsTex, GL_RGBA, GL_UNSIGNED_BYTE, 64, 64);
639 context.viewport(0, 0, width, height);
642 Framebuffer fboA(context, m_config, width, height);
650 Framebuffer fboB(context, cfg, width, height);
653 context.bindFramebuffer(GL_FRAMEBUFFER, fboB.getFramebuffer());
657 context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fboA.getColorBuffer(), 0);
661 context.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, fboA.getColorBuffer());
669 context.clear(GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
672 context.bindFramebuffer(GL_FRAMEBUFFER, fboA.getFramebuffer());
673 context.bindTexture(GL_TEXTURE_2D, quadsTex);
674 context.clearColor(0.0f, 0.0f, 0.0f, 1.0f);
675 context.clear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
680 context.clearStencil(1);
681 context.clear(GL_STENCIL_BUFFER_BIT);
684 texShader.setUniforms(context, texShaderID);
686 context.enable(GL_DEPTH_TEST);
687 sglr::drawQuad(context, texShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
688 context.disable(GL_DEPTH_TEST);
691 context.bindFramebuffer(GL_FRAMEBUFFER, fboB.getFramebuffer());
692 context.bindTexture(GL_TEXTURE_2D, metaballsTex);
693 context.enable(GL_BLEND);
694 context.blendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE);
695 sglr::drawQuad(context, texShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
698 context.bindTexture(GL_TEXTURE_2D, quadsTex);
699 context.enable(GL_DEPTH_TEST);
700 sglr::drawQuad(context, texShaderID, Vec3(0.5f, 0.5f, 0.5f), Vec3(1.0f, 1.0f, 0.5f));
701 context.disable(GL_DEPTH_TEST);
705 flatShader.setColor(context, flatShaderID, Vec4(0.0f, 1.0f, 0.0f, 1.0f));
708 context.enable(GL_SCISSOR_TEST);
709 context.scissor(10, 10, 12, 25);
710 context.clearStencil(1);
711 context.clear(GL_STENCIL_BUFFER_BIT);
712 context.disable(GL_SCISSOR_TEST);
715 context.enable(GL_STENCIL_TEST);
716 context.stencilFunc(GL_EQUAL, 1, 0xffu);
717 sglr::drawQuad(context, flatShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
718 context.disable(GL_STENCIL_TEST);
724 texShader.setUniforms(context, texShaderID);
726 context.bindFramebuffer(GL_FRAMEBUFFER, 0);
727 context.bindTexture(GL_TEXTURE_2D, fboA.getColorBuffer());
728 context.viewport(0, 0, context.getWidth(), context.getHeight());
729 sglr::drawQuad(context, texShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
730 context.readPixels(dst, 0, 0, context.getWidth(), context.getHeight());
733 readPixels(context, dst, 0, 0, width, height, glu::mapGLInternalFormat(fboA.getConfig().colorFormat), Vec4(1.0f), Vec4(0.0f));
739 SharedColorbufferClearsTest (Context& context, const FboConfig& config);
742 void render (sglr::Context& context, Surface& dst);
745 SharedColorbufferClearsTest::SharedColorbufferClearsTest (Context& context, const FboConfig& config)
746 : FboRenderCase (context, config.getName().c_str(), "Shared colorbuffer clears", config)
750 void SharedColorbufferClearsTest::render (sglr::Context& context, Surface& dst)
759 checkColorFormatSupport(context, m_config.colorFormat);
764 context.bindTexture(GL_TEXTURE_2D, colorbuffer);
765 context.texImage2D(GL_TEXTURE_2D, 0, m_config.colorFormat, width, height);
766 context.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
767 context.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
772 context.bindRenderbuffer(GL_RENDERBUFFER, colorbuffer);
773 context.renderbufferStorage(GL_RENDERBUFFER, m_config.colorFormat, width, height);
779 context.bindFramebuffer(GL_FRAMEBUFFER, fbo);
782 context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorbuffer, 0);
784 context.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorbuffer);
787 context.bindFramebuffer(GL_FRAMEBUFFER, 1);
791 GLenum status = context.checkFramebufferStatus(GL_FRAMEBUFFER);
797 context.viewport(0, 0, width, height);
798 context.clearColor(0.0f, 0.0f, 1.0f, 1.0f);
799 context.clear(GL_COLOR_BUFFER_BIT);
801 context.enable(GL_SCISSOR_TEST);
803 context.bindFramebuffer(GL_FRAMEBUFFER, 2);
804 context.clearColor(0.6f, 0.0f, 0.0f, 1.0f);
805 context.scissor(10, 10, 64, 64);
806 context.clear(GL_COLOR_BUFFER_BIT);
807 context.clearColor(0.0f, 0.6f, 0.0f, 1.0f);
808 context.scissor(60, 60, 40, 20);
809 context.clear(GL_COLOR_BUFFER_BIT);
811 context.bindFramebuffer(GL_FRAMEBUFFER, 3);
812 context.clearColor(0.0f, 0.0f, 0.6f, 1.0f);
813 context.scissor(20, 20, 100, 10);
814 context.clear(GL_COLOR_BUFFER_BIT);
816 context.bindFramebuffer(GL_FRAMEBUFFER, 1);
817 context.clearColor(0.6f, 0.0f, 0.6f, 1.0f);
818 context.scissor(20, 20, 5, 100);
819 context.clear(GL_COLOR_BUFFER_BIT);
821 context.disable(GL_SCISSOR_TEST);
826 deUint32 shaderID = context.createProgram(&shader);
828 shader.setUniforms(context, shaderID);
830 context.bindFramebuffer(GL_FRAMEBUFFER, 0);
831 context.viewport(0, 0, context.getWidth(), context.getHeight());
832 sglr::drawQuad(context, shaderID, Vec3(-0.9f, -0.9f, 0.0f), Vec3(0.9f, 0.9f, 0.0f));
833 context.readPixels(dst, 0, 0, context.getWidth(), context.getHeight());
836 readPixels(context, dst, 0, 0, width, height, colorFormat, Vec4(1.0f), Vec4(0.0f));
842 SharedDepthStencilTest (Context& context, const FboConfig& config);
846 void render (sglr::Context& context, Surface& dst);
849 SharedDepthStencilTest::SharedDepthStencilTest (Context& context, const FboConfig& config)
850 : FboRenderCase (context, config.getName().c_str(), "Shared depth/stencilbuffer", config)
859 void SharedDepthStencilTest::render (sglr::Context& context, Surface& dst)
863 deUint32 texShaderID = context.createProgram(&texShader);
864 deUint32 flatShaderID = context.createProgram(&flatShader);
873 createMetaballsTex2D(context, metaballsTex, GL_RGB, GL_UNSIGNED_BYTE, 64, 64);
874 createQuadsTex2D(context, quadsTex, GL_RGB, GL_UNSIGNED_BYTE, 64, 64);
876 context.viewport(0, 0, width, height);
879 Framebuffer fboA(context, m_config, width, height);
887 Framebuffer fboB(context, cfg, width, height);
890 context.bindFramebuffer(GL_FRAMEBUFFER, fboB.getFramebuffer());
901 case GL_TEXTURE_2D: context.framebufferTexture2D(GL_FRAMEBUFFER, point, GL_TEXTURE_2D, fboA.getDepthStencilBuffer(), 0); break;
902 case GL_RENDERBUFFER: context.framebufferRenderbuffer(GL_FRAMEBUFFER, point, GL_RENDERBUFFER, fboA.getDepthStencilBuffer()); break;
909 texShader.setUniforms(context, texShaderID);
912 context.clearColor(1.0f, 0.0f, 0.0f, 1.0f);
913 context.clearStencil(1);
914 context.clear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
916 context.enable(GL_DEPTH_TEST);
919 context.bindFramebuffer(GL_FRAMEBUFFER, fboA.getFramebuffer());
920 context.bindTexture(GL_TEXTURE_2D, quadsTex);
921 sglr::drawQuad(context, texShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
926 context.enable(GL_SCISSOR_TEST);
927 context.scissor(10, 10, 12, 25);
928 context.clearStencil(0);
929 context.clear(GL_STENCIL_BUFFER_BIT);
930 context.disable(GL_SCISSOR_TEST);
934 context.bindFramebuffer(GL_FRAMEBUFFER, fboB.getFramebuffer());
935 context.bindTexture(GL_TEXTURE_2D, metaballsTex);
936 sglr::drawQuad(context, texShaderID, Vec3(-1.0f, -1.0f, -1.0f), Vec3(1.0f, 1.0f, 1.0f));
938 context.disable(GL_DEPTH_TEST);
943 context.enable(GL_STENCIL_TEST);
944 context.stencilFunc(GL_EQUAL, 0, 0xffu);
945 context.useProgram(flatShaderID);
946 flatShader.setColor(context, flatShaderID, Vec4(0.0f, 1.0f, 0.0f, 1.0f));
947 sglr::drawQuad(context, flatShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(+1.0f, +1.0f, 0.0f));
948 context.disable(GL_STENCIL_TEST);
954 context.bindFramebuffer(GL_FRAMEBUFFER, 0);
955 context.viewport(0, 0, context.getWidth(), context.getHeight());
956 context.bindTexture(GL_TEXTURE_2D, fboA.getColorBuffer());
957 sglr::drawQuad(context, texShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(0.0f, 1.0f, 0.0f));
958 context.bindTexture(GL_TEXTURE_2D, fboB.getColorBuffer());
959 sglr::drawQuad(context, texShaderID, Vec3(0.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
961 context.readPixels(dst, 0, 0, context.getWidth(), context.getHeight());
966 readPixels(context, dst, 0, 0, width, height, glu::mapGLInternalFormat(m_config.colorFormat), Vec4(1.0f), Vec4(0.0f));
974 TexSubImageAfterRenderTest (Context& context, const FboConfig& config);
977 void render (sglr::Context& context, Surface& dst);
980 TexSubImageAfterRenderTest::TexSubImageAfterRenderTest (Context& context, const FboConfig& config)
981 : FboRenderCase(context, (string("after_render_") + config.getName()).c_str(), "TexSubImage after rendering to texture", config)
985 void TexSubImageAfterRenderTest::render (sglr::Context& context, Surface& dst)
998 context.bindTexture(GL_TEXTURE_2D, fourQuadsTex);
999 context.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1000 context.texImage2D(GL_TEXTURE_2D, 0, GL_RGB, fourQuads);
1002 context.bindFramebuffer(GL_FRAMEBUFFER, 1);
1005 context.bindTexture(GL_TEXTURE_2D, fboTex);
1006 context.texImage2D(GL_TEXTURE_2D, 0, isRGBA ? GL_RGBA : GL_RGB, 128, 128);
1007 context.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1008 context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fboTex, 0);
1011 context.viewport(0, 0, 128, 128);
1012 context.bindTexture(GL_TEXTURE_2D, fourQuadsTex);
1013 context.draw(TexturedQuadOp(-1.0f, -1.0f, 1.0f, 1.0f, 0));
1016 context.bindTexture(GL_TEXTURE_2D, fboTex);
1017 context.texSubImage2D(GL_TEXTURE_2D, 0, 32, 32, metaballs);
1020 context.bindFramebuffer(GL_FRAMEBUFFER, 0);
1021 context.viewport(0, 0, context.getWidth(), context.getHeight());
1022 context.draw(TexturedQuadOp(-1.0f, -1.0f, 1.0f, 1.0f, 0));
1023 context.readPixels(dst, 0, 0, context.getWidth(), context.getHeight());
1029 TexSubImageBetweenRenderTest (Context& context, const FboConfig& config);
1032 void render (sglr::Context& context, Surface& dst);
1035 TexSubImageBetweenRenderTest::TexSubImageBetweenRenderTest (Context& context, const FboConfig& config)
1036 : FboRenderCase(context, (string("between_render_") + config.getName()).c_str(), "TexSubImage between rendering calls", config)
1040 void TexSubImageBetweenRenderTest::render (sglr::Context& context, Surface& dst)
1057 context.bindTexture(GL_TEXTURE_2D, metaballsTex);
1058 context.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1059 context.texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, metaballs2);
1062 context.bindTexture(GL_TEXTURE_2D, fourQuadsTex);
1063 context.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1064 context.texImage2D(GL_TEXTURE_2D, 0, GL_RGB, fourQuads);
1066 context.bindFramebuffer(GL_FRAMEBUFFER, 1);
1069 context.bindTexture(GL_TEXTURE_2D, fboTex);
1070 context.texImage2D(GL_TEXTURE_2D, 0, isRGBA ? GL_RGBA : GL_RGB, 128, 128);
1071 context.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1072 context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fboTex, 0);
1075 context.viewport(0, 0, 128, 128);
1076 context.bindTexture(GL_TEXTURE_2D, fourQuadsTex);
1077 context.draw(TexturedQuadOp(-1.0f, -1.0f, 1.0f, 1.0f, 0));
1080 context.bindTexture(GL_TEXTURE_2D, fboTex);
1081 context.texSubImage2D(GL_TEXTURE_2D, 0, 32, 32, metaballs);
1084 context.bindTexture(GL_TEXTURE_2D, metaballsTex);
1085 context.draw(BlendTextureOp(0));
1088 context.bindFramebuffer(GL_FRAMEBUFFER, 0);
1089 context.viewport(0, 0, context.getWidth(), context.getHeight());
1090 context.bindTexture(GL_TEXTURE_2D, fboTex);
1091 context.draw(TexturedQuadOp(-1.0f, -1.0f, 1.0f, 1.0f, 0));
1093 context.readPixels(dst, 0, 0, context.getWidth(), context.getHeight());
1100 ResizeTest (Context& context, const FboConfig& config);
1103 void render (sglr::Context& context, Surface& dst);
1106 ResizeTest::ResizeTest (Context& context, const FboConfig& config)
1107 : FboRenderCase (context, config.getName().c_str(), "Resize framebuffer", config)
1111 void ResizeTest::render (sglr::Context& context, Surface& dst)
1123 deUint32 texToFboShaderID = context.createProgram(&texToFboShader);
1124 deUint32 texFromFboShaderID = context.createProgram(&texFromFboShader);
1125 deUint32 flatShaderID = context.createProgram(&flatShader);
1139 createQuadsTex2D(context, quadsTex, GL_RGB, GL_UNSIGNED_BYTE, 64, 64);
1140 createMetaballsTex2D(context, metaballsTex, GL_RGB, GL_UNSIGNED_BYTE, 32, 32);
1142 Framebuffer fbo(context, m_config, initialWidth, initialHeight);
1146 texToFboShader.setUniforms (context, texToFboShaderID);
1147 texFromFboShader.setUniforms(context, texFromFboShaderID);
1148 flatShader.setColor (context, flatShaderID, Vec4(0.0f, 1.0f, 0.0f, 1.0f) * fboOutScale + fboOutBias);
1151 context.bindFramebuffer(GL_FRAMEBUFFER, fbo.getFramebuffer());
1152 context.viewport(0, 0, initialWidth, initialHeight);
1153 clearColorBuffer(context, colorFormat, tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
1154 context.clear(GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
1155 context.bindTexture(GL_TEXTURE_2D, quadsTex);
1156 sglr::drawQuad(context, texToFboShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
1161 context.bindFramebuffer(GL_FRAMEBUFFER, 0);
1162 context.viewport(0, 0, context.getWidth(), context.getHeight());
1163 context.bindTexture(GL_TEXTURE_2D, fbo.getColorBuffer());
1164 sglr::drawQuad(context, texFromFboShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
1167 context.bindFramebuffer(GL_FRAMEBUFFER, fbo.getFramebuffer());
1174 context.bindTexture(GL_TEXTURE_2D, fbo.getColorBuffer());
1175 context.texImage2D(GL_TEXTURE_2D, 0, fbo.getConfig().colorFormat, newWidth, newHeight);
1179 context.bindRenderbuffer(GL_RENDERBUFFER, fbo.getColorBuffer());
1180 context.renderbufferStorage(GL_RENDERBUFFER, fbo.getConfig().colorFormat, newWidth, newHeight);
1192 context.bindTexture(GL_TEXTURE_2D, fbo.getDepthStencilBuffer());
1193 context.texImage2D(GL_TEXTURE_2D, 0, fbo.getConfig().depthStencilFormat, newWidth, newHeight);
1197 context.bindRenderbuffer(GL_RENDERBUFFER, fbo.getDepthStencilBuffer());
1198 context.renderbufferStorage(GL_RENDERBUFFER, fbo.getConfig().depthStencilFormat, newWidth, newHeight);
1207 context.viewport(0, 0, newWidth, newHeight);
1208 clearColorBuffer(context, colorFormat, tcu::Vec4(1.0f, 0.0f, 0.0f, 1.0f));
1209 context.clear(GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
1211 context.enable(GL_DEPTH_TEST);
1213 context.bindTexture(GL_TEXTURE_2D, metaballsTex);
1214 sglr::drawQuad(context, texToFboShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(+1.0f, +1.0f, 0.0f));
1216 context.bindTexture(GL_TEXTURE_2D, quadsTex);
1217 sglr::drawQuad(context, texToFboShaderID, Vec3(0.0f, 0.0f, -1.0f), Vec3(+1.0f, +1.0f, 1.0f));
1219 context.disable(GL_DEPTH_TEST);
1223 context.enable(GL_SCISSOR_TEST);
1224 context.clearStencil(1);
1225 context.scissor(10, 10, 5, 15);
1226 context.clear(GL_STENCIL_BUFFER_BIT);
1227 context.disable(GL_SCISSOR_TEST);
1229 context.enable(GL_STENCIL_TEST);
1230 context.stencilFunc(GL_EQUAL, 1, 0xffu);
1231 sglr::drawQuad(context, flatShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(+1.0f, +1.0f, 0.0f));
1232 context.disable(GL_STENCIL_TEST);
1237 context.bindFramebuffer(GL_FRAMEBUFFER, 0);
1238 context.viewport(0, 0, context.getWidth(), context.getHeight());
1239 context.bindTexture(GL_TEXTURE_2D, fbo.getColorBuffer());
1240 sglr::drawQuad(context, texFromFboShaderID, Vec3(-0.5f, -0.5f, 0.0f), Vec3(0.5f, 0.5f, 0.0f));
1241 context.readPixels(dst, 0, 0, context.getWidth(), context.getHeight());
1244 readPixels(context, dst, 0, 0, newWidth, newHeight, colorFormat, fboRangeInfo.lookupScale, fboRangeInfo.lookupBias);
1250 RecreateBuffersTest (Context& context, const FboConfig& config, deUint32 buffers, bool rebind);
1253 void render (sglr::Context& context, Surface& dst);
1260 RecreateBuffersTest::RecreateBuffersTest (Context& context, const FboConfig& config, deUint32 buffers, bool rebind)
1261 : FboRenderCase (context, (string(config.getName()) + (rebind ? "" : "_no_rebind")).c_str(), "Recreate buffers", config)
1450 FboRenderTestGroup::FboRenderTestGroup (Context& context)
1451 : TestCaseGroup(context, "render", "Rendering Tests")