kode / krafix Goto Github PK
View Code? Open in Web Editor NEWGLSL cross-compiler based on glslang and SPIRV-Cross
License: zlib License
GLSL cross-compiler based on glslang and SPIRV-Cross
License: zlib License
Minimal GLSL example:
#version 450
uniform sampler2D gbuffer0;
uniform samplerCubeShadow shadowMapPoint[4];
out vec4 fragColor;
vec3 sampleLight() {
vec3 direct = vec3(1);
direct *= texture(shadowMapPoint[0], vec4(1.0, 1.0, 1.0, 0.5));
direct *= texture(shadowMapPoint[1], vec4(1.0, 1.0, 1.0, 0.5));
direct *= texture(shadowMapPoint[2], vec4(1.0, 1.0, 1.0, 0.5));
direct *= texture(shadowMapPoint[3], vec4(1.0, 1.0, 1.0, 0.5));
return direct;
}
void main() {
fragColor.rgb = vec3(1.0);
fragColor.r = texture(gbuffer0, vec2(0.0, 0.0)).x;
// (1)
// fragColor.rgb *= texture(shadowMapPoint[0], vec4(1.0, 1.0, 1.0, 0.5));
// fragColor.rgb *= texture(shadowMapPoint[1], vec4(1.0, 1.0, 1.0, 0.5));
// fragColor.rgb *= texture(shadowMapPoint[2], vec4(1.0, 1.0, 1.0, 0.5));
// fragColor.rgb *= texture(shadowMapPoint[3], vec4(1.0, 1.0, 1.0, 0.5));
// (2)
fragColor.rgb += sampleLight();
}
Krafix call + console output (make sure to create a temp
folder):
λ "[...]\krafix.exe" d3d11 deferred_light.frag.glsl deferred_light.frag.d3d11.temp ./temp krom --version 330 --debug
#shader:fragment
#uniform:shadowMapPoint:samplerCubeShadow[]
#output:fragColor:vec4
#uniform:gbuffer0:sampler2D
[...]\deferred_light.frag.hlsl(4,14-30): error X4500: overlapping register semantics not yet implemented 's1'
[...]\deferred_light.frag.hlsl(3,19-26): error X4500: overlapping register semantics not yet implemented 't1'
If you comment out (2) and use (1) instead, no error happens. In case of (2), the generated HLSL file puts the shadowMap declaration above the gbuffer declaration which is not the case for (1):
TextureCube<float4> shadowMapPoint[4] : register(t0);
SamplerComparisonState _shadowMapPoint_sampler[4] : register(s0);
Texture2D<float4> gbuffer0 : register(t1); // <--- this should probably be t4?
SamplerState _gbuffer0_sampler : register(s1); // s4?
This issue originally came up in armory3d/armory#1772 and is reported quite often by users. If you know any workarounds please let me know :) I'm afraid we can't just move the first reference to the uniforms since the original shader is 2000+ lines generated from multiple includes, so it would get really messy trying to ensure the correct order.
May be related to #66, it could be a regression.
If you try to translate this fragment:
vec4 c1 = texture2D( tex, texCoord);
vec4 finalColor=vec4( c1.x, c1.y, c1.z, c1.w);
gl_FragColor = finalColor;
you get this agal code:
mov ft0, v0
tex ft0, ft0, fs0 <2d, wrap, linear>
mov ft0, ft0
mov ft1, ft0.w
mov ft1, ft1
mov ft2, ft0.w
mov ft2, ft2
mov ft3, ft0.w
mov ft3, ft3
mov ft0, ft0.w
mov ft0, ft0
mov ft1.x, ft1.x
mov ft1.y, ft2.y
mov ft1.z, ft3.z
mov ft1.w, ft0.w
mov ft0, ft1
mov ft0, ft0
mov oc, ft0
clearly the output shoul write mov ft1, ft0.x mov ft2, ft0.y etc, instead.
I found that the op that generates thoues lines is OpAccessChain
In my test the problem is that indexName expects a number between 0 and 3, and if its bigger than 3 it just returns "w".
I made the code work by changing indexName to
const char* indexName(unsigned index) {
switch (index) {
case 0:
return "x";
case 1:
return "y";
case 2:
return "z";
case 22:
return "x";
case 26:
return "y";
case 29:
return "z";
case 3:
default:
return "w";
}
}
I cant figure out why inst.operands[3] has those values. In another example I have other values like 58,61,64,67.
Any help would be greate! thanks
Perhaps as an optional flag when calling krafix.
https://github.com/KhronosGroup/SPIRV-Tools#optimizer
When i use https://registry.khronos.org/OpenGL-Refpages/gl4/html/textureSize.xhtml in a shader, krafix writes a 0 bytes file but it shows no error.
#version 450
in vec2 f_uv;
uniform sampler2D u_msdf;
uniform vec4 u_background_color;
uniform vec4 u_foreground_color;
uniform float u_px_range;
out vec4 FragColor;
float median( float r, float g, float b ) {
return max(min(r, g), min(max(r, g), b));
}
float screen_px_range() {
// vec2 unit_range = vec2(u_px_range) / vec2(textureSize(u_msdf, 0));
vec2 unit_range = vec2(1.0, 1.0);
vec2 screen_tex_size = vec2(1.0) / fwidth(f_uv);
return max(0.5 * dot(unit_range, screen_tex_size), 1.0);
}
void main() {
vec3 msd = texture(u_msdf, f_uv).rgb;
float sd = median(msd.r, msd.g, msd.b);
float screen_px_distance = screen_px_range() * (sd - 0.5);
float opacity = clamp(screen_px_distance + 0.5, 0.0, 1.0);
FragColor = mix(u_background_color, u_foreground_color, opacity);
}
Executing a program using the generated glsl shaders fails with the following error.
GLSL compiler error: 0:4(1): error: no precision specified this scope for type `vec2'
GLSL linker error: error: linking with uncompiled shader
A quick solution is to change #version 100
e.g. to #version 110
in both shaders.
Source glsl:
#version 450
uniform vec3 A;
uniform vec3 B;
uniform vec3 C;
uniform vec3 D;
uniform vec3 E;
uniform vec3 F;
uniform vec3 G;
uniform vec3 H;
uniform vec3 I;
uniform vec3 Z;
uniform vec3 hosekSunDirection;
out vec4 fragColor;
vec3 hosekWilkie(float cos_theta, float gamma, float cos_gamma) {
// Accessing uniforms here...
vec3 chi = (1 + cos_gamma * cos_gamma) / pow(1 + H * H - 2 * cos_gamma * H, vec3(1.5));
return (1 + A * exp(B / (cos_theta + 0.01))) * (C + D * exp(E * gamma) + F * (cos_gamma * cos_gamma) + G * chi + I * sqrt(cos_theta));
}
void main() {
vec3 n = vec3(1.0, 0.0, 0.0);
float cos_theta = clamp(n.z, 0.0, 1.0);
float cos_gamma = dot(n, hosekSunDirection);
float gamma_val = acos(cos_gamma);
fragColor.rgb = Z * hosekWilkie(cos_theta, gamma_val, cos_gamma);
}
Output metal:
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct world_pass_frag_main_uniforms
{
float3 A;
float3 B;
float3 C;
float3 D;
float3 E;
float3 F;
float3 G;
float3 H;
float3 I;
float3 Z;
float3 hosekSunDirection;
};
struct world_pass_frag_main_out
{
float4 fragColor [[color(0)]];
};
static inline __attribute__((always_inline))
float3 hosekWilkie(thread const float& cos_theta, thread const float& gamma, thread const float& cos_gamma, thread float3 H, thread float3 A, thread float3 B, thread float3 C, thread float3 D, thread float3 E, thread float3 F, thread float3 G, thread float3 I)
{
float3 chi = float3(1.0 + (cos_gamma * cos_gamma)) / pow((float3(1.0) + (H * H)) - (H * (2.0 * cos_gamma)), float3(1.5));
return (float3(1.0) + (A * exp(B / float3(cos_theta + 0.00999999977648258209228515625)))) * ((((C + (D * exp(E * gamma))) + (F * (cos_gamma * cos_gamma))) + (G * chi)) + (I * sqrt(cos_theta)));
}
fragment world_pass_frag_main_out world_pass_frag_main(constant world_pass_frag_main_uniforms& uniforms [[buffer(0)]])
{
world_pass_frag_main_out out = {};
float3 n = float3(1.0, 0.0, 0.0);
float cos_theta = fast::clamp(n.z, 0.0, 1.0);
float cos_gamma = dot(n, uniforms.hosekSunDirection);
float gamma_val = acos(cos_gamma);
float param = cos_theta;
float param_1 = gamma_val;
float param_2 = cos_gamma;
// Error: generates 'uniforms.uniforms.H' instead of 'uniforms.H' for the 'hosekWilkie' call
float3 _136 = (uniforms.Z * hosekWilkie(param, param_1, param_2, uniforms.uniforms.H, uniforms.uniforms.A, uniforms.uniforms.B, uniforms.uniforms.C, uniforms.uniforms.D, uniforms.uniforms.E, uniforms.uniforms.F, uniforms.uniforms.G, uniforms.uniforms.I));
out.fragColor = float4(_136.x, _136.y, _136.z, out.fragColor.w);
return out;
}
math.glsl:
#ifndef _MATH_GLSL_
#define _MATH_GLSL_
float attenuate(const float dist) {
return 1.0 / (dist * dist);
}
#endif
Material.frag.metal:
float attenuate(thread const float& dist)
{
return 1.0 / (dist * dist);
}
fragment Material_frag_main_out Material_frag_main(Material_frag_main_in in [[stage_in]], constant Material_frag_main_uniforms& uniforms [[buffer(0)]])
{
//...
}
Material_001.frag.metal:
float attenuate(thread const float& dist)
{
return 1.0 / (dist * dist);
}
fragment Material_001_frag_main_out Material_001_frag_main(Material_001_frag_main_in in [[stage_in]], constant Material_001_frag_main_uniforms& uniforms [[buffer(0)]])
{
//...
}
Metal Linker Error: metallib: multiple symbols ('_Z9attenuateRKf')!
Perhaps we need to prefix included functions with Material_001_
as well?
Example shader which triggers slow compiling:
#version 450
uniform sampler2D gbufferD;
in vec3 viewRay;
out vec4 fragColor;
vec3 hitCoord;
float getDeltaDepth(vec3 hitCoord) {
return texture(gbufferD, hitCoord.xy).r - hitCoord.z;
}
vec4 binarySearch(vec3 dir) {
for (int i = 0; i < 20; i++) {
hitCoord -= dir;
if (getDeltaDepth(hitCoord) < 0.0) hitCoord += dir;
}
return vec4(1.0);
}
vec4 rayCast(vec3 dir) {
for (int i = 0; i < 20; i++) {
hitCoord += dir;
if (getDeltaDepth(hitCoord) > 0.0) return binarySearch(dir);
}
return vec4(0.0);
}
void main() {
fragColor = rayCast(viewRay);
}
.d3d11
size is 67KB (grows with the amount of loops)#version 450
uniform sampler2D gbufferD;
in vec3 viewRay;
out vec4 fragColor;
vec3 hitCoord;
float getDeltaDepth(vec3 hitCoord) {
// return texture(gbufferD, hitCoord.xy).r - hitCoord.z;
return hitCoord.x - hitCoord.z; // <--- HERE
}
vec4 binarySearch(vec3 dir) {
for (int i = 0; i < 20; i++) {
hitCoord -= dir;
if (getDeltaDepth(hitCoord) < 0.0) hitCoord += dir;
}
return vec4(1.0);
}
vec4 rayCast(vec3 dir) {
for (int i = 0; i < 20; i++) {
hitCoord += dir;
if (getDeltaDepth(hitCoord) > 0.0) return binarySearch(dir);
}
return vec4(0.0);
}
void main() {
fragColor = rayCast(viewRay);
}
.d3d11
size is 1KBIf this is related to loop unrolling, do we have a way to prevent that for fast debug builds?
Ends up being undetected at https://github.com/Kode/krafix/blob/master/Sources/SpirVTranslator.cpp#L239.
Hi!
I'm not sure if this is desired/needed or something that went unnoticed, but appears that now Kha apps can't be build in Linux systems with a glibc version less than 2.29:
Compiling shader 1 of 8 (painter-colored.frag.glsl).
.../Kinc/Tools/krafix/krafix-linux64: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by .../Kinc/Tools/krafix/krafix-linux64)
Compiling shader 1 of 8 (painter-colored.frag.glsl) failed:
Shader compiler error.
Looks to me that this can be the reason, since this was working to me until today → 7f8fced .
To be clear, I'm not saying this should be changed back nor anything like that — but I would appreciate some feedback to know if I should update my system or if this is really an unwanted dependency change that went unnoticed.
for example
layout (binding = 0, rgba32f) uniform writeonly image2D destTex;
layout (binding = 1, rgba32f) uniform readonly image2D sourceTex;
becomes to
kernel void test_comp_main(texture2d<float, access::read> sourceTex [[texture(0)]], texture2d<float, access::write> destTex [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
there are two texture(0)'s
When using krafix as a library, this line throws an error because from
is NULL
:
Line 1060 in b8038e6
the shader thats throwing the error is this
`
attribute vec2 vertexPosition;
attribute vec2 texPosition;
uniform mat4 projectionMatrix;
varying vec2 texCoord;
varying vec2 texCoordMask;
void kore() {
vec4 pos = projectionMatrix*vec4(vertexPosition.xy,0.0, 1.0) ;
texCoord = texPosition;
vec2 v_texCoordMask= vec2((1.0 + pos.x)*0.5,(1.0 + pos.y)*0.5);
texCoordMask=v_texCoordMask;
gl_Position=pos;
}`
simpleMask.vert.hlsl(62,34): error X3004: undeclared identifier 'posv_'
simpleMask.vert.hlsl(62,34): error X3004: undeclared identifier 'posv_'
The following shader
#version 450
in vec3 pos;
in vec2 uv;
in vec4 col;
out vec2 frag_uv;
uniform mat4 m[4];
void main() {
gl_Position = m[gl_InstanceID] * vec4(pos, 1.0f);
frag_uv = uv;
}
results in the following error:
Vulkan ERROR: Code 7060244 : Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x55a824ad8180, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: The result pointer storage class and base pointer storage class in OpAccessChain do not match.
%25 = OpAccessChain %_ptr_UniformConstant_mat4v4float %59 %23
and if I remove the array access it gives:
Vulkan ERROR: Code 7060244 : Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x55ae7ee40290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: Structure id 43 decorated as Block must be explicitly laid out with ArrayStride decorations.
%_k_global_uniform_buffer_type = OpTypeStruct %_arr_mat4v4float_uint_4
Source glsl:
#version 450
uniform sampler2D senvmapBrdf;
uniform sampler2D senvmapRadiance;
out vec4 fragColor;
void main() {
vec4 a = texture(senvmapBrdf, vec2(0.0, 0.0));
vec4 b = texture(senvmapRadiance, vec2(0.0, 0.0));
fragColor = a + b;
}
Output metal:
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Material_mesh_frag_main_uniforms
{
// ...
};
struct Material_mesh_frag_main_out
{
float4 fragColor_0 [[color(0)]];
};
// Error: both textures are tagged as [[texture(0)]]
// Error: both samplers are tagged as [[sampler(0)]]
// Cannot reserve 'texture' resource location at index 0
fragment Material_mesh_frag_main_out Material_mesh_frag_main(constant Material_mesh_frag_main_uniforms& uniforms [[buffer(0)]], texture2d<float> senvmapRadiance [[texture(0)]], texture2d<float> senvmapBrdf [[texture(0)]], sampler senvmapBrdfSmplr [[sampler(0)]], sampler senvmapRadianceSmplr [[sampler(0)]])
{
// ...
}
From @romamik on August 13, 2016 14:20
Render code:
var projection = FastMatrix4.orthogonalProjection( -framebuffer.width / 4, framebuffer.width / 4, framebuffer.height / 4, -framebuffer.height / 4, 0.1, 1000);
var model = FastMatrix4.rotation(0, angle * Math.PI / 180, 0).multmat(FastMatrix4.translation( -50, -50, 0));
var matrix = projection.multmat(model);
var g4 = framebuffer.g4;
g4.begin();
g4.clear(Color.Black);
g4.setVertexBuffer(vertexBuffer);
g4.setIndexBuffer(indexBuffer);
g4.setPipeline(shaderPipeline);
g4.setTexture(textureLocation, Assets.images.bitmap);
g4.setMatrix(projectionLocation, matrix);
g4.setTextureParameters(textureLocation, TextureAddressing.Clamp, TextureAddressing.Clamp, TextureFilter.LinearFilter, TextureFilter.LinearFilter, MipMapFilter.NoMipFilter);
g4.drawIndexedVertices(0, 6);
g4.setTexture(textureLocation, null);
g4.end();
And in flash for angles from 90 to 270 my picture dissappears. I also tested in windows and HTML5 and it's ok. I'm using shaders used by Graphics2.
Manually applying the same matrix and setting shader matrix to identity makes it work...
Example project: matrixWTF.zip
Copied from original issue: Kode/Kha#375
Trying to set the gl_ViewportIndex
in a geometry shader compiles fine, however in the resulting .glsl file gl_ViewportIndex
is replaced by gl_BuiltIn_10
. Is this SPIRV-Cross at fault, or are we missing something in Krafix?
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/gl_ViewportIndex.xhtml
It looks like after the 2ff05b4 only a black screen shows up when running https://github.com/Kinc-Samples/Texture-Kinc on Linux + Vulkan.
I built krafix to test the alignment fix 340300f, but now i get: Error compiling to SPIR-V: Optimizer error
in another shader.
#version 450
in float sampler_index;
in vec2 uv;
in vec4 col;
uniform sampler2D u_sampler[8];
out vec4 FragColor;
void main() {
vec4 color;
if (sampler_index < 0.5) {
color = texture(u_sampler[0], uv);
} else if (sampler_index < 1.5) {
color = texture(u_sampler[1], uv);
} else if (sampler_index < 2.5) {
color = texture(u_sampler[2], uv);
} else if (sampler_index < 3.5) {
color = texture(u_sampler[3], uv);
} else if (sampler_index < 4.5) {
color = texture(u_sampler[4], uv);
} else if (sampler_index < 5.5) {
color = texture(u_sampler[5], uv);
} else if (sampler_index < 6.5) {
color = texture(u_sampler[6], uv);
} else {
color = texture(u_sampler[7], uv);
}
color *= col;
FragColor = color;
}
Hi,
I have just found this repository. It looks like something that I could use. Currently we only support essl shaders, but I would like to add support to our engine (which is based on bgfx) for metal shaders, vulkan spir-v and d3d9. From what I see this lib could be used for this.
My plans are to compile shader source to spir-v(possible using khronos' compiler), than do some modification (constant specialication then dead code removal), then convert this shaders to metalsl, d3d9 and opengl shaders.
Is these possible with your lib?
Anyway, I think It would be great to have some info (readme file) about the goal of this project, how-to-use description, current state of the project.
Thanks
Constant size/offset is capped to one byte. This prevents setting bigger arrays exceeding the size of 255.
In Kore constant.offset and constant.size are also defined as u8:
https://github.com/Kode/Kore/blob/master/Backends/Graphics4/Direct3D11/Sources/Kore/ShaderImpl.cpp#L46
Problem
Generating a mat4
in glsl and translating it to SPIR-V leads to a wrong result.
How to reproduce
I made a repo that reproduces the issue here:
Expected result
Additional info
When running it using Vulkan I get the following validation errors:
Vulkan ERROR: Code 7060244 : Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x55555aed8490, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: Entry-point has conflicting output location assignment at location 1, component 0
OpEntryPoint Vertex %4 "main" %142 %148 %vertex_position %160 %vertex_uv %gl_VertexIndex %gl_InstanceID
and
Vulkan ERROR: Code 7060244 : Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x55555aed8490, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: Entry-point has conflicting input location assignment at location 1, component 0
OpEntryPoint Fragment %4 "main" %sg_mat4 %uv %99
Not sure if this is on purpose, using gl_VertexID
worked at ea222cd but now it assets when calling vkCreateGraphicsPipelines
.
Noting this down until I investigate further.
Does not work:
#version 450
uniform vec4 test;
out vec4 fragColor;
void main() {
fragColor = vec4(test.x, 0.0, 0.0, 0.0);
}
// spirv-dis output
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 8
; Bound: 25
; Schema: 4
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %fragColor
OpExecutionMode %main OriginLowerLeft
OpName %_k_global_uniform_buffer_type "_k_global_uniform_buffer_type"
OpName %_k_global_uniform_buffer "_k_global_uniform_buffer"
OpMemberName %_k_global_uniform_buffer_type 0 "test"
OpSource GLSL 450
OpName %main "main"
OpName %fragColor "fragColor"
OpName %test "test"
OpDecorate %fragColor Location 0
OpMemberDecorate %_k_global_uniform_buffer_type 0 Offset 0
OpDecorate %_k_global_uniform_buffer_type Block
OpDecorate %_k_global_uniform_buffer_type Binding 1
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%fragColor = OpVariable %_ptr_Output_v4float Output
%_ptr_UniformConstant_v4float = OpTypePointer UniformConstant %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_UniformConstant_float = OpTypePointer UniformConstant %float
%float_0 = OpConstant %float 0
%_k_global_uniform_buffer_type = OpTypeStruct %v4float
%_ptr_Uniform__k_global_uniform_buffer_type = OpTypePointer Uniform %_k_global_uniform_buffer_type
%_k_global_uniform_buffer = OpVariable %_ptr_Uniform__k_global_uniform_buffer_type Uniform
%uint_0_0 = OpConstant %uint 0
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%main = OpFunction %void None %3
%5 = OpLabel
%15 = OpAccessChain %_ptr_UniformConstant_float %test %uint_0
%16 = OpLoad %float %15
%18 = OpCompositeConstruct %v4float %16 %float_0 %float_0 %float_0
OpStore %fragColor %18
OpReturn
OpFunctionEnd
// spirv-cross output
SPIRV-Cross threw an exception: Cannot resolve expression type.
Does work:
#version 450
uniform vec4 test;
out vec4 fragColor;
void main() {
vec4 testLocal = test;
fragColor = vec4(testLocal.x, 0.0, 0.0, 0.0);
}
// spirv-dis output
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 8
; Bound: 29
; Schema: 4
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %fragColor
OpExecutionMode %main OriginLowerLeft
OpName %_k_global_uniform_buffer_type "_k_global_uniform_buffer_type"
OpName %_k_global_uniform_buffer "_k_global_uniform_buffer"
OpMemberName %_k_global_uniform_buffer_type 0 "test"
OpSource GLSL 450
OpName %main "main"
OpName %testLocal "testLocal"
OpName %test "test"
OpName %fragColor "fragColor"
OpDecorate %fragColor Location 0
OpMemberDecorate %_k_global_uniform_buffer_type 0 Offset 0
OpDecorate %_k_global_uniform_buffer_type Block
OpDecorate %_k_global_uniform_buffer_type Binding 1
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_UniformConstant_v4float = OpTypePointer UniformConstant %v4float
%_ptr_Output_v4float = OpTypePointer Output %v4float
%fragColor = OpVariable %_ptr_Output_v4float Output
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Function_float = OpTypePointer Function %float
%float_0 = OpConstant %float 0
%_k_global_uniform_buffer_type = OpTypeStruct %v4float
%_ptr_Uniform__k_global_uniform_buffer_type = OpTypePointer Uniform %_k_global_uniform_buffer_type
%_k_global_uniform_buffer = OpVariable %_ptr_Uniform__k_global_uniform_buffer_type Uniform
%uint_0_0 = OpConstant %uint 0
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%main = OpFunction %void None %3
%5 = OpLabel
%testLocal = OpVariable %_ptr_Function_v4float Function
%27 = OpAccessChain %_ptr_Uniform_v4float %_k_global_uniform_buffer %uint_0_0
%12 = OpLoad %v4float %27
OpStore %testLocal %12
%18 = OpAccessChain %_ptr_Function_float %testLocal %uint_0
%19 = OpLoad %float %18
%21 = OpCompositeConstruct %v4float %19 %float_0 %float_0 %float_0
OpStore %fragColor %21
OpReturn
OpFunctionEnd
// spirv-cross output
#version 450
layout(std140) uniform _k_global_uniform_buffer_type
{
vec4 test;
} _k_global_uniform_buffer;
layout(location = 0) out vec4 fragColor;
void main()
{
vec4 testLocal = _k_global_uniform_buffer.test;
fragColor = vec4(testLocal.x, 0.0, 0.0, 0.0);
}
Will try to take a look myself.
Since the last krafix update, it's no longer possible to target glsl #version 330
.
#version 330
#ifdef GL_ARB_shading_language_420pack
#extension GL_ARB_shading_language_420pack : require
#endif
layout(binding = 0) uniform sampler2D gbuffer0; // <- ERROR: 0:7: Unknown identifier 'binding' in layout
layout(binding = 1) uniform sampler2D tex;
Before the update (9b3cf9d):
#version 330
#ifdef GL_ARB_shading_language_420pack
#extension GL_ARB_shading_language_420pack : require
#endif
uniform sampler2D gbuffer0;
uniform sampler2D tex;
Declaring uniform samplerCube shadowMapCube;
throws at compile-time:
error X3000: unrecognized identifier 'samplerCube'
Using textureLod()
throws at compile-time:
error X3004: undeclared identifier 'tex2DLod'
Hey ;)
I found one small problem with sampler2D arrays.
Here is what I have in my GLSL file:
uniform sampler2D u_textures[2];
layout(location = 0) out vec4 outResult;
void main()
{
outResult = texture(u_textures[0], texCoord);
}
Here is what I got in HLSL file:
Texture2D<float4> u_textures;
SamplerState _u_textures_sampler;
static float4 outResult
void frag_main()
{
outResult = u_textures[0].Sample(_u_textures[0]_sampler, texCoord); //! error here
}
Here is what error message I got:
error X3120: invalid type for index - index must be a scalar, or a vector with the correct number of
dimensions
Kha, D3D11 target.
From what I learned, krafix compiles two sets of shaders for webgl to have both available at runtime. The same thing would make sense to be enabled for targeting Android.
glslang does not expose vender specific opengl extensions by default, preventing to access them from krafix.
This could be solved by adding into the korefile.js
:
project.addDefine('NV_EXTENSIONS');
project.addDefine('AMD_EXTENSIONS');
I tested with NV_EXTENSIONS, and the resulting binary raised about 50KB in size. Could we enable this by default? Any ideas on more solutions?
Related:
https://github.com/KhronosGroup/glslang/blob/master/CMakeLists.txt#L34
Describe the bug
A generated shader that works on other platforms, fails to compile when krafix creates the corresponding Metal shader.
To Reproduce
I made a little repo to reproduce the problem here
Expected behavior
Tested it on Linux and it works as expected (renders a raymarched scene on one triangle showing a cube)
Execution Environment:
Using Kinc (b293f46b) from /Users/tizilogic/code/metalgigashaderrepro/Kinc
kfile found.
Creating macOS project files.
Compiling shader 1 of 4 (shader.frag).
Compiling shader 2 of 4 (shader.vert).
Compiling shader 3 of 4 (g1.frag).
Compiling shader 4 of 4 (g1.vert).
Compiling...
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -configuration Debug -project ShaderTest.xcodeproj
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Computing target dependency graph and provisioning inputs
Create build description
Build description signature: 9c82125a0c017211dffc9b63292daf13
Build description path: /Users/tizilogic/code/metalgigashaderrepro/build/build/XCBuildData/9c82125a0c017211dffc9b63292daf13-desc.xcbuild
warning: Building targets in manual order is deprecated - check "Parallelize build for command-line builds" in the project editor, or set DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING in any of the targets in the current build to suppress this warning
CreateBuildDirectory /Users/tizilogic/code/metalgigashaderrepro/build/build
cd /Users/tizilogic/code/metalgigashaderrepro/build/ShaderTest.xcodeproj
builtin-create-build-directory /Users/tizilogic/code/metalgigashaderrepro/build/build
CreateBuildDirectory /Users/tizilogic/code/metalgigashaderrepro/build/build/EagerLinkingTBDs
cd /Users/tizilogic/code/metalgigashaderrepro/build/ShaderTest.xcodeproj
builtin-create-build-directory /Users/tizilogic/code/metalgigashaderrepro/build/build/EagerLinkingTBDs
CreateBuildDirectory /Users/tizilogic/code/metalgigashaderrepro/build/build/Debug
cd /Users/tizilogic/code/metalgigashaderrepro/build/ShaderTest.xcodeproj
builtin-create-build-directory /Users/tizilogic/code/metalgigashaderrepro/build/build/Debug
/Users/tizilogic/code/metalgigashaderrepro/build/ShaderTest.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 13.1.99. (in target 'ShaderTest' from project 'ShaderTest')
warning: ONLY_ACTIVE_ARCH=YES requested with multiple ARCHS and no active architecture could be computed; building for all applicable architectures (in target 'ShaderTest' from project 'ShaderTest')
MkDir /Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/ShaderTest.app/Contents (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/bin/mkdir -p /Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/ShaderTest.app/Contents
MkDir /Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/ShaderTest.app/Contents/MacOS (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/bin/mkdir -p /Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/ShaderTest.app/Contents/MacOS
MkDir /Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/ShaderTest.app/Contents/Resources (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/bin/mkdir -p /Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/ShaderTest.app/Contents/Resources
MkDir /Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/ShaderTest.app (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/bin/mkdir -p /Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/ShaderTest.app
WriteAuxiliaryFile /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources/Entitlements.plist (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
write-file /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources/Entitlements.plist
ProcessProductPackaging "" /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest.app.xcent (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
Entitlements:
{
"com.apple.security.get-task-allow" = 1;
}
builtin-productPackagingUtility -entitlements -format xml -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest.app.xcent
ProcessProductPackagingDER /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest.app.xcent /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest.app.xcent.der (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/usr/bin/derq query -f xml -i /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest.app.xcent -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest.app.xcent.der --raw
WriteAuxiliaryFile /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest.hmap (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
write-file /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest.hmap
WriteAuxiliaryFile /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/all-product-headers.yaml (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
write-file /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/all-product-headers.yaml
WriteAuxiliaryFile /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-generated-files.hmap (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
write-file /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-generated-files.hmap
WriteAuxiliaryFile /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-own-target-headers.hmap (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
write-file /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-own-target-headers.hmap
WriteAuxiliaryFile /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-all-target-headers.hmap (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
write-file /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-all-target-headers.hmap
WriteAuxiliaryFile /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-project-headers.hmap (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
write-file /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-project-headers.hmap
WriteAuxiliaryFile /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-all-non-framework-target-headers.hmap (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
write-file /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-all-non-framework-target-headers.hmap
WriteAuxiliaryFile /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/arm64/ShaderTest.LinkFileList (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
write-file /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/arm64/ShaderTest.LinkFileList
CpResource /Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/ShaderTest.app/Contents/Resources/Deployment /Users/tizilogic/code/metalgigashaderrepro/Deployment (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks /Users/tizilogic/code/metalgigashaderrepro/Deployment /Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/ShaderTest.app/Contents/Resources
WriteAuxiliaryFile /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/ShaderTest.LinkFileList (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
write-file /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/ShaderTest.LinkFileList
CompileMetalFile /Users/tizilogic/code/metalgigashaderrepro/build/Sources/shader.vert.metal (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal -c -target air64-apple-macos10.11 -gline-tables-only -I/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/include -F/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -ffast-math -serialize-diagnostics /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Metal/shader.vert.dia -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Metal/shader.vert.air -MMD -MT dependencies -MF /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Metal/shader.vert.dat /Users/tizilogic/code/metalgigashaderrepro/build/Sources/shader.vert.metal
CompileMetalFile /Users/tizilogic/code/metalgigashaderrepro/build/Sources/shader.frag.metal (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal -c -target air64-apple-macos10.11 -gline-tables-only -I/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/include -F/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -ffast-math -serialize-diagnostics /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Metal/shader.frag.dia -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Metal/shader.frag.air -MMD -MT dependencies -MF /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Metal/shader.frag.dat /Users/tizilogic/code/metalgigashaderrepro/build/Sources/shader.frag.metal
/Users/tizilogic/code/metalgigashaderrepro/build/Sources/shader.frag.metal:263:22: error: no matching function for call to 'render'
out.frag_color = render(uniforms.i_resolution, uniforms.sg_data, in.uv, uniforms.sg_mouse, uniforms.sg_alpha) - float4((uniforms.i_time * uniforms.i_resolution.x) * 9.9999996826552253889678874634872e-21);
^~~~~~
/Users/tizilogic/code/metalgigashaderrepro/build/Sources/shader.frag.metal:189:8: note: candidate function not viable: address space mismatch in 2nd argument ('const constant spvUnsafeArray<float4, 14>'), parameter type must be 'spvUnsafeArray<float4, 14> (&)'
float4 render(thread float2 i_resolution, thread spvUnsafeArray<float4, 14> (&sg_data), thread float2& uv, thread float2 sg_mouse, thread float2 sg_alpha)
^
1 error generated.
CompileMetalFile /Users/tizilogic/code/metalgigashaderrepro/build/Sources/g1.vert.metal (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal -c -target air64-apple-macos10.11 -gline-tables-only -I/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/include -F/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -ffast-math -serialize-diagnostics /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Metal/g1.vert.dia -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Metal/g1.vert.air -MMD -MT dependencies -MF /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Metal/g1.vert.dat /Users/tizilogic/code/metalgigashaderrepro/build/Sources/g1.vert.metal
CompileMetalFile /Users/tizilogic/code/metalgigashaderrepro/build/Sources/g1.frag.metal (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal -c -target air64-apple-macos10.11 -gline-tables-only -I/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/include -F/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -ffast-math -serialize-diagnostics /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Metal/g1.frag.dia -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Metal/g1.frag.air -MMD -MT dependencies -MF /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Metal/g1.frag.dat /Users/tizilogic/code/metalgigashaderrepro/build/Sources/g1.frag.metal
CompileC /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/stb_vorbis.o /Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources/kinc/libs/stb_vorbis.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target x86_64-apple-macos10.11 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fmodules -gmodules -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/var/folders/w6/89pyc5mj6fs0jj84rr91fln00000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wunreachable-code -Wquoted-include-in-framework-header -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-implicit-fallthrough -DDEBUG\=1 -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_METAL -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-generated-files.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-own-target-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-all-target-headers.hmap -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-project-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/Apple/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/macOS/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/POSIX/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics5/Metal/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics4/G4onG5/Sources -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources-normal/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources -F/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug -MMD -MT dependencies -MF /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/stb_vorbis.d --serialize-diagnostics /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/stb_vorbis.dia -c /Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources/kinc/libs/stb_vorbis.c -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/stb_vorbis.o
CompileC /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/shader.o /Users/tizilogic/code/metalgigashaderrepro/Sources/shader.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target x86_64-apple-macos10.11 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fmodules -gmodules -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/var/folders/w6/89pyc5mj6fs0jj84rr91fln00000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wunreachable-code -Wquoted-include-in-framework-header -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-implicit-fallthrough -DDEBUG\=1 -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_METAL -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-generated-files.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-own-target-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-all-target-headers.hmap -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-project-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/Apple/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/macOS/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/POSIX/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics5/Metal/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics4/G4onG5/Sources -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources-normal/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources -F/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug -MMD -MT dependencies -MF /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/shader.d --serialize-diagnostics /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/shader.dia -c /Users/tizilogic/code/metalgigashaderrepro/Sources/shader.c -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/shader.o
CompileC /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/rootunit-563a0f82fe87fcd28f62c5f0d960e95a.o /Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources/kinc/rootunit.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -target x86_64-apple-macos10.11 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu++14 -fmodules -gmodules -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/var/folders/w6/89pyc5mj6fs0jj84rr91fln00000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wunreachable-code -Wquoted-include-in-framework-header -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -Wno-implicit-fallthrough -DDEBUG\=1 -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_METAL -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -fvisibility-inlines-hidden -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-generated-files.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-own-target-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-all-target-headers.hmap -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-project-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/Apple/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/macOS/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/POSIX/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics5/Metal/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics4/G4onG5/Sources -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources-normal/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources -F/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug -MMD -MT dependencies -MF /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/rootunit-563a0f82fe87fcd28f62c5f0d960e95a.d --serialize-diagnostics /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/rootunit-563a0f82fe87fcd28f62c5f0d960e95a.dia -c /Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources/kinc/rootunit.cpp -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/rootunit-563a0f82fe87fcd28f62c5f0d960e95a.o
CompileC /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/rootunit-36293cee253cf2a3e5c515e10a81688a.o /Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources/kinc/rootunit.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target x86_64-apple-macos10.11 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fmodules -gmodules -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/var/folders/w6/89pyc5mj6fs0jj84rr91fln00000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wunreachable-code -Wquoted-include-in-framework-header -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-implicit-fallthrough -DDEBUG\=1 -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_METAL -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-generated-files.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-own-target-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-all-target-headers.hmap -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-project-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/Apple/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/macOS/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/POSIX/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics5/Metal/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics4/G4onG5/Sources -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources-normal/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources -F/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug -MMD -MT dependencies -MF /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/rootunit-36293cee253cf2a3e5c515e10a81688a.d --serialize-diagnostics /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/rootunit-36293cee253cf2a3e5c515e10a81688a.dia -c /Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources/kinc/rootunit.c -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/rootunit-36293cee253cf2a3e5c515e10a81688a.o
CompileC /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/posixunit.o /Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/POSIX/Sources/kinc/backend/posixunit.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target x86_64-apple-macos10.11 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fmodules -gmodules -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/var/folders/w6/89pyc5mj6fs0jj84rr91fln00000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wunreachable-code -Wquoted-include-in-framework-header -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-implicit-fallthrough -DDEBUG\=1 -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_METAL -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-generated-files.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-own-target-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-all-target-headers.hmap -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-project-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/Apple/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/macOS/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/POSIX/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics5/Metal/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics4/G4onG5/Sources -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources-normal/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources -F/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug -MMD -MT dependencies -MF /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/posixunit.d --serialize-diagnostics /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/posixunit.dia -c /Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/POSIX/Sources/kinc/backend/posixunit.c -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/posixunit.o
CompileC /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/networkunit.o /Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources/kinc/network/networkunit.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target x86_64-apple-macos10.11 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fmodules -gmodules -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/var/folders/w6/89pyc5mj6fs0jj84rr91fln00000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wunreachable-code -Wquoted-include-in-framework-header -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-implicit-fallthrough -DDEBUG\=1 -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_METAL -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-generated-files.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-own-target-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-all-target-headers.hmap -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-project-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/Apple/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/macOS/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/POSIX/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics5/Metal/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics4/G4onG5/Sources -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources-normal/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources -F/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug -MMD -MT dependencies -MF /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/networkunit.d --serialize-diagnostics /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/networkunit.dia -c /Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources/kinc/network/networkunit.c -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/networkunit.o
CompileC /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/metalunit.o /Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics5/Metal/Sources/kinc/backend/graphics5/metalunit.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -target x86_64-apple-macos10.11 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/var/folders/w6/89pyc5mj6fs0jj84rr91fln00000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wunreachable-code -Wquoted-include-in-framework-header -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -Wno-implicit-fallthrough -DDEBUG\=1 -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_METAL -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -DOBJC_OLD_DISPATCH_PROTOTYPES\=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-generated-files.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-own-target-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-all-target-headers.hmap -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-project-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/Apple/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/macOS/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/POSIX/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics5/Metal/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics4/G4onG5/Sources -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources-normal/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources -F/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug -MMD -MT dependencies -MF /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/metalunit.d --serialize-diagnostics /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/metalunit.dia -c /Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics5/Metal/Sources/kinc/backend/graphics5/metalunit.m -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/metalunit.o
CompileC /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/mathunit.o /Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources/kinc/math/mathunit.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target x86_64-apple-macos10.11 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fmodules -gmodules -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/var/folders/w6/89pyc5mj6fs0jj84rr91fln00000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wunreachable-code -Wquoted-include-in-framework-header -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-implicit-fallthrough -DDEBUG\=1 -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_METAL -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-generated-files.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-own-target-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-all-target-headers.hmap -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-project-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/Apple/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/macOS/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/POSIX/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics5/Metal/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics4/G4onG5/Sources -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources-normal/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources -F/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug -MMD -MT dependencies -MF /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/mathunit.d --serialize-diagnostics /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/mathunit.dia -c /Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources/kinc/math/mathunit.c -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/mathunit.o
CompileC /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/macosunit.o /Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/macOS/Sources/kinc/backend/macosunit.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'ShaderTest' from project 'ShaderTest')
cd /Users/tizilogic/code/metalgigashaderrepro/build
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -target x86_64-apple-macos10.11 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/var/folders/w6/89pyc5mj6fs0jj84rr91fln00000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wunreachable-code -Wquoted-include-in-framework-header -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -Wno-implicit-fallthrough -DDEBUG\=1 -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_METAL -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -DOBJC_OLD_DISPATCH_PROTOTYPES\=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-generated-files.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-own-target-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-all-target-headers.hmap -iquote /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/ShaderTest-project-headers.hmap -I/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/Apple/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/macOS/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/POSIX/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics5/Metal/Sources -I/Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/Graphics4/G4onG5/Sources -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources-normal/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources/x86_64 -I/Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/DerivedSources -F/Users/tizilogic/code/metalgigashaderrepro/build/build/Debug -MMD -MT dependencies -MF /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/macosunit.d --serialize-diagnostics /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/macosunit.dia -c /Users/tizilogic/code/metalgigashaderrepro/Kinc/Backends/System/macOS/Sources/kinc/backend/macosunit.m -o /Users/tizilogic/code/metalgigashaderrepro/build/build/ShaderTest.build/Debug/ShaderTest.build/Objects-normal/x86_64/macosunit.o
** BUILD FAILED **
The following build commands failed:
CompileMetalFile /Users/tizilogic/code/metalgigashaderrepro/build/Sources/shader.frag.metal (in target 'ShaderTest' from project 'ShaderTest')
(1 failure)
Build time: 0m 4s
Compilation failed.
Error: Compile error
Additional context
The shader source is generated by an app of mine...
I did not check whether this is due to Kore or krafix yet. The problem is that when only texelFetch()
is used to access the texture, SamplerState
is not generated in HLSL and afterwards setting the sampler gets mismatched.
Texture2D<float4> clustersData; // <-- no SamplerState
TextureCube<float4> shadowMap0;
SamplerComparisonState _shadowMap0_sampler;
After adding a dummy texture(clustersData, vec2(0.0))
call, SamplerState
is generated and everything is fine.
Texture2D<float4> clustersData; // <-- has SamplerState now
SamplerState _clustersData_sampler;
TextureCube<float4> shadowMap0;
SamplerComparisonState _shadowMap0_sampler;
Krom bless renderdoc for helping me to figure this out.
transpose requires glsl120, but we set 110 on Linux because we had error reports for some 3XX version and 110 seemed like the safest bet, so let's emit a transpose implementation for Linux.
I get the following error when trying to compile a Vulkan pipeline using the shaders stored in this zip: shader_pair.zip
Vulkan ERROR: Code 7060244 : Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x55555c32f920, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: The result pointer storage class and base pointer storage class in OpAccessChain do not match.
%104 = OpAccessChain %_ptr_UniformConstant_float %792 %uint_0
Trying to set precision, which is useful for gles targets:
#version 450
in vec3 test;
out vec4 FragColor;
void main() {
mediump vec3 v = test * vec3(0.5);
FragColor = vec4(v.xyz, 1.0);
}
Results in mediump
being discarded:
#version 100
precision mediump float;
precision highp int;
varying highp vec3 test;
void main()
{
highp vec3 v = test * vec3(0.5);
gl_FragData[0] = vec4(v, 1.0);
}
Possible solution hinted by Hans:
I suspect you are compiling with GL semantics. mediump/highp does not mean anything in GLSL 4.5, and is probably just ignored. Tried using Vulkan GLSL? That should work.
uniform vec3 lightPos;
uniform vec3 viewPos;
uniform vec3 lightColor;
uniform vec3 objectColor;
results in (for example) the second vec having offset 12, but it should be aligned to 16.
The two snippets below produce the same result in GLSL. In HLSL, coord.w
somehow gets mangled and only the second snippet produces the correct result.
vec2 SMAASearchDiag1(vec2 texcoord, vec2 dir) {
vec4 coord = vec4(texcoord, -1.0, 1.0);
vec3 t = vec3(1.0 / 800.0, 1.0 / 600, 1.0);
while (coord.z < 7.0 && coord.w > 0.9) {
coord.xyz = t * vec3(dir, 1.0) + coord.xyz;
float e = textureLod(edgesTex, coord.xy, 0.0).rg;
coord.w = dot(e, vec2(0.5, 0.5));
}
return coord.zw;
}
vec2 SMAASearchDiag1(vec2 texcoord, vec2 dir) {
vec4 coord = vec4(texcoord, -1.0, 1.0);
vec3 t = vec3(1.0 / 800.0, 1.0 / 600, 1.0);
float cw = coord.w; // <-- HLSL fix
while (coord.z < 7.0 && cw > 0.9) {
coord.xyz = t * vec3(dir, 1.0) + coord.xyz;
float e = textureLod(edgesTex, coord.xy, 0.0).rg;
cw = dot(e, vec2(0.5, 0.5));
}
coord.w = cw;
return coord.zw;
}
how to reproduce: don't use all vertex info in your code in a vertex shader in directx 11
bug result: it mixes the inputs,
example: Lubos tutorial 7 http://kodegarden.org/#c9fd447c82cc95428d974ecddd487bdcff2a2564
it has a nor in the vertex shader that is not use in the code, if you use all inputs by adding to simple.vert.glsl the line vec2 norm=nor+vec2(1.0); the shader works as expected.
Hey ;)
Got that error with matrices.
GLSL vertex shader code:
in ...
out ...
out mat3 someMatrix;
void main ()
{
someMatrix = mat3(A, B, C); //where A, B and C is a vec3;
....
}
Generated HLSL:
uniform ....
uniform ....
....
static float3x3 someMatrix;
.....
struct SPIRV_Cross_Input
{
....
};
struct SPIRV_Cross_Output
{
.....
float3 someMatrix_0 : TEXCOORD1;
float3 someMatrix_1 : TEXCOORD2;
float3 someMatrix_2 : TEXCOORD3;
.....
};
void vert_main()
{
....
someMatrix = float3x3(float3(A), float3(B), float3(C));
....
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
....
stage_output.someMatrix = someMatrix; //! error X3018: invalid subscript 'someMatrix'
....
return stage_output;
}
Error:
error X3018: invalid subscript 'someMatrix'
So, output declarated as
float3 someMatrix_0 : TEXCOORD1;
float3 someMatrix_1 : TEXCOORD2;
float3 someMatrix_2 : TEXCOORD3;
But in main function it trying to apply matrix as:
stage_output.someMatrix = someMatrix;
Minimal GLSL example:
#version 450
#define BUFFER_SIZE 16
uniform float radius[BUFFER_SIZE];
out vec4 fragColor;
void main() {
fragColor = vec4(radius[1], radius[1], radius[1], 1.0);
}
The radius array looks like the following in the Visual Studio graphics debugger:
So the shader should output the value at the second position of the array, which is 4. But instead the output is 0, it is read from the fifth position. If I change the index in the glsl source to 2, the value from the 9th position is used. In OpenGL, everything works as expected, so there is some problem with cross-compiling to HLSL.
Full HLSL assembly:
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
// float radius[16]; // Offset: 0 Size: 244
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim HLSL Bind Count
// ------------------------------ ---------- ------- ----------- -------------- ------
// $Globals cbuffer NA NA cb0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD 0 xyzw 0 NONE float
// TEXCOORD 1 x 1 NONE int
// SV_Position 0 xyzw 2 POS float
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target 0 xyzw 0 TARGET float xyzw
//
ps_4_0
dcl_constantbuffer CB0[2], immediateIndexed
dcl_output o0.xyzw
0: mov o0.xyz, cb0[1].xxxx
1: mov o0.w, l(1.000000)
2: ret
// Approximately 3 instruction slots used
I think the problematic line is this:
0: mov o0.xyz, cb0[1].xxxx
It looks as if the values were interpreted as float4
instead of float
and thus the pointer offset for the array access is 4 floats big instead of one.
The array interpreted as float4s:
Thanks!
Source glsl:
uniform vec4 shirr[7];
vec3 shIrradiance(const vec3 nor) {
vec3 cl00 = vec3(shirr[0].x, shirr[0].y, shirr[0].z);
// ...
}
void main() {
// ...
shIrradiance(n);
}
Output metal:
struct Material_mesh_frag_main_uniforms
{
float4 shirr[7];
// ...
};
float3 shIrradiance(thread const float3& nor, thread spvUnsafeArray<float4, 7> (&shirr))
{
//...
}
fragment Material_mesh_frag_main_out Material_mesh_frag_main(Material_mesh_frag_main_in in [[stage_in]], constant Material_mesh_frag_main_uniforms& uniforms [[buffer(0)]])
{
//...
// Error:
// No matching function for call to 'shIrradiance'
// Candidate function not viable: 2nd argument ('const constant spvUnsafeArray<float4, 7>') is in address space constant, but parameter must be in address space 0
shIrradiance(n, uniforms.shirr);
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.