Commit Graph

349 Commits

Author SHA1 Message Date
Bill Hollings
1f83856366 CompilerMSL add support for MSL specialization function constants.
CompilerMSL add emit_custom_functions() function.
CompilerMSL restrict use of as_type<> cast to necessary conditions.
CompilerMSL refactor get_declared_struct_member_size() and
get_declared_struct_member_alignment() functions, and remove
unnecessary get_declared_type_size() functions.
Add test shaders-msl/vulkan/frag/spec-constant.vk.frag.
2017-06-15 15:24:22 -04:00
Bill Hollings
6f3381a5d3 Fixes from review of PR #190. 2017-06-01 16:29:39 -04:00
Bill Hollings
b41e1482c8 Support emitting SPIR-V type declarations tuned for specified SPIR-V objects.
CompilerGLSL type_to_glsl() and image_type_glsl() functions support optional object ID.
Add SPIRType::Image::access member to support SPIR-V OpTypeImage access qualifier.
Remove SPIRType::Image::is_read and ::is_written members.
Use DecorationNonReadable and DecorationNonWritable to mark read/write access for image variables.
CompilerMSL emit access qualifiers per image variable, instead of per image type.
CompilerGLSL and CompilerHLSL behaviour is unchanged.
2017-05-29 20:45:05 -04:00
Bill Hollings
192bdc9516 CompilerMSL elide unused builtins from entry function input and output structs.
Add Compiler::has_active_builtin() function.
Update test reference shaders that included unused builtins.
2017-05-24 09:31:38 -04:00
Bill Hollings
d77de7ab80 CompilerMSL add support for MSL qualifiers on gl_ClipDistance and other array-based builtins. 2017-05-23 13:24:41 -04:00
Bill Hollings
0f97ffd8be Fix merge conflicts with upstream master, plus fixes from review of PR #186. 2017-05-23 10:44:10 -04:00
Hans-Kristian Arntzen
8d43908e66 Fix ternary statement. 2017-05-23 10:15:22 +02:00
Hans-Kristian Arntzen
91379fb0d0 Implement more sophisticated check for point_size. 2017-05-23 10:15:22 +02:00
Bill Hollings
a71c547b30 CompilerMSL remove pad_and_pack_uniform_structs option from both API and CLI tool. 2017-05-22 16:38:38 -04:00
Bill Hollings
542e8c37ad Edits resulting from review of PR #186. 2017-05-22 13:38:23 -04:00
Bill Hollings
d677e63860 Merge with upstream 2017-05-19 19:36:24 -04:00
Bill Hollings
8f6df770ce CompilerMSL map many GLSL functions to MSL functions.
Add bool members is_read and is_written to SPIRType::Image.
Output correct texture read/write access by marking whether textures
are read from and written to by the shader.
Override bitcast_glsl_op() to use Metal as_type<type> functions.
Add implementations of SPIR-V functions inverse(), degrees() & radians().
Map inverseSqrt() to rsqrt().
Map roundEven() to rint().
GLSL functions imageSize() and textureSize() map to equivalent
expression using MSL get_width() & get_height() functions.
Map several SPIR-V integer bitfield functions to MSL equivalents.
Map SPIR-V atomic functions to MSL equivalents.
Map texture packing and unpacking functions to MSL equivalents.
Refactor existing, and add new, image query functions.
Reorganize header lines into includes and pragmas.
Simplify type_to_glsl() logic.
Add MSL test case vert/functions.vert for added function implementations.
Add MSL test case comp/atomic.comp for added function implementations.
test_shaders.py use macOS compilation for MSL shader compilation validations.
2017-05-19 18:14:08 -04:00
Hans-Kristian Arntzen
f081fe1125 Fix separate sampler images in MSL. 2017-05-07 12:36:14 +02:00
Bill Hollings
561dc036f2 CompilerMSL round floating point tex coords for read() and tex array index. 2017-04-25 16:32:16 -04:00
Bill Hollings
012cb25b7d CompilerMSL remove option to flip fragment coordinates. 2017-04-25 11:25:50 -04:00
Bill Hollings
7703b746f7 CompilerMSL vectorless constructor uses vectorless attribute and resource bindings. 2017-04-04 16:38:17 -04:00
Hans-Kristian Arntzen
9bad477f16 Add vector-less IR construction to subclasses as well. 2017-04-01 16:08:19 +02:00
Robert Konrad
ec39647d92 Check for legal lod id
And avoid passing superfluous has_lod parameter.
2017-03-24 09:26:02 +01:00
Robert Konrad
3f74503aca Prefer plain texture2D in legacy es vertex shaders
WebGL supports lod texture funcs only in fragment
shaders but SPIR-V supports only lod texture funcs
in vertex shaders. This reverts calls which were
forced (infered from using a 0 constant) to use
an lod to plain calls in vertex shaders when
using legacy es.
2017-03-23 10:11:45 +01:00
Hans-Kristian Arntzen
61c31c6054 Make use of explicit locations in HLSL. 2017-03-21 13:48:50 +01:00
Hans-Kristian Arntzen
099f307123 Add traversal for active builtin variables.
Refactor some ugly type-copying for access chains.
2017-03-21 13:48:28 +01:00
Bill Hollings
5ad73f33f5 MSL fixes from review of PR 134.
Remove unnecessary use of std:: prefix in spirv_msl.cpp.
Use typedef instead of #define.
spirv-cross deprecate --metal CLI option and replace with --msl option.
2017-03-19 21:06:21 -04:00
Bill Hollings
5550c87b1f CompilerMSL options access and UBO alignment test case.
CompilerMSL accesses options using same design pattern as CompilerGLSL and CompilerHLSL.
CompilerMSL support setting VA & rez binding specs via either constructor or compile() method overload.
CompilerMSL support single UBO packing and padding in single pass.
spriv_cross app (main.cpp) supports turning off UBO packing and padding via command line option.
Add MSL UBO alignment test shader.
2017-03-12 17:42:51 -04:00
Bill Hollings
dc69427402 Updates to MSL functionality to support PR review feedback. 2017-03-11 12:17:22 -05:00
Bill Hollings
a3546ebb54 spirv_msl only add padding structure members if required by member alignment. 2017-03-06 11:00:23 -05:00
Bill Hollings
5cb3ce96a7 spirv_msl pack MSL uniform struct members only when size warrants. 2017-03-02 17:57:26 -08:00
Bill Hollings
b332bae3c3 spirv_msl unpack packed MSL uniform struct members.
spirv_glsl add member_is_packed_type() and unpack_expression_type() functions.
2017-03-01 13:07:40 -05:00
Bill Hollings
484931d8b2 spirv_msl auto-alignment of members of MSL uniform structs.
spirv_msl optionally add padding and packing to allow MSL
struct members to align with SPIR-V struct alignments.
spirv_cross add convenience methods for testing Decorations.
spirv_glsl replace member_decl() function with new emit_stuct_member().
Allow struct member types to be marked as packed via DecorationCPacked decoration.
2017-02-28 21:44:36 -05:00
Bill Hollings
92f12d1d29 CompilerMSL avoid including hidden variables as entry point function arguments. 2017-02-25 23:19:52 -05:00
Hans-Kristian Arntzen
eb5e09fa64 Run format_all.sh. 2017-02-23 19:33:14 +01:00
Hans-Kristian Arntzen
3c58bbbcbe Flatten varying structs outputs in legacy targets. 2017-02-22 20:17:58 +01:00
Bill Hollings
6159a61c95 CompilerMSL add support for texel buffers.
Compiler MSL support DimBuffer as image dimension.
CompilerMSL check texture coordinate result type dimension before adding swizzles.
Update MSL reference shaders affected by this update.
2017-02-09 12:14:30 -05:00
Hans-Kristian Arntzen
5dd7c04195 Merge branch 'master' of git://github.com/brenwill/SPIRV-Cross into pr-109 2017-02-05 10:59:44 +01:00
Hans-Kristian Arntzen
9cb8616c31 Do not use write/read counters for "global" parameters.
Fixes device const & SSBO issues.
2017-02-05 10:50:14 +01:00
Hans-Kristian Arntzen
4ca769b546 Merge branch 'msl_global-invocation-id' of git://github.com/Kangz/SPIRV-Cross into pr-105 2017-02-05 10:14:38 +01:00
Bill Hollings
e4f0dde68f CompilerMSL uses std::set where order matters for consistent regression testing. 2017-01-31 11:02:44 -05:00
Bill Hollings
81757507be CompilerMSL support separate indexed MTLBuffers for stage_in containing matrices.
Add DecorationBinding to Compiler::get_member_decoration()/set_member_decoration().
2017-01-29 13:28:20 -05:00
Bill Hollings
05be822512 Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2017-01-28 12:54:49 -05:00
Hans-Kristian Arntzen
d0cc4fe3ad Fix Wshadow warning. 2017-01-28 08:58:25 +01:00
Bill Hollings
804d5313fa Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2017-01-27 16:12:37 -08:00
Corentin Wallez
d8278a8e3b msl: Add support for gl_LocalInvocationID and gl_LocalInvocationIndex 2017-01-26 20:22:31 -05:00
Corentin Wallez
789eb432e5 msl: Handle writable SSBO in function arguments 2017-01-26 19:44:33 -05:00
Corentin Wallez
6d653aa934 spirv_msl: Add support for gl_GlobalInvocationId 2017-01-26 19:43:44 -05:00
Polona Caserman
a9fb150faa Improved loop 2017-01-26 20:05:43 +01:00
Robert Konrad
bbc1e0c0cc Format code 2017-01-26 10:20:42 +01:00
Robert Konrad
4846e081a7 Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross into metalcat
# Conflicts:
#	spirv_msl.cpp
2017-01-26 10:19:26 +01:00
Bill Hollings
948a24a049 Update spirv_msl copyright dates. 2017-01-25 19:33:32 -08:00
Polona Caserman
3289043729 Remove hard-coded case 2017-01-23 13:02:16 +01:00
Polona Caserman
945494d211 Pass main function name in MSLConfiguration 2017-01-23 13:02:01 +01:00
Polona Caserman
91ccd21fc9 Manage variable names in an unordered map 2017-01-23 13:01:44 +01:00
Polona Caserman
1c63357577 Remove old code 2017-01-23 13:01:05 +01:00
Polona Caserman
b631003230 Replace ib_type.self with ib_type_id 2017-01-23 13:00:43 +01:00
Polona Caserman
92c36e75df Fix: check if location mask is set 2017-01-23 12:56:11 +01:00
Bill Hollings
ef1f860c01 CompilerMSL support OpImageFetch and Metal read() function.
Don't emit automatic sampler when using texture read().
Convert tex coords to uintN() when using texture read().
Emit face when read()ing cube textures.
2017-01-20 17:30:36 -05:00
Bill Hollings
2d0d328f61 Run style formatter. 2017-01-20 11:33:59 -05:00
Bill Hollings
339881468c Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2017-01-20 11:27:05 -05:00
Bill Hollings
4c198bbce9 Remove emission of function prototypes in MSL.
Do not emit function prototypes. If secondary functions are used,
suppress compiler -Wmissing-prototypes warnings.
Refactor Compiler::emit_function_prototype() functions to simplify.
Rename Compiler_msl::CustomFunctionHandler to OpCodePreprocessor, and
Compiler_msl::register_custom_functions() to preprocess_op_codes()
to perform more generic preprocessing.
Add space between dynamic header lines and fixed header lines.
2017-01-20 11:24:44 -05:00
Hans-Kristian Arntzen
7b9036f402 Fix small oversight in last PR. 2017-01-20 12:06:05 +01:00
Corentin Wallez
b61235ae9f spirv_msl: Put writable SSBOs in the 'device' address space 2017-01-19 10:37:15 -05:00
Polona Caserman
b63b8a9996 Dont add a prefix to every function name 2017-01-18 14:52:55 +01:00
Polona Caserman
62ac1c873b Remove struct if it has no members 2017-01-18 14:50:35 +01:00
Polona Caserman
330b366c53 Format code 2017-01-16 17:37:20 +01:00
Polona Caserman
20de679813 Dont iterate over global_variables. Ids are already in global_var_ids 2017-01-16 17:36:31 +01:00
Polona Caserman
f47305c74d Move vector into the class member 2017-01-16 17:35:48 +01:00
Polona Caserman
5d7e126d52 Remove redundant function call 2017-01-16 17:35:14 +01:00
Polona Caserman
be3670ac86 Add break to switch case 2017-01-16 17:35:14 +01:00
Polona Caserman
3e0f52d44c Remove redundant function 2017-01-16 17:35:13 +01:00
Polona Caserman
f647e32659 Add vars declared in the main to the functions 2017-01-16 17:31:20 +01:00
Robert Konrad
a778c363e1 Format code 2017-01-15 16:39:03 +01:00
Robert Konrad
fe5de5e03c Merge branch 'original' into metalcat 2017-01-15 16:33:14 +01:00
Polona Caserman
84c3092aba Merge with KhronosGroup/SPIRV-Cross 2017-01-15 16:21:15 +01:00
Polona Caserman
47808ec6f3 Add function global variables 2017-01-15 16:05:15 +01:00
Polona Caserman
5775dcfcc6 Check if a variable has a valid name 2017-01-15 16:05:14 +01:00
Polona Caserman
3b2dab99a6 Check if this arg is an uniform pointer 2017-01-15 16:05:14 +01:00
Polona Caserman
16834e5832 Sort fragment input variables and vertex output variables alphabetical 2017-01-15 16:05:14 +01:00
Polona Caserman
a496a40f98 Adjust clip-space for Metal 2017-01-15 16:05:13 +01:00
Polona Caserman
20d2b59c8d Buffer counter modified 2017-01-15 16:05:13 +01:00
Polona Caserman
742ec49946 Create uniform struct 2017-01-15 16:05:12 +01:00
Polona Caserman
df3e4c3eb3 Check if function name contains _main 2017-01-15 16:05:12 +01:00
Polona Caserman
5de757621c Set function name 2017-01-15 16:05:12 +01:00
Polona Caserman
989563ad3f Add uniform structure 2017-01-15 16:05:11 +01:00
Polona Caserman
bafde4e917 Check if the location of the original variable is set 2017-01-15 16:05:11 +01:00
Endre Oma
6ad8b307a1 Use the classic locale when converting floats to string 2017-01-11 17:06:06 +01:00
Bill Hollings
4e915e8c48 Run style formatter. 2017-01-08 08:52:57 -05:00
Bill Hollings
4a6358bb9f Add clean_func_name() to support overrides to function names. 2017-01-07 22:15:58 -05:00
Bill Hollings
e6dab816b0 Removed names of unused function parameters. 2017-01-07 15:55:04 -05:00
Bill Hollings
91367799b0 Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2017-01-06 14:13:56 -05:00
Hans-Kristian Arntzen
3576cfb158 Fix warning in MSL. 2017-01-05 18:16:22 +01:00
Bill Hollings
e27a5f7df6 CompilerMSL refactored to simplify handling of vertex attributes.
Combine all vertex attributes into a single stage_in structure.
Remove unneeded structure members from MSLConfiguration, MSLVertexAttr and Meta::Decoration.
Remove unneeded CompilerMSL functions that supported struct offsets and padding.
2017-01-01 14:43:20 -05:00
Bill Hollings
a2b8a0e5c9 Refactor emit_texture_op() function.
CompilerGLSL add to_function_name() and to_function_args() functions to organize
structure of emit_texture_op() function.
CompilerMSL add support for MSL gather(), gather_compare() and sample_compare() functions.
2016-12-28 18:36:42 -05:00
Bill Hollings
7d38f1822a CompilerMSL fixes to support pull-request feedback.
Make Compiler::OpcodeHandler and Compiler::traverse_all_reachable_opcodes protected
instead of private, for use by subclasses.
Add CompilerMSL::CustomFunctionHandler and traverse_all_reachable_opcodes() to detect
active opcodes that require the output of a custom function.
CompilerMSL::custom_function_ops use std::set to retain ordering to improve testability.
2016-12-21 16:31:13 -05:00
Bill Hollings
b1b68db835 Resolve conflict with upstream pull. 2016-12-21 11:43:32 -05:00
Bill Hollings
1a5dc0edcd CompilerMSL support emitting custom functions for SPIR-V ops.
CompilerMSL use custom mod() function instead of Metal's fmod() function.
2016-12-18 21:42:10 -05:00
Bill Hollings
32ae2eceed CompilerMSL enhancements to handling of in/out variables.
CompilerMSL sort in/out attributes by attribute number (location). Sort inputs in reverse order.
CompilerMSL propagate incoming vertex attribute offset values.
CompilerMSL elide unused in/out variables.
CompilerMSL replace use of sets with unordered_sets.
2016-12-18 18:48:15 -05:00
Bill Hollings
e73e8e4f48 Add support for the BuiltInClipDistance builtin for MSL.
CompilerGLSL builtin_to_glsl() function outputs gl_ClipDistance for BuiltInClipDistance
builtin, and includes builtin code in output when handling unknown builtin code.
CompilerMSL uses type ID instead of type object where appropriate to support array types,
where type.self is not consistent with actual type ID, plus support array stride calc
even when not explicitly set by SPIR-V code.
For output consistency, CompilerMSL prefers use of standard builtin names over specified
names, and output builtins qualified with output struct while in entry function.
2016-12-17 17:07:53 -05:00
Panagiotis Christopoulos Charitos
946f7796c1 Add an option to disable exceptions
Some refactoring in the no-exceptions case

