summaryrefslogtreecommitdiffstats
path: root/src/VBox/GuestHost/OpenGL/state_tracker/state_multisample.c
blob: 3b7dba5b8da73a78f3635ce1b13387264a02ebf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* Copyright (c) 2001, Stanford University
 * All rights reserved
 *
 * See the file LICENSE.txt for information on redistributing this software.
 */

#include <stdio.h>
#include "state.h"
#include "state/cr_statetypes.h"
#include "state_internals.h"

void crStateMultisampleInit (CRContext *ctx)
{
	CRMultisampleState *m = &ctx->multisample;
	CRStateBits *sb       = GetCurrentBits();
	CRMultisampleBits *mb = &(sb->multisample);

	m->enabled = GL_FALSE; /* TRUE if the visual supports it */
	m->sampleAlphaToCoverage = GL_FALSE;
	m->sampleAlphaToOne = GL_FALSE;
	m->sampleCoverage = GL_FALSE;
	RESET(mb->enable, ctx->bitid);

	m->sampleCoverageValue = 1.0F;
	m->sampleCoverageInvert = GL_FALSE;
	RESET(mb->sampleCoverageValue, ctx->bitid);

	RESET(mb->dirty, ctx->bitid);
}

void STATE_APIENTRY crStateSampleCoverageARB(GLclampf value, GLboolean invert)
{
	CRContext *g          = GetCurrentContext();
	CRMultisampleState *m = &(g->multisample);
	CRStateBits *sb       = GetCurrentBits();
	CRMultisampleBits *mb = &(sb->multisample);

	if (g->current.inBeginEnd)
	{
		crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glStateSampleCoverageARB called in begin/end");
		return;
	}

	FLUSH();

	m->sampleCoverageValue = value;
	m->sampleCoverageInvert = invert;
	DIRTY(mb->dirty, g->neg_bitid);
	DIRTY(mb->sampleCoverageValue, g->neg_bitid);
}