Lines Matching defs:ctx
132 std::string generateVertexShaderSource (NegativeTestContext& ctx)
134 const bool supportsES32 = contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
147 std::string generateFragmentShaderSource (NegativeTestContext& ctx, BlendEquation equation)
149 const bool supportsES32 = contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
165 glu::ProgramSources generateProgramSources (NegativeTestContext& ctx, BlendEquation equation)
168 << glu::VertexSource(generateVertexShaderSource(ctx))
169 << glu::FragmentSource(generateFragmentShaderSource(ctx, equation));
172 void blend_qualifier_mismatch (NegativeTestContext& ctx)
175 ctx.isExtensionSupported("GL_KHR_blend_equation_advanced") || contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)),
179 bool isES = glu::isContextTypeES(ctx.getRenderContext().getType());
182 ctx.glGenVertexArrays(1, &vao);
183 ctx.glBindVertexArray(vao);
186 ctx.beginSection("GL_INVALID_OPERATION is generated if blending is enabled, and the blend qualifier is different from blend_support_all_equations and does not match the blend equation.");
189 glu::ShaderProgram program(ctx.getRenderContext(), generateProgramSources(ctx, s_equations[ndx]));
191 ctx.getLog() << program;
194 ctx.glUseProgram(program.getProgram());
195 ctx.expectError(GL_NO_ERROR);
202 ctx.glEnable(GL_BLEND);
203 ctx.glBlendEquation(getEquation(s_equations[ndx2]));
204 ctx.expectError(GL_NO_ERROR);
205 ctx.glDrawElements(GL_TRIANGLES, 0, GL_UNSIGNED_INT, 0);
206 ctx.expectError(GL_INVALID_OPERATION);
208 ctx.glDisable(GL_BLEND);
209 ctx.glDrawElements(GL_TRIANGLES, 0, GL_UNSIGNED_INT, 0);
210 ctx.expectError(GL_NO_ERROR);
213 ctx.endSection();
216 ctx.glDeleteVertexArrays(1, &vao);
219 void attachment_advanced_equation (NegativeTestContext& ctx)
222 ctx.isExtensionSupported("GL_KHR_blend_equation_advanced") || contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)),
229 const bool isES = glu::isContextTypeES(ctx.getRenderContext().getType());
233 ctx.glGenVertexArrays(1, &vao);
234 ctx.glBindVertexArray(vao);
237 ctx.glGenTextures(1, &texture);
238 ctx.glBindTexture(GL_TEXTURE_2D, texture);
239 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
240 ctx.glGenFramebuffers(1, &fbo);
241 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
242 ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
243 ctx.expectError(GL_NO_ERROR);
244 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
246 ctx.beginSection("GL_INVALID_OPERATION is generated if blending is enabled, advanced equations are used, and the draw buffer for other color outputs is not NONE unless NVX_blend_equation_advanced_multi_draw_buffers is supported.");
249 glu::ShaderProgram program(ctx.getRenderContext(), generateProgramSources(ctx, s_equations[ndx]));
250 ctx.getLog() << program;
253 ctx.glUseProgram(program.getProgram());
254 ctx.glEnable(GL_BLEND);
255 ctx.glDrawBuffers(2, attachments);
256 ctx.expectError(GL_NO_ERROR);
257 ctx.glBlendEquation(getEquation(s_equations[ndx]));
258 ctx.glDrawElements(GL_TRIANGLES, 0, GL_UNSIGNED_INT, 0);
259 if (ctx.isExtensionSupported("GL_NVX_blend_equation_advanced_multi_draw_buffers"))
260 ctx.expectError(GL_NO_ERROR);
262 ctx.expectError(GL_INVALID_OPERATION);
264 ctx.endSection();
266 ctx.beginSection("GL_NO_ERROR is generated if no advanced blend equations are used.");
267 ctx.glBlendEquation(GL_FUNC_ADD);
268 ctx.glDrawElements(GL_TRIANGLES, 0, GL_UNSIGNED_INT, 0);
269 ctx.expectError(GL_NO_ERROR);
270 ctx.endSection();
272 ctx.beginSection("GL_NO_ERROR is generated if blending is disabled.");
273 ctx.glDisable(GL_BLEND);
276 ctx.glBlendEquation(getEquation(s_equations[ndx]));
277 ctx.glDrawElements(GL_TRIANGLES, 0, GL_UNSIGNED_INT, 0);
278 ctx.expectError(GL_NO_ERROR);
280 ctx.endSection();
283 ctx.glDeleteVertexArrays(1, &vao);
285 ctx.glDeleteFramebuffers(1, &fbo);
286 ctx.glDeleteTextures(1, &texture);