|
|
@ -1845,13 +1845,21 @@ private:
|
|
|
|
|
|
|
|
|
|
|
|
Expression TextureGather(Operation operation) {
|
|
|
|
Expression TextureGather(Operation operation) {
|
|
|
|
const auto& meta = std::get<MetaTexture>(operation.GetMeta());
|
|
|
|
const auto& meta = std::get<MetaTexture>(operation.GetMeta());
|
|
|
|
UNIMPLEMENTED_IF(!meta.aoffi.empty());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Id coords = GetCoordinates(operation, Type::Float);
|
|
|
|
const Id coords = GetCoordinates(operation, Type::Float);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spv::ImageOperandsMask mask = spv::ImageOperandsMask::MaskNone;
|
|
|
|
|
|
|
|
std::vector<Id> operands{};
|
|
|
|
Id texture{};
|
|
|
|
Id texture{};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!meta.aoffi.empty()) {
|
|
|
|
|
|
|
|
mask = mask | spv::ImageOperandsMask::Offset;
|
|
|
|
|
|
|
|
operands.push_back(GetOffsetCoordinates(operation));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (meta.sampler.is_shadow) {
|
|
|
|
if (meta.sampler.is_shadow) {
|
|
|
|
texture = OpImageDrefGather(t_float4, GetTextureSampler(operation), coords,
|
|
|
|
texture = OpImageDrefGather(t_float4, GetTextureSampler(operation), coords,
|
|
|
|
AsFloat(Visit(meta.depth_compare)));
|
|
|
|
AsFloat(Visit(meta.depth_compare)), mask, operands);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
u32 component_value = 0;
|
|
|
|
u32 component_value = 0;
|
|
|
|
if (meta.component) {
|
|
|
|
if (meta.component) {
|
|
|
@ -1860,7 +1868,7 @@ private:
|
|
|
|
component_value = component->GetValue();
|
|
|
|
component_value = component->GetValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
texture = OpImageGather(t_float4, GetTextureSampler(operation), coords,
|
|
|
|
texture = OpImageGather(t_float4, GetTextureSampler(operation), coords,
|
|
|
|
Constant(t_uint, component_value));
|
|
|
|
Constant(t_uint, component_value), mask, operands);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return GetTextureElement(operation, texture, Type::Float);
|
|
|
|
return GetTextureElement(operation, texture, Type::Float);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1928,13 +1936,22 @@ private:
|
|
|
|
|
|
|
|
|
|
|
|
const Id image = GetTextureImage(operation);
|
|
|
|
const Id image = GetTextureImage(operation);
|
|
|
|
const Id coords = GetCoordinates(operation, Type::Int);
|
|
|
|
const Id coords = GetCoordinates(operation, Type::Int);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spv::ImageOperandsMask mask = spv::ImageOperandsMask::MaskNone;
|
|
|
|
|
|
|
|
std::vector<Id> operands{};
|
|
|
|
Id fetch;
|
|
|
|
Id fetch;
|
|
|
|
|
|
|
|
|
|
|
|
if (meta.lod && !meta.sampler.is_buffer) {
|
|
|
|
if (meta.lod && !meta.sampler.is_buffer) {
|
|
|
|
fetch = OpImageFetch(t_float4, image, coords, spv::ImageOperandsMask::Lod,
|
|
|
|
mask = mask | spv::ImageOperandsMask::Lod;
|
|
|
|
AsInt(Visit(meta.lod)));
|
|
|
|
operands.push_back(AsInt(Visit(meta.lod)));
|
|
|
|
} else {
|
|
|
|
|
|
|
|
fetch = OpImageFetch(t_float4, image, coords);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!meta.aoffi.empty()) {
|
|
|
|
|
|
|
|
mask = mask | spv::ImageOperandsMask::Offset;
|
|
|
|
|
|
|
|
operands.push_back(GetOffsetCoordinates(operation));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fetch = OpImageFetch(t_float4, image, coords, mask, operands);
|
|
|
|
return GetTextureElement(operation, fetch, Type::Float);
|
|
|
|
return GetTextureElement(operation, fetch, Type::Float);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|