An elaboration on Minimal D3D11 pt2, adding shadowmapping and incorporating various improvements and alternative approaches to the rendering setup, such as manual vertex fetching, samplerless texture lookup, null shader depth map rendering and procedurally generated texture and [instance data](https://gist.github.com/d7samurai/abab8a580d0298cb2f34a44eec41d39d#file-shader
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
| #pragma once | |
| // uncompressed png writer & reader | |
| // supports only 8-bit and 16-bit formats | |
| // Performance comparison for 8192x8192 BGRA8 image (256MB) | |
| // Compiled with "clang -O2", AVX2 requires extra "-mavx2" or "/arch:AVX2" argument | |
| // | |
| // For libpng (compressed) uses default libpng/zlib compression settings | |
| // For libpng (uncompressed) case following two functions are used: |
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 <stdio.h> | |
| #include <stdlib.h> | |
| #include <stdbool.h> | |
| #include <stdint.h> | |
| #include <limits.h> | |
| #include <sys/types.h> | |
| #include <sys/stat.h> | |
| #include <fcntl.h> |
Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.
There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.
1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]
struct foo {
struct bar {
int x;
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
| curl -s https://api.github.com/users/milanboers/repos | grep \"clone_url\" | awk '{print $2}' | sed -e 's/"//g' -e 's/,//g' | xargs -n1 git clone |
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
| target remote 127.0.0.1:1234 | |
| layout asm | |
| focus cmd | |
| file main.elf | |
| break *_start | |
| continue |
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
| /* ======================================================================== | |
| $File: tools/ctime/ctime.c $ | |
| $Date: 2016/05/08 04:16:55PM $ | |
| $Revision: 7 $ | |
| $Creator: Casey Muratori $ | |
| $Notice: | |
| The author of this software MAKES NO WARRANTY as to the RELIABILITY, | |
| SUITABILITY, or USABILITY of this software. USE IT AT YOUR OWN RISK. |
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
| /* ======================================================================== | |
| $File: tools/ctime/ctime.c $ | |
| $Date: 2016/05/08 04:16:55PM $ | |
| $Revision: 7 $ | |
| $Creator: Casey Muratori $ | |
| $Notice: | |
| The author of this software MAKES NO WARRANTY as to the RELIABILITY, | |
| SUITABILITY, or USABILITY of this software. USE IT AT YOUR OWN RISK. |
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
| ;example program using debouncing | |
| ;from AVR Programming by Elliot Williams p.115 | |
| ; | |
| ;compile with gavrasm debouncer.asm | |
| ;flash with avrdude -c avrisp -p m168 -P /dev/tty.usbmodem1411 -b 19200 -U flash:w:debouncer.hex | |
| ; | |
| .def temp = r16 | |
| .device atmega168 | |
| ;--- inits --- | |
| .def b_pressed = r17 |
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 <string.h> | |
| void *__memcpy_glibc_2_2_5(void *, const void *, size_t); | |
| asm(".symver __memcpy_glibc_2_2_5, memcpy@GLIBC_2.2.5"); | |
| void *__wrap_memcpy(void *dest, const void *src, size_t n) | |
| { | |
| return __memcpy_glibc_2_2_5(dest, src, n); | |
| } |
NewerOlder