Grooming the no-exceptions patch for pull request
2016-12-15 17:49:01 +01:00
Bill Hollings
1358362075 Fixes to non-native row-major matrix support.
Add support for OpLoad. Throw exception for non-square non-native row-major matrix.
Update variable and function names to clarify purposes.
2016-12-14 02:12:52 -05:00
Bill Hollings
343677e639 Support row-major matrices in access chain when not natively supported by backend (MSL). 2016-12-11 11:01:08 -05:00
Hans-Kristian Arntzen
03a26e593d Fixes for MSL and strip redundant parens in some places. 2016-12-06 23:03:35 +01:00
Hans-Kristian Arntzen
e67f6f85a4 Defer parenthesis generation until needed.
Previously, we would generate parentheses proactively when generating
binary ops, however, this leads to uglier code and hits warnings in
compilers when used as a conditional.
2016-12-05 10:56:54 +01:00
Bill Hollings
72df15061d CompilerMSL do not clear used_by_shader flag of
contextual vertex attributes and resource bindings.
2016-12-04 21:57:29 -05:00
Bill Hollings
aca1b55449 MSL sort interface struct members by offset instead of location.
MSL support OpFMod as fmod() function.
Remove SPIRType::is_packed member.
2016-12-04 12:32:58 -05:00
Bill Hollings
c2e6013f4b CompilerMSL supports promoting unnamed global vars to function args.
CompilerMSL use correct MSL type name for 3D textures.
2016-11-27 15:00:06 -05:00
Bill Hollings
c5c073699e CompilerMSL fix func_call_arg() cast error when not passed SPIRVariable type.
CompilerGLSL allow retrieval of partial source if an error occurs.
2016-11-27 12:34:04 -05:00
Hans-Kristian Arntzen
67aad48e50 Run format.sh. 2016-11-12 10:04:50 +01:00
Bill Hollings
23ff950390 When flattening global structs for MSL, don't qualify names of built-in members. 2016-11-10 21:07:50 -05:00
Bill Hollings
f5f910483b Support MSL-specific functions.
Add CompilerMSL emit_instruction() and emit_glsl_op() functions
to handle MSL-specific operation and function definitions.
Remove CompilerMSL emit_msl_defines() function.
2016-10-27 18:47:17 -04:00
Bill Hollings
943191a1c8 Compliance fixes for pull request.
Use C++ style primitive casts.
Add BackendVariations.discard_literal to support language variation for discard syntax.
Tweaks to custom MSL defines.
2016-10-27 10:20:01 -04:00
Bill Hollings
ac00c6032f Run clang-format. 2016-10-24 09:24:24 -04:00
Bill Hollings
0943d9fece MoltenVK shader converter handle missing names.
Use entry point name if no function name provided.
When flattening in/out structs, qualify member names with struct name.
Fix issue when determining declared size of struct types.
Refactor use of m_ name prefix.
Identify header defines in MSL code.
2016-10-23 21:42:54 -04:00
Nathaniel Brown
9577568d56 Corrects some problems converting to compilable MSL from SPIRV. A better solution is to refactor the glsl compiler base-class so some keywords and actions can be overridden, and then the msl subclass can override them - this is a quick & dirty solution.
- adds some common macros that correct for intrinsic differences
 - adds some inline functions to adapt for GLSL terms
 - injects structure member names when the original SPV has been stripped - there is another way to use the correct temporarily assigned member name, but using m_<id> based on the inside SPV code yields metal code that more correctly maps to the original SPV opcodes/slots.
2016-10-21 13:48:21 -07:00
Bill Hollings
a759e2c872 Merge Brenwill fork with upstream. 2016-10-19 14:09:51 -07:00
Hans-Kristian Arntzen
5d4bb687bc Support arrays which have spec constant size.
The size of an array can be a specialization constant or a spec constant
op. This complicates things quite a lot.

Reflection becomes very painful in the presence of expressions instead
of literals so add a new array which expresses this.

It is unlikely that we will need to do accurate reflection of interface
types which have specialization constant size.

SSBOs and UBOs will for now throw exception if a dynamic size is used since it
is very difficult to know the real size.
2016-10-03 17:17:11 +02:00
rob
8bdc4060e8 MSL: Add color attribute qualifiers to fragment function outputs 2016-10-01 15:46:43 +09:00
Hans-Kristian Arntzen
6cc9624e88 Run format.sh. 2016-09-17 18:46:10 +02:00
Rob Fischer
691072894f Reset MSL sequential resource binding EACH pass 2016-09-17 18:30:58 +09:00
Rob Fischer
e2a37b6301 Emit header_lines for MSL also 2016-09-17 12:21:37 +09:00
Rob Fischer
3e45786fbc Correct vector's size begin checked
This caused a null pointer being used when called with p_vtx_attrs = nullptr and p_res_bindings != nullptr
2016-09-16 09:14:22 +09:00
Bill Hollings
b4ce4e4b2f MSL handle input structs originating from HLSL. 2016-08-31 22:51:51 -04:00
Bill Hollings
cf476f36d1 Merge MSL with upstream. 2016-08-31 21:00:56 -04:00
Hans-Kristian Arntzen
f61a5d1e5d Implement dead variable elimination. 2016-08-26 12:58:50 +02:00
Bill Hollings
0dfeabc6d2 Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2016-08-01 15:38:57 -04:00
Hans-Kristian Arntzen
042475e88e Add support for multiple entry points.
- Only consider I/O variables if part of OpEntryPoint.
- Keep a safe fallback if #entry-points is 1 to avoid potentially
  breaking previously working shaders.
2016-07-28 13:18:55 +02:00
Bill Hollings
c45e74f1c0 MSL support global input vars as automatic function args.
Add Decoration qualified_alias element.
Virualize Compiler to_name() function.
MSL use qualified_alias instead of alias when inside entry-point function.
2016-07-08 12:39:22 -04:00
Bill Hollings
65cc931da0 MSL support textures and samplers as global function args. 2016-07-06 21:47:42 -04:00
Bill Hollings
b321b83c8f MSL support textures and samplers as function args.
Add automatic sampler func arg when passing SampledImage type.
Pass texture and sampler in thread address space.
2016-07-06 20:30:47 -04:00
Bill Hollings
14f4339b1c Merge upstream.
Add explicit test for uniform var storage class (changed from test of storage class of var type).
2016-07-06 17:10:42 -04:00
Bill Hollings
fe8b8604bc For MSL, extract global var refs from within functions and convert them to function args. 2016-07-06 16:55:45 -04:00
Hans-Kristian Arntzen
d5dc5f3f1c Fix issue with new glslang behavior for samplers as parameters.
Check case where storage class uniform is passed as function parameter.
2016-07-05 13:21:26 +02:00
Bill Hollings
8f2dec358c Add support for BuiltInFragCoord (changed from BuiltInSamplePosition). 2016-07-04 11:49:46 -04:00
Bill Hollings
449335fd34 Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2016-06-13 19:49:43 -04:00
Hans-Kristian Arntzen
5f629276a7 Use Boolean instead of Bool.
Xlib.h header uses a very ugly define for Bool which conflicts with
SPIRV-Cross.

The hassle free solution is to use Boolean instead.
2016-06-05 20:13:45 +02:00
Bill Hollings
691844f9d7 Support builtin inputs glVertexIndex, glVertexID, glInstanceIndex and glInstanceID
even if they are not identified in the SPIR-V.
2016-05-31 20:27:13 -04:00
Hans-Kristian Arntzen
5ea59bd11b Non-functional: Update formatting. 2016-05-23 13:30:02 +02:00
Hans-Kristian Arntzen
6aa2007cba Deal better with OpName and OpMemberName which alias.
OpName is only for debug information, so we must be very careful that
we do not reuse the same name for different variables.

This was previously done for local variables, but this commit extends
this to global variables as well.
2016-05-23 13:19:41 +02:00
Hans-Kristian Arntzen
4b8ed53974 Add Clang format.
Reformats the entire codebase. Better to do it now than later.

Adds .clang-format and a convenience script format_all.sh which formats
everything automatically.
2016-05-05 09:40:58 +02:00
Hans-Kristian Arntzen
926916d745 Add -Wshadow.
Fixes lots of dubious variable shadowing.
2016-05-05 09:15:25 +02:00
Bill Hollings
2436f4cb5c CompilerMSL DimBuffer image type uses 2D MTLTexture. 2016-04-29 15:04:17 +02:00
Bill Hollings
762947e3dd CompilerMSL move Private global variables to entry-point function variables.
CompilerMSL add support for texture read() without sampler for OpImageFetch.
2016-04-27 19:54:33 +02:00
Bill Hollings
5aafb28cc7 Track sampler ID in Meta for OpSampledImage objects.
Add virtual CompilerGLSL emit_sampled_image_op function for OpSampledImage.
Under MSL, set sampler ID for local OpSampledImage objects and extract it when emitting sampler.
2016-04-23 21:47:41 -04:00
Bill Hollings
1dbd18daaf Add pixel type qualifier to MSL image type names.
Add MSL support for half-precision base formats (short, ushort, half).
2016-04-21 20:47:57 -04:00
Bill Hollings
fa46c14a78 Clean up commented uniform code and replace with TODO statement. 2016-04-11 17:34:26 -04:00
Bill Hollings
257b10eef4 Fix MSL reference to instruction stream modified in subclass update. 2016-04-11 14:16:12 -04:00
Bill Hollings
78b6877368 MSL outputs vertex input struct even when vertex attribute configuration input is missing. 2016-04-11 13:28:43 -04:00
Bill Hollings
b2e313ef3e Support 3 compilation loops for MSL. 2016-04-11 12:23:31 -04:00
Bill Hollings
f9e5fb38b8 Fix compiler warnings. 2016-04-11 10:19:20 -04:00
Bill Hollings
6ddd80e3fe Fixes from code review of MSL functionality.
Rename MSLOptions to MSLConfiguration.
Convert tabs to spaces.
Replace Builtin with uint32_t as map key.
2016-04-08 15:12:40 -04:00
Bill Hollings
8f30f07eb5 Clarify CompileMSL config parameters and move to compile() function.
CompileMSL supports marking vertex attributes and resource bindings
as to whether they are used by the shader, and feeding back to caller.
2016-04-07 21:25:51 -04:00
Bill Hollings
103aabf5e8 Initial support for Metal Shading Language. 2016-04-06 17:42:27 -04:00