mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-26 00:34:19 +00:00
Fix using gl_VertexIndex and gl_InstanceIndex producing errors
This commit is contained in:
parent
d0738e20e8
commit
4ae0c4541a
@ -176,6 +176,10 @@ fn write_entry_point(doc: &parse::Spirv, instruction: &parse::Instruction) -> St
|
|||||||
storage_class: enums::StorageClass::StorageClassInput, .. }
|
storage_class: enums::StorageClass::StorageClassInput, .. }
|
||||||
if &result_id == interface =>
|
if &result_id == interface =>
|
||||||
{
|
{
|
||||||
|
if is_builtin(doc, result_id) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
input_types.push(type_from_id(doc, result_type_id));
|
input_types.push(type_from_id(doc, result_type_id));
|
||||||
let name = name_from_id(doc, result_id);
|
let name = name_from_id(doc, result_id);
|
||||||
let loc = match location_decoration(doc, result_id) {
|
let loc = match location_decoration(doc, result_id) {
|
||||||
@ -375,6 +379,23 @@ fn location_decoration(doc: &parse::Spirv, searched: u32) -> Option<u32> {
|
|||||||
}).next()
|
}).next()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true if a `BuiltIn` decorator is applied on an id.
|
||||||
|
fn is_builtin(doc: &parse::Spirv, id: u32) -> bool {
|
||||||
|
for instruction in &doc.instructions {
|
||||||
|
match *instruction {
|
||||||
|
parse::Instruction::Decorate { target_id,
|
||||||
|
decoration: enums::Decoration::DecorationBuiltIn,
|
||||||
|
.. } if target_id == id =>
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
_ => ()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the name of the Vulkan something that corresponds to an `OpCapability`.
|
/// Returns the name of the Vulkan something that corresponds to an `OpCapability`.
|
||||||
///
|
///
|
||||||
/// Returns `None` if irrelevant.
|
/// Returns `None` if irrelevant.
|
||||||
|
@ -91,8 +91,6 @@ fn write_struct(doc: &parse::Spirv, struct_id: u32, members: &[u32]) -> String {
|
|||||||
|
|
||||||
/// Returns true if a `BuiltIn` decorator is applied on a struct member.
|
/// Returns true if a `BuiltIn` decorator is applied on a struct member.
|
||||||
fn is_builtin_member(doc: &parse::Spirv, id: u32, member_id: u32) -> bool {
|
fn is_builtin_member(doc: &parse::Spirv, id: u32, member_id: u32) -> bool {
|
||||||
let mut result = String::new();
|
|
||||||
|
|
||||||
for instruction in &doc.instructions {
|
for instruction in &doc.instructions {
|
||||||
match *instruction {
|
match *instruction {
|
||||||
parse::Instruction::MemberDecorate { target_id, member,
|
parse::Instruction::MemberDecorate { target_id, member,
|
||||||
|
Loading…
Reference in New Issue
Block a user