ivec2 textureSize(sampler1DArrayShadow sampler, int lod);
ivec3 textureSize(sampler2DArrayShadow sampler, int lod);
ivec3 textureSize(samplerCubeArrayShadow sampler, int lod);
+vec2 textureQueryLod(sampler1D sampler, float P);
+vec2 textureQueryLod(sampler2D sampler, vec2 P);
+vec2 textureQueryLod(sampler3D sampler, vec3 P);
+vec2 textureQueryLod(sampler1DArray sampler, float P);
+vec2 textureQueryLod(sampler2DArray sampler, vec2 P);
+vec2 textureQueryLod(samplerCube sampler, vec3 P);
+vec2 textureQueryLod(samplerCubeArray sampler, vec3 P);
+vec2 textureQueryLod(sampler1DShadow sampler, float P);
+vec2 textureQueryLod(sampler2DShadow sampler, vec2 P);
+vec2 textureQueryLod(samplerCubeShadow sampler, vec3 P);
+vec2 textureQueryLod(sampler1DArrayShadow sampler, float P);
+vec2 textureQueryLod(sampler2DArrayShadow sampler, vec2 P);
+vec2 textureQueryLod(samplerCubeArrayShadow sampler, vec3 P);
+int textureQueryLevels(sampler1D sampler);
+int textureQueryLevels(sampler2D sampler);
+int textureQueryLevels(sampler3D sampler);
+int textureQueryLevels(sampler1DArray sampler);
+int textureQueryLevels(sampler2DArray sampler);
+int textureQueryLevels(samplerCube sampler);
+int textureQueryLevels(samplerCubeArray sampler);
+int textureQueryLevels(sampler1DShadow sampler);
+int textureQueryLevels(sampler2DShadow sampler);
+int textureQueryLevels(samplerCubeShadow sampler);
+int textureQueryLevels(sampler1DArrayShadow sampler);
+int textureQueryLevels(sampler2DArrayShadow sampler);
+int textureQueryLevels(samplerCubeArrayShadow sampler);
vec4 texture(sampler1D sampler, float P);
vec4 texture(sampler2D sampler, vec2 P);
vec4 texture(sampler3D sampler, vec3 P);
import sys
traits = {
- "sampler1D": { "CDim": 1, "IDim": 1 },
- "sampler2D": { "CDim": 2, "IDim": 2 },
- "sampler3D": { "CDim": 3, "IDim": 3 },
- "sampler1DArray": { "CDim": 2, "IDim": 2 },
- "sampler2DArray": { "CDim": 3, "IDim": 3 },
- "samplerCube": { "CDim": 3, "IDim": 2 },
- "samplerCubeArray": { "CDim": 4, "IDim": 3 },
- "sampler1DShadow": { "CDim": 3, "IDim": 1 },
- "sampler2DShadow": { "CDim": 3, "IDim": 2 },
- "samplerCubeShadow": { "CDim": 4, "IDim": 2 },
- "sampler1DArrayShadow": { "CDim": 3, "IDim": 2 },
- "sampler2DArrayShadow": { "CDim": 4, "IDim": 3 },
- "samplerCubeArrayShadow": { "IDim": 3 },
+ "sampler1D": { "CDim": 1, "IDim": 1, "LDim": 1 },
+ "sampler2D": { "CDim": 2, "IDim": 2, "LDim": 2 },
+ "sampler3D": { "CDim": 3, "IDim": 3, "LDim": 3 },
+ "sampler1DArray": { "CDim": 2, "IDim": 2, "LDim": 1 },
+ "sampler2DArray": { "CDim": 3, "IDim": 3, "LDim": 2 },
+ "samplerCube": { "CDim": 3, "IDim": 2, "LDim": 3 },
+ "samplerCubeArray": { "CDim": 4, "IDim": 3, "LDim": 3 },
+ "sampler1DShadow": { "CDim": 3, "IDim": 1, "LDim": 1 },
+ "sampler2DShadow": { "CDim": 3, "IDim": 2, "LDim": 2 },
+ "samplerCubeShadow": { "CDim": 4, "IDim": 2, "LDim": 3 },
+ "sampler1DArrayShadow": { "CDim": 3, "IDim": 2, "LDim": 1 },
+ "sampler2DArrayShadow": { "CDim": 4, "IDim": 3, "LDim": 2 },
+ "samplerCubeArrayShadow": { "IDim": 3, "LDim": 3 },
"float": { "Base": "float", "Dim": 1, "Vec": "vec", "Mat": "mat" },
"vec2": { "Base": "float", "Dim": 2 },
"vec3": { "Base": "float", "Dim": 3 },
# Texture
("int[T::IDim] textureSize(T sampler, int lod)", samplertypes),
+ ("vec2 textureQueryLod(T sampler, float[T::LDim] P)", samplertypes),
+ ("int textureQueryLevels(T sampler)", samplertypes),
("vec4 texture(T sampler, float[T::CDim] P)", colorsamplertypes),
("float texture(T sampler, float[T::CDim] P)", tuple(s for s in shadowsamplertypes if "CubeArray" not in s)),
"float texture(samplerCubeArrayShadow sampler, vec4 P, float compare)",
{ "findMSB", "i", "GLSL.std.450", GLSL450_FIND_S_MSB, { 1 }, 0, 0 },
{ "findMSB", "u", "GLSL.std.450", GLSL450_FIND_U_MSB, { 1 }, 0, 0 },
{ "textureSize", "", "", 0, { }, CAP_IMAGE_QUERY, &SpirVGenerator::visit_builtin_texture_query },
+ { "textureQueryLod", "", "", 0, { }, CAP_IMAGE_QUERY, &SpirVGenerator::visit_builtin_texture_query },
+ { "textureQueryLevels", "", "", 0, { }, CAP_IMAGE_QUERY, &SpirVGenerator::visit_builtin_texture_query },
{ "texture", "", "", 0, { }, 0, &SpirVGenerator::visit_builtin_texture },
{ "textureLod", "", "", 0, { }, 0, &SpirVGenerator::visit_builtin_texture },
{ "texelFetch", "", "", 0, { }, 0, &SpirVGenerator::visit_builtin_texel_fetch },
Opcode opcode;
if(call.name=="textureSize")
opcode = OP_IMAGE_QUERY_SIZE_LOD;
+ else if(call.name=="textureQueryLod")
+ opcode = OP_IMAGE_QUERY_LOD;
+ else if(call.name=="textureQueryLevels")
+ opcode = OP_IMAGE_QUERY_LEVELS;
else
throw internal_error("invalid texture query call");
OP_IMAGE_FETCH = 95,
OP_IMAGE = 100,
OP_IMAGE_QUERY_SIZE_LOD = 103,
+ OP_IMAGE_QUERY_LOD = 105,
+ OP_IMAGE_QUERY_LEVELS = 106,
OP_CONVERT_F_TO_U = 109,
OP_CONVERT_F_TO_S = 110,
OP_CONVERT_S_TO_F = 111,