File: shader_samples_identical.py

package info (click to toggle)
pyopengl 3.1.10%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,024 kB
  • sloc: python: 108,056; sh: 13; makefile: 8
file content (52 lines) | stat: -rw-r--r-- 2,134 bytes parent folder | download | duplicates (2)
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
52
'''OpenGL extension EXT.shader_samples_identical

This module customises the behaviour of the 
OpenGL.raw.GL.EXT.shader_samples_identical to provide a more 
Python-friendly API

Overview (from the spec)
	
	Multisampled antialiasing has become a common method for improving the
	quality of rendered images.  Multisampling differs from supersampling in
	that the color of a primitive that covers all or part of a pixel is
	resolved once, regardless of the number of samples covered.  If a large
	polygon is rendered, the colors of all samples in each interior pixel will
	be the same.  This suggests a simple compression scheme that can reduce
	the necessary memory bandwidth requirements.  In one such scheme, each
	sample is stored in a separate slice of the multisample surface.  An
	additional multisample control surface (MCS) contains a mapping from pixel
	samples to slices.
	
	If all the values stored in the MCS for a particular pixel are the same,
	then all the samples have the same value.  Applications can take advantage
	of this information to reduce the bandwidth of reading multisample
	textures.  A custom multisample resolve filter could optimize resolving
	pixels where every sample is identical by reading the color once.
	
	color = texelFetch(sampler, coordinate, 0);
	if (!textureSamplesIdenticalEXT(sampler, coordinate)) {
	    for (int i = 1; i < MAX_SAMPLES; i++) {
	        vec4 c = texelFetch(sampler, coordinate, i);
	
	        //... accumulate c into color
	
	    }
	}

The official definition of this extension is available here:
http://www.opengl.org/registry/specs/EXT/shader_samples_identical.txt
'''
from OpenGL import platform, constant, arrays
from OpenGL import extensions, wrapper
import ctypes
from OpenGL.raw.GL import _types, _glgets
from OpenGL.raw.GL.EXT.shader_samples_identical import *
from OpenGL.raw.GL.EXT.shader_samples_identical import _EXTENSION_NAME

def glInitShaderSamplesIdenticalEXT():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION