summaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* spirv: Apply OriginUpperLeft to FragCoordNeil Roberts2018-05-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This behaviour was changed in 1e5b09f42f694687ac. The commit message for that says it is just a “tidy up” so my assumption is that the behaviour change was a mistake. It’s a little hard to decipher looking at the diff, but the previous code before that patch was: if (builtin == SpvBuiltInFragCoord || builtin == SpvBuiltInSamplePosition) nir_var->data.origin_upper_left = b->origin_upper_left; if (builtin == SpvBuiltInFragCoord) nir_var->data.pixel_center_integer = b->pixel_center_integer; After the patch the code was: case SpvBuiltInSamplePosition: nir_var->data.origin_upper_left = b->origin_upper_left; /* fallthrough */ case SpvBuiltInFragCoord: nir_var->data.pixel_center_integer = b->pixel_center_integer; break; Before the patch origin_upper_left affected both builtins and pixel_center_integer only affected FragCoord. After the patch origin_upper_left only affects SamplePosition and pixel_center_integer affects both variables. This patch tries to restore the previous behaviour by changing the code to: case SpvBuiltInFragCoord: nir_var->data.pixel_center_integer = b->pixel_center_integer; /* fallthrough */ case SpvBuiltInSamplePosition: nir_var->data.origin_upper_left = b->origin_upper_left; break; This change will be important for ARB_gl_spirv which is meant to support OriginLowerLeft. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Fixes: 1e5b09f42f694687ac "spirv: Tidy some repeated if checks..." (cherry picked from commit e17d0ccbbddac455e4c47f5adc2333a531fedd3e)
* nir/lower_vec_to_movs: Only coalesce if the vec had a SSA destinationJason Ekstrand2018-04-121-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise we may end up trying to coalesce in a case such as ssa_1 = fadd r1, r2 r3.x = fneg(r2); r3 = vec4(ssa_1, ssa_1.y, ...) and that would cause us to move the writes to r3 from the vec to the fadd which would re-order them with respect to the write from the fneg. In order to solve this, we just don't coalesce if the destination of the vec is not SSA. We could try to get clever and still coalesce if there are no writes to the destination of the vec between the vec and the ALU source. However, since registers only come from phi webs and indirects, the chances of having a vec with a register destination that is actually coalescable into its source is very slim. Shader-db results on Haswell: total instructions in shared programs: 13657906 -> 13659101 (<.01%) instructions in affected programs: 149291 -> 150486 (0.80%) helped: 0 HURT: 592 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105440 Fixes: 2458ea95c56 "nir/lower_vec_to_movs: Coalesce movs on-the-fly when possible" Reported-by: Vadym Shovkoplias <[email protected]> Tested-by: Vadym Shovkoplias <[email protected]> Reviewed-by: Matt Turner <[email protected]> (cherry picked from commit 800df942eadc5356840f5cbc2ceaa8a65c01ee91)
* glsl: always call do_lower_jumps() after loop unrollingTimothy Arceri2018-04-121-0/+18
| | | | | | | | | | | | | | | This fixes a bug in radeonsi where LLVM cannot handle the case where a break exists but its not the last instruction in the block. LLVM would fail with: Terminator found in the middle of a basic block! LLVM ERROR: Broken function found, compilation aborted! Fixes: 96fe8834f539 "glsl_to_tgsi: do fewer optimizations with GLSLOptimizeConservatively" Reviewed-by: Matt Turner <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105317 (cherry picked from commit b42633db8e3711e54a5bd10495b1436b8e362801)
* nir: fix crash in loop unroll corner caseTimothy Arceri2018-04-121-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an if nesting inside anouther if is optimised away we can end up with a loop terminator and following block that looks like this: if ssa_596 { block block_5: /* preds: block_4 */ vec1 32 ssa_601 = load_const (0xffffffff /* -nan */) break /* succs: block_8 */ } else { block block_6: /* preds: block_4 */ /* succs: block_7 */ } block block_7: /* preds: block_6 */ vec1 32 ssa_602 = phi block_6: ssa_552 vec1 32 ssa_603 = phi block_6: ssa_553 vec1 32 ssa_604 = iadd ssa_551, ssa_66 The problem is the phis. Loop unrolling expects the last block in the loop to be empty once we splice the instructions in the last block into the continue branch. The problem is we cant move phis so here we lower the phis to regs when preparing the loop for unrolling. As it could be possible to have multiple additional blocks/ifs following the terminator we just convert all phis at the top level of the loop body for simplicity. We also add some comments to loop_prepare_for_unroll() while we are here. Fixes: 51daccb289eb "nir: add a loop unrolling pass" Reviewed-by: Jason Ekstrand <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105670 (cherry picked from commit 629ee690addad9b3dc8f68cfff5ae09858f31caf)
* glsl: fix infinite loop caused by bug in loop unrolling passTimothy Arceri2018-04-121-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just checking for 2 jumps is not enough to be sure we can do a complex loop unroll. We need to make sure we also have also found 2 loop terminators. Without this we were attempting to unroll a loop where the second jump was nested inside multiple ifs which loop analysis is unable to detect as a terminator. We ended up splicing out the first terminator but failed to actually unroll the loop, this resulted in the creation of a possible infinite loop. Fixes: 646621c66da9 "glsl: make loop unrolling more like the nir unrolling path" Tested-by: Gert Wollny <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105670 (cherry picked from commit 56b867395dee1a48594b27987d3bf68a4e745dda) Squashed with: glsl: remove unreachable assert() Earlier commit enforced that we'll bail out if the number of terminators is different than 2. With that in mind, the assert() will never trigger. Fixes: 56b867395de ("glsl: fix infinite loop caused by bug in loop unrolling pass") Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Emil Velikov <[email protected]> (cherry picked from commit 8eceac9de7d3cd4fddabbe61d512acfed9812169)
* compiler/spirv: set is_shadow for depth comparitor sampling opcodesIago Toral Quiroga2018-04-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | From the SPIR-V spec, OpTypeImage: "Depth is whether or not this image is a depth image. (Note that whether or not depth comparisons are actually done is a property of the sampling opcode, not of this type declaration.)" The sampling opcodes that specify depth comparisons are OpImageSample{Proj}Dref{Explicit,Implicit}Lod, so we should set is_shadow only for these (we were using the deph property of the image until now). v2: - Do the same for OpImageDrefGather. - Set is_shadow to false if the sampling opcode is not one of these (Jason) - Reuse an existing switch statement instead of adding a new one (Jason) Fixes crashes in: dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.* Reviewed-by: Jason Ekstrand <[email protected]> Cc: [email protected] (cherry picked from commit 41ac0b1443ca7c8c3481eab978a41b7caba5503a)
* nir/lower_indirect_derefs: Support interp_var_at intrinsicsJason Ekstrand2018-04-121-2/+11
| | | | | | | | This fixes the fs-interpolateAtCentroid-block-array piglit test on i965. Reviewed-by: Kenneth Graunke <[email protected]> Cc: [email protected] (cherry picked from commit 6018f5b07966a0f85dea1ee6775d50a8c85fdee1)
* nir/vars_to_ssa: Remove copies from the correct setJason Ekstrand2018-04-121-1/+1
| | | | | | Reviewed-by: Kenneth Graunke <[email protected]> Cc: [email protected] (cherry picked from commit 0517d65f9639349d626aeb2af48ba9e4e605900d)
* nir: fix per_vertex_output intrinsicRob Clark2018-04-121-1/+1
| | | | | | | | | | This is supposed to have both BASE and COMPONENT but num_indices was inadvertantly set to 1. Cc: <[email protected]> Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> (cherry picked from commit cc3a88e81dbceb12b79eb4ebe7a4ce5ba97fc291)
* glsl: Fix memory leak with known glsl_type instancesSimon Hausmann2018-03-202-87/+47
| | | | | | | | | | | | | | | | | | | When looking up known glsl_type instances in the various hash tables, we end up leaking the key instances used for the lookup, as the glsl_type constructor allocates memory on the global mem_ctx. This patch changes glsl_type to manage its own memory, which fixes the leak and also allows getting rid of the global mem_ctx and its mutex. v2: remove lambda usage (Tapani) (+keep ASSERT_BITFIELD_SIZE, modify dummy ctor to initialize mem_ctx) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104884 Cc: [email protected] Signed-off-by: Simon Hausmann <[email protected]> Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> (cherry picked from commit fb5825e7ceeb16ac05f870ffe1e5a5daa09e68dd)
* glsl/linker: fix bug when checking precision qualifierSamuel Iglesias Gonsálvez2018-03-201-8/+3
| | | | | | | | | | | | | | | | According to GLSL ES 3.2 spec, see table in 9.2.1 "Linked Shaders" section, the precision qualifier should match for uniform variables. This also applies to previous GLSL ES 3.x specs. This 'if' checks the condition for uniform variables, while for UBOs it is checked in link_interface_blocks.cpp. Fixes: b50b82b8a553 ("glsl/es31: precision qualifier doesn't need to match in shader interface block members") Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> (cherry picked from commit e207b2e2c8dea99972e744c8fdfa0b9a9481ea5e)
* nir: fix interger divide by zero crash during constant foldingTimothy Arceri2018-03-201-2/+2
| | | | | | | | | | | | | From the GLSL 4.60 spec Section 5.9 (Expressions): "Dividing by zero does not cause an exception but does result in an unspecified value." Fixes: 89285e4d47a6 "nir: add new constant folding infrastructure" Reviewed-by: Jason Ekstrand <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105271 (cherry picked from commit 0c1f37cc2d8555223ade73b244a3ee374be8d9cd)
* glsl/tests: Fix a compiler warning about signed/unsigned loop comparison.Eric Anholt2018-03-201-1/+1
| | | | | | Fixes: d32956935edf ("glsl: Walk a list of ir_dereference_array to mark array elements as accessed") Reviewed-by: Ian Romanick <[email protected]> (cherry picked from commit 4636ce362d4defc70a2b40cab1f52d1c890f5673)
* glsl: Silence warnings in the uniform initializer test about 16-bit typesEric Anholt2018-03-201-0/+9
| | | | | | | | | | They should probably get unit tests implemented, but this cleans up a bunch of warnings in my build for now. Fixes: 59f458cd8703 ("glsl: Add 16-bit types") Cc: Eduardo Lima Mitev <[email protected]> Reviewed-by: Ian Romanick <[email protected]> (cherry picked from commit 1b313eedb5e5da3c7ee3f62a83b66a6e097fe0d3)
* glsl/tests: Fix strict aliasing warning about int64/double.Eric Anholt2018-03-201-3/+19
| | | | | | Fixes: 4bf986274728 ("glsl/tests: Add UINT64 and INT64 types") Reviewed-by: Rhys Kidd <[email protected]> (cherry picked from commit 21670f820812238dbe3fb18ab90493999b7e718e)
* glsl/linker: check same name is not used in block and outsideJuan A. Suarez Romero2018-02-281-23/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According with OpenGL GLSL 3.20 spec, section 4.3.9: "It is a link-time error if any particular shader interface contains: - two different blocks, each having no instance name, and each having a member of the same name, or - a variable outside a block, and a block with no instance name, where the variable has the same name as a member in the block." This fixes a previous commit 9b894c8 ("glsl/linker: link-error using the same name in unnamed block and outside") that covered this case, but did not take in account that precision qualifiers are ignored when comparing blocks with no instance name. With this commit, the original tests KHR-GL*.shaders.uniform_block.common.name_matching keep fixed, and also dEQP-GLES31.functional.shaders.linkage.uniform.block.differing_precision regression is fixed, which was broken by previous commit. v2: use helper varibles (Matteo Bruni) Fixes: 9b894c8 ("glsl/linker: link-error using the same name in unnamed block and outside") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104668 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104777 CC: Mark Janes <[email protected]> CC: "18.0" <[email protected]> Tested-by: Matteo Bruni <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Signed-off-by: Juan A. Suarez Romero <[email protected]> (cherry picked from commit 4195eed961ccfe404ae81b9112189fc93a254ded)
* nir: mark unused space in packed_tex_dataTapani Pälli2018-02-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | This change cleans following scary warnings in valgrind output when disk cache is being written: ==6532== Uninitialised byte(s) found during client check request ==6532== at 0x14423FAD: blob_write_bytes (blob.c:152) ==6532== by 0x144240FB: blob_write_uint32 (blob.c:194) ==6532== by 0x144001A5: write_tex (nir_serialize.c:613) and later (loads of): ==6532== Use of uninitialised value of size 8 ==6532== at 0x62FCD9E: crc32_z (in /usr/lib64/libz.so.1.2.11) ==6532== by 0x13F65014: util_hash_crc32 (crc32.c:127) ==6532== by 0x13F5DABA: cache_put (disk_cache.c:947) Signed-off-by: Tapani Pälli <[email protected]> Cc: [email protected] Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Emil Velikov <[email protected]> (cherry picked from commit d0343bef6680cc660ba691bbed31a2a1b7449f79)
* automake: small cleanup after the meson.build inclusion18.0-branchpointEmil Velikov2018-01-231-1/+0
| | | | | | | | Namely extend the EXTRA_DIST list, instead of re-assigning it and bring back a file dropped by mistake. Fixes: 436ed65d38d ("autotools: include meson build files in tarball") Signed-off-by: Emil Velikov <[email protected]>
* glsl: add image and sampler (un)packing support to glsl to nirTimothy Arceri2018-01-231-0/+4
| | | | | | This is needed for ARB_bindless_texture support. Reviewed-by: Nicolai Hähnle <[email protected]>
* nir: add image and sampler type to glsl_get_bit_size()Timothy Arceri2018-01-231-0/+2
| | | | | | These are needed for ARB_bindless_texture support. Reviewed-by: Nicolai Hähnle <[email protected]>
* autotools: include meson build files in tarballDylan Baker2018-01-191-1/+8
| | | | | | | | | | | | This adds the meson.build, meson_options.txt, and a few scripts that are used exclusively by the meson build. v2: - Remove accidentally included changes needed to test make dist with LLVM > 3.9 Signed-off-by: Dylan Baker <[email protected]> Acked-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glsl: remove unneeded extern "C" {} bracketing around Mesa includesBrian Paul2018-01-171-4/+2
| | | | | | The two headers already have the right extern "C" annotations. Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: include util/bitscan.h in serialize.cppBrian Paul2018-01-171-0/+1
| | | | | | Instead of relying on indirect inclusion of the header. Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl/linker: link-error using the same name in unnamed block and outsideJuan A. Suarez Romero2018-01-161-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | According with OpenGL GLSL 4.20 spec, section 4.3.9, page 57: "It is a link-time error if any particular shader interface contains: - two different blocks, each having no instance name, and each having a member of the same name, or - a variable outside a block, and a block with no instance name, where the variable has the same name as a member in the block." This means that it is a link error if for example we have a vertex shader with the following definition. "layout(location=0) uniform Data { float a; float b; };" and a fragment shader with: "uniform float a;" As in both cases we refer to both uniforms as "a", and thus using glGetUniformLocation() wouldn't know which one we mean. This fixes KHR-GL*.shaders.uniform_block.common.name_matching. v2: add fixed tests (Tapani) Reviewed-by: Tapani Pälli <[email protected]>
* nir: add a 'const' qualifier to nir_ssa_def_components_read()Samuel Pitoiset2018-01-122-2/+2
| | | | | | | | To avoid compilation warnings and because this helper shouldn't update anything. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* meson: Use dependencies for nirDylan Baker2018-01-113-6/+19
| | | | | | | | | | | | | | | | | This creates two new internal dependencies, idep_nir_headers and idep_nir. The former encapsulates the generation of nir_opcodes.h and nir_builder_opcodes.h and adding src/compiler/nir as an include path. This ensures that any target that needs nir headers will have the includes and that the generated headers will be generated before the target is build. The second, idep_nir, includes the first and additionally links to libnir. This is intended to make it easier to avoid race conditions in the build when using nir, since the number of consumers for libnir and it's headers are quite high. Acked-by: Eric Engestrom <[email protected]> Signed-off-by: Dylan Baker <[email protected]>
* meson: Use consistent style for testsDylan Baker2018-01-112-49/+60
| | | | | | | Don't use intermediate variables, use consistent whitespace. Acked-by: Eric Engestrom <[email protected]> Signed-off-by: Dylan Baker <[email protected]>
* meson: Use consistent styleDylan Baker2018-01-112-4/+8
| | | | | | | | | | | | | | | | | | | | Currently the meosn build has a mix of two styles: arg : [foo, ... bar], and arg : [ foo, ..., bar, ] For consistency let's pick one. I've picked the later style, which I think is more readable, and is more common in the mesa code base. v2: - fix commit message Acked-by: Eric Engestrom <[email protected]> Signed-off-by: Dylan Baker <[email protected]>
* glsl: cleanup shader_cache header guardTapani Pälli2018-01-111-3/+3
| | | | | Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl/linker: Safely generate mask of possible locationsIan Romanick2018-01-101-4/+5
| | | | | | | | | | If MaxAttribs were ever raised to 32, undefined behavior would occur. We had already gone to the effort (albeit incorrectly) handle this in one case, so fix them all. CID: 1369628 Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl/linker: Mark no locations as invalid instead of marking all locationsIan Romanick2018-01-101-1/+1
| | | | | | | | | | | | If max_index were ever 32, the linker would have marked all 32 locations as invalid instead of marking none of them as invalid. It's a good thing the maximum value actually set by any driver for MaxAttribs is 16. Found by inspection while investigating CID 1369628. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl: Don't handle visit_stop in several ::accept methodsIan Romanick2018-01-101-3/+6
| | | | | | | | | All cases where the result could be non-visit_continue would have already returned. CID: 401351, 1224465, 1224466 Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl: Remove unnecessary assignments to typeIan Romanick2018-01-101-4/+0
| | | | | | | | | None of these are necessary because result->type is the only thing used outside the giant switch-statement. CID: 1230983, 1230984 Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* nir: Silence unused parameter warningsIan Romanick2018-01-101-2/+2
| | | | | | | | | | | | | | | | In file included from src/compiler/nir/nir_opt_algebraic.c:4:0: src/compiler/nir/nir_search_helpers.h: In function ‘is_not_const’: src/compiler/nir/nir_search_helpers.h:118:59: warning: unused parameter ‘num_components’ [-Wunused-parameter] is_not_const(nir_alu_instr *instr, unsigned src, unsigned num_components, ^~~~~~~~~~~~~~ src/compiler/nir/nir_search_helpers.h:119:29: warning: unused parameter ‘swizzle ’ [-Wunused-parameter] const uint8_t *swizzle) ^~~~~~~ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl: remove Lower{TCS,TES}PatchVerticesInIago Toral Quiroga2018-01-102-27/+4
| | | | | | | | | | | | Intel was the only user and now NIR can do the lowering. v2: do not try to handle it as a system value directly for the SPIR-V path. In GL we rather handle it as a uniform like we do for the GLSL path (Jason). v3: drop LowerTESPatchVerticesIn as well (Jason) Reviewed-by: Jason Ekstrand <[email protected]>
* .gitignore: Ignore new generated filesScott D Phillips2018-01-081-0/+1
| | | | | | | | | New generated files from: bb1e6ff161c ("spirv: Add a prepass to set types on vtn_values") 65fc16c9741 ("autotools: set XA versions in configure.ac and configure header file") Reviewed-by: Jordan Justen <[email protected]>
* spirv: Do implicit conversions of uint to bool in OpStoreJason Ekstrand2018-01-081-0/+19
| | | | | | | | | | | Technically, the GLSLang bug related to this can also affect SSBO writes where the bool -> uint conversion is missing. However, the only known shipping application with an old enough version of GLSLang to cause issues with this is the new DOOM game so we keep the workaround as small as possible. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104424 Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Loosen the validation for load/store type matchingJason Ekstrand2018-01-081-6/+33
| | | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104338 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104424 Tested-by: Eero Tamminen <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Require a storage type for OpStore destinationsJason Ekstrand2018-01-081-0/+4
| | | | | | | This rules out things such as trying to store a pointer to a local variable. Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Add a vtn_types_compatible helperJason Ekstrand2018-01-082-0/+55
| | | | | Tested-by: Eero Tamminen <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Store the id of the type in vtn_typeJason Ekstrand2018-01-083-5/+8
| | | | | | | | | Previously, we were storing a pointer to the vtn_value because we use it to look up decorations when we create input/output variables. This works, but it also may be useful to have the id itself so we may as well store that instead. Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Add a mechanism for dumping failing shadersJason Ekstrand2018-01-082-0/+29
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Rework asserts in var_decoration_cbJason Ekstrand2018-01-081-7/+8
| | | | | | | | Now that higher levels are enforcing decoration sanity, we don't need the vtn_asserts here. This function *should* be safe but we still want a few well-placed regular asserts in case something goes awry. Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Rework error checking for decorationsJason Ekstrand2018-01-081-9/+32
| | | | | | | | | | | | This reworks the error checking on our generic handling of decorations. The objective is to validate all of the SPIR-V assumptions we make up-front and convert redundant checks to compiled-out asserts. The most important part of this is to ensure that member decorations only occur on OpTypeStruct and that the member is never out-of-bounds. This way later code can assume that the member is sane and not have to worry about OOB array access due to a misplaced OpMemberDecorate. Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Add better type validation to OpTypeImageJason Ekstrand2018-01-081-7/+10
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Switch on vtn_base_type in OpComposite(Extract|Insert)Jason Ekstrand2018-01-081-37/+32
| | | | | | | | This is a bit simpler since we have fewer enum values in the case. It's also a bit more efficient because we're making fewer glsl_get_* calls. While we're at it, add better type validation. Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Refactor Op[Spec]ConstantComposite and add better validationJason Ekstrand2018-01-081-36/+32
| | | | | | | | Now that vtn_base_type is a real and full base type, we can switch on that instead of the GLSL base type which is a lot fewer cases in our switch. Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Add better validation to Op[Spec]ConstantJason Ekstrand2018-01-081-2/+7
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Remove a pointless assignment in SpvOpSpecConstantJason Ekstrand2018-01-081-1/+0
| | | | | | We re-assign later inside the bit_size switch Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Unify boolean constants and add better validationJason Ekstrand2018-01-081-10/+11
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>