Created
March 28, 2020 14:34
-
-
Save kig/c00cd7b3579a363eaa179090d6b9519a to your computer and use it in GitHub Desktop.
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
#define SPIRV_INLINE inline | |
struct int3 | |
{ | |
int x; | |
int y; | |
int z; | |
}; | |
struct float4 | |
{ | |
float x; | |
float y; | |
float z; | |
float w; | |
}; | |
static SPIRV_INLINE varying float4 float4_init(varying const float a ) { varying float4 ret = { a, a, a, a }; return ret; } | |
static SPIRV_INLINE varying float4 float4_init(varying const float a, varying const float b, varying const float c, varying const float d ) { varying float4 ret = { a, b, c, d }; return ret; } | |
#define float4(...) float4_init(__VA_ARGS__) | |
static SPIRV_INLINE varying float4 operator*(varying float4 a, varying float b) { varying float4 ret = { a.x * b , a.y * b , a.z * b , a.w * b }; return ret; } | |
static SPIRV_INLINE varying float4 operator*(varying float4 a, varying float4 b) { varying float4 ret = { a.x * b.x , a.y * b.y , a.z * b.z , a.w * b.w }; return ret; } | |
static SPIRV_INLINE varying float4 operator+(varying float4 a, varying float4 b) { varying float4 ret = { a.x + b.x , a.y + b.y , a.z + b.z , a.w + b.w }; return ret; } | |
static SPIRV_INLINE uniform int3 operator+(uniform int3 a, uniform int3 b) { uniform int3 ret = { a.x + b.x , a.y + b.y , a.z + b.z }; return ret; } | |
static SPIRV_INLINE varying int3 operator+(uniform int3 a, varying int3 b) { varying int3 ret = { a.x + b.x , a.y + b.y , a.z + b.z }; return ret; } | |
static SPIRV_INLINE varying int3 operator+(varying int3 a, uniform int3 b) { varying int3 ret = { a.x + b.x , a.y + b.y , a.z + b.z }; return ret; } | |
static SPIRV_INLINE varying int3 operator+(varying int3 a, varying int3 b) { varying int3 ret = { a.x + b.x , a.y + b.y , a.z + b.z }; return ret; } | |
static SPIRV_INLINE uniform int3 operator*(uniform int3 a, uniform int3 b) { uniform int3 ret = { a.x * b.x , a.y * b.y , a.z * b.z }; return ret; } | |
static SPIRV_INLINE varying int3 operator*(uniform int3 a, varying int3 b) { varying int3 ret = { a.x * b.x , a.y * b.y , a.z * b.z }; return ret; } | |
static SPIRV_INLINE varying int3 operator*(varying int3 a, uniform int3 b) { varying int3 ret = { a.x * b.x , a.y * b.y , a.z * b.z }; return ret; } | |
static SPIRV_INLINE varying int3 operator*(varying int3 a, varying int3 b) { varying int3 ret = { a.x * b.x , a.y * b.y , a.z * b.z }; return ret; } | |
static uniform int3 gl_WorkGroupSize = {4, 1, 1}; | |
struct inputs | |
{ | |
float data[]; | |
}; | |
struct outputs | |
{ | |
int imageData[]; | |
}; | |
static void program_ispc_main(uniform int3 gl_NumWorkGroups, uniform int3 gl_WorkGroupID, varying int3 gl_LocalInvocationID, varying int3 gl_GlobalInvocationID, varying int gl_LocalInvocationIndex, uniform struct inputs& v_167, uniform struct outputs& _682) | |
{ | |
varying float4 fragColor; | |
fragColor = float4(0.0f); | |
varying float rdz = 1.0f; | |
varying float rdy = 1.0f; | |
varying float rdx = 0.01f; | |
varying float roz = -10.0f; | |
varying float roy = 1.0f; | |
varying float rox = 1.0f; | |
for (varying int i = 0; i < 70; i++) | |
{ | |
varying float t = abs( roz - 15.0f - rox ); | |
roz = roz + (rdz * t); | |
roy = roy + (rdy * t); | |
rox = rox + (rdx * t); | |
if (gl_GlobalInvocationID.x*20 < i) | |
{ | |
fragColor = fragColor + float4(rox*0.1f, roy*0.1f, roz*0.1f, 1.0f) * float4((float)(i) / 70.0f); | |
break; | |
} | |
} | |
fragColor = fragColor * 255.0f; | |
print("%\n%\n%\n", fragColor.x, fragColor.y, fragColor.z); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment