Commit Graph

75 Commits

Author SHA1 Message Date
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
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
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
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
f9f87ca391 CompilerMSL output [[point_size]] attribute for BuiltInPointSize member by default.
CompilerMSL::Options::is_rendering_points defaults to true.
2017-05-05 16:13:55 -04: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
Bill Hollings
6a42051d6a CompilerMSL mark the legacy version of the compile() function as deprecated. 2017-03-22 11:15:08 -04:00
Hans-Kristian Arntzen
61c31c6054 Make use of explicit locations in HLSL. 2017-03-21 13:48:50 +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
Hans-Kristian Arntzen
3c58bbbcbe Flatten varying structs outputs in legacy targets. 2017-02-22 20:17:58 +01: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
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
804d5313fa Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2017-01-27 16:12:37 -08:00
Corentin Wallez
789eb432e5 msl: Handle writable SSBO in function arguments 2017-01-26 19:44:33 -05: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
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
Bill Hollings
2d0d328f61 Run style formatter. 2017-01-20 11:33:59 -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
Polona Caserman
f47305c74d Move vector into the class member 2017-01-16 17:35:48 +01:00
Robert Konrad
a778c363e1 Format code 2017-01-15 16:39:03 +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
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
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
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
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