shaderc icon indicating copy to clipboard operation
shaderc copied to clipboard

shaderc::PreprocessGlsl removes defines from the shader

Open SC5Shout opened this issue 1 year ago • 1 comments

I've got this code in my shader:

#define float highp float
#define float2 highp vec2
#define float3 highp vec3
#define float4 highp vec4
#define float2x2 highp mat2
#define float3x3 highp mat3
#define float4x4 highp mat4

#define half mediump float
#define half2 mediump vec2
#define half3 mediump vec3
#define half4 mediump vec4
#define half2x2 mediump mat2
#define half3x3 mediump mat3
#define half4x4 mediump mat4

and when I use shaderc::PreprocessGlsl function, shaderc::PreprocessedSourceCompilationResult::begin() gives the preprocessed shader but defines are deleted. Is there a way to keep these defines?

I don't want to use shaderc::CompileOptions::AddMacroDefinition() function.

SC5Shout avatar Aug 02 '23 13:08 SC5Shout

It's doing the same thing gcc -E would do. the #defines disappear.

dneto0 avatar Aug 08 '23 17:08 dneto0