diff options
| author | Tim Foley <tfoley@nvidia.com> | 2017-11-06 14:05:32 -0800 |
|---|---|---|
| committer | Tim Foley <tfoley@nvidia.com> | 2017-11-07 10:38:56 -0800 |
| commit | 19c7c371aaef9dc537f6a6ed8cbfd77355f219ff (patch) | |
| tree | 6e6a7033d1bdf72abb1b76d72b8a87fec0bee096 /source/slang/core.meta.slang | |
| parent | 9919c823938ae929b16efac9d507f6d5eb122bf4 (diff) | |
Remove `__intrinsic_op` from many decls
This attribute used to be how we marked ops for special handling in emission, but now it is being used to mark ops that map to single instructions. Either way, we have a bunch of intrinsic functions that need to get lowered in a more traditional fashion for HLSL, and the intrinsics are getting in the way.
Subsequent changes will fix up issues created by this removal.
A few cases were left unchanged, either because the ops really do map to single instructions, or because there is some special-case support attached to those operations that would be tricky to replace right now.
Diffstat (limited to 'source/slang/core.meta.slang')
| -rw-r--r-- | source/slang/core.meta.slang | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang index 8accc83a4..f36b53227 100644 --- a/source/slang/core.meta.slang +++ b/source/slang/core.meta.slang @@ -444,13 +444,6 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) sb << ")\")\n"; - - - // TIM: Making `GetDimensions` *not* be marked as - // an intrinsic, just so we can see how defining - // things as `extern` functions would work. -// sb << "__intrinsic_op\n"; - } char const* t = isFloat ? "out float " : "out uint "; @@ -524,7 +517,6 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) { sb << "__target_intrinsic(glsl, \"texelFetch($$P, ($0)." << kGLSLLoadCoordsSwizzle[loadCoordCount] << ", ($0)." << kGLSLLoadLODSwizzle[loadCoordCount] << ")\")\n"; } - sb << "__intrinsic_op\n"; sb << "T Load("; sb << "int" << loadCoordCount << " location"; if(isMultisample) @@ -541,7 +533,6 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) { sb << "__target_intrinsic(glsl, \"texelFetch($$P, ($0)." << kGLSLLoadCoordsSwizzle[loadCoordCount] << ", ($0)." << kGLSLLoadLODSwizzle[loadCoordCount] << ", $1)\")\n"; } - sb << "__intrinsic_op\n"; sb << "T Load("; sb << "int" << loadCoordCount << " location"; if(isMultisample) @@ -569,7 +560,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) // this should have both `get` and `set` accessors. // subscript operator - sb << "__intrinsic_op __subscript(uint"; + sb << "__subscript(uint"; if(kBaseTextureTypes[tt].coordCount + isArray > 1) { sb << kBaseTextureTypes[tt].coordCount + isArray; @@ -584,16 +575,14 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) sb << "__target_intrinsic(glsl, \"texture($$p, $1)\")\n"; // TODO: only enable if IR is being used? - sb << "__intrinsic_op(sample)\n"; +// sb << "__intrinsic_op(sample)\n"; - sb << "__intrinsic_op\n"; sb << "T Sample(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location);\n"; if( baseShape != TextureType::ShapeCube ) { sb << "__target_intrinsic(glsl, \"textureOffset($$p, $1, $2)\")\n"; - sb << "__intrinsic_op\n"; sb << "T Sample(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, "; sb << "int" << kBaseTextureTypes[tt].coordCount << " offset);\n"; @@ -618,14 +607,12 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) // `SampleBias()` sb << "__target_intrinsic(glsl, \"texture($$p, $1, $2)\")\n"; - sb << "__intrinsic_op\n"; sb << "T SampleBias(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, float bias);\n"; if( baseShape != TextureType::ShapeCube ) { sb << "__target_intrinsic(glsl, \"textureOffset($$p, $1, $2, $3)\")\n"; - sb << "__intrinsic_op\n"; sb << "T SampleBias(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, float bias, "; sb << "int" << kBaseTextureTypes[tt].coordCount << " offset);\n"; @@ -678,7 +665,6 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) sb << ", vec" << baseCoordCount << "(0.0)"; sb << ")\")\n"; } - sb << "__intrinsic_op\n"; sb << "T SampleCmpLevelZero(SamplerComparisonState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, "; sb << "float compareValue"; @@ -706,7 +692,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) sb << "__target_intrinsic(glsl, \"textureGrad($$p, $1, $2, $3)\")\n"; - sb << "__intrinsic_op(sampleGrad)\n"; +// sb << "__intrinsic_op(sampleGrad)\n"; sb << "T SampleGrad(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, "; sb << "float" << kBaseTextureTypes[tt].coordCount << " gradX, "; @@ -716,7 +702,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) if( baseShape != TextureType::ShapeCube ) { sb << "__target_intrinsic(glsl, \"textureGradOffset($$p, $1, $2, $3, $4)\")\n"; - sb << "__intrinsic_op(sampleGrad)\n"; +// sb << "__intrinsic_op(sampleGrad)\n"; sb << "T SampleGrad(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, "; sb << "float" << kBaseTextureTypes[tt].coordCount << " gradX, "; @@ -727,7 +713,6 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) // `SampleLevel` sb << "__target_intrinsic(glsl, \"textureLod($$p, $1, $2)\")\n"; - sb << "__intrinsic_op\n"; sb << "T SampleLevel(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, "; sb << "float level);\n"; @@ -735,7 +720,6 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) if( baseShape != TextureType::ShapeCube ) { sb << "__target_intrinsic(glsl, \"textureLodOffset($$p, $1, $2, $3)\")\n"; - sb << "__intrinsic_op\n"; sb << "T SampleLevel(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, "; sb << "float level, "; @@ -803,13 +787,11 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) EMIT_LINE_DIRECTIVE(); sb << "__target_intrinsic(glsl, \"textureGather($$p, $1, " << componentIndex << ")\")\n"; - sb << "__intrinsic_op\n"; sb << "vector<T, 4> Gather" << componentName << "(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount << " location);\n"; EMIT_LINE_DIRECTIVE(); sb << "__target_intrinsic(glsl, \"textureGatherOffset($$p, $1, $2, " << componentIndex << ")\")\n"; - sb << "__intrinsic_op\n"; sb << "vector<T, 4> Gather" << componentName << "(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount << " location, "; sb << "int" << kBaseTextureTypes[tt].coordCount << " offset);\n"; @@ -822,7 +804,6 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) EMIT_LINE_DIRECTIVE(); sb << "__target_intrinsic(glsl, \"textureGatherOffsets($$p, $1, int" << kBaseTextureTypes[tt].coordCount << "[]($2, $3, $4, $5), " << componentIndex << ")\")\n"; - sb << "__intrinsic_op\n"; sb << "vector<T, 4> Gather" << componentName << "(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount << " location, "; sb << "int" << kBaseTextureTypes[tt].coordCount << " offset1, "; |
