mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
spv-out: option to skip OpName for varyings
This commit is contained in:
committed by
Dzmitry Malyshau
parent
c1eed779fe
commit
e226cf3f1d
@@ -511,6 +511,9 @@ bitflags::bitflags! {
|
||||
const DEBUG = 0x1;
|
||||
/// Flip Y coordinate of `BuiltIn::Position` output.
|
||||
const ADJUST_COORDINATE_SPACE = 0x2;
|
||||
/// Emit `OpLabel` for input/output locations.
|
||||
/// Some drivers treat it as semantic, not allowing any conflicts.
|
||||
const LABEL_VARYINGS = 0x4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -535,7 +538,7 @@ pub struct Options {
|
||||
|
||||
impl Default for Options {
|
||||
fn default() -> Self {
|
||||
let mut flags = WriterFlags::ADJUST_COORDINATE_SPACE;
|
||||
let mut flags = WriterFlags::ADJUST_COORDINATE_SPACE | WriterFlags::LABEL_VARYINGS;
|
||||
if cfg!(debug_assertions) {
|
||||
flags |= WriterFlags::DEBUG;
|
||||
}
|
||||
|
||||
@@ -1038,7 +1038,10 @@ impl Writer {
|
||||
Instruction::variable(pointer_type_id, id, class, None)
|
||||
.to_words(&mut self.logical_layout.declarations);
|
||||
|
||||
if self.flags.contains(WriterFlags::DEBUG) {
|
||||
if self
|
||||
.flags
|
||||
.contains(WriterFlags::DEBUG | WriterFlags::LABEL_VARYINGS)
|
||||
{
|
||||
if let Some(name) = debug_name {
|
||||
self.debugs.push(Instruction::name(id, name));
|
||||
}
|
||||
|
||||
@@ -176,13 +176,12 @@ fn write_output_spv(
|
||||
use naga::back::spv;
|
||||
use rspirv::binary::Disassemble;
|
||||
|
||||
let mut flags = spv::WriterFlags::empty();
|
||||
if params.spv_debug {
|
||||
flags |= spv::WriterFlags::DEBUG;
|
||||
}
|
||||
if params.spv_adjust_coordinate_space {
|
||||
flags |= spv::WriterFlags::ADJUST_COORDINATE_SPACE;
|
||||
}
|
||||
let mut flags = spv::WriterFlags::LABEL_VARYINGS;
|
||||
flags.set(spv::WriterFlags::DEBUG, params.spv_debug);
|
||||
flags.set(
|
||||
spv::WriterFlags::ADJUST_COORDINATE_SPACE,
|
||||
params.spv_adjust_coordinate_space,
|
||||
);
|
||||
let options = spv::Options {
|
||||
lang_version: params.spv_version,
|
||||
flags,
|
||||
|
||||
Reference in New Issue
Block a user