Lines Matching refs:ctx

224 static void setRenderState (sglr::Context& ctx, const RenderState& state)
228 ctx.enable(GL_SCISSOR_TEST);
229 ctx.scissor(state.scissorRectangle.left, state.scissorRectangle.bottom,
233 ctx.disable(GL_SCISSOR_TEST);
237 ctx.enable(GL_STENCIL_TEST);
244 ctx.stencilFuncSeparate(glFace, sParams.function, sParams.reference, sParams.compareMask);
245 ctx.stencilOpSeparate(glFace, sParams.stencilFailOp, sParams.depthFailOp, sParams.depthPassOp);
246 ctx.stencilMaskSeparate(glFace, sParams.writeMask);
250 ctx.disable(GL_STENCIL_TEST);
254 ctx.enable(GL_DEPTH_TEST);
255 ctx.depthFunc(state.depthFunc);
256 ctx.depthMask(state.depthWriteMask ? GL_TRUE : GL_FALSE);
259 ctx.disable(GL_DEPTH_TEST);
263 ctx.enable(GL_BLEND);
264 ctx.blendEquationSeparate(state.blendRGBState.equation, state.blendAState.equation);
265 ctx.blendFuncSeparate(state.blendRGBState.srcFunc, state.blendRGBState.dstFunc, state.blendAState.srcFunc, state.blendAState.dstFunc);
266 ctx.blendColor(state.blendColor.x(), state.blendColor.y(), state.blendColor.z(), state.blendColor.w());
269 ctx.disable(GL_BLEND);
272 ctx.enable(GL_DITHER);
274 ctx.disable(GL_DITHER);
276 ctx.colorMask(state.colorMask[0] ? GL_TRUE : GL_FALSE,
282 static void renderQuad (sglr::Context& ctx, const glu::VertexArrayPointer& posPtr, const Quad& quad, const float depth)
301 ctx.viewport(viewportX, viewportY, viewportW, viewportH);
302 ctx.drawElements(GL_TRIANGLES, DE_LENGTH_OF_ARRAY(indices), GL_UNSIGNED_SHORT, &indices[0]);
305 static void render (sglr::Context& ctx, const glu::VertexArrayPointer& posPtr, const RenderCommand& cmd)
307 setRenderState(ctx, cmd.state);
308 renderQuad(ctx, posPtr, cmd.quad, cmd.depth);
311 static void setupAttributes (sglr::Context& ctx, const VertexDataStorage& vertexData, deUint32 program)
316 const int attribLoc = bindingPtr.binding.type == glu::BindingPoint::BPTYPE_NAME ? ctx.getAttribLocation(program, bindingPtr.binding.name.c_str()) : bindingPtr.binding.location;
322 ctx.enableVertexAttribArray(attribLoc);
323 ctx.vertexAttribPointer(attribLoc, bindingPtr.pointer.numComponents, GL_FLOAT, GL_FALSE, bindingPtr.pointer.stride, bindingPtr.pointer.data);
328 void setUniformValue (sglr::Context& ctx, int location, rsg::ConstValueAccess value)
338 case 1: ctx.uniform1fv(location, 1, (float*)value.value().getValuePtr()); break;
339 case 2: ctx.uniform2fv(location, 1, (float*)value.value().getValuePtr()); break;
340 case 3: ctx.uniform3fv(location, 1, (float*)value.value().getValuePtr()); break;
341 case 4: ctx.uniform4fv(location, 1, (float*)value.value().getValuePtr()); break;
352 case 1: ctx.uniform1iv(location, 1, (int*)value.value().getValuePtr()); break;
353 case 2: ctx.uniform2iv(location, 1, (int*)value.value().getValuePtr()); break;
354 case 3: ctx.uniform3iv(location, 1, (int*)value.value().getValuePtr()); break;
355 case 4: ctx.uniform4iv(location, 1, (int*)value.value().getValuePtr()); break;
584 sglr::Context& ctx = *contexts[ndx];
587 setupAttributes(ctx, vertexData, program);
589 ctx.disable (GL_SCISSOR_TEST);
590 ctx.colorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
591 ctx.depthMask (GL_TRUE);
592 ctx.stencilMask (~0u);
593 ctx.clearColor (clearColor.x(), clearColor.y(), clearColor.z(), clearColor.w());
594 ctx.clear (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
596 ctx.useProgram (program);
599 setUniformValue(ctx, ctx.getUniformLocation(program, uniformIter->getVariable()->getName()), uniformIter->getValue());
602 render(ctx, posPtr, *cmdIter);
604 GLU_EXPECT_NO_ERROR(ctx.getError(), "Rendering failed");
606 ctx.readPixels(0, 0, m_viewportSize.x(), m_viewportSize.y(), GL_RGBA, GL_UNSIGNED_BYTE, readDst[ndx].getDataPtr());