Lines Matching refs:ctx
637 void renderTo (sglr::Context& ctx, sglr::ShaderProgram& program, tcu::Surface& dst);
660 sglr::GLContext ctx (m_context.getRenderContext(), m_testCtx.getLog(), sglr::GLCONTEXT_LOG_CALLS | sglr::GLCONTEXT_LOG_PROGRAMS, tcu::IVec4(0, 0, renderTargetWidth, renderTargetHeight));
666 renderTo(ctx, program, surface);
677 void InstancedGridRenderTest::renderTo (sglr::Context& ctx, sglr::ShaderProgram& program, tcu::Surface& dst)
686 deUint32 programID = ctx.createProgram(&program);
687 deInt32 posLocation = ctx.getAttribLocation(programID, "a_position");
688 deInt32 offsetLocation = ctx.getAttribLocation(programID, "a_offset");
689 deInt32 colorLocation = ctx.getAttribLocation(programID, "a_color");
720 ctx.genBuffers(1, &positionBuf);
721 ctx.bindBuffer(GL_ARRAY_BUFFER, positionBuf);
722 ctx.bufferData(GL_ARRAY_BUFFER, sizeof(vertexPositions), vertexPositions, GL_STATIC_DRAW);
723 ctx.vertexAttribPointer(posLocation, 4, GL_FLOAT, GL_FALSE, 0, DE_NULL);
724 ctx.vertexAttribDivisor(posLocation, 0);
725 ctx.enableVertexAttribArray(posLocation);
727 ctx.genBuffers(1, &offsetBuf);
728 ctx.bindBuffer(GL_ARRAY_BUFFER, offsetBuf);
729 ctx.bufferData(GL_ARRAY_BUFFER, offsets.size() * sizeof(tcu::Vec4), &offsets[0], GL_STATIC_DRAW);
730 ctx.vertexAttribPointer(offsetLocation, 4, GL_FLOAT, GL_FALSE, 0, DE_NULL);
731 ctx.vertexAttribDivisor(offsetLocation, 1);
732 ctx.enableVertexAttribArray(offsetLocation);
734 ctx.genBuffers(1, &colorBuf);
735 ctx.bindBuffer(GL_ARRAY_BUFFER, colorBuf);
736 ctx.bufferData(GL_ARRAY_BUFFER, colors.size() * sizeof(tcu::Vec4), &colors[0], GL_STATIC_DRAW);
737 ctx.vertexAttribPointer(colorLocation, 4, GL_FLOAT, GL_FALSE, 0, DE_NULL);
738 ctx.vertexAttribDivisor(colorLocation, 1);
739 ctx.enableVertexAttribArray(colorLocation);
743 ctx.genBuffers(1, &indexBuf);
744 ctx.bindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuf);
745 ctx.bufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
748 ctx.clearColor(0, 0, 0, 1);
749 ctx.clear(GL_COLOR_BUFFER_BIT);
751 ctx.viewport(0, 0, dst.getWidth(), dst.getHeight());
753 ctx.useProgram(programID);
755 ctx.drawElementsInstanced(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, DE_NULL, m_gridSide * m_gridSide);
757 ctx.drawArraysInstanced(GL_TRIANGLES, 0, 6, m_gridSide * m_gridSide);
758 ctx.useProgram(0);
761 ctx.deleteBuffers(1, &indexBuf);
762 ctx.deleteBuffers(1, &colorBuf);
763 ctx.deleteBuffers(1, &offsetBuf);
764 ctx.deleteBuffers(1, &positionBuf);
765 ctx.deleteProgram(programID);
767 ctx.finish();
768 ctx.readPixels(dst, 0, 0, dst.getWidth(), dst.getHeight());
770 glu::checkError(ctx.getError(), "", __FILE__, __LINE__);