0003-Add-support-for-SPV_NV_shader_image_footprint
This commit is contained in:
parent
beae2251b7
commit
3a1379667d
13 changed files with 1189 additions and 5 deletions
|
|
@ -865,6 +865,16 @@ enum TOperator {
|
|||
#endif
|
||||
|
||||
EOpSparseTextureGuardEnd,
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
EOpImageFootprintGuardBegin,
|
||||
EOpImageSampleFootprintNV,
|
||||
EOpImageSampleFootprintClampNV,
|
||||
EOpImageSampleFootprintLodNV,
|
||||
EOpImageSampleFootprintGradNV,
|
||||
EOpImageSampleFootprintGradClampNV,
|
||||
EOpImageFootprintGuardEnd,
|
||||
#endif
|
||||
EOpSamplingGuardEnd,
|
||||
EOpTextureGuardEnd,
|
||||
|
||||
|
|
@ -1248,6 +1258,9 @@ public:
|
|||
bool isSampling() const { return op > EOpSamplingGuardBegin && op < EOpSamplingGuardEnd; }
|
||||
bool isImage() const { return op > EOpImageGuardBegin && op < EOpImageGuardEnd; }
|
||||
bool isSparseTexture() const { return op > EOpSparseTextureGuardBegin && op < EOpSparseTextureGuardEnd; }
|
||||
#ifdef NV_EXTENSIONS
|
||||
bool isImageFootprint() const { return op > EOpImageFootprintGuardBegin && op < EOpImageFootprintGuardEnd; }
|
||||
#endif
|
||||
bool isSparseImage() const { return op == EOpSparseImageLoad; }
|
||||
|
||||
void setOperationPrecision(TPrecisionQualifier p) { operationPrecision = p; }
|
||||
|
|
@ -1420,6 +1433,23 @@ public:
|
|||
cracked.subpass = sampler.dim == EsdSubpass;
|
||||
cracked.fragMask = true;
|
||||
break;
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EOpImageSampleFootprintNV:
|
||||
break;
|
||||
case EOpImageSampleFootprintClampNV:
|
||||
cracked.lodClamp = true;
|
||||
break;
|
||||
case EOpImageSampleFootprintLodNV:
|
||||
cracked.lod = true;
|
||||
break;
|
||||
case EOpImageSampleFootprintGradNV:
|
||||
cracked.grad = true;
|
||||
break;
|
||||
case EOpImageSampleFootprintGradClampNV:
|
||||
cracked.lodClamp = true;
|
||||
cracked.grad = true;
|
||||
break;
|
||||
#endif
|
||||
case EOpSubpassLoad:
|
||||
case EOpSubpassLoadMS:
|
||||
|
|
|
|||
|
|
@ -3850,6 +3850,42 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
|
||||
#endif // AMD_EXTENSIONS
|
||||
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
if ((profile != EEsProfile && version >= 450) ||
|
||||
(profile == EEsProfile && version >= 320)) {
|
||||
commonBuiltins.append(
|
||||
"struct gl_TextureFootprint2DNV {"
|
||||
"uvec2 anchor;"
|
||||
"uvec2 offset;"
|
||||
"uvec2 mask;"
|
||||
"uint lod;"
|
||||
"uint granularity;"
|
||||
"};"
|
||||
|
||||
"struct gl_TextureFootprint3DNV {"
|
||||
"uvec3 anchor;"
|
||||
"uvec3 offset;"
|
||||
"uvec2 mask;"
|
||||
"uint lod;"
|
||||
"uint granularity;"
|
||||
"};"
|
||||
"bool textureFootprintNV(sampler2D, vec2, int, bool, out gl_TextureFootprint2DNV);"
|
||||
"bool textureFootprintNV(sampler3D, vec3, int, bool, out gl_TextureFootprint3DNV);"
|
||||
"bool textureFootprintNV(sampler2D, vec2, int, bool, out gl_TextureFootprint2DNV, float);"
|
||||
"bool textureFootprintNV(sampler3D, vec3, int, bool, out gl_TextureFootprint3DNV, float);"
|
||||
"bool textureFootprintClampNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV);"
|
||||
"bool textureFootprintClampNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV);"
|
||||
"bool textureFootprintClampNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV, float);"
|
||||
"bool textureFootprintClampNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV, float);"
|
||||
"bool textureFootprintLodNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV);"
|
||||
"bool textureFootprintLodNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV);"
|
||||
"bool textureFootprintGradNV(sampler2D, vec2, vec2, vec2, int, bool, out gl_TextureFootprint2DNV);"
|
||||
"bool textureFootprintGradClampNV(sampler2D, vec2, vec2, vec2, float, int, bool, out gl_TextureFootprint2DNV);"
|
||||
"\n");
|
||||
}
|
||||
|
||||
#endif // NV_EXTENSIONS
|
||||
// GL_AMD_gpu_shader_half_float/Explicit types
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
commonBuiltins.append(
|
||||
|
|
@ -7545,6 +7581,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
symbolTable.setFunctionExtensions("textureFootprintNV", 1, &E_GL_NV_shader_texture_footprint);
|
||||
symbolTable.setFunctionExtensions("textureFootprintClampNV", 1, &E_GL_NV_shader_texture_footprint);
|
||||
symbolTable.setFunctionExtensions("textureFootprintLodNV", 1, &E_GL_NV_shader_texture_footprint);
|
||||
symbolTable.setFunctionExtensions("textureFootprintGradNV", 1, &E_GL_NV_shader_texture_footprint);
|
||||
symbolTable.setFunctionExtensions("textureFootprintGradClampNV", 1, &E_GL_NV_shader_texture_footprint);
|
||||
#endif
|
||||
// Compatibility variables, vertex only
|
||||
if (spvVersion.spv == 0) {
|
||||
BuiltInVariable("gl_Color", EbvColor, symbolTable);
|
||||
|
|
@ -8501,6 +8544,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
symbolTable.relateToOperator("noise3", EOpNoise);
|
||||
symbolTable.relateToOperator("noise4", EOpNoise);
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
symbolTable.relateToOperator("textureFootprintNV", EOpImageSampleFootprintNV);
|
||||
symbolTable.relateToOperator("textureFootprintClampNV", EOpImageSampleFootprintClampNV);
|
||||
symbolTable.relateToOperator("textureFootprintLodNV", EOpImageSampleFootprintLodNV);
|
||||
symbolTable.relateToOperator("textureFootprintGradNV", EOpImageSampleFootprintGradNV);
|
||||
symbolTable.relateToOperator("textureFootprintGradClampNV", EOpImageSampleFootprintGradClampNV);
|
||||
#endif
|
||||
|
||||
if (spvVersion.spv == 0 && (IncludeLegacy(version, profile, spvVersion) ||
|
||||
(profile == EEsProfile && version == 100))) {
|
||||
symbolTable.relateToOperator("ftransform", EOpFtransform);
|
||||
|
|
|
|||
|
|
@ -237,6 +237,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_NV_shader_subgroup_partitioned] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_fragment_shader_barycentric] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_compute_shader_derivatives] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_shader_texture_footprint] = EBhDisable;
|
||||
#endif
|
||||
|
||||
// AEP
|
||||
|
|
@ -409,6 +410,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_NV_shader_subgroup_partitioned 1\n"
|
||||
"#define GL_NV_fragment_shader_barycentric 1\n"
|
||||
"#define GL_NV_compute_shader_derivatives 1\n"
|
||||
"#define GL_NV_shader_texture_footprint 1\n"
|
||||
#endif
|
||||
"#define GL_KHX_shader_explicit_arithmetic_types 1\n"
|
||||
"#define GL_KHX_shader_explicit_arithmetic_types_int8 1\n"
|
||||
|
|
|
|||
|
|
@ -209,6 +209,7 @@ const char* const E_GL_NV_shader_noperspective_interpolation = "GL_NV_shader_
|
|||
const char* const E_GL_NV_shader_subgroup_partitioned = "GL_NV_shader_subgroup_partitioned";
|
||||
const char* const E_GL_NV_fragment_shader_barycentric = "GL_NV_fragment_shader_barycentric";
|
||||
const char* const E_GL_NV_compute_shader_derivatives = "GL_NV_compute_shader_derivatives";
|
||||
const char* const E_GL_NV_shader_texture_footprint = "GL_NV_shader_texture_footprint";
|
||||
// Arrays of extensions for the above viewportEXTs duplications
|
||||
|
||||
const char* const viewportEXTs[] = { E_GL_ARB_shader_viewport_layer_array, E_GL_NV_viewport_array2 };
|
||||
|
|
|
|||
|
|
@ -956,7 +956,13 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpSparseTextureGatherLodOffsets: out.debug << "sparseTextureGatherLodOffsets"; break;
|
||||
case EOpSparseImageLoadLod: out.debug << "sparseImageLoadLod"; break;
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EOpImageSampleFootprintNV: out.debug << "imageSampleFootprintNV"; break;
|
||||
case EOpImageSampleFootprintClampNV: out.debug << "imageSampleFootprintClampNV"; break;
|
||||
case EOpImageSampleFootprintLodNV: out.debug << "imageSampleFootprintLodNV"; break;
|
||||
case EOpImageSampleFootprintGradNV: out.debug << "imageSampleFootprintGradNV"; break;
|
||||
case EOpImageSampleFootprintGradClampNV: out.debug << "mageSampleFootprintGradClampNV"; break;
|
||||
#endif
|
||||
case EOpAddCarry: out.debug << "addCarry"; break;
|
||||
case EOpSubBorrow: out.debug << "subBorrow"; break;
|
||||
case EOpUMulExtended: out.debug << "uMulExtended"; break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue