* able to change other state.
*/
save->TransformFeedbackNeedsResume =
- ctx->TransformFeedback.CurrentObject->Active &&
- !ctx->TransformFeedback.CurrentObject->Paused;
+ _mesa_is_xfb_active_and_unpaused(ctx);
if (save->TransformFeedbackNeedsResume)
_mesa_PauseTransformFeedback();
#include "main/state.h"
#include "main/enums.h"
#include "main/macros.h"
+#include "main/transformfeedback.h"
#include "tnl/tnl.h"
#include "vbo/vbo_context.h"
#include "swrast/swrast.h"
= vbo_count_tessellated_primitives(prim->mode, prim->count,
prim->num_instances);
brw->sol.primitives_generated += count;
- if (brw->intel.ctx.TransformFeedback.CurrentObject->Active &&
- !brw->intel.ctx.TransformFeedback.CurrentObject->Paused) {
+ if (_mesa_is_xfb_active_and_unpaused(&brw->intel.ctx)) {
/* Update brw->sol.svbi_0_max_index to reflect the amount by which the
* hardware is going to increment SVBI 0 when this drawing operation
* occurs. This is necessary because the kernel does not (yet) save and
#include "main/glheader.h"
#include "main/macros.h"
#include "main/enums.h"
+#include "main/transformfeedback.h"
#include "intel_batchbuffer.h"
} else if (intel->gen == 6) {
/* On Gen6, GS is used for transform feedback. */
/* _NEW_TRANSFORM_FEEDBACK */
- if (ctx->TransformFeedback.CurrentObject->Active &&
- !ctx->TransformFeedback.CurrentObject->Paused) {
+ if (_mesa_is_xfb_active_and_unpaused(ctx)) {
const struct gl_shader_program *shaderprog =
ctx->Shader.CurrentVertexProgram;
const struct gl_transform_feedback_info *linked_xfb_info =
for (i = 0; i < BRW_MAX_SOL_BINDINGS; ++i) {
const int surf_index = SURF_INDEX_SOL_BINDING(i);
- if (xfb_obj->Active && !xfb_obj->Paused &&
+ if (_mesa_is_xfb_active_and_unpaused(ctx) &&
i < linked_xfb_info->NumOutputs) {
unsigned buffer = linked_xfb_info->Outputs[i].OutputBuffer;
unsigned buffer_offset =
#include "brw_defines.h"
#include "intel_batchbuffer.h"
#include "intel_buffer_objects.h"
+#include "main/transformfeedback.h"
static void
upload_3dstate_so_buffers(struct brw_context *brw)
struct intel_context *intel = &brw->intel;
struct gl_context *ctx = &intel->ctx;
/* _NEW_TRANSFORM_FEEDBACK */
- struct gl_transform_feedback_object *xfb_obj =
- ctx->TransformFeedback.CurrentObject;
- bool active = xfb_obj->Active && !xfb_obj->Paused;
+ bool active = _mesa_is_xfb_active_and_unpaused(ctx);
if (active) {
upload_3dstate_so_buffers(brw);
#include "mtypes.h"
#include "enums.h"
#include "vbo/vbo.h"
+#include "transformfeedback.h"
#include <stdbool.h>
* current transform feedback state as given by table X.1.
*
*/
- if (ctx->TransformFeedback.CurrentObject->Active &&
- !ctx->TransformFeedback.CurrentObject->Paused) {
+ if (_mesa_is_xfb_active_and_unpaused(ctx)) {
GLboolean pass = GL_TRUE;
switch (mode) {
GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
{
- struct gl_transform_feedback_object *xfb_obj
- = ctx->TransformFeedback.CurrentObject;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
* DrawElementsInstanced, and DrawRangeElements while transform feedback
* is active and not paused, regardless of mode.
*/
- if (_mesa_is_gles3(ctx) && xfb_obj->Active && !xfb_obj->Paused) {
+ if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawElements(transform feedback active)");
return GL_FALSE;
GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
{
- struct gl_transform_feedback_object *xfb_obj
- = ctx->TransformFeedback.CurrentObject;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
* DrawElementsInstanced, and DrawRangeElements while transform feedback
* is active and not paused, regardless of mode.
*/
- if (_mesa_is_gles3(ctx) && xfb_obj->Active && !xfb_obj->Paused) {
+ if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawElements(transform feedback active)");
return GL_FALSE;
* This is in contrast to the behaviour of desktop GL, where the extra
* primitives are silently dropped from the transform feedback buffer.
*/
- if (_mesa_is_gles3(ctx) && xfb_obj->Active && !xfb_obj->Paused) {
+ if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) {
size_t prim_count = vbo_count_tessellated_primitives(mode, count, 1);
if (xfb_obj->GlesRemainingPrims < prim_count) {
_mesa_error(ctx, GL_INVALID_OPERATION,
* This is in contrast to the behaviour of desktop GL, where the extra
* primitives are silently dropped from the transform feedback buffer.
*/
- if (_mesa_is_gles3(ctx) && xfb_obj->Active && !xfb_obj->Paused) {
+ if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) {
size_t prim_count
= vbo_count_tessellated_primitives(mode, count, numInstances);
if (xfb_obj->GlesRemainingPrims < prim_count) {
const GLvoid *indices, GLsizei numInstances,
GLint basevertex)
{
- struct gl_transform_feedback_object *xfb_obj
- = ctx->TransformFeedback.CurrentObject;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
* DrawElementsInstanced, and DrawRangeElements while transform feedback
* is active and not paused, regardless of mode.
*/
- if (_mesa_is_gles3(ctx) && xfb_obj->Active && !xfb_obj->Paused) {
+ if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawElements(transform feedback active)");
return GL_FALSE;
#include "main/mtypes.h"
#include "main/shaderapi.h"
#include "main/shaderobj.h"
+#include "main/transformfeedback.h"
#include "main/uniforms.h"
#include "program/program.h"
#include "program/prog_parameter.h"
{
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *shProg;
- struct gl_transform_feedback_object *obj =
- ctx->TransformFeedback.CurrentObject;
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (obj->Active && !obj->Paused) {
+ if (_mesa_is_xfb_active_and_unpaused(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glUseProgram(transform feedback active)");
return;
return;
}
- if (ctx->TransformFeedback.CurrentObject->Active &&
- !ctx->TransformFeedback.CurrentObject->Paused) {
+ if (_mesa_is_xfb_active_and_unpaused(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glUseShaderProgramEXT(transform feedback is active)");
return;
return;
}
- if (ctx->TransformFeedback.CurrentObject->Active &&
- !ctx->TransformFeedback.CurrentObject->Paused) {
+ if (_mesa_is_xfb_active_and_unpaused(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBindTransformFeedback(transform is active, or not paused)");
return;
obj = ctx->TransformFeedback.CurrentObject;
- if (!obj->Active || obj->Paused) {
+ if (!_mesa_is_xfb_active_and_unpaused(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glPauseTransformFeedback(feedback not active or already paused)");
return;
#ifndef TRANSFORM_FEEDBACK_H
#define TRANSFORM_FEEDBACK_H
+#include <stdbool.h>
#include "compiler.h"
#include "glheader.h"
#include "mfeatures.h"
+#include "mtypes.h"
struct _glapi_table;
struct dd_function_table;
extern void GLAPIENTRY
_mesa_ResumeTransformFeedback(void);
+static inline bool
+_mesa_is_xfb_active_and_unpaused(const struct gl_context *ctx)
+{
+ return ctx->TransformFeedback.CurrentObject->Active &&
+ !ctx->TransformFeedback.CurrentObject->Paused;
+}
+
#endif /* TRANSFORM_FEEDBACK_H */