mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2024-12-22 12:12:05 +00:00
image: Remove assumed lod in image samples
This commits breaks the API. Depth image samples assumed a lod operand, this made using Grad samples clumsy to use.
This commit is contained in:
parent
88d37bedf0
commit
9f4d057aa2
2 changed files with 14 additions and 21 deletions
|
@ -767,14 +767,14 @@ public:
|
||||||
|
|
||||||
/// Sample an image using an explicit level of detail.
|
/// Sample an image using an explicit level of detail.
|
||||||
Id OpImageSampleExplicitLod(Id result_type, Id sampled_image, Id coordinate,
|
Id OpImageSampleExplicitLod(Id result_type, Id sampled_image, Id coordinate,
|
||||||
spv::ImageOperandsMask image_operands, Id lod,
|
spv::ImageOperandsMask image_operands,
|
||||||
const std::vector<Id>& operands = {});
|
const std::vector<Id>& operands = {});
|
||||||
|
|
||||||
/// Sample an image using an explicit level of detail.
|
/// Sample an image using an explicit level of detail.
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
Id OpImageSampleExplicitLod(Id result_type, Id sampled_image, Id coordinate,
|
Id OpImageSampleExplicitLod(Id result_type, Id sampled_image, Id coordinate,
|
||||||
spv::ImageOperandsMask image_operands, Id lod, Ts&&... operands) {
|
spv::ImageOperandsMask image_operands, Ts&&... operands) {
|
||||||
return OpImageSampleExplicitLod(result_type, sampled_image, coordinate, image_operands, lod,
|
return OpImageSampleExplicitLod(result_type, sampled_image, coordinate, image_operands,
|
||||||
{operands...});
|
{operands...});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -793,16 +793,15 @@ public:
|
||||||
|
|
||||||
/// Sample an image doing depth-comparison using an explicit level of detail.
|
/// Sample an image doing depth-comparison using an explicit level of detail.
|
||||||
Id OpImageSampleDrefExplicitLod(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
Id OpImageSampleDrefExplicitLod(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
||||||
spv::ImageOperandsMask image_operands, Id lod,
|
spv::ImageOperandsMask image_operands,
|
||||||
const std::vector<Id>& operands = {});
|
const std::vector<Id>& operands = {});
|
||||||
|
|
||||||
/// Sample an image doing depth-comparison using an explicit level of detail.
|
/// Sample an image doing depth-comparison using an explicit level of detail.
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
Id OpImageSampleDrefExplicitLod(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
Id OpImageSampleDrefExplicitLod(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
||||||
spv::ImageOperandsMask image_operands, Id lod,
|
spv::ImageOperandsMask image_operands, Ts&&... operands) {
|
||||||
Ts&&... operands) {
|
|
||||||
return OpImageSampleDrefExplicitLod(result_type, sampled_image, coordinate, dref,
|
return OpImageSampleDrefExplicitLod(result_type, sampled_image, coordinate, dref,
|
||||||
image_operands, lod, {operands...});
|
image_operands, {operands...});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sample an image with with a project coordinate and an implicit level of detail.
|
/// Sample an image with with a project coordinate and an implicit level of detail.
|
||||||
|
@ -820,16 +819,15 @@ public:
|
||||||
|
|
||||||
/// Sample an image with a project coordinate using an explicit level of detail.
|
/// Sample an image with a project coordinate using an explicit level of detail.
|
||||||
Id OpImageSampleProjExplicitLod(Id result_type, Id sampled_image, Id coordinate,
|
Id OpImageSampleProjExplicitLod(Id result_type, Id sampled_image, Id coordinate,
|
||||||
spv::ImageOperandsMask image_operands, Id lod,
|
spv::ImageOperandsMask image_operands,
|
||||||
const std::vector<Id>& operands = {});
|
const std::vector<Id>& operands = {});
|
||||||
|
|
||||||
/// Sample an image with a project coordinate using an explicit level of detail.
|
/// Sample an image with a project coordinate using an explicit level of detail.
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
Id OpImageSampleProjExplicitLod(Id result_type, Id sampled_image, Id coordinate,
|
Id OpImageSampleProjExplicitLod(Id result_type, Id sampled_image, Id coordinate,
|
||||||
spv::ImageOperandsMask image_operands, Id lod,
|
spv::ImageOperandsMask image_operands, Ts&&... operands) {
|
||||||
Ts&&... operands) {
|
|
||||||
return OpImageSampleProjExplicitLod(result_type, sampled_image, coordinate, image_operands,
|
return OpImageSampleProjExplicitLod(result_type, sampled_image, coordinate, image_operands,
|
||||||
lod, {operands...});
|
{operands...});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sample an image with a project coordinate, doing depth-comparison, with an implicit level of
|
/// Sample an image with a project coordinate, doing depth-comparison, with an implicit level of
|
||||||
|
@ -850,17 +848,16 @@ public:
|
||||||
/// Sample an image with a project coordinate, doing depth-comparison, using an explicit level
|
/// Sample an image with a project coordinate, doing depth-comparison, using an explicit level
|
||||||
/// of detail.
|
/// of detail.
|
||||||
Id OpImageSampleProjDrefExplicitLod(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
Id OpImageSampleProjDrefExplicitLod(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
||||||
spv::ImageOperandsMask image_operands, Id lod,
|
spv::ImageOperandsMask image_operands,
|
||||||
const std::vector<Id>& operands = {});
|
const std::vector<Id>& operands = {});
|
||||||
|
|
||||||
/// Sample an image with a project coordinate, doing depth-comparison, using an explicit level
|
/// Sample an image with a project coordinate, doing depth-comparison, using an explicit level
|
||||||
/// of detail.
|
/// of detail.
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
Id OpImageSampleProjDrefExplicitLod(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
Id OpImageSampleProjDrefExplicitLod(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
||||||
spv::ImageOperandsMask image_operands, Id lod,
|
spv::ImageOperandsMask image_operands, Ts&&... operands) {
|
||||||
Ts&&... operands) {
|
|
||||||
return OpImageSampleProjDrefExplicitLod(result_type, sampled_image, coordinate, dref,
|
return OpImageSampleProjDrefExplicitLod(result_type, sampled_image, coordinate, dref,
|
||||||
image_operands, lod, {operands...});
|
image_operands, {operands...});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fetch a single texel from an image whose Sampled operand is 1.
|
/// Fetch a single texel from an image whose Sampled operand is 1.
|
||||||
|
|
|
@ -31,13 +31,11 @@ static void AddImageOperands(Op* op, std::optional<spv::ImageOperandsMask> image
|
||||||
|
|
||||||
#define DEFINE_IMAGE_EXP_OP(opcode) \
|
#define DEFINE_IMAGE_EXP_OP(opcode) \
|
||||||
Id Module::opcode(Id result_type, Id sampled_image, Id coordinate, \
|
Id Module::opcode(Id result_type, Id sampled_image, Id coordinate, \
|
||||||
spv::ImageOperandsMask image_operands, Id lod, \
|
spv::ImageOperandsMask image_operands, const std::vector<Id>& operands) { \
|
||||||
const std::vector<Id>& operands) { \
|
|
||||||
auto op{std::make_unique<Op>(spv::Op::opcode, bound++, result_type)}; \
|
auto op{std::make_unique<Op>(spv::Op::opcode, bound++, result_type)}; \
|
||||||
op->Add(sampled_image); \
|
op->Add(sampled_image); \
|
||||||
op->Add(coordinate); \
|
op->Add(coordinate); \
|
||||||
op->Add(static_cast<u32>(image_operands)); \
|
op->Add(static_cast<u32>(image_operands)); \
|
||||||
op->Add(lod); \
|
|
||||||
op->Add(operands); \
|
op->Add(operands); \
|
||||||
return AddCode(std::move(op)); \
|
return AddCode(std::move(op)); \
|
||||||
}
|
}
|
||||||
|
@ -56,14 +54,12 @@ static void AddImageOperands(Op* op, std::optional<spv::ImageOperandsMask> image
|
||||||
|
|
||||||
#define DEFINE_IMAGE_EXTRA_EXP_OP(opcode) \
|
#define DEFINE_IMAGE_EXTRA_EXP_OP(opcode) \
|
||||||
Id Module::opcode(Id result_type, Id sampled_image, Id coordinate, Id extra, \
|
Id Module::opcode(Id result_type, Id sampled_image, Id coordinate, Id extra, \
|
||||||
spv::ImageOperandsMask image_operands, Id lod, \
|
spv::ImageOperandsMask image_operands, const std::vector<Id>& operands) { \
|
||||||
const std::vector<Id>& operands) { \
|
|
||||||
auto op{std::make_unique<Op>(spv::Op::opcode, bound++, result_type)}; \
|
auto op{std::make_unique<Op>(spv::Op::opcode, bound++, result_type)}; \
|
||||||
op->Add(sampled_image); \
|
op->Add(sampled_image); \
|
||||||
op->Add(coordinate); \
|
op->Add(coordinate); \
|
||||||
op->Add(extra); \
|
op->Add(extra); \
|
||||||
op->Add(static_cast<u32>(image_operands)); \
|
op->Add(static_cast<u32>(image_operands)); \
|
||||||
op->Add(lod); \
|
|
||||||
op->Add(operands); \
|
op->Add(operands); \
|
||||||
return AddCode(std::move(op)); \
|
return AddCode(std::move(op)); \
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue