summaryrefslogtreecommitdiff
path: root/source/slang/core.meta.slang.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/core.meta.slang.h')
-rw-r--r--source/slang/core.meta.slang.h50
1 files changed, 19 insertions, 31 deletions
diff --git a/source/slang/core.meta.slang.h b/source/slang/core.meta.slang.h
index 53e1f202e..84a1abbf0 100644
--- a/source/slang/core.meta.slang.h
+++ b/source/slang/core.meta.slang.h
@@ -464,7 +464,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
sb << "__glsl_version(450)\n";
sb << "__target_intrinsic(glsl, \"(";
- int aa = 0;
+ int aa = 1;
String lodStr = "0";
if (includeMipInfo)
{
@@ -585,11 +585,11 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
if (isMultisample)
{
- sb << "__target_intrinsic(glsl, \"texelFetch($P, $0, $1)\")\n";
+ sb << "__target_intrinsic(glsl, \"texelFetch($P, $1, $3)\")\n";
}
else
{
- sb << "__target_intrinsic(glsl, \"texelFetch($P, ($0)." << kGLSLLoadCoordsSwizzle[loadCoordCount] << ", ($0)." << kGLSLLoadLODSwizzle[loadCoordCount] << ")\")\n";
+ sb << "__target_intrinsic(glsl, \"texelFetch($P, ($1)." << kGLSLLoadCoordsSwizzle[loadCoordCount] << ", ($1)." << kGLSLLoadLODSwizzle[loadCoordCount] << ")\")\n";
}
sb << "T Load(";
sb << "int" << loadCoordCount << " location";
@@ -605,7 +605,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
}
else
{
- sb << "__target_intrinsic(glsl, \"texelFetch($P, ($0)." << kGLSLLoadCoordsSwizzle[loadCoordCount] << ", ($0)." << kGLSLLoadLODSwizzle[loadCoordCount] << ", $1)\")\n";
+ sb << "__target_intrinsic(glsl, \"texelFetch($P, ($1)." << kGLSLLoadCoordsSwizzle[loadCoordCount] << ", ($1)." << kGLSLLoadLODSwizzle[loadCoordCount] << ", $2)\")\n";
}
sb << "T Load(";
sb << "int" << loadCoordCount << " location";
@@ -646,7 +646,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
{
// `Sample()`
-// sb << "__target_intrinsic(glsl, \"texture($p, $1)\")\n";
+ sb << "__target_intrinsic(glsl, \"texture($p, $2)\")\n";
// TODO: only enable if IR is being used?
// sb << "__intrinsic_op(sample)\n";
@@ -654,21 +654,9 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
sb << "T Sample(SamplerState s, ";
sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location);\n";
- // Specialized definition for GLSL
- sb << "__specialized_for_target(glsl)\n";
- sb << "T Sample(SamplerState s, ";
- sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location) {\n";
- sb << " return texture<T>(Sampler";
- sb << kBaseTextureAccessLevels[accessLevel].name;
- sb << name;
- if (isMultisample) sb << "MS";
- if (isArray) sb << "Array";
- sb << "<T>(this, s), location);\n";
- sb << "}\n";
-
if( baseShape != TextureType::ShapeCube )
{
- sb << "__target_intrinsic(glsl, \"textureOffset($p, $1, $2)\")\n";
+ sb << "__target_intrinsic(glsl, \"textureOffset($p, $2, $3)\")\n";
sb << "T Sample(SamplerState s, ";
sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, ";
sb << "int" << kBaseTextureTypes[tt].coordCount << " offset);\n";
@@ -692,13 +680,13 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
// `SampleBias()`
- sb << "__target_intrinsic(glsl, \"texture($p, $1, $2)\")\n";
+ sb << "__target_intrinsic(glsl, \"texture($p, $2, $3)\")\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 << "__target_intrinsic(glsl, \"textureOffset($p, $2, $3, $4)\")\n";
sb << "T SampleBias(SamplerState s, ";
sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, float bias, ";
sb << "int" << kBaseTextureTypes[tt].coordCount << " offset);\n";
@@ -721,12 +709,12 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
sb << "__target_intrinsic(glsl, \"textureLod($p, ";
- sb << "vec" << extCoordCount << "($1,";
+ sb << "vec" << extCoordCount << "($2,";
for (int ii = arrCoordCount; ii < extCoordCount - 1; ++ii)
{
sb << " 0.0,";
}
- sb << "$2)";
+ sb << "$3)";
sb << ", 0.0)\")\n";
}
@@ -739,12 +727,12 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
sb << "__target_intrinsic(glsl, \"textureGrad($p, ";
- sb << "vec" << extCoordCount << "($1,";
+ sb << "vec" << extCoordCount << "($2,";
for (int ii = arrCoordCount; ii < extCoordCount - 1; ++ii)
{
sb << " 0.0,";
}
- sb << "$2)";
+ sb << "$3)";
// Construct gradients
sb << ", vec" << baseCoordCount << "(0.0)";
@@ -777,7 +765,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
}
- sb << "__target_intrinsic(glsl, \"textureGrad($p, $1, $2, $3)\")\n";
+ sb << "__target_intrinsic(glsl, \"textureGrad($p, $2, $3, $4)\")\n";
// sb << "__intrinsic_op(sampleGrad)\n";
sb << "T SampleGrad(SamplerState s, ";
sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, ";
@@ -787,7 +775,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
if( baseShape != TextureType::ShapeCube )
{
- sb << "__target_intrinsic(glsl, \"textureGradOffset($p, $1, $2, $3, $4)\")\n";
+ sb << "__target_intrinsic(glsl, \"textureGradOffset($p, $2, $3, $4, $5)\")\n";
// sb << "__intrinsic_op(sampleGrad)\n";
sb << "T SampleGrad(SamplerState s, ";
sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, ";
@@ -798,14 +786,14 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
// `SampleLevel`
- sb << "__target_intrinsic(glsl, \"textureLod($p, $1, $2)\")\n";
+ sb << "__target_intrinsic(glsl, \"textureLod($p, $2, $3)\")\n";
sb << "T SampleLevel(SamplerState s, ";
sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, ";
sb << "float level);\n";
if( baseShape != TextureType::ShapeCube )
{
- sb << "__target_intrinsic(glsl, \"textureLodOffset($p, $1, $2, $3)\")\n";
+ sb << "__target_intrinsic(glsl, \"textureLodOffset($p, $2, $3, $4)\")\n";
sb << "T SampleLevel(SamplerState s, ";
sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, ";
sb << "float level, ";
@@ -872,12 +860,12 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
EMIT_LINE_DIRECTIVE();
- sb << "__target_intrinsic(glsl, \"textureGather($p, $1, " << componentIndex << ")\")\n";
+ sb << "__target_intrinsic(glsl, \"textureGather($p, $2, " << componentIndex << ")\")\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 << "__target_intrinsic(glsl, \"textureGatherOffset($p, $2, $3, " << componentIndex << ")\")\n";
sb << "vector<T, 4> Gather" << componentName << "(SamplerState s, ";
sb << "float" << kBaseTextureTypes[tt].coordCount << " location, ";
sb << "int" << kBaseTextureTypes[tt].coordCount << " offset);\n";
@@ -889,7 +877,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
sb << "out uint status);\n";
EMIT_LINE_DIRECTIVE();
- sb << "__target_intrinsic(glsl, \"textureGatherOffsets($p, $1, int" << kBaseTextureTypes[tt].coordCount << "[]($2, $3, $4, $5), " << componentIndex << ")\")\n";
+ sb << "__target_intrinsic(glsl, \"textureGatherOffsets($p, $2, int" << kBaseTextureTypes[tt].coordCount << "[]($3, $4, $5, $6), " << componentIndex << ")\")\n";
sb << "vector<T, 4> Gather" << componentName << "(SamplerState s, ";
sb << "float" << kBaseTextureTypes[tt].coordCount << " location, ";
sb << "int" << kBaseTextureTypes[tt].coordCount << " offset1, ";