This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int maxAASamplesConst; // gles2 img/apple/ext extensions all use different constants (facepalm) | |
int halfConst; // gles2 and gles3 have different constants for half float type | |
int texSRGBAConst; // gles2 (without 'internal format' ext) and gles3 have different constants for SRGB RGBA texture type | |
int texSRGBConst; // gles2 (without 'internal format' ext) and gles3 have different constants for SRGB RGB texture type | |
int etcFormatConst; // gles2/gles3 have different standard etc formats | |
bool isPvrGpu; | |
bool isMaliGpu; | |
bool isAdrenoGpu; | |
bool isTegraGpu; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; How to render a cube using a single 14-index triangle strip | |
; (Reposted from http://www.asmcommunity.net/forums/topic/?id=6284#post-45209) | |
; Drawbacks: no support for per-vertex normals, UVs, etc. | |
; | |
; 1-------3-------4-------2 Cube = 8 vertices | |
; | E __/|\__ A | H __/| ================= | |
; | __/ | \__ | __/ | Single Strip: 4 3 7 8 5 3 1 4 2 7 6 5 2 1 | |
; |/ D | B \|/ I | 12 triangles: A B C D E F G H I J K L | |
; 5-------8-------7-------6 | |
; | C __/| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Some shitty boolean logic code because WebGL... | |
bool and(int x, int y) | |
{ | |
return mod(float(x), exp2(float(y))) != 0.0; | |
} | |
int GetTriangleIndex(vec3 position) | |
{ | |
// TODO: Add integer arithmetic to simplify the boolean logic. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <mach/mach.h> | |
#include <mach/mach_vm.h> | |
#include <mach-o/dyld.h> | |
int | |
main (int argc, char * argv[]) | |
{ | |
volatile char * library; | |
const mach_vm_size_t page_size = getpagesize (); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE language SYSTEM "language.dtd"> | |
<!-- the version of this file shows the largest supported OpenGL version, second digit is the minor patch level (Y.XP = supports GLSL X.Y0 with patchlevel P --> | |
<language name="GLSL" section="Sources" extensions="*.glsl;*.vsh;*.vert;*.tcsh;*.tcs;*.tesh;*.tes;*.gsh;*.geo;*.geom;*.fsh;*.frag;*.csh;*.cs" mimetype="text/x-glslsrc" version="4.40" kateversion="2.4" author="Robert Menzel ([email protected])" license="LGPL"> | |
<highlighting> | |
<!-- ####################################################################################################### keywords --> | |
<list name="keywordsCompatibility"> | |
<!-- compatibility mode, older GLSL versions --> | |
<item>attribute</item> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Amend manifest to tell Windows that the application is DPI aware (needed for Windows 8.1 and up) | |
IF (MSVC) | |
IF (CMAKE_MAJOR_VERSION LESS 3) | |
MESSAGE(WARNING "CMake version 3.0 or newer is required use build variable TARGET_FILE") | |
ELSE() | |
ADD_CUSTOM_COMMAND( | |
TARGET ${TARGET_TARGETNAME} | |
POST_BUILD | |
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\dpiawarescaleing.manifest\" -inputresource:\"$<TARGET_FILE:${TARGET_TARGETNAME}>\"\;\#1 -outputresource:\"$<TARGET_FILE:${TARGET_TARGETNAME}>\"\;\#1 | |
COMMENT "Adding display aware manifest..." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <wrl/client.h> | |
#include <d3d11_1.h> | |
#include <agile.h> | |
#include <ppl.h> | |
#include <ppltasks.h> | |
using namespace Microsoft::WRL; | |
using namespace Windows::ApplicationModel; | |
using namespace Windows::ApplicationModel::Core; | |
using namespace Windows::ApplicationModel::Activation; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void check_for_leaks() | |
{ | |
GLuint max_id = 10000; // better idea would be to keep track of assigned names. | |
GLuint id; | |
// if brute force doesn't work, you're not applying it hard enough | |
for ( id = 1 ; id <= max_id ; id++ ) | |
{ | |
#define CHECK( type ) if ( glIs##type( id ) ) fprintf( stderr, "GLX: leaked " #type " handle 0x%x\n", (unsigned int) id ) | |
CHECK( Texture ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef SSVU_FASTFUNC | |
#define SSVU_FASTFUNC | |
#include <cstring> | |
#include <type_traits> | |
#include <cassert> | |
#include <cstddef> | |
#include <memory> | |
#include <new> | |
#include <utility> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |