[*] Which shitlicker thought mixing tabs and spaces everywhere was a good idea?
This commit is contained in:
parent
ad5308af71
commit
48a4ee0a35
612
spirv_cfg.cpp
612
spirv_cfg.cpp
@ -34,323 +34,323 @@ CFG::CFG(Compiler &compiler_, const SPIRFunction &func_)
|
|||||||
: compiler(compiler_)
|
: compiler(compiler_)
|
||||||
, func(func_)
|
, func(func_)
|
||||||
{
|
{
|
||||||
build_post_order_visit_order();
|
build_post_order_visit_order();
|
||||||
build_immediate_dominators();
|
build_immediate_dominators();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CFG::find_common_dominator(uint32_t a, uint32_t b) const
|
uint32_t CFG::find_common_dominator(uint32_t a, uint32_t b) const
|
||||||
{
|
{
|
||||||
while (a != b)
|
while (a != b)
|
||||||
{
|
{
|
||||||
if (get_visit_order(a) < get_visit_order(b))
|
if (get_visit_order(a) < get_visit_order(b))
|
||||||
a = get_immediate_dominator(a);
|
a = get_immediate_dominator(a);
|
||||||
else
|
else
|
||||||
b = get_immediate_dominator(b);
|
b = get_immediate_dominator(b);
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFG::build_immediate_dominators()
|
void CFG::build_immediate_dominators()
|
||||||
{
|
{
|
||||||
// Traverse the post-order in reverse and build up the immediate dominator tree.
|
// Traverse the post-order in reverse and build up the immediate dominator tree.
|
||||||
immediate_dominators.clear();
|
immediate_dominators.clear();
|
||||||
immediate_dominators[func.entry_block] = func.entry_block;
|
immediate_dominators[func.entry_block] = func.entry_block;
|
||||||
|
|
||||||
for (auto i = post_order.size(); i; i--)
|
for (auto i = post_order.size(); i; i--)
|
||||||
{
|
{
|
||||||
uint32_t block = post_order[i - 1];
|
uint32_t block = post_order[i - 1];
|
||||||
auto &pred = preceding_edges[block];
|
auto &pred = preceding_edges[block];
|
||||||
if (pred.empty()) // This is for the entry block, but we've already set up the dominators.
|
if (pred.empty()) // This is for the entry block, but we've already set up the dominators.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto &edge : pred)
|
for (auto &edge : pred)
|
||||||
{
|
{
|
||||||
if (immediate_dominators[block])
|
if (immediate_dominators[block])
|
||||||
{
|
{
|
||||||
assert(immediate_dominators[edge]);
|
assert(immediate_dominators[edge]);
|
||||||
immediate_dominators[block] = find_common_dominator(immediate_dominators[block], edge);
|
immediate_dominators[block] = find_common_dominator(immediate_dominators[block], edge);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
immediate_dominators[block] = edge;
|
immediate_dominators[block] = edge;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFG::is_back_edge(uint32_t to) const
|
bool CFG::is_back_edge(uint32_t to) const
|
||||||
{
|
{
|
||||||
// We have a back edge if the visit order is set with the temporary magic value 0.
|
// We have a back edge if the visit order is set with the temporary magic value 0.
|
||||||
// Crossing edges will have already been recorded with a visit order.
|
// Crossing edges will have already been recorded with a visit order.
|
||||||
auto itr = visit_order.find(to);
|
auto itr = visit_order.find(to);
|
||||||
return itr != end(visit_order) && itr->second.get() == 0;
|
return itr != end(visit_order) && itr->second.get() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFG::has_visited_forward_edge(uint32_t to) const
|
bool CFG::has_visited_forward_edge(uint32_t to) const
|
||||||
{
|
{
|
||||||
// If > 0, we have visited the edge already, and this is not a back edge branch.
|
// If > 0, we have visited the edge already, and this is not a back edge branch.
|
||||||
auto itr = visit_order.find(to);
|
auto itr = visit_order.find(to);
|
||||||
return itr != end(visit_order) && itr->second.get() > 0;
|
return itr != end(visit_order) && itr->second.get() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFG::post_order_visit(uint32_t block_id)
|
bool CFG::post_order_visit(uint32_t block_id)
|
||||||
{
|
{
|
||||||
// If we have already branched to this block (back edge), stop recursion.
|
// If we have already branched to this block (back edge), stop recursion.
|
||||||
// If our branches are back-edges, we do not record them.
|
// If our branches are back-edges, we do not record them.
|
||||||
// We have to record crossing edges however.
|
// We have to record crossing edges however.
|
||||||
if (has_visited_forward_edge(block_id))
|
if (has_visited_forward_edge(block_id))
|
||||||
return true;
|
return true;
|
||||||
else if (is_back_edge(block_id))
|
else if (is_back_edge(block_id))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Block back-edges from recursively revisiting ourselves.
|
// Block back-edges from recursively revisiting ourselves.
|
||||||
visit_order[block_id].get() = 0;
|
visit_order[block_id].get() = 0;
|
||||||
|
|
||||||
auto &block = compiler.get<SPIRBlock>(block_id);
|
auto &block = compiler.get<SPIRBlock>(block_id);
|
||||||
|
|
||||||
// If this is a loop header, add an implied branch to the merge target.
|
// If this is a loop header, add an implied branch to the merge target.
|
||||||
// This is needed to avoid annoying cases with do { ... } while(false) loops often generated by inliners.
|
// This is needed to avoid annoying cases with do { ... } while(false) loops often generated by inliners.
|
||||||
// To the CFG, this is linear control flow, but we risk picking the do/while scope as our dominating block.
|
// To the CFG, this is linear control flow, but we risk picking the do/while scope as our dominating block.
|
||||||
// This makes sure that if we are accessing a variable outside the do/while, we choose the loop header as dominator.
|
// This makes sure that if we are accessing a variable outside the do/while, we choose the loop header as dominator.
|
||||||
// We could use has_visited_forward_edge, but this break code-gen where the merge block is unreachable in the CFG.
|
// We could use has_visited_forward_edge, but this break code-gen where the merge block is unreachable in the CFG.
|
||||||
|
|
||||||
// Make a point out of visiting merge target first. This is to make sure that post visit order outside the loop
|
// Make a point out of visiting merge target first. This is to make sure that post visit order outside the loop
|
||||||
// is lower than inside the loop, which is going to be key for some traversal algorithms like post-dominance analysis.
|
// is lower than inside the loop, which is going to be key for some traversal algorithms like post-dominance analysis.
|
||||||
// For selection constructs true/false blocks will end up visiting the merge block directly and it works out fine,
|
// For selection constructs true/false blocks will end up visiting the merge block directly and it works out fine,
|
||||||
// but for loops, only the header might end up actually branching to merge block.
|
// but for loops, only the header might end up actually branching to merge block.
|
||||||
if (block.merge == SPIRBlock::MergeLoop && post_order_visit(block.merge_block))
|
if (block.merge == SPIRBlock::MergeLoop && post_order_visit(block.merge_block))
|
||||||
add_branch(block_id, block.merge_block);
|
add_branch(block_id, block.merge_block);
|
||||||
|
|
||||||
// First visit our branch targets.
|
// First visit our branch targets.
|
||||||
switch (block.terminator)
|
switch (block.terminator)
|
||||||
{
|
{
|
||||||
case SPIRBlock::Direct:
|
case SPIRBlock::Direct:
|
||||||
if (post_order_visit(block.next_block))
|
if (post_order_visit(block.next_block))
|
||||||
add_branch(block_id, block.next_block);
|
add_branch(block_id, block.next_block);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPIRBlock::Select:
|
case SPIRBlock::Select:
|
||||||
if (post_order_visit(block.true_block))
|
if (post_order_visit(block.true_block))
|
||||||
add_branch(block_id, block.true_block);
|
add_branch(block_id, block.true_block);
|
||||||
if (post_order_visit(block.false_block))
|
if (post_order_visit(block.false_block))
|
||||||
add_branch(block_id, block.false_block);
|
add_branch(block_id, block.false_block);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPIRBlock::MultiSelect:
|
case SPIRBlock::MultiSelect:
|
||||||
{
|
{
|
||||||
const auto &cases = compiler.get_case_list(block);
|
const auto &cases = compiler.get_case_list(block);
|
||||||
for (const auto &target : cases)
|
for (const auto &target : cases)
|
||||||
{
|
{
|
||||||
if (post_order_visit(target.block))
|
if (post_order_visit(target.block))
|
||||||
add_branch(block_id, target.block);
|
add_branch(block_id, target.block);
|
||||||
}
|
}
|
||||||
if (block.default_block && post_order_visit(block.default_block))
|
if (block.default_block && post_order_visit(block.default_block))
|
||||||
add_branch(block_id, block.default_block);
|
add_branch(block_id, block.default_block);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this is a selection merge, add an implied branch to the merge target.
|
// If this is a selection merge, add an implied branch to the merge target.
|
||||||
// This is needed to avoid cases where an inner branch dominates the outer branch.
|
// This is needed to avoid cases where an inner branch dominates the outer branch.
|
||||||
// This can happen if one of the branches exit early, e.g.:
|
// This can happen if one of the branches exit early, e.g.:
|
||||||
// if (cond) { ...; break; } else { var = 100 } use_var(var);
|
// if (cond) { ...; break; } else { var = 100 } use_var(var);
|
||||||
// We can use the variable without a Phi since there is only one possible parent here.
|
// We can use the variable without a Phi since there is only one possible parent here.
|
||||||
// However, in this case, we need to hoist out the inner variable to outside the branch.
|
// However, in this case, we need to hoist out the inner variable to outside the branch.
|
||||||
// Use same strategy as loops.
|
// Use same strategy as loops.
|
||||||
if (block.merge == SPIRBlock::MergeSelection && post_order_visit(block.next_block))
|
if (block.merge == SPIRBlock::MergeSelection && post_order_visit(block.next_block))
|
||||||
{
|
{
|
||||||
// If there is only one preceding edge to the merge block and it's not ourselves, we need a fixup.
|
// If there is only one preceding edge to the merge block and it's not ourselves, we need a fixup.
|
||||||
// Add a fake branch so any dominator in either the if (), or else () block, or a lone case statement
|
// Add a fake branch so any dominator in either the if (), or else () block, or a lone case statement
|
||||||
// will be hoisted out to outside the selection merge.
|
// will be hoisted out to outside the selection merge.
|
||||||
// If size > 1, the variable will be automatically hoisted, so we should not mess with it.
|
// If size > 1, the variable will be automatically hoisted, so we should not mess with it.
|
||||||
// The exception here is switch blocks, where we can have multiple edges to merge block,
|
// The exception here is switch blocks, where we can have multiple edges to merge block,
|
||||||
// all coming from same scope, so be more conservative in this case.
|
// all coming from same scope, so be more conservative in this case.
|
||||||
// Adding fake branches unconditionally breaks parameter preservation analysis,
|
// Adding fake branches unconditionally breaks parameter preservation analysis,
|
||||||
// which looks at how variables are accessed through the CFG.
|
// which looks at how variables are accessed through the CFG.
|
||||||
auto pred_itr = preceding_edges.find(block.next_block);
|
auto pred_itr = preceding_edges.find(block.next_block);
|
||||||
if (pred_itr != end(preceding_edges))
|
if (pred_itr != end(preceding_edges))
|
||||||
{
|
{
|
||||||
auto &pred = pred_itr->second;
|
auto &pred = pred_itr->second;
|
||||||
auto succ_itr = succeeding_edges.find(block_id);
|
auto succ_itr = succeeding_edges.find(block_id);
|
||||||
size_t num_succeeding_edges = 0;
|
size_t num_succeeding_edges = 0;
|
||||||
if (succ_itr != end(succeeding_edges))
|
if (succ_itr != end(succeeding_edges))
|
||||||
num_succeeding_edges = succ_itr->second.size();
|
num_succeeding_edges = succ_itr->second.size();
|
||||||
|
|
||||||
if (block.terminator == SPIRBlock::MultiSelect && num_succeeding_edges == 1)
|
if (block.terminator == SPIRBlock::MultiSelect && num_succeeding_edges == 1)
|
||||||
{
|
{
|
||||||
// Multiple branches can come from the same scope due to "break;", so we need to assume that all branches
|
// Multiple branches can come from the same scope due to "break;", so we need to assume that all branches
|
||||||
// come from same case scope in worst case, even if there are multiple preceding edges.
|
// come from same case scope in worst case, even if there are multiple preceding edges.
|
||||||
// If we have more than one succeeding edge from the block header, it should be impossible
|
// If we have more than one succeeding edge from the block header, it should be impossible
|
||||||
// to have a dominator be inside the block.
|
// to have a dominator be inside the block.
|
||||||
// Only case this can go wrong is if we have 2 or more edges from block header and
|
// Only case this can go wrong is if we have 2 or more edges from block header and
|
||||||
// 2 or more edges to merge block, and still have dominator be inside a case label.
|
// 2 or more edges to merge block, and still have dominator be inside a case label.
|
||||||
if (!pred.empty())
|
if (!pred.empty())
|
||||||
add_branch(block_id, block.next_block);
|
add_branch(block_id, block.next_block);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pred.size() == 1 && *pred.begin() != block_id)
|
if (pred.size() == 1 && *pred.begin() != block_id)
|
||||||
add_branch(block_id, block.next_block);
|
add_branch(block_id, block.next_block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If the merge block does not have any preceding edges, i.e. unreachable, hallucinate it.
|
// If the merge block does not have any preceding edges, i.e. unreachable, hallucinate it.
|
||||||
// We're going to do code-gen for it, and domination analysis requires that we have at least one preceding edge.
|
// We're going to do code-gen for it, and domination analysis requires that we have at least one preceding edge.
|
||||||
add_branch(block_id, block.next_block);
|
add_branch(block_id, block.next_block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then visit ourselves. Start counting at one, to let 0 be a magic value for testing back vs. crossing edges.
|
// Then visit ourselves. Start counting at one, to let 0 be a magic value for testing back vs. crossing edges.
|
||||||
visit_order[block_id].get() = ++visit_count;
|
visit_order[block_id].get() = ++visit_count;
|
||||||
post_order.push_back(block_id);
|
post_order.push_back(block_id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFG::build_post_order_visit_order()
|
void CFG::build_post_order_visit_order()
|
||||||
{
|
{
|
||||||
uint32_t block = func.entry_block;
|
uint32_t block = func.entry_block;
|
||||||
visit_count = 0;
|
visit_count = 0;
|
||||||
visit_order.clear();
|
visit_order.clear();
|
||||||
post_order.clear();
|
post_order.clear();
|
||||||
post_order_visit(block);
|
post_order_visit(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFG::add_branch(uint32_t from, uint32_t to)
|
void CFG::add_branch(uint32_t from, uint32_t to)
|
||||||
{
|
{
|
||||||
const auto add_unique = [](SmallVector<uint32_t> &l, uint32_t value) {
|
const auto add_unique = [](SmallVector<uint32_t> &l, uint32_t value) {
|
||||||
auto itr = find(begin(l), end(l), value);
|
auto itr = find(begin(l), end(l), value);
|
||||||
if (itr == end(l))
|
if (itr == end(l))
|
||||||
l.push_back(value);
|
l.push_back(value);
|
||||||
};
|
};
|
||||||
add_unique(preceding_edges[to], from);
|
add_unique(preceding_edges[to], from);
|
||||||
add_unique(succeeding_edges[from], to);
|
add_unique(succeeding_edges[from], to);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CFG::find_loop_dominator(uint32_t block_id) const
|
uint32_t CFG::find_loop_dominator(uint32_t block_id) const
|
||||||
{
|
{
|
||||||
while (block_id != SPIRBlock::NoDominator)
|
while (block_id != SPIRBlock::NoDominator)
|
||||||
{
|
{
|
||||||
auto itr = preceding_edges.find(block_id);
|
auto itr = preceding_edges.find(block_id);
|
||||||
if (itr == end(preceding_edges))
|
if (itr == end(preceding_edges))
|
||||||
return SPIRBlock::NoDominator;
|
return SPIRBlock::NoDominator;
|
||||||
if (itr->second.empty())
|
if (itr->second.empty())
|
||||||
return SPIRBlock::NoDominator;
|
return SPIRBlock::NoDominator;
|
||||||
|
|
||||||
uint32_t pred_block_id = SPIRBlock::NoDominator;
|
uint32_t pred_block_id = SPIRBlock::NoDominator;
|
||||||
bool ignore_loop_header = false;
|
bool ignore_loop_header = false;
|
||||||
|
|
||||||
// If we are a merge block, go directly to the header block.
|
// If we are a merge block, go directly to the header block.
|
||||||
// Only consider a loop dominator if we are branching from inside a block to a loop header.
|
// Only consider a loop dominator if we are branching from inside a block to a loop header.
|
||||||
// NOTE: In the CFG we forced an edge from header to merge block always to support variable scopes properly.
|
// NOTE: In the CFG we forced an edge from header to merge block always to support variable scopes properly.
|
||||||
for (auto &pred : itr->second)
|
for (auto &pred : itr->second)
|
||||||
{
|
{
|
||||||
auto &pred_block = compiler.get<SPIRBlock>(pred);
|
auto &pred_block = compiler.get<SPIRBlock>(pred);
|
||||||
if (pred_block.merge == SPIRBlock::MergeLoop && pred_block.merge_block == ID(block_id))
|
if (pred_block.merge == SPIRBlock::MergeLoop && pred_block.merge_block == ID(block_id))
|
||||||
{
|
{
|
||||||
pred_block_id = pred;
|
pred_block_id = pred;
|
||||||
ignore_loop_header = true;
|
ignore_loop_header = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (pred_block.merge == SPIRBlock::MergeSelection && pred_block.next_block == ID(block_id))
|
else if (pred_block.merge == SPIRBlock::MergeSelection && pred_block.next_block == ID(block_id))
|
||||||
{
|
{
|
||||||
pred_block_id = pred;
|
pred_block_id = pred;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// No merge block means we can just pick any edge. Loop headers dominate the inner loop, so any path we
|
// No merge block means we can just pick any edge. Loop headers dominate the inner loop, so any path we
|
||||||
// take will lead there.
|
// take will lead there.
|
||||||
if (pred_block_id == SPIRBlock::NoDominator)
|
if (pred_block_id == SPIRBlock::NoDominator)
|
||||||
pred_block_id = itr->second.front();
|
pred_block_id = itr->second.front();
|
||||||
|
|
||||||
block_id = pred_block_id;
|
block_id = pred_block_id;
|
||||||
|
|
||||||
if (!ignore_loop_header && block_id)
|
if (!ignore_loop_header && block_id)
|
||||||
{
|
{
|
||||||
auto &block = compiler.get<SPIRBlock>(block_id);
|
auto &block = compiler.get<SPIRBlock>(block_id);
|
||||||
if (block.merge == SPIRBlock::MergeLoop)
|
if (block.merge == SPIRBlock::MergeLoop)
|
||||||
return block_id;
|
return block_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return block_id;
|
return block_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFG::node_terminates_control_flow_in_sub_graph(BlockID from, BlockID to) const
|
bool CFG::node_terminates_control_flow_in_sub_graph(BlockID from, BlockID to) const
|
||||||
{
|
{
|
||||||
// Walk backwards, starting from "to" block.
|
// Walk backwards, starting from "to" block.
|
||||||
// Only follow pred edges if they have a 1:1 relationship, or a merge relationship.
|
// Only follow pred edges if they have a 1:1 relationship, or a merge relationship.
|
||||||
// If we cannot find a path to "from", we must assume that to is inside control flow in some way.
|
// If we cannot find a path to "from", we must assume that to is inside control flow in some way.
|
||||||
|
|
||||||
auto &from_block = compiler.get<SPIRBlock>(from);
|
auto &from_block = compiler.get<SPIRBlock>(from);
|
||||||
BlockID ignore_block_id = 0;
|
BlockID ignore_block_id = 0;
|
||||||
if (from_block.merge == SPIRBlock::MergeLoop)
|
if (from_block.merge == SPIRBlock::MergeLoop)
|
||||||
ignore_block_id = from_block.merge_block;
|
ignore_block_id = from_block.merge_block;
|
||||||
|
|
||||||
while (to != from)
|
while (to != from)
|
||||||
{
|
{
|
||||||
auto pred_itr = preceding_edges.find(to);
|
auto pred_itr = preceding_edges.find(to);
|
||||||
if (pred_itr == end(preceding_edges))
|
if (pred_itr == end(preceding_edges))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DominatorBuilder builder(*this);
|
DominatorBuilder builder(*this);
|
||||||
for (auto &edge : pred_itr->second)
|
for (auto &edge : pred_itr->second)
|
||||||
builder.add_block(edge);
|
builder.add_block(edge);
|
||||||
|
|
||||||
uint32_t dominator = builder.get_dominator();
|
uint32_t dominator = builder.get_dominator();
|
||||||
if (dominator == 0)
|
if (dominator == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto &dom = compiler.get<SPIRBlock>(dominator);
|
auto &dom = compiler.get<SPIRBlock>(dominator);
|
||||||
|
|
||||||
bool true_path_ignore = false;
|
bool true_path_ignore = false;
|
||||||
bool false_path_ignore = false;
|
bool false_path_ignore = false;
|
||||||
|
|
||||||
bool merges_to_nothing = dom.merge == SPIRBlock::MergeNone ||
|
bool merges_to_nothing = dom.merge == SPIRBlock::MergeNone ||
|
||||||
(dom.merge == SPIRBlock::MergeSelection && dom.next_block &&
|
(dom.merge == SPIRBlock::MergeSelection && dom.next_block &&
|
||||||
compiler.get<SPIRBlock>(dom.next_block).terminator == SPIRBlock::Unreachable) ||
|
compiler.get<SPIRBlock>(dom.next_block).terminator == SPIRBlock::Unreachable) ||
|
||||||
(dom.merge == SPIRBlock::MergeLoop && dom.merge_block &&
|
(dom.merge == SPIRBlock::MergeLoop && dom.merge_block &&
|
||||||
compiler.get<SPIRBlock>(dom.merge_block).terminator == SPIRBlock::Unreachable);
|
compiler.get<SPIRBlock>(dom.merge_block).terminator == SPIRBlock::Unreachable);
|
||||||
|
|
||||||
if (dom.self == from || merges_to_nothing)
|
if (dom.self == from || merges_to_nothing)
|
||||||
{
|
{
|
||||||
// We can only ignore inner branchy paths if there is no merge,
|
// We can only ignore inner branchy paths if there is no merge,
|
||||||
// i.e. no code is generated afterwards. E.g. this allows us to elide continue:
|
// i.e. no code is generated afterwards. E.g. this allows us to elide continue:
|
||||||
// for (;;) { if (cond) { continue; } else { break; } }.
|
// for (;;) { if (cond) { continue; } else { break; } }.
|
||||||
// Codegen here in SPIR-V will be something like either no merge if one path directly breaks, or
|
// Codegen here in SPIR-V will be something like either no merge if one path directly breaks, or
|
||||||
// we merge to Unreachable.
|
// we merge to Unreachable.
|
||||||
if (ignore_block_id && dom.terminator == SPIRBlock::Select)
|
if (ignore_block_id && dom.terminator == SPIRBlock::Select)
|
||||||
{
|
{
|
||||||
auto &true_block = compiler.get<SPIRBlock>(dom.true_block);
|
auto &true_block = compiler.get<SPIRBlock>(dom.true_block);
|
||||||
auto &false_block = compiler.get<SPIRBlock>(dom.false_block);
|
auto &false_block = compiler.get<SPIRBlock>(dom.false_block);
|
||||||
auto &ignore_block = compiler.get<SPIRBlock>(ignore_block_id);
|
auto &ignore_block = compiler.get<SPIRBlock>(ignore_block_id);
|
||||||
true_path_ignore = compiler.execution_is_branchless(true_block, ignore_block);
|
true_path_ignore = compiler.execution_is_branchless(true_block, ignore_block);
|
||||||
false_path_ignore = compiler.execution_is_branchless(false_block, ignore_block);
|
false_path_ignore = compiler.execution_is_branchless(false_block, ignore_block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cases where we allow traversal. This serves as a proxy for post-dominance in a loop body.
|
// Cases where we allow traversal. This serves as a proxy for post-dominance in a loop body.
|
||||||
// TODO: Might want to do full post-dominance analysis, but it's a lot of churn for something like this ...
|
// TODO: Might want to do full post-dominance analysis, but it's a lot of churn for something like this ...
|
||||||
// - We're the merge block of a selection construct. Jump to header.
|
// - We're the merge block of a selection construct. Jump to header.
|
||||||
// - We're the merge block of a loop. Jump to header.
|
// - We're the merge block of a loop. Jump to header.
|
||||||
// - Direct branch. Trivial.
|
// - Direct branch. Trivial.
|
||||||
// - Allow cases inside a branch if the header cannot merge execution before loop exit.
|
// - Allow cases inside a branch if the header cannot merge execution before loop exit.
|
||||||
if ((dom.merge == SPIRBlock::MergeSelection && dom.next_block == to) ||
|
if ((dom.merge == SPIRBlock::MergeSelection && dom.next_block == to) ||
|
||||||
(dom.merge == SPIRBlock::MergeLoop && dom.merge_block == to) ||
|
(dom.merge == SPIRBlock::MergeLoop && dom.merge_block == to) ||
|
||||||
(dom.terminator == SPIRBlock::Direct && dom.next_block == to) ||
|
(dom.terminator == SPIRBlock::Direct && dom.next_block == to) ||
|
||||||
(dom.terminator == SPIRBlock::Select && dom.true_block == to && false_path_ignore) ||
|
(dom.terminator == SPIRBlock::Select && dom.true_block == to && false_path_ignore) ||
|
||||||
(dom.terminator == SPIRBlock::Select && dom.false_block == to && true_path_ignore))
|
(dom.terminator == SPIRBlock::Select && dom.false_block == to && true_path_ignore))
|
||||||
{
|
{
|
||||||
// Allow walking selection constructs if the other branch reaches out of a loop construct.
|
// Allow walking selection constructs if the other branch reaches out of a loop construct.
|
||||||
// It cannot be in-scope anymore.
|
// It cannot be in-scope anymore.
|
||||||
to = dominator;
|
to = dominator;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DominatorBuilder::DominatorBuilder(const CFG &cfg_)
|
DominatorBuilder::DominatorBuilder(const CFG &cfg_)
|
||||||
@ -360,71 +360,71 @@ DominatorBuilder::DominatorBuilder(const CFG &cfg_)
|
|||||||
|
|
||||||
void DominatorBuilder::add_block(uint32_t block)
|
void DominatorBuilder::add_block(uint32_t block)
|
||||||
{
|
{
|
||||||
if (!cfg.get_immediate_dominator(block))
|
if (!cfg.get_immediate_dominator(block))
|
||||||
{
|
{
|
||||||
// Unreachable block via the CFG, we will never emit this code anyways.
|
// Unreachable block via the CFG, we will never emit this code anyways.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dominator)
|
if (!dominator)
|
||||||
{
|
{
|
||||||
dominator = block;
|
dominator = block;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block != dominator)
|
if (block != dominator)
|
||||||
dominator = cfg.find_common_dominator(block, dominator);
|
dominator = cfg.find_common_dominator(block, dominator);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DominatorBuilder::lift_continue_block_dominator()
|
void DominatorBuilder::lift_continue_block_dominator()
|
||||||
{
|
{
|
||||||
// It is possible for a continue block to be the dominator of a variable is only accessed inside the while block of a do-while loop.
|
// It is possible for a continue block to be the dominator of a variable is only accessed inside the while block of a do-while loop.
|
||||||
// We cannot safely declare variables inside a continue block, so move any variable declared
|
// We cannot safely declare variables inside a continue block, so move any variable declared
|
||||||
// in a continue block to the entry block to simplify.
|
// in a continue block to the entry block to simplify.
|
||||||
// It makes very little sense for a continue block to ever be a dominator, so fall back to the simplest
|
// It makes very little sense for a continue block to ever be a dominator, so fall back to the simplest
|
||||||
// solution.
|
// solution.
|
||||||
|
|
||||||
if (!dominator)
|
if (!dominator)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto &block = cfg.get_compiler().get<SPIRBlock>(dominator);
|
auto &block = cfg.get_compiler().get<SPIRBlock>(dominator);
|
||||||
auto post_order = cfg.get_visit_order(dominator);
|
auto post_order = cfg.get_visit_order(dominator);
|
||||||
|
|
||||||
// If we are branching to a block with a higher post-order traversal index (continue blocks), we have a problem
|
// If we are branching to a block with a higher post-order traversal index (continue blocks), we have a problem
|
||||||
// since we cannot create sensible GLSL code for this, fallback to entry block.
|
// since we cannot create sensible GLSL code for this, fallback to entry block.
|
||||||
bool back_edge_dominator = false;
|
bool back_edge_dominator = false;
|
||||||
switch (block.terminator)
|
switch (block.terminator)
|
||||||
{
|
{
|
||||||
case SPIRBlock::Direct:
|
case SPIRBlock::Direct:
|
||||||
if (cfg.get_visit_order(block.next_block) > post_order)
|
if (cfg.get_visit_order(block.next_block) > post_order)
|
||||||
back_edge_dominator = true;
|
back_edge_dominator = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPIRBlock::Select:
|
case SPIRBlock::Select:
|
||||||
if (cfg.get_visit_order(block.true_block) > post_order)
|
if (cfg.get_visit_order(block.true_block) > post_order)
|
||||||
back_edge_dominator = true;
|
back_edge_dominator = true;
|
||||||
if (cfg.get_visit_order(block.false_block) > post_order)
|
if (cfg.get_visit_order(block.false_block) > post_order)
|
||||||
back_edge_dominator = true;
|
back_edge_dominator = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPIRBlock::MultiSelect:
|
case SPIRBlock::MultiSelect:
|
||||||
{
|
{
|
||||||
auto &cases = cfg.get_compiler().get_case_list(block);
|
auto &cases = cfg.get_compiler().get_case_list(block);
|
||||||
for (auto &target : cases)
|
for (auto &target : cases)
|
||||||
{
|
{
|
||||||
if (cfg.get_visit_order(target.block) > post_order)
|
if (cfg.get_visit_order(target.block) > post_order)
|
||||||
back_edge_dominator = true;
|
back_edge_dominator = true;
|
||||||
}
|
}
|
||||||
if (block.default_block && cfg.get_visit_order(block.default_block) > post_order)
|
if (block.default_block && cfg.get_visit_order(block.default_block) > post_order)
|
||||||
back_edge_dominator = true;
|
back_edge_dominator = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (back_edge_dominator)
|
if (back_edge_dominator)
|
||||||
dominator = cfg.get_function().entry_block;
|
dominator = cfg.get_function().entry_block;
|
||||||
}
|
}
|
||||||
} // namespace SPIRV_CROSS_NAMESPACE
|
} // namespace SPIRV_CROSS_NAMESPACE
|
||||||
|
2704
spirv_common.hpp
2704
spirv_common.hpp
File diff suppressed because it is too large
Load Diff
8100
spirv_cross.cpp
8100
spirv_cross.cpp
File diff suppressed because it is too large
Load Diff
678
spirv_cross_c.h
678
spirv_cross_c.h
@ -93,63 +93,63 @@ typedef SpvId spvc_constant_id;
|
|||||||
/* See C++ API. */
|
/* See C++ API. */
|
||||||
typedef struct spvc_reflected_resource
|
typedef struct spvc_reflected_resource
|
||||||
{
|
{
|
||||||
spvc_variable_id id;
|
spvc_variable_id id;
|
||||||
spvc_type_id base_type_id;
|
spvc_type_id base_type_id;
|
||||||
spvc_type_id type_id;
|
spvc_type_id type_id;
|
||||||
const char *name;
|
const char *name;
|
||||||
} spvc_reflected_resource;
|
} spvc_reflected_resource;
|
||||||
|
|
||||||
typedef struct spvc_reflected_builtin_resource
|
typedef struct spvc_reflected_builtin_resource
|
||||||
{
|
{
|
||||||
SpvBuiltIn builtin;
|
SpvBuiltIn builtin;
|
||||||
spvc_type_id value_type_id;
|
spvc_type_id value_type_id;
|
||||||
spvc_reflected_resource resource;
|
spvc_reflected_resource resource;
|
||||||
} spvc_reflected_builtin_resource;
|
} spvc_reflected_builtin_resource;
|
||||||
|
|
||||||
/* See C++ API. */
|
/* See C++ API. */
|
||||||
typedef struct spvc_entry_point
|
typedef struct spvc_entry_point
|
||||||
{
|
{
|
||||||
SpvExecutionModel execution_model;
|
SpvExecutionModel execution_model;
|
||||||
const char *name;
|
const char *name;
|
||||||
} spvc_entry_point;
|
} spvc_entry_point;
|
||||||
|
|
||||||
/* See C++ API. */
|
/* See C++ API. */
|
||||||
typedef struct spvc_combined_image_sampler
|
typedef struct spvc_combined_image_sampler
|
||||||
{
|
{
|
||||||
spvc_variable_id combined_id;
|
spvc_variable_id combined_id;
|
||||||
spvc_variable_id image_id;
|
spvc_variable_id image_id;
|
||||||
spvc_variable_id sampler_id;
|
spvc_variable_id sampler_id;
|
||||||
} spvc_combined_image_sampler;
|
} spvc_combined_image_sampler;
|
||||||
|
|
||||||
/* See C++ API. */
|
/* See C++ API. */
|
||||||
typedef struct spvc_specialization_constant
|
typedef struct spvc_specialization_constant
|
||||||
{
|
{
|
||||||
spvc_constant_id id;
|
spvc_constant_id id;
|
||||||
unsigned constant_id;
|
unsigned constant_id;
|
||||||
} spvc_specialization_constant;
|
} spvc_specialization_constant;
|
||||||
|
|
||||||
/* See C++ API. */
|
/* See C++ API. */
|
||||||
typedef struct spvc_buffer_range
|
typedef struct spvc_buffer_range
|
||||||
{
|
{
|
||||||
unsigned index;
|
unsigned index;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
size_t range;
|
size_t range;
|
||||||
} spvc_buffer_range;
|
} spvc_buffer_range;
|
||||||
|
|
||||||
/* See C++ API. */
|
/* See C++ API. */
|
||||||
typedef struct spvc_hlsl_root_constants
|
typedef struct spvc_hlsl_root_constants
|
||||||
{
|
{
|
||||||
unsigned start;
|
unsigned start;
|
||||||
unsigned end;
|
unsigned end;
|
||||||
unsigned binding;
|
unsigned binding;
|
||||||
unsigned space;
|
unsigned space;
|
||||||
} spvc_hlsl_root_constants;
|
} spvc_hlsl_root_constants;
|
||||||
|
|
||||||
/* See C++ API. */
|
/* See C++ API. */
|
||||||
typedef struct spvc_hlsl_vertex_attribute_remap
|
typedef struct spvc_hlsl_vertex_attribute_remap
|
||||||
{
|
{
|
||||||
unsigned location;
|
unsigned location;
|
||||||
const char *semantic;
|
const char *semantic;
|
||||||
} spvc_hlsl_vertex_attribute_remap;
|
} spvc_hlsl_vertex_attribute_remap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -163,105 +163,105 @@ typedef unsigned char spvc_bool;
|
|||||||
|
|
||||||
typedef enum spvc_result
|
typedef enum spvc_result
|
||||||
{
|
{
|
||||||
/* Success. */
|
/* Success. */
|
||||||
SPVC_SUCCESS = 0,
|
SPVC_SUCCESS = 0,
|
||||||
|
|
||||||
/* The SPIR-V is invalid. Should have been caught by validation ideally. */
|
/* The SPIR-V is invalid. Should have been caught by validation ideally. */
|
||||||
SPVC_ERROR_INVALID_SPIRV = -1,
|
SPVC_ERROR_INVALID_SPIRV = -1,
|
||||||
|
|
||||||
/* The SPIR-V might be valid or invalid, but SPIRV-Cross currently cannot correctly translate this to your target language. */
|
/* The SPIR-V might be valid or invalid, but SPIRV-Cross currently cannot correctly translate this to your target language. */
|
||||||
SPVC_ERROR_UNSUPPORTED_SPIRV = -2,
|
SPVC_ERROR_UNSUPPORTED_SPIRV = -2,
|
||||||
|
|
||||||
/* If for some reason we hit this, new or malloc failed. */
|
/* If for some reason we hit this, new or malloc failed. */
|
||||||
SPVC_ERROR_OUT_OF_MEMORY = -3,
|
SPVC_ERROR_OUT_OF_MEMORY = -3,
|
||||||
|
|
||||||
/* Invalid API argument. */
|
/* Invalid API argument. */
|
||||||
SPVC_ERROR_INVALID_ARGUMENT = -4,
|
SPVC_ERROR_INVALID_ARGUMENT = -4,
|
||||||
|
|
||||||
SPVC_ERROR_INT_MAX = 0x7fffffff
|
SPVC_ERROR_INT_MAX = 0x7fffffff
|
||||||
} spvc_result;
|
} spvc_result;
|
||||||
|
|
||||||
typedef enum spvc_capture_mode
|
typedef enum spvc_capture_mode
|
||||||
{
|
{
|
||||||
/* The Parsed IR payload will be copied, and the handle can be reused to create other compiler instances. */
|
/* The Parsed IR payload will be copied, and the handle can be reused to create other compiler instances. */
|
||||||
SPVC_CAPTURE_MODE_COPY = 0,
|
SPVC_CAPTURE_MODE_COPY = 0,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The payload will now be owned by the compiler.
|
* The payload will now be owned by the compiler.
|
||||||
* parsed_ir should now be considered a dead blob and must not be used further.
|
* parsed_ir should now be considered a dead blob and must not be used further.
|
||||||
* This is optimal for performance and should be the go-to option.
|
* This is optimal for performance and should be the go-to option.
|
||||||
*/
|
*/
|
||||||
SPVC_CAPTURE_MODE_TAKE_OWNERSHIP = 1,
|
SPVC_CAPTURE_MODE_TAKE_OWNERSHIP = 1,
|
||||||
|
|
||||||
SPVC_CAPTURE_MODE_INT_MAX = 0x7fffffff
|
SPVC_CAPTURE_MODE_INT_MAX = 0x7fffffff
|
||||||
} spvc_capture_mode;
|
} spvc_capture_mode;
|
||||||
|
|
||||||
typedef enum spvc_backend
|
typedef enum spvc_backend
|
||||||
{
|
{
|
||||||
/* This backend can only perform reflection, no compiler options are supported. Maps to spirv_cross::Compiler. */
|
/* This backend can only perform reflection, no compiler options are supported. Maps to spirv_cross::Compiler. */
|
||||||
SPVC_BACKEND_NONE = 0,
|
SPVC_BACKEND_NONE = 0,
|
||||||
SPVC_BACKEND_GLSL = 1, /* spirv_cross::CompilerGLSL */
|
SPVC_BACKEND_GLSL = 1, /* spirv_cross::CompilerGLSL */
|
||||||
SPVC_BACKEND_HLSL = 2, /* CompilerHLSL */
|
SPVC_BACKEND_HLSL = 2, /* CompilerHLSL */
|
||||||
SPVC_BACKEND_MSL = 3, /* CompilerMSL */
|
SPVC_BACKEND_MSL = 3, /* CompilerMSL */
|
||||||
SPVC_BACKEND_CPP = 4, /* CompilerCPP */
|
SPVC_BACKEND_CPP = 4, /* CompilerCPP */
|
||||||
SPVC_BACKEND_JSON = 5, /* CompilerReflection w/ JSON backend */
|
SPVC_BACKEND_JSON = 5, /* CompilerReflection w/ JSON backend */
|
||||||
SPVC_BACKEND_INT_MAX = 0x7fffffff
|
SPVC_BACKEND_INT_MAX = 0x7fffffff
|
||||||
} spvc_backend;
|
} spvc_backend;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_resource_type
|
typedef enum spvc_resource_type
|
||||||
{
|
{
|
||||||
SPVC_RESOURCE_TYPE_UNKNOWN = 0,
|
SPVC_RESOURCE_TYPE_UNKNOWN = 0,
|
||||||
SPVC_RESOURCE_TYPE_UNIFORM_BUFFER = 1,
|
SPVC_RESOURCE_TYPE_UNIFORM_BUFFER = 1,
|
||||||
SPVC_RESOURCE_TYPE_STORAGE_BUFFER = 2,
|
SPVC_RESOURCE_TYPE_STORAGE_BUFFER = 2,
|
||||||
SPVC_RESOURCE_TYPE_STAGE_INPUT = 3,
|
SPVC_RESOURCE_TYPE_STAGE_INPUT = 3,
|
||||||
SPVC_RESOURCE_TYPE_STAGE_OUTPUT = 4,
|
SPVC_RESOURCE_TYPE_STAGE_OUTPUT = 4,
|
||||||
SPVC_RESOURCE_TYPE_SUBPASS_INPUT = 5,
|
SPVC_RESOURCE_TYPE_SUBPASS_INPUT = 5,
|
||||||
SPVC_RESOURCE_TYPE_STORAGE_IMAGE = 6,
|
SPVC_RESOURCE_TYPE_STORAGE_IMAGE = 6,
|
||||||
SPVC_RESOURCE_TYPE_SAMPLED_IMAGE = 7,
|
SPVC_RESOURCE_TYPE_SAMPLED_IMAGE = 7,
|
||||||
SPVC_RESOURCE_TYPE_ATOMIC_COUNTER = 8,
|
SPVC_RESOURCE_TYPE_ATOMIC_COUNTER = 8,
|
||||||
SPVC_RESOURCE_TYPE_PUSH_CONSTANT = 9,
|
SPVC_RESOURCE_TYPE_PUSH_CONSTANT = 9,
|
||||||
SPVC_RESOURCE_TYPE_SEPARATE_IMAGE = 10,
|
SPVC_RESOURCE_TYPE_SEPARATE_IMAGE = 10,
|
||||||
SPVC_RESOURCE_TYPE_SEPARATE_SAMPLERS = 11,
|
SPVC_RESOURCE_TYPE_SEPARATE_SAMPLERS = 11,
|
||||||
SPVC_RESOURCE_TYPE_ACCELERATION_STRUCTURE = 12,
|
SPVC_RESOURCE_TYPE_ACCELERATION_STRUCTURE = 12,
|
||||||
SPVC_RESOURCE_TYPE_RAY_QUERY = 13,
|
SPVC_RESOURCE_TYPE_RAY_QUERY = 13,
|
||||||
SPVC_RESOURCE_TYPE_SHADER_RECORD_BUFFER = 14,
|
SPVC_RESOURCE_TYPE_SHADER_RECORD_BUFFER = 14,
|
||||||
SPVC_RESOURCE_TYPE_INT_MAX = 0x7fffffff
|
SPVC_RESOURCE_TYPE_INT_MAX = 0x7fffffff
|
||||||
} spvc_resource_type;
|
} spvc_resource_type;
|
||||||
|
|
||||||
typedef enum spvc_builtin_resource_type
|
typedef enum spvc_builtin_resource_type
|
||||||
{
|
{
|
||||||
SPVC_BUILTIN_RESOURCE_TYPE_UNKNOWN = 0,
|
SPVC_BUILTIN_RESOURCE_TYPE_UNKNOWN = 0,
|
||||||
SPVC_BUILTIN_RESOURCE_TYPE_STAGE_INPUT = 1,
|
SPVC_BUILTIN_RESOURCE_TYPE_STAGE_INPUT = 1,
|
||||||
SPVC_BUILTIN_RESOURCE_TYPE_STAGE_OUTPUT = 2,
|
SPVC_BUILTIN_RESOURCE_TYPE_STAGE_OUTPUT = 2,
|
||||||
SPVC_BUILTIN_RESOURCE_TYPE_INT_MAX = 0x7fffffff
|
SPVC_BUILTIN_RESOURCE_TYPE_INT_MAX = 0x7fffffff
|
||||||
} spvc_builtin_resource_type;
|
} spvc_builtin_resource_type;
|
||||||
|
|
||||||
/* Maps to spirv_cross::SPIRType::BaseType. */
|
/* Maps to spirv_cross::SPIRType::BaseType. */
|
||||||
typedef enum spvc_basetype
|
typedef enum spvc_basetype
|
||||||
{
|
{
|
||||||
SPVC_BASETYPE_UNKNOWN = 0,
|
SPVC_BASETYPE_UNKNOWN = 0,
|
||||||
SPVC_BASETYPE_VOID = 1,
|
SPVC_BASETYPE_VOID = 1,
|
||||||
SPVC_BASETYPE_BOOLEAN = 2,
|
SPVC_BASETYPE_BOOLEAN = 2,
|
||||||
SPVC_BASETYPE_INT8 = 3,
|
SPVC_BASETYPE_INT8 = 3,
|
||||||
SPVC_BASETYPE_UINT8 = 4,
|
SPVC_BASETYPE_UINT8 = 4,
|
||||||
SPVC_BASETYPE_INT16 = 5,
|
SPVC_BASETYPE_INT16 = 5,
|
||||||
SPVC_BASETYPE_UINT16 = 6,
|
SPVC_BASETYPE_UINT16 = 6,
|
||||||
SPVC_BASETYPE_INT32 = 7,
|
SPVC_BASETYPE_INT32 = 7,
|
||||||
SPVC_BASETYPE_UINT32 = 8,
|
SPVC_BASETYPE_UINT32 = 8,
|
||||||
SPVC_BASETYPE_INT64 = 9,
|
SPVC_BASETYPE_INT64 = 9,
|
||||||
SPVC_BASETYPE_UINT64 = 10,
|
SPVC_BASETYPE_UINT64 = 10,
|
||||||
SPVC_BASETYPE_ATOMIC_COUNTER = 11,
|
SPVC_BASETYPE_ATOMIC_COUNTER = 11,
|
||||||
SPVC_BASETYPE_FP16 = 12,
|
SPVC_BASETYPE_FP16 = 12,
|
||||||
SPVC_BASETYPE_FP32 = 13,
|
SPVC_BASETYPE_FP32 = 13,
|
||||||
SPVC_BASETYPE_FP64 = 14,
|
SPVC_BASETYPE_FP64 = 14,
|
||||||
SPVC_BASETYPE_STRUCT = 15,
|
SPVC_BASETYPE_STRUCT = 15,
|
||||||
SPVC_BASETYPE_IMAGE = 16,
|
SPVC_BASETYPE_IMAGE = 16,
|
||||||
SPVC_BASETYPE_SAMPLED_IMAGE = 17,
|
SPVC_BASETYPE_SAMPLED_IMAGE = 17,
|
||||||
SPVC_BASETYPE_SAMPLER = 18,
|
SPVC_BASETYPE_SAMPLER = 18,
|
||||||
SPVC_BASETYPE_ACCELERATION_STRUCTURE = 19,
|
SPVC_BASETYPE_ACCELERATION_STRUCTURE = 19,
|
||||||
|
|
||||||
SPVC_BASETYPE_INT_MAX = 0x7fffffff
|
SPVC_BASETYPE_INT_MAX = 0x7fffffff
|
||||||
} spvc_basetype;
|
} spvc_basetype;
|
||||||
|
|
||||||
#define SPVC_COMPILER_OPTION_COMMON_BIT 0x1000000
|
#define SPVC_COMPILER_OPTION_COMMON_BIT 0x1000000
|
||||||
@ -276,59 +276,59 @@ typedef enum spvc_basetype
|
|||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_platform
|
typedef enum spvc_msl_platform
|
||||||
{
|
{
|
||||||
SPVC_MSL_PLATFORM_IOS = 0,
|
SPVC_MSL_PLATFORM_IOS = 0,
|
||||||
SPVC_MSL_PLATFORM_MACOS = 1,
|
SPVC_MSL_PLATFORM_MACOS = 1,
|
||||||
SPVC_MSL_PLATFORM_MAX_INT = 0x7fffffff
|
SPVC_MSL_PLATFORM_MAX_INT = 0x7fffffff
|
||||||
} spvc_msl_platform;
|
} spvc_msl_platform;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_index_type
|
typedef enum spvc_msl_index_type
|
||||||
{
|
{
|
||||||
SPVC_MSL_INDEX_TYPE_NONE = 0,
|
SPVC_MSL_INDEX_TYPE_NONE = 0,
|
||||||
SPVC_MSL_INDEX_TYPE_UINT16 = 1,
|
SPVC_MSL_INDEX_TYPE_UINT16 = 1,
|
||||||
SPVC_MSL_INDEX_TYPE_UINT32 = 2,
|
SPVC_MSL_INDEX_TYPE_UINT32 = 2,
|
||||||
SPVC_MSL_INDEX_TYPE_MAX_INT = 0x7fffffff
|
SPVC_MSL_INDEX_TYPE_MAX_INT = 0x7fffffff
|
||||||
} spvc_msl_index_type;
|
} spvc_msl_index_type;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_shader_variable_format
|
typedef enum spvc_msl_shader_variable_format
|
||||||
{
|
{
|
||||||
SPVC_MSL_SHADER_VARIABLE_FORMAT_OTHER = 0,
|
SPVC_MSL_SHADER_VARIABLE_FORMAT_OTHER = 0,
|
||||||
SPVC_MSL_SHADER_VARIABLE_FORMAT_UINT8 = 1,
|
SPVC_MSL_SHADER_VARIABLE_FORMAT_UINT8 = 1,
|
||||||
SPVC_MSL_SHADER_VARIABLE_FORMAT_UINT16 = 2,
|
SPVC_MSL_SHADER_VARIABLE_FORMAT_UINT16 = 2,
|
||||||
SPVC_MSL_SHADER_VARIABLE_FORMAT_ANY16 = 3,
|
SPVC_MSL_SHADER_VARIABLE_FORMAT_ANY16 = 3,
|
||||||
SPVC_MSL_SHADER_VARIABLE_FORMAT_ANY32 = 4,
|
SPVC_MSL_SHADER_VARIABLE_FORMAT_ANY32 = 4,
|
||||||
|
|
||||||
/* Deprecated names. */
|
/* Deprecated names. */
|
||||||
SPVC_MSL_VERTEX_FORMAT_OTHER = SPVC_MSL_SHADER_VARIABLE_FORMAT_OTHER,
|
SPVC_MSL_VERTEX_FORMAT_OTHER = SPVC_MSL_SHADER_VARIABLE_FORMAT_OTHER,
|
||||||
SPVC_MSL_VERTEX_FORMAT_UINT8 = SPVC_MSL_SHADER_VARIABLE_FORMAT_UINT8,
|
SPVC_MSL_VERTEX_FORMAT_UINT8 = SPVC_MSL_SHADER_VARIABLE_FORMAT_UINT8,
|
||||||
SPVC_MSL_VERTEX_FORMAT_UINT16 = SPVC_MSL_SHADER_VARIABLE_FORMAT_UINT16,
|
SPVC_MSL_VERTEX_FORMAT_UINT16 = SPVC_MSL_SHADER_VARIABLE_FORMAT_UINT16,
|
||||||
SPVC_MSL_SHADER_INPUT_FORMAT_OTHER = SPVC_MSL_SHADER_VARIABLE_FORMAT_OTHER,
|
SPVC_MSL_SHADER_INPUT_FORMAT_OTHER = SPVC_MSL_SHADER_VARIABLE_FORMAT_OTHER,
|
||||||
SPVC_MSL_SHADER_INPUT_FORMAT_UINT8 = SPVC_MSL_SHADER_VARIABLE_FORMAT_UINT8,
|
SPVC_MSL_SHADER_INPUT_FORMAT_UINT8 = SPVC_MSL_SHADER_VARIABLE_FORMAT_UINT8,
|
||||||
SPVC_MSL_SHADER_INPUT_FORMAT_UINT16 = SPVC_MSL_SHADER_VARIABLE_FORMAT_UINT16,
|
SPVC_MSL_SHADER_INPUT_FORMAT_UINT16 = SPVC_MSL_SHADER_VARIABLE_FORMAT_UINT16,
|
||||||
SPVC_MSL_SHADER_INPUT_FORMAT_ANY16 = SPVC_MSL_SHADER_VARIABLE_FORMAT_ANY16,
|
SPVC_MSL_SHADER_INPUT_FORMAT_ANY16 = SPVC_MSL_SHADER_VARIABLE_FORMAT_ANY16,
|
||||||
SPVC_MSL_SHADER_INPUT_FORMAT_ANY32 = SPVC_MSL_SHADER_VARIABLE_FORMAT_ANY32,
|
SPVC_MSL_SHADER_INPUT_FORMAT_ANY32 = SPVC_MSL_SHADER_VARIABLE_FORMAT_ANY32,
|
||||||
|
|
||||||
|
|
||||||
SPVC_MSL_SHADER_INPUT_FORMAT_INT_MAX = 0x7fffffff
|
SPVC_MSL_SHADER_INPUT_FORMAT_INT_MAX = 0x7fffffff
|
||||||
} spvc_msl_shader_variable_format, spvc_msl_shader_input_format, spvc_msl_vertex_format;
|
} spvc_msl_shader_variable_format, spvc_msl_shader_input_format, spvc_msl_vertex_format;
|
||||||
|
|
||||||
/* Maps to C++ API. Deprecated; use spvc_msl_shader_interface_var. */
|
/* Maps to C++ API. Deprecated; use spvc_msl_shader_interface_var. */
|
||||||
typedef struct spvc_msl_vertex_attribute
|
typedef struct spvc_msl_vertex_attribute
|
||||||
{
|
{
|
||||||
unsigned location;
|
unsigned location;
|
||||||
|
|
||||||
/* Obsolete, do not use. Only lingers on for ABI compatibility. */
|
/* Obsolete, do not use. Only lingers on for ABI compatibility. */
|
||||||
unsigned msl_buffer;
|
unsigned msl_buffer;
|
||||||
/* Obsolete, do not use. Only lingers on for ABI compatibility. */
|
/* Obsolete, do not use. Only lingers on for ABI compatibility. */
|
||||||
unsigned msl_offset;
|
unsigned msl_offset;
|
||||||
/* Obsolete, do not use. Only lingers on for ABI compatibility. */
|
/* Obsolete, do not use. Only lingers on for ABI compatibility. */
|
||||||
unsigned msl_stride;
|
unsigned msl_stride;
|
||||||
/* Obsolete, do not use. Only lingers on for ABI compatibility. */
|
/* Obsolete, do not use. Only lingers on for ABI compatibility. */
|
||||||
spvc_bool per_instance;
|
spvc_bool per_instance;
|
||||||
|
|
||||||
spvc_msl_vertex_format format;
|
spvc_msl_vertex_format format;
|
||||||
SpvBuiltIn builtin;
|
SpvBuiltIn builtin;
|
||||||
} spvc_msl_vertex_attribute;
|
} spvc_msl_vertex_attribute;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -339,10 +339,10 @@ SPVC_PUBLIC_API void spvc_msl_vertex_attribute_init(spvc_msl_vertex_attribute *a
|
|||||||
/* Maps to C++ API. Deprecated; use spvc_msl_shader_interface_var_2. */
|
/* Maps to C++ API. Deprecated; use spvc_msl_shader_interface_var_2. */
|
||||||
typedef struct spvc_msl_shader_interface_var
|
typedef struct spvc_msl_shader_interface_var
|
||||||
{
|
{
|
||||||
unsigned location;
|
unsigned location;
|
||||||
spvc_msl_vertex_format format;
|
spvc_msl_vertex_format format;
|
||||||
SpvBuiltIn builtin;
|
SpvBuiltIn builtin;
|
||||||
unsigned vecsize;
|
unsigned vecsize;
|
||||||
} spvc_msl_shader_interface_var, spvc_msl_shader_input;
|
} spvc_msl_shader_interface_var, spvc_msl_shader_input;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -358,21 +358,21 @@ SPVC_PUBLIC_API void spvc_msl_shader_input_init(spvc_msl_shader_input *input);
|
|||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_shader_variable_rate
|
typedef enum spvc_msl_shader_variable_rate
|
||||||
{
|
{
|
||||||
SPVC_MSL_SHADER_VARIABLE_RATE_PER_VERTEX = 0,
|
SPVC_MSL_SHADER_VARIABLE_RATE_PER_VERTEX = 0,
|
||||||
SPVC_MSL_SHADER_VARIABLE_RATE_PER_PRIMITIVE = 1,
|
SPVC_MSL_SHADER_VARIABLE_RATE_PER_PRIMITIVE = 1,
|
||||||
SPVC_MSL_SHADER_VARIABLE_RATE_PER_PATCH = 2,
|
SPVC_MSL_SHADER_VARIABLE_RATE_PER_PATCH = 2,
|
||||||
|
|
||||||
SPVC_MSL_SHADER_VARIABLE_RATE_INT_MAX = 0x7fffffff,
|
SPVC_MSL_SHADER_VARIABLE_RATE_INT_MAX = 0x7fffffff,
|
||||||
} spvc_msl_shader_variable_rate;
|
} spvc_msl_shader_variable_rate;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef struct spvc_msl_shader_interface_var_2
|
typedef struct spvc_msl_shader_interface_var_2
|
||||||
{
|
{
|
||||||
unsigned location;
|
unsigned location;
|
||||||
spvc_msl_shader_variable_format format;
|
spvc_msl_shader_variable_format format;
|
||||||
SpvBuiltIn builtin;
|
SpvBuiltIn builtin;
|
||||||
unsigned vecsize;
|
unsigned vecsize;
|
||||||
spvc_msl_shader_variable_rate rate;
|
spvc_msl_shader_variable_rate rate;
|
||||||
} spvc_msl_shader_interface_var_2;
|
} spvc_msl_shader_interface_var_2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -384,23 +384,23 @@ SPVC_PUBLIC_API void spvc_msl_shader_interface_var_init_2(spvc_msl_shader_interf
|
|||||||
* Deprecated. Use spvc_msl_resource_binding_2. */
|
* Deprecated. Use spvc_msl_resource_binding_2. */
|
||||||
typedef struct spvc_msl_resource_binding
|
typedef struct spvc_msl_resource_binding
|
||||||
{
|
{
|
||||||
SpvExecutionModel stage;
|
SpvExecutionModel stage;
|
||||||
unsigned desc_set;
|
unsigned desc_set;
|
||||||
unsigned binding;
|
unsigned binding;
|
||||||
unsigned msl_buffer;
|
unsigned msl_buffer;
|
||||||
unsigned msl_texture;
|
unsigned msl_texture;
|
||||||
unsigned msl_sampler;
|
unsigned msl_sampler;
|
||||||
} spvc_msl_resource_binding;
|
} spvc_msl_resource_binding;
|
||||||
|
|
||||||
typedef struct spvc_msl_resource_binding_2
|
typedef struct spvc_msl_resource_binding_2
|
||||||
{
|
{
|
||||||
SpvExecutionModel stage;
|
SpvExecutionModel stage;
|
||||||
unsigned desc_set;
|
unsigned desc_set;
|
||||||
unsigned binding;
|
unsigned binding;
|
||||||
unsigned count;
|
unsigned count;
|
||||||
unsigned msl_buffer;
|
unsigned msl_buffer;
|
||||||
unsigned msl_texture;
|
unsigned msl_texture;
|
||||||
unsigned msl_sampler;
|
unsigned msl_sampler;
|
||||||
} spvc_msl_resource_binding_2;
|
} spvc_msl_resource_binding_2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -426,130 +426,130 @@ SPVC_PUBLIC_API unsigned spvc_msl_get_aux_buffer_struct_version(void);
|
|||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_sampler_coord
|
typedef enum spvc_msl_sampler_coord
|
||||||
{
|
{
|
||||||
SPVC_MSL_SAMPLER_COORD_NORMALIZED = 0,
|
SPVC_MSL_SAMPLER_COORD_NORMALIZED = 0,
|
||||||
SPVC_MSL_SAMPLER_COORD_PIXEL = 1,
|
SPVC_MSL_SAMPLER_COORD_PIXEL = 1,
|
||||||
SPVC_MSL_SAMPLER_INT_MAX = 0x7fffffff
|
SPVC_MSL_SAMPLER_INT_MAX = 0x7fffffff
|
||||||
} spvc_msl_sampler_coord;
|
} spvc_msl_sampler_coord;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_sampler_filter
|
typedef enum spvc_msl_sampler_filter
|
||||||
{
|
{
|
||||||
SPVC_MSL_SAMPLER_FILTER_NEAREST = 0,
|
SPVC_MSL_SAMPLER_FILTER_NEAREST = 0,
|
||||||
SPVC_MSL_SAMPLER_FILTER_LINEAR = 1,
|
SPVC_MSL_SAMPLER_FILTER_LINEAR = 1,
|
||||||
SPVC_MSL_SAMPLER_FILTER_INT_MAX = 0x7fffffff
|
SPVC_MSL_SAMPLER_FILTER_INT_MAX = 0x7fffffff
|
||||||
} spvc_msl_sampler_filter;
|
} spvc_msl_sampler_filter;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_sampler_mip_filter
|
typedef enum spvc_msl_sampler_mip_filter
|
||||||
{
|
{
|
||||||
SPVC_MSL_SAMPLER_MIP_FILTER_NONE = 0,
|
SPVC_MSL_SAMPLER_MIP_FILTER_NONE = 0,
|
||||||
SPVC_MSL_SAMPLER_MIP_FILTER_NEAREST = 1,
|
SPVC_MSL_SAMPLER_MIP_FILTER_NEAREST = 1,
|
||||||
SPVC_MSL_SAMPLER_MIP_FILTER_LINEAR = 2,
|
SPVC_MSL_SAMPLER_MIP_FILTER_LINEAR = 2,
|
||||||
SPVC_MSL_SAMPLER_MIP_FILTER_INT_MAX = 0x7fffffff
|
SPVC_MSL_SAMPLER_MIP_FILTER_INT_MAX = 0x7fffffff
|
||||||
} spvc_msl_sampler_mip_filter;
|
} spvc_msl_sampler_mip_filter;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_sampler_address
|
typedef enum spvc_msl_sampler_address
|
||||||
{
|
{
|
||||||
SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_ZERO = 0,
|
SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_ZERO = 0,
|
||||||
SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_EDGE = 1,
|
SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_EDGE = 1,
|
||||||
SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_BORDER = 2,
|
SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_BORDER = 2,
|
||||||
SPVC_MSL_SAMPLER_ADDRESS_REPEAT = 3,
|
SPVC_MSL_SAMPLER_ADDRESS_REPEAT = 3,
|
||||||
SPVC_MSL_SAMPLER_ADDRESS_MIRRORED_REPEAT = 4,
|
SPVC_MSL_SAMPLER_ADDRESS_MIRRORED_REPEAT = 4,
|
||||||
SPVC_MSL_SAMPLER_ADDRESS_INT_MAX = 0x7fffffff
|
SPVC_MSL_SAMPLER_ADDRESS_INT_MAX = 0x7fffffff
|
||||||
} spvc_msl_sampler_address;
|
} spvc_msl_sampler_address;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_sampler_compare_func
|
typedef enum spvc_msl_sampler_compare_func
|
||||||
{
|
{
|
||||||
SPVC_MSL_SAMPLER_COMPARE_FUNC_NEVER = 0,
|
SPVC_MSL_SAMPLER_COMPARE_FUNC_NEVER = 0,
|
||||||
SPVC_MSL_SAMPLER_COMPARE_FUNC_LESS = 1,
|
SPVC_MSL_SAMPLER_COMPARE_FUNC_LESS = 1,
|
||||||
SPVC_MSL_SAMPLER_COMPARE_FUNC_LESS_EQUAL = 2,
|
SPVC_MSL_SAMPLER_COMPARE_FUNC_LESS_EQUAL = 2,
|
||||||
SPVC_MSL_SAMPLER_COMPARE_FUNC_GREATER = 3,
|
SPVC_MSL_SAMPLER_COMPARE_FUNC_GREATER = 3,
|
||||||
SPVC_MSL_SAMPLER_COMPARE_FUNC_GREATER_EQUAL = 4,
|
SPVC_MSL_SAMPLER_COMPARE_FUNC_GREATER_EQUAL = 4,
|
||||||
SPVC_MSL_SAMPLER_COMPARE_FUNC_EQUAL = 5,
|
SPVC_MSL_SAMPLER_COMPARE_FUNC_EQUAL = 5,
|
||||||
SPVC_MSL_SAMPLER_COMPARE_FUNC_NOT_EQUAL = 6,
|
SPVC_MSL_SAMPLER_COMPARE_FUNC_NOT_EQUAL = 6,
|
||||||
SPVC_MSL_SAMPLER_COMPARE_FUNC_ALWAYS = 7,
|
SPVC_MSL_SAMPLER_COMPARE_FUNC_ALWAYS = 7,
|
||||||
SPVC_MSL_SAMPLER_COMPARE_FUNC_INT_MAX = 0x7fffffff
|
SPVC_MSL_SAMPLER_COMPARE_FUNC_INT_MAX = 0x7fffffff
|
||||||
} spvc_msl_sampler_compare_func;
|
} spvc_msl_sampler_compare_func;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_sampler_border_color
|
typedef enum spvc_msl_sampler_border_color
|
||||||
{
|
{
|
||||||
SPVC_MSL_SAMPLER_BORDER_COLOR_TRANSPARENT_BLACK = 0,
|
SPVC_MSL_SAMPLER_BORDER_COLOR_TRANSPARENT_BLACK = 0,
|
||||||
SPVC_MSL_SAMPLER_BORDER_COLOR_OPAQUE_BLACK = 1,
|
SPVC_MSL_SAMPLER_BORDER_COLOR_OPAQUE_BLACK = 1,
|
||||||
SPVC_MSL_SAMPLER_BORDER_COLOR_OPAQUE_WHITE = 2,
|
SPVC_MSL_SAMPLER_BORDER_COLOR_OPAQUE_WHITE = 2,
|
||||||
SPVC_MSL_SAMPLER_BORDER_COLOR_INT_MAX = 0x7fffffff
|
SPVC_MSL_SAMPLER_BORDER_COLOR_INT_MAX = 0x7fffffff
|
||||||
} spvc_msl_sampler_border_color;
|
} spvc_msl_sampler_border_color;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_format_resolution
|
typedef enum spvc_msl_format_resolution
|
||||||
{
|
{
|
||||||
SPVC_MSL_FORMAT_RESOLUTION_444 = 0,
|
SPVC_MSL_FORMAT_RESOLUTION_444 = 0,
|
||||||
SPVC_MSL_FORMAT_RESOLUTION_422,
|
SPVC_MSL_FORMAT_RESOLUTION_422,
|
||||||
SPVC_MSL_FORMAT_RESOLUTION_420,
|
SPVC_MSL_FORMAT_RESOLUTION_420,
|
||||||
SPVC_MSL_FORMAT_RESOLUTION_INT_MAX = 0x7fffffff
|
SPVC_MSL_FORMAT_RESOLUTION_INT_MAX = 0x7fffffff
|
||||||
} spvc_msl_format_resolution;
|
} spvc_msl_format_resolution;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_chroma_location
|
typedef enum spvc_msl_chroma_location
|
||||||
{
|
{
|
||||||
SPVC_MSL_CHROMA_LOCATION_COSITED_EVEN = 0,
|
SPVC_MSL_CHROMA_LOCATION_COSITED_EVEN = 0,
|
||||||
SPVC_MSL_CHROMA_LOCATION_MIDPOINT,
|
SPVC_MSL_CHROMA_LOCATION_MIDPOINT,
|
||||||
SPVC_MSL_CHROMA_LOCATION_INT_MAX = 0x7fffffff
|
SPVC_MSL_CHROMA_LOCATION_INT_MAX = 0x7fffffff
|
||||||
} spvc_msl_chroma_location;
|
} spvc_msl_chroma_location;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_component_swizzle
|
typedef enum spvc_msl_component_swizzle
|
||||||
{
|
{
|
||||||
SPVC_MSL_COMPONENT_SWIZZLE_IDENTITY = 0,
|
SPVC_MSL_COMPONENT_SWIZZLE_IDENTITY = 0,
|
||||||
SPVC_MSL_COMPONENT_SWIZZLE_ZERO,
|
SPVC_MSL_COMPONENT_SWIZZLE_ZERO,
|
||||||
SPVC_MSL_COMPONENT_SWIZZLE_ONE,
|
SPVC_MSL_COMPONENT_SWIZZLE_ONE,
|
||||||
SPVC_MSL_COMPONENT_SWIZZLE_R,
|
SPVC_MSL_COMPONENT_SWIZZLE_R,
|
||||||
SPVC_MSL_COMPONENT_SWIZZLE_G,
|
SPVC_MSL_COMPONENT_SWIZZLE_G,
|
||||||
SPVC_MSL_COMPONENT_SWIZZLE_B,
|
SPVC_MSL_COMPONENT_SWIZZLE_B,
|
||||||
SPVC_MSL_COMPONENT_SWIZZLE_A,
|
SPVC_MSL_COMPONENT_SWIZZLE_A,
|
||||||
SPVC_MSL_COMPONENT_SWIZZLE_INT_MAX = 0x7fffffff
|
SPVC_MSL_COMPONENT_SWIZZLE_INT_MAX = 0x7fffffff
|
||||||
} spvc_msl_component_swizzle;
|
} spvc_msl_component_swizzle;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_msl_sampler_ycbcr_model_conversion
|
typedef enum spvc_msl_sampler_ycbcr_model_conversion
|
||||||
{
|
{
|
||||||
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY = 0,
|
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY = 0,
|
||||||
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY,
|
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY,
|
||||||
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_BT_709,
|
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_BT_709,
|
||||||
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_BT_601,
|
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_BT_601,
|
||||||
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_BT_2020,
|
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_BT_2020,
|
||||||
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_INT_MAX = 0x7fffffff
|
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_INT_MAX = 0x7fffffff
|
||||||
} spvc_msl_sampler_ycbcr_model_conversion;
|
} spvc_msl_sampler_ycbcr_model_conversion;
|
||||||
|
|
||||||
/* Maps to C+ API. */
|
/* Maps to C+ API. */
|
||||||
typedef enum spvc_msl_sampler_ycbcr_range
|
typedef enum spvc_msl_sampler_ycbcr_range
|
||||||
{
|
{
|
||||||
SPVC_MSL_SAMPLER_YCBCR_RANGE_ITU_FULL = 0,
|
SPVC_MSL_SAMPLER_YCBCR_RANGE_ITU_FULL = 0,
|
||||||
SPVC_MSL_SAMPLER_YCBCR_RANGE_ITU_NARROW,
|
SPVC_MSL_SAMPLER_YCBCR_RANGE_ITU_NARROW,
|
||||||
SPVC_MSL_SAMPLER_YCBCR_RANGE_INT_MAX = 0x7fffffff
|
SPVC_MSL_SAMPLER_YCBCR_RANGE_INT_MAX = 0x7fffffff
|
||||||
} spvc_msl_sampler_ycbcr_range;
|
} spvc_msl_sampler_ycbcr_range;
|
||||||
|
|
||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef struct spvc_msl_constexpr_sampler
|
typedef struct spvc_msl_constexpr_sampler
|
||||||
{
|
{
|
||||||
spvc_msl_sampler_coord coord;
|
spvc_msl_sampler_coord coord;
|
||||||
spvc_msl_sampler_filter min_filter;
|
spvc_msl_sampler_filter min_filter;
|
||||||
spvc_msl_sampler_filter mag_filter;
|
spvc_msl_sampler_filter mag_filter;
|
||||||
spvc_msl_sampler_mip_filter mip_filter;
|
spvc_msl_sampler_mip_filter mip_filter;
|
||||||
spvc_msl_sampler_address s_address;
|
spvc_msl_sampler_address s_address;
|
||||||
spvc_msl_sampler_address t_address;
|
spvc_msl_sampler_address t_address;
|
||||||
spvc_msl_sampler_address r_address;
|
spvc_msl_sampler_address r_address;
|
||||||
spvc_msl_sampler_compare_func compare_func;
|
spvc_msl_sampler_compare_func compare_func;
|
||||||
spvc_msl_sampler_border_color border_color;
|
spvc_msl_sampler_border_color border_color;
|
||||||
float lod_clamp_min;
|
float lod_clamp_min;
|
||||||
float lod_clamp_max;
|
float lod_clamp_max;
|
||||||
int max_anisotropy;
|
int max_anisotropy;
|
||||||
|
|
||||||
spvc_bool compare_enable;
|
spvc_bool compare_enable;
|
||||||
spvc_bool lod_clamp_enable;
|
spvc_bool lod_clamp_enable;
|
||||||
spvc_bool anisotropy_enable;
|
spvc_bool anisotropy_enable;
|
||||||
} spvc_msl_constexpr_sampler;
|
} spvc_msl_constexpr_sampler;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -561,15 +561,15 @@ SPVC_PUBLIC_API void spvc_msl_constexpr_sampler_init(spvc_msl_constexpr_sampler
|
|||||||
/* Maps to the sampler Y'CbCr conversion-related portions of MSLConstexprSampler. See C++ API for defaults and details. */
|
/* Maps to the sampler Y'CbCr conversion-related portions of MSLConstexprSampler. See C++ API for defaults and details. */
|
||||||
typedef struct spvc_msl_sampler_ycbcr_conversion
|
typedef struct spvc_msl_sampler_ycbcr_conversion
|
||||||
{
|
{
|
||||||
unsigned planes;
|
unsigned planes;
|
||||||
spvc_msl_format_resolution resolution;
|
spvc_msl_format_resolution resolution;
|
||||||
spvc_msl_sampler_filter chroma_filter;
|
spvc_msl_sampler_filter chroma_filter;
|
||||||
spvc_msl_chroma_location x_chroma_offset;
|
spvc_msl_chroma_location x_chroma_offset;
|
||||||
spvc_msl_chroma_location y_chroma_offset;
|
spvc_msl_chroma_location y_chroma_offset;
|
||||||
spvc_msl_component_swizzle swizzle[4];
|
spvc_msl_component_swizzle swizzle[4];
|
||||||
spvc_msl_sampler_ycbcr_model_conversion ycbcr_model;
|
spvc_msl_sampler_ycbcr_model_conversion ycbcr_model;
|
||||||
spvc_msl_sampler_ycbcr_range ycbcr_range;
|
spvc_msl_sampler_ycbcr_range ycbcr_range;
|
||||||
unsigned bpc;
|
unsigned bpc;
|
||||||
} spvc_msl_sampler_ycbcr_conversion;
|
} spvc_msl_sampler_ycbcr_conversion;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -581,13 +581,13 @@ SPVC_PUBLIC_API void spvc_msl_sampler_ycbcr_conversion_init(spvc_msl_sampler_ycb
|
|||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef enum spvc_hlsl_binding_flag_bits
|
typedef enum spvc_hlsl_binding_flag_bits
|
||||||
{
|
{
|
||||||
SPVC_HLSL_BINDING_AUTO_NONE_BIT = 0,
|
SPVC_HLSL_BINDING_AUTO_NONE_BIT = 0,
|
||||||
SPVC_HLSL_BINDING_AUTO_PUSH_CONSTANT_BIT = 1 << 0,
|
SPVC_HLSL_BINDING_AUTO_PUSH_CONSTANT_BIT = 1 << 0,
|
||||||
SPVC_HLSL_BINDING_AUTO_CBV_BIT = 1 << 1,
|
SPVC_HLSL_BINDING_AUTO_CBV_BIT = 1 << 1,
|
||||||
SPVC_HLSL_BINDING_AUTO_SRV_BIT = 1 << 2,
|
SPVC_HLSL_BINDING_AUTO_SRV_BIT = 1 << 2,
|
||||||
SPVC_HLSL_BINDING_AUTO_UAV_BIT = 1 << 3,
|
SPVC_HLSL_BINDING_AUTO_UAV_BIT = 1 << 3,
|
||||||
SPVC_HLSL_BINDING_AUTO_SAMPLER_BIT = 1 << 4,
|
SPVC_HLSL_BINDING_AUTO_SAMPLER_BIT = 1 << 4,
|
||||||
SPVC_HLSL_BINDING_AUTO_ALL = 0x7fffffff
|
SPVC_HLSL_BINDING_AUTO_ALL = 0x7fffffff
|
||||||
} spvc_hlsl_binding_flag_bits;
|
} spvc_hlsl_binding_flag_bits;
|
||||||
typedef unsigned spvc_hlsl_binding_flags;
|
typedef unsigned spvc_hlsl_binding_flags;
|
||||||
|
|
||||||
@ -597,17 +597,17 @@ typedef unsigned spvc_hlsl_binding_flags;
|
|||||||
/* Maps to C++ API. */
|
/* Maps to C++ API. */
|
||||||
typedef struct spvc_hlsl_resource_binding_mapping
|
typedef struct spvc_hlsl_resource_binding_mapping
|
||||||
{
|
{
|
||||||
unsigned register_space;
|
unsigned register_space;
|
||||||
unsigned register_binding;
|
unsigned register_binding;
|
||||||
} spvc_hlsl_resource_binding_mapping;
|
} spvc_hlsl_resource_binding_mapping;
|
||||||
|
|
||||||
typedef struct spvc_hlsl_resource_binding
|
typedef struct spvc_hlsl_resource_binding
|
||||||
{
|
{
|
||||||
SpvExecutionModel stage;
|
SpvExecutionModel stage;
|
||||||
unsigned desc_set;
|
unsigned desc_set;
|
||||||
unsigned binding;
|
unsigned binding;
|
||||||
|
|
||||||
spvc_hlsl_resource_binding_mapping cbv, uav, srv, sampler;
|
spvc_hlsl_resource_binding_mapping cbv, uav, srv, sampler;
|
||||||
} spvc_hlsl_resource_binding;
|
} spvc_hlsl_resource_binding;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -619,132 +619,132 @@ SPVC_PUBLIC_API void spvc_hlsl_resource_binding_init(spvc_hlsl_resource_binding
|
|||||||
/* Maps to the various spirv_cross::Compiler*::Option structures. See C++ API for defaults and details. */
|
/* Maps to the various spirv_cross::Compiler*::Option structures. See C++ API for defaults and details. */
|
||||||
typedef enum spvc_compiler_option
|
typedef enum spvc_compiler_option
|
||||||
{
|
{
|
||||||
SPVC_COMPILER_OPTION_UNKNOWN = 0,
|
SPVC_COMPILER_OPTION_UNKNOWN = 0,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_FORCE_TEMPORARY = 1 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
SPVC_COMPILER_OPTION_FORCE_TEMPORARY = 1 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
||||||
SPVC_COMPILER_OPTION_FLATTEN_MULTIDIMENSIONAL_ARRAYS = 2 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
SPVC_COMPILER_OPTION_FLATTEN_MULTIDIMENSIONAL_ARRAYS = 2 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
||||||
SPVC_COMPILER_OPTION_FIXUP_DEPTH_CONVENTION = 3 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
SPVC_COMPILER_OPTION_FIXUP_DEPTH_CONVENTION = 3 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
||||||
SPVC_COMPILER_OPTION_FLIP_VERTEX_Y = 4 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
SPVC_COMPILER_OPTION_FLIP_VERTEX_Y = 4 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_GLSL_SUPPORT_NONZERO_BASE_INSTANCE = 5 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
SPVC_COMPILER_OPTION_GLSL_SUPPORT_NONZERO_BASE_INSTANCE = 5 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_GLSL_SEPARATE_SHADER_OBJECTS = 6 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
SPVC_COMPILER_OPTION_GLSL_SEPARATE_SHADER_OBJECTS = 6 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_GLSL_ENABLE_420PACK_EXTENSION = 7 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
SPVC_COMPILER_OPTION_GLSL_ENABLE_420PACK_EXTENSION = 7 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_GLSL_VERSION = 8 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
SPVC_COMPILER_OPTION_GLSL_VERSION = 8 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_GLSL_ES = 9 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
SPVC_COMPILER_OPTION_GLSL_ES = 9 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_GLSL_VULKAN_SEMANTICS = 10 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
SPVC_COMPILER_OPTION_GLSL_VULKAN_SEMANTICS = 10 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_GLSL_ES_DEFAULT_FLOAT_PRECISION_HIGHP = 11 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
SPVC_COMPILER_OPTION_GLSL_ES_DEFAULT_FLOAT_PRECISION_HIGHP = 11 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_GLSL_ES_DEFAULT_INT_PRECISION_HIGHP = 12 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
SPVC_COMPILER_OPTION_GLSL_ES_DEFAULT_INT_PRECISION_HIGHP = 12 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_HLSL_SHADER_MODEL = 13 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
SPVC_COMPILER_OPTION_HLSL_SHADER_MODEL = 13 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_HLSL_POINT_SIZE_COMPAT = 14 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
SPVC_COMPILER_OPTION_HLSL_POINT_SIZE_COMPAT = 14 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_HLSL_POINT_COORD_COMPAT = 15 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
SPVC_COMPILER_OPTION_HLSL_POINT_COORD_COMPAT = 15 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_HLSL_SUPPORT_NONZERO_BASE_VERTEX_BASE_INSTANCE = 16 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
SPVC_COMPILER_OPTION_HLSL_SUPPORT_NONZERO_BASE_VERTEX_BASE_INSTANCE = 16 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_MSL_VERSION = 17 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_VERSION = 17 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_TEXEL_BUFFER_TEXTURE_WIDTH = 18 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_TEXEL_BUFFER_TEXTURE_WIDTH = 18 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
/* Obsolete, use SWIZZLE_BUFFER_INDEX instead. */
|
/* Obsolete, use SWIZZLE_BUFFER_INDEX instead. */
|
||||||
SPVC_COMPILER_OPTION_MSL_AUX_BUFFER_INDEX = 19 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_AUX_BUFFER_INDEX = 19 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_SWIZZLE_BUFFER_INDEX = 19 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_SWIZZLE_BUFFER_INDEX = 19 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_MSL_INDIRECT_PARAMS_BUFFER_INDEX = 20 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_INDIRECT_PARAMS_BUFFER_INDEX = 20 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_SHADER_OUTPUT_BUFFER_INDEX = 21 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_SHADER_OUTPUT_BUFFER_INDEX = 21 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_SHADER_PATCH_OUTPUT_BUFFER_INDEX = 22 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_SHADER_PATCH_OUTPUT_BUFFER_INDEX = 22 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_SHADER_TESS_FACTOR_OUTPUT_BUFFER_INDEX = 23 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_SHADER_TESS_FACTOR_OUTPUT_BUFFER_INDEX = 23 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_SHADER_INPUT_WORKGROUP_INDEX = 24 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_SHADER_INPUT_WORKGROUP_INDEX = 24 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_ENABLE_POINT_SIZE_BUILTIN = 25 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_ENABLE_POINT_SIZE_BUILTIN = 25 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_DISABLE_RASTERIZATION = 26 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_DISABLE_RASTERIZATION = 26 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_CAPTURE_OUTPUT_TO_BUFFER = 27 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_CAPTURE_OUTPUT_TO_BUFFER = 27 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_SWIZZLE_TEXTURE_SAMPLES = 28 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_SWIZZLE_TEXTURE_SAMPLES = 28 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_PAD_FRAGMENT_OUTPUT_COMPONENTS = 29 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_PAD_FRAGMENT_OUTPUT_COMPONENTS = 29 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_TESS_DOMAIN_ORIGIN_LOWER_LEFT = 30 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_TESS_DOMAIN_ORIGIN_LOWER_LEFT = 30 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_PLATFORM = 31 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_PLATFORM = 31 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_ARGUMENT_BUFFERS = 32 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_ARGUMENT_BUFFERS = 32 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_GLSL_EMIT_PUSH_CONSTANT_AS_UNIFORM_BUFFER = 33 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
SPVC_COMPILER_OPTION_GLSL_EMIT_PUSH_CONSTANT_AS_UNIFORM_BUFFER = 33 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_MSL_TEXTURE_BUFFER_NATIVE = 34 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_TEXTURE_BUFFER_NATIVE = 34 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_GLSL_EMIT_UNIFORM_BUFFER_AS_PLAIN_UNIFORMS = 35 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
SPVC_COMPILER_OPTION_GLSL_EMIT_UNIFORM_BUFFER_AS_PLAIN_UNIFORMS = 35 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_MSL_BUFFER_SIZE_BUFFER_INDEX = 36 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_BUFFER_SIZE_BUFFER_INDEX = 36 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_EMIT_LINE_DIRECTIVES = 37 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
SPVC_COMPILER_OPTION_EMIT_LINE_DIRECTIVES = 37 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_MSL_MULTIVIEW = 38 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_MULTIVIEW = 38 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_VIEW_MASK_BUFFER_INDEX = 39 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_VIEW_MASK_BUFFER_INDEX = 39 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_DEVICE_INDEX = 40 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_DEVICE_INDEX = 40 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_VIEW_INDEX_FROM_DEVICE_INDEX = 41 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_VIEW_INDEX_FROM_DEVICE_INDEX = 41 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_DISPATCH_BASE = 42 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_DISPATCH_BASE = 42 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_DYNAMIC_OFFSETS_BUFFER_INDEX = 43 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_DYNAMIC_OFFSETS_BUFFER_INDEX = 43 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_TEXTURE_1D_AS_2D = 44 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_TEXTURE_1D_AS_2D = 44 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_ENABLE_BASE_INDEX_ZERO = 45 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_ENABLE_BASE_INDEX_ZERO = 45 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
/* Obsolete. Use MSL_FRAMEBUFFER_FETCH_SUBPASS instead. */
|
/* Obsolete. Use MSL_FRAMEBUFFER_FETCH_SUBPASS instead. */
|
||||||
SPVC_COMPILER_OPTION_MSL_IOS_FRAMEBUFFER_FETCH_SUBPASS = 46 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_IOS_FRAMEBUFFER_FETCH_SUBPASS = 46 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_FRAMEBUFFER_FETCH_SUBPASS = 46 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_FRAMEBUFFER_FETCH_SUBPASS = 46 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_MSL_INVARIANT_FP_MATH = 47 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_INVARIANT_FP_MATH = 47 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_EMULATE_CUBEMAP_ARRAY = 48 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_EMULATE_CUBEMAP_ARRAY = 48 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_ENABLE_DECORATION_BINDING = 49 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_ENABLE_DECORATION_BINDING = 49 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_FORCE_ACTIVE_ARGUMENT_BUFFER_RESOURCES = 50 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_FORCE_ACTIVE_ARGUMENT_BUFFER_RESOURCES = 50 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_FORCE_NATIVE_ARRAYS = 51 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_FORCE_NATIVE_ARRAYS = 51 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_ENABLE_STORAGE_IMAGE_QUALIFIER_DEDUCTION = 52 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
SPVC_COMPILER_OPTION_ENABLE_STORAGE_IMAGE_QUALIFIER_DEDUCTION = 52 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_HLSL_FORCE_STORAGE_BUFFER_AS_UAV = 53 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
SPVC_COMPILER_OPTION_HLSL_FORCE_STORAGE_BUFFER_AS_UAV = 53 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_FORCE_ZERO_INITIALIZED_VARIABLES = 54 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
SPVC_COMPILER_OPTION_FORCE_ZERO_INITIALIZED_VARIABLES = 54 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_HLSL_NONWRITABLE_UAV_TEXTURE_AS_SRV = 55 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
SPVC_COMPILER_OPTION_HLSL_NONWRITABLE_UAV_TEXTURE_AS_SRV = 55 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_OUTPUT_MASK = 56 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_OUTPUT_MASK = 56 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_DEPTH_BUILTIN = 57 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_DEPTH_BUILTIN = 57 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_STENCIL_REF_BUILTIN = 58 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_STENCIL_REF_BUILTIN = 58 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_ENABLE_CLIP_DISTANCE_USER_VARYING = 59 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_ENABLE_CLIP_DISTANCE_USER_VARYING = 59 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_HLSL_ENABLE_16BIT_TYPES = 60 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
SPVC_COMPILER_OPTION_HLSL_ENABLE_16BIT_TYPES = 60 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_MSL_MULTI_PATCH_WORKGROUP = 61 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_MULTI_PATCH_WORKGROUP = 61 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_SHADER_INPUT_BUFFER_INDEX = 62 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_SHADER_INPUT_BUFFER_INDEX = 62 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_SHADER_INDEX_BUFFER_INDEX = 63 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_SHADER_INDEX_BUFFER_INDEX = 63 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_VERTEX_FOR_TESSELLATION = 64 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_VERTEX_FOR_TESSELLATION = 64 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_VERTEX_INDEX_TYPE = 65 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_VERTEX_INDEX_TYPE = 65 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_GLSL_FORCE_FLATTENED_IO_BLOCKS = 66 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
SPVC_COMPILER_OPTION_GLSL_FORCE_FLATTENED_IO_BLOCKS = 66 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_MSL_MULTIVIEW_LAYERED_RENDERING = 67 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_MULTIVIEW_LAYERED_RENDERING = 67 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_ARRAYED_SUBPASS_INPUT = 68 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_ARRAYED_SUBPASS_INPUT = 68 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_R32UI_LINEAR_TEXTURE_ALIGNMENT = 69 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_R32UI_LINEAR_TEXTURE_ALIGNMENT = 69 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_R32UI_ALIGNMENT_CONSTANT_ID = 70 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_R32UI_ALIGNMENT_CONSTANT_ID = 70 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_HLSL_FLATTEN_MATRIX_VERTEX_INPUT_SEMANTICS = 71 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
SPVC_COMPILER_OPTION_HLSL_FLATTEN_MATRIX_VERTEX_INPUT_SEMANTICS = 71 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_MSL_IOS_USE_SIMDGROUP_FUNCTIONS = 72 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_IOS_USE_SIMDGROUP_FUNCTIONS = 72 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_EMULATE_SUBGROUPS = 73 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_EMULATE_SUBGROUPS = 73 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_FIXED_SUBGROUP_SIZE = 74 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_FIXED_SUBGROUP_SIZE = 74 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_FORCE_SAMPLE_RATE_SHADING = 75 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_FORCE_SAMPLE_RATE_SHADING = 75 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_IOS_SUPPORT_BASE_VERTEX_INSTANCE = 76 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_IOS_SUPPORT_BASE_VERTEX_INSTANCE = 76 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_GLSL_OVR_MULTIVIEW_VIEW_COUNT = 77 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
SPVC_COMPILER_OPTION_GLSL_OVR_MULTIVIEW_VIEW_COUNT = 77 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_RELAX_NAN_CHECKS = 78 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
SPVC_COMPILER_OPTION_RELAX_NAN_CHECKS = 78 | SPVC_COMPILER_OPTION_COMMON_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_MSL_RAW_BUFFER_TESE_INPUT = 79 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_RAW_BUFFER_TESE_INPUT = 79 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_SHADER_PATCH_INPUT_BUFFER_INDEX = 80 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_SHADER_PATCH_INPUT_BUFFER_INDEX = 80 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_MANUAL_HELPER_INVOCATION_UPDATES = 81 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_MANUAL_HELPER_INVOCATION_UPDATES = 81 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_CHECK_DISCARDED_FRAG_STORES = 82 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_CHECK_DISCARDED_FRAG_STORES = 82 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_GLSL_ENABLE_ROW_MAJOR_LOAD_WORKAROUND = 83 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
SPVC_COMPILER_OPTION_GLSL_ENABLE_ROW_MAJOR_LOAD_WORKAROUND = 83 | SPVC_COMPILER_OPTION_GLSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_MSL_ARGUMENT_BUFFERS_TIER = 84 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_ARGUMENT_BUFFERS_TIER = 84 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_SAMPLE_DREF_LOD_ARRAY_AS_GRAD = 85 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_SAMPLE_DREF_LOD_ARRAY_AS_GRAD = 85 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_READWRITE_TEXTURE_FENCES = 86 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_READWRITE_TEXTURE_FENCES = 86 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_REPLACE_RECURSIVE_INPUTS = 87 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_REPLACE_RECURSIVE_INPUTS = 87 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_AGX_MANUAL_CUBE_GRAD_FIXUP = 88 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_AGX_MANUAL_CUBE_GRAD_FIXUP = 88 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
SPVC_COMPILER_OPTION_MSL_FORCE_FRAGMENT_WITH_SIDE_EFFECTS_EXECUTION = 89 | SPVC_COMPILER_OPTION_MSL_BIT,
|
SPVC_COMPILER_OPTION_MSL_FORCE_FRAGMENT_WITH_SIDE_EFFECTS_EXECUTION = 89 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||||
|
|
||||||
SPVC_COMPILER_OPTION_INT_MAX = 0x7fffffff
|
SPVC_COMPILER_OPTION_INT_MAX = 0x7fffffff
|
||||||
} spvc_compiler_option;
|
} spvc_compiler_option;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -908,9 +908,9 @@ SPVC_PUBLIC_API spvc_result spvc_resources_get_resource_list_for_type(spvc_resou
|
|||||||
size_t *resource_size);
|
size_t *resource_size);
|
||||||
|
|
||||||
SPVC_PUBLIC_API spvc_result spvc_resources_get_builtin_resource_list_for_type(
|
SPVC_PUBLIC_API spvc_result spvc_resources_get_builtin_resource_list_for_type(
|
||||||
spvc_resources resources, spvc_builtin_resource_type type,
|
spvc_resources resources, spvc_builtin_resource_type type,
|
||||||
const spvc_reflected_builtin_resource **resource_list,
|
const spvc_reflected_builtin_resource **resource_list,
|
||||||
size_t *resource_size);
|
size_t *resource_size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Decorations.
|
* Decorations.
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -32,46 +32,46 @@ namespace spirv_cross_util
|
|||||||
void rename_interface_variable(Compiler &compiler, const SmallVector<Resource> &resources, uint32_t location,
|
void rename_interface_variable(Compiler &compiler, const SmallVector<Resource> &resources, uint32_t location,
|
||||||
const std::string &name)
|
const std::string &name)
|
||||||
{
|
{
|
||||||
for (auto &v : resources)
|
for (auto &v : resources)
|
||||||
{
|
{
|
||||||
if (!compiler.has_decoration(v.id, spv::DecorationLocation))
|
if (!compiler.has_decoration(v.id, spv::DecorationLocation))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto loc = compiler.get_decoration(v.id, spv::DecorationLocation);
|
auto loc = compiler.get_decoration(v.id, spv::DecorationLocation);
|
||||||
if (loc != location)
|
if (loc != location)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto &type = compiler.get_type(v.base_type_id);
|
auto &type = compiler.get_type(v.base_type_id);
|
||||||
|
|
||||||
// This is more of a friendly variant. If we need to rename interface variables, we might have to rename
|
// This is more of a friendly variant. If we need to rename interface variables, we might have to rename
|
||||||
// structs as well and make sure all the names match up.
|
// structs as well and make sure all the names match up.
|
||||||
if (type.basetype == SPIRType::Struct)
|
if (type.basetype == SPIRType::Struct)
|
||||||
{
|
{
|
||||||
compiler.set_name(v.base_type_id, join("SPIRV_Cross_Interface_Location", location));
|
compiler.set_name(v.base_type_id, join("SPIRV_Cross_Interface_Location", location));
|
||||||
for (uint32_t i = 0; i < uint32_t(type.member_types.size()); i++)
|
for (uint32_t i = 0; i < uint32_t(type.member_types.size()); i++)
|
||||||
compiler.set_member_name(v.base_type_id, i, join("InterfaceMember", i));
|
compiler.set_member_name(v.base_type_id, i, join("InterfaceMember", i));
|
||||||
}
|
}
|
||||||
|
|
||||||
compiler.set_name(v.id, name);
|
compiler.set_name(v.id, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void inherit_combined_sampler_bindings(Compiler &compiler)
|
void inherit_combined_sampler_bindings(Compiler &compiler)
|
||||||
{
|
{
|
||||||
auto &samplers = compiler.get_combined_image_samplers();
|
auto &samplers = compiler.get_combined_image_samplers();
|
||||||
for (auto &s : samplers)
|
for (auto &s : samplers)
|
||||||
{
|
{
|
||||||
if (compiler.has_decoration(s.image_id, spv::DecorationDescriptorSet))
|
if (compiler.has_decoration(s.image_id, spv::DecorationDescriptorSet))
|
||||||
{
|
{
|
||||||
uint32_t set = compiler.get_decoration(s.image_id, spv::DecorationDescriptorSet);
|
uint32_t set = compiler.get_decoration(s.image_id, spv::DecorationDescriptorSet);
|
||||||
compiler.set_decoration(s.combined_id, spv::DecorationDescriptorSet, set);
|
compiler.set_decoration(s.combined_id, spv::DecorationDescriptorSet, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compiler.has_decoration(s.image_id, spv::DecorationBinding))
|
if (compiler.has_decoration(s.image_id, spv::DecorationBinding))
|
||||||
{
|
{
|
||||||
uint32_t binding = compiler.get_decoration(s.image_id, spv::DecorationBinding);
|
uint32_t binding = compiler.get_decoration(s.image_id, spv::DecorationBinding);
|
||||||
compiler.set_decoration(s.combined_id, spv::DecorationBinding, binding);
|
compiler.set_decoration(s.combined_id, spv::DecorationBinding, binding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace spirv_cross_util
|
} // namespace spirv_cross_util
|
||||||
|
32044
spirv_glsl.cpp
32044
spirv_glsl.cpp
File diff suppressed because it is too large
Load Diff
32200
spirv_msl.cpp
32200
spirv_msl.cpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user