Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upMetal: new binding model and SPIRV support #1576
+814
−465
Conversation
msiglreith
approved these changes
Oct 16, 2017
|
Seems to be sound.. good job! |
| @@ -233,13 +235,15 @@ fn main() { | |||
|
|
|||
| // | |||
| let pipelines = { | |||
| #[cfg(any(feature = "vulkan", feature = "dx12", feature = "gl"))] | |||
| //TODO: remove the type annotations when we have support for | |||
| // inidirect argument buffers in SPIRV-Cross | |||
This comment has been minimized.
This comment has been minimized.
| self.samplers.clear(); | ||
| } | ||
|
|
||
| fn add_buffer(&mut self, slot: usize, buffer: MTLBuffer, offset: usize) { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| }); | ||
| }; | ||
| inner.viewport = Some(vp); | ||
| if let EncoderState::Render(ref encoder) = inner.encoder_state { |
This comment has been minimized.
This comment has been minimized.
msiglreith
Oct 16, 2017
Member
General question: Caching still required if we are already inside an encoder? Will the states in MTL be reset at encoder boundaries?
This comment has been minimized.
This comment has been minimized.
kvark
Oct 16, 2017
Author
Member
Yes, they will be reset. That's why we still fill the cache, so that when we exit a render pass and then enter another one, we can re-bind everything that is active.
| } | ||
|
|
||
| command_buffer.encoder_state = EncoderState::Render(render_encoder); | ||
| command_buffer.begin_renderpass(render_encoder); |
This comment has been minimized.
This comment has been minimized.
kvark
added some commits
Oct 13, 2017
kvark
force-pushed the
kvark:metal-spirv
branch
3 times, most recently
from
54e072f
to
be59a2d
Oct 16, 2017
kvark
force-pushed the
kvark:metal-spirv
branch
from
be59a2d
to
6a048c0
Oct 17, 2017
kvark
and others
added some commits
Oct 16, 2017
kvark
force-pushed the
kvark:metal-spirv
branch
from
6a048c0
to
7132b64
Oct 17, 2017
This comment has been minimized.
This comment has been minimized.
|
Huge thanks to @grovesNL for fixing the OSX Travis build issues with |
bors bot
added a commit
that referenced
this pull request
Oct 17, 2017
kvark
changed the title
[metal] New binding model and SPIRV support
Metal: new binding model and SPIRV support
Oct 17, 2017
This comment has been minimized.
This comment has been minimized.
bors
bot
merged commit 7132b64
into
gfx-rs:master
Oct 17, 2017
kvark
deleted the
kvark:metal-spirv
branch
Oct 17, 2017
kvark
referenced this pull request
Oct 17, 2017
Closed
[RFC][ll] SPIR-V as the shader API solution #1374
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
kvark commentedOct 16, 2017
•
edited
This PR grew out of scope (basic SPIRV-support), but that was necessary.
Major changes:
Also fixes #1581
New binding model
Assignment from (descriptor_set, binding) to MSL buffer/texture/sampler index is figured out for the pipeline layout and stored inside it as a hashmap.
A shader is not really compiled at
create_shader_module, but rather - at PSO creation time, since this is where we know about the pipeline layout. The resource binding overrides of that layout are fed directly into SPIRV-cross compile options.A command buffer caches all bound resources at the MSL level (not descriptor set level, like it previously did). Binding descriptor sets would update the caches and potentially set the active encoder values. Both argument and regular vertex buffers just participate without extra semantics at this stage, simplifying the command buffer handling and solving the question of how to map those to not conflict.