summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* tnl: Push down the gl_vertex_array inputs into tnl drivers.Mathias Fröhlich2018-03-3113-9/+88
| | | | | Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
* vbo: Remove vbo_indirect_draw_func.Mathias Fröhlich2018-03-313-102/+30
| | | | | | | | | | | Remove the vbo_indirect_draw_func vbo callback and make the default implementation use the drivers main draw callback function directly. This will be needed with the next changes when drivers without own main drivers DrawIndirect implementation get moved to the main drivers Draw method. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
* i965: Push down the gl_vertex_array inputs into i965.Mathias Fröhlich2018-03-314-6/+23
| | | | | | | | | | Let the i965 backend have its own gl_vertex_array array and basically reimplement the way _vbo_draw works. Note that brw_draw_indirect_prims calls brw_draw_prims internally and gets its update to Array._DrawArray by this way. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
* gallium: Push down the gl_vertex_array inputs into gallium.Mathias Fröhlich2018-03-315-14/+52
| | | | | | | | Let the gallium backend have its own gl_vertex_array array and basically reimplement the way _vbo_draw works. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
* nir/validator: Validate that all used variables existJason Ekstrand2018-03-301-9/+8
| | | | | | We were validating this for locals but nothing else. Reviewed-by: Kenneth Graunke <[email protected]>
* intel/vec4: Set channel_sizes for MOV_INDIRECT sourcesJason Ekstrand2018-03-301-1/+4
| | | | | | | | | | | Otherwise, any indirect push constant access results in an assertion failure when we start digging through the channel_sizes array. This fixes dEQP-VK.pipeline.push_constant.graphics_pipeline.dynamic_index_vert on Haswell. It should be a harmless no-op for GL since indirect push constants aren't used there. Reviewed-by: Kenneth Graunke <[email protected]> Fixes: e69e5c7006d "i965/vec4: load dvec3/4 uniforms first in the..."
* nir/lower_indirect_derefs: Support interp_var_at intrinsicsJason Ekstrand2018-03-301-2/+11
| | | | | | | This fixes the fs-interpolateAtCentroid-block-array piglit test on i965. Reviewed-by: Kenneth Graunke <[email protected]> Cc: [email protected]
* nir/vars_to_ssa: Remove copies from the correct setJason Ekstrand2018-03-301-1/+1
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Cc: [email protected]
* nir: Return a cursor from nir_instr_removeJason Ekstrand2018-03-303-19/+18
| | | | | | | | Because nir_instr_remove is an inline wrapper around nir_instr_remove_v, the compiler should be able to tell that the return value is unused and not emit the extra code in most cases. Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Add src/dest num_components helpersJason Ekstrand2018-03-301-0/+12
| | | | | | We already have these for bit_size Reviewed-by: Kenneth Graunke <[email protected]>
* st/wgl: check if WGL_SWAP_INTERVAL is defined in wglSwapIntervalEXT()Brian Paul2018-03-302-2/+2
| | | | | | | | | | | | This allows the WGL_SWAP_INTERVAL env var to override any application calls to wglSwapIntervalEXT(). Useful for debugging, or to set the interval to zero to effectively disable the swap interval. Note: we also rename the previous instance of SVGA_SWAP_INTERVAL to WGL_SWAP_INTERVAL since this is a WGL feature and not related to the svga driver. Reviewed-by: Charmaine Lee <[email protected]>
* glapi: define GL_API to be KEYWORD1 in glapi_dispatch.c (v2)Brian Paul2018-03-301-0/+7
| | | | | | | | | | This fixes a Windows build warning where the prototypes for the ES function in the header file don't match the prototypes in this file because the GL_API and GLAPI macros are defined differently. v2: defined GL_API to KEYWORD1 instead of GLAPI, per Mathias. Reviewed-by: Mathias Fröhlich <[email protected]>
* spirv: s/uint/unsigned/ to fix MSVC buildBrian Paul2018-03-301-1/+1
| | | | Reviewed-by: Neil Roberts <[email protected]>
* nir/spirv: s/uint32_t/SpvOp/ in various functionsBrian Paul2018-03-303-7/+7
| | | | | | | | | | The MSVC compiler warns when the function parameter types don't exactly match with respect to enum vs. uint32_t. Use SpvOp everywhere. Alternately, uint32_t could be used everywhere. There doesn't seem to be an advantage to one over the other. Reviewed-by: Neil Roberts <[email protected]>
* nir/spirv: fix MSVC syntax error in vtn_handle_texture()Brian Paul2018-03-301-1/+2
| | | | Reviewed-by: Neil Roberts <[email protected]>
* nir/spirv: move NORETURN annotation on _vtn_fail() prototypeBrian Paul2018-03-301-2/+4
| | | | | | | This needs to before the function, not after, to compile with MSVC. This works with gcc too. Reviewed-by: Neil Roberts <[email protected]>
* nir/spirv: fix MSVC warning in vtn_align_u32()Brian Paul2018-03-301-1/+1
| | | | | | | Fixes warning that "negation of an unsigned value results in an unsigned value". Reviewed-by: Neil Roberts <[email protected]>
* spirv: Fix building with SConsNeil Roberts2018-03-3010-2/+70
| | | | | | | | | | | | | The SCons build broke with commit ba975140d3c9 because a SPIR-V function is called from Mesa main. This adds a convenience library for SPIR-V and adds it to everything that was including nir. It also adds both nir and spirv to drivers/x11/SConscript. Also add nir/spirv modules to osmesa and libgl-gdi targets. (Brian Paul) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105817 Reviewed-by: Brian Paul <[email protected]> Tested-by: Brian Paul <[email protected]>
* mesa: fix MSVC bitshift overflow warningsBrian Paul2018-03-301-1/+1
| | | | | | | | | | | | | | In the BITFIELD_MASK() macro, if b==32 the expression evaluates to ~0u, but the compiler still sees the expression (1 << 32) in the unused part and issues a warning about integer bitshift overflow. Fix that by using (b) % 32 to ensure the max shift is 31 bits. This issue has been present for a while, but shows up much more often because of the recent VBO changes. Reviewed-by: Mathias Fröhlich <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* st/mesa: add missing GLSL_TYPE_[U]INT8 cases in st_glsl_type_dword_size()Brian Paul2018-03-301-0/+3
| | | | | | Silences a compiler warning about unhandled enum switch cases. Reviewed-by: Mathias Fröhlich <[email protected]>
* vbo: MaxVertexAttribStride is not always setJakob Bornecrantz2018-03-301-1/+6
| | | | | | | This assert is hit on hardware which does not expose GL 4.4 or GLES 3.1. Reviewed-by: Mathias Fröhlich <[email protected]> Signed-off-by: Jakob Bornecrantz <[email protected]>
* x11: Only report supported DRI3/Present versionsDaniel Stone2018-03-302-10/+32
| | | | | | | | | | | | | The version passed to QueryVersion requests is the version that the client supports. We were just passing in whatever version of XCB was present on the system, which may not be a version that Mesa actually explicitly supports, e.g. it might bring unwanted semantics. Set specific protocol versions which we support, and only pass those. Signed-off-by: Daniel Stone <[email protected]> Fixes: 7aeef2d4efd ("dri3: allow building against older xcb (v3)") Reviewed-by: Emil Velikov <[email protected]>
* radv: set SAMPLE_RATE to the number of samples of the current fbSamuel Pitoiset2018-03-303-4/+16
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* nir: s/uint/unsigned/ to fix MSVC/MinGW buildBrian Paul2018-03-302-2/+2
| | | | | Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Neha Bhende <[email protected]>
* i965: Don't call process_glsl_ir() for SPIR-V shadersEduardo Lima Mitev2018-03-301-1/+2
| | | | | | | v2: Use 'spirv_data' from gl_linked_shader instead, to check if shader is SPIR-V. (Timothy Arceri) Reviewed-by: Timothy Arceri <[email protected]>
* i965: Call spirv_to_nir() instead of glsl_to_nir() for SPIR-V shadersEduardo Lima Mitev2018-03-301-2/+8
| | | | | | | | | | | This is the main fork of the shader compilation code-path, where a NIR shader is obtained by calling spirv_to_nir() or glsl_to_nir(), depending on its nature.. v2: Use 'spirv_data' member from gl_linked_shader to know which method to call. (Timothy Arceri) Reviewed-by: Timothy Arceri <[email protected]>
* mesa/glspirv: Add a _mesa_spirv_to_nir() functionEduardo Lima Mitev2018-03-302-0/+65
| | | | | | | | | | | This is basically a wrapper around spirv_to_nir() that includes arguments setup and post-conversion validation. v2: * Rebase update (SpirVCapabilities not a pointer anymore, spirv_to_nir_options added, and others). * Code-style improvements and remove debug hunk. (Timothy Arceri) Reviewed-by: Timothy Arceri <[email protected]>
* mesa/program: Link SPIR-V shaders using the SPIR-V code-pathEduardo Lima Mitev2018-03-301-1/+5
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* mesa/glspirv: Add _mesa_spirv_link_shaders() functionEduardo Lima Mitev2018-03-302-0/+75
| | | | | | | | | | | | | | | | | | | This is the equivalent to link_shaders() from src/compiler/glsl/linker.cpp, but for SPIR-V programs. It just creates the program and its gl_linked_shader objects, giving drivers the opportunity to implement any linking of SPIR-V shaders they choose, at a later stage. v2: Bail out if we see more that one shader for the same stage, and add a corresponding comment. (Timothy Arceri) v3: * Adds also a linker error log to the condition above, with a reference to the specification issue. (Timothy Arceri) * Squash with the patch adding the function boilerplate (Timothy Arceri) Reviewed-by: Timothy Arceri <[email protected]>
* mesa: Add a reference to gl_shader_spirv_data to gl_linked_shaderEduardo Lima Mitev2018-03-302-0/+9
| | | | | | | This is a reference to the spirv_data object stored in gl_shader, which stores shader SPIR-V data that is needed during linking too. Reviewed-by: Timothy Arceri <[email protected]>
* mesa: Implement glSpecializeShaderARBNicolai Hähnle2018-03-301-2/+105
| | | | | | | | | | | | | | | | | v2: * Use gl_spirv_validation instead of spirv_to_nir. This method just validates the shader. The conversion to NIR will happen later, during linking. (Alejandro Piñeiro) * Use gl_shader_spirv_data struct to store the SPIR-V data. (Eduardo Lima) * Use the 'spirv_data' member to tell if the gl_shader is a SPIR-V shader, instead of a dedicated flag. (Timothy Arceri) Signed-off-by: Nicolai Hähnle <[email protected]> Signed-off-by: Alejandro Piñeiro <[email protected]> Signed-off-by: Eduardo Lima Mitev <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* nir/spirv: add gl_spirv_validation methodAlejandro Piñeiro2018-03-306-14/+305
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ARB_gl_spirv adds the ability to use SPIR-V binaries, and a new method, glSpecializeShader. Here we add a new function to do the validation for this function: From OpenGL 4.6 spec, section 7.2.1" "Shader Specialization", error table: INVALID_VALUE is generated if <pEntryPoint> does not name a valid entry point for <shader>. INVALID_VALUE is generated if any element of <pConstantIndex> refers to a specialization constant that does not exist in the shader module contained in <shader>."" v2: rebase update (spirv_to_nir options added, changes on the warning logging, and others) v3: include passing options on common initialization, doesn't call setjmp on common_initialization v4: (after Jason comments): * Rename common_initialization to vtn_builder_create * Move validation method and their helpers to own source file. * Create own handle_constant_decoration_cb instead of reuse existing one v5: put vtn_build_create refactoring to their own patch (Jason) v6: update after vtn_builder_create method renamed, add explanatory comment, tweak existing comment and commit message (Timothy)
* spirv: add vtn_create_builderAlejandro Piñeiro2018-03-302-17/+38
| | | | | | | | | Refactored from spirv_to_nir, in order to be reused later. Reviewed-by: Timothy Arceri <[email protected]> v2: renamed method (from vtn_builder_create), add explanatory comment (Timothy)
* i965: initialize SPIR-V capabilitiesAlejandro Piñeiro2018-03-301-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Needed for ARB_gl_spirv. Those are not the same that the Intel vulkan driver. From the ARB_spirv_extensions spec: "3. If a new GL extension is added that includes SPIR-V support via a new SPIR-V extension does it's SPIR-V extension also get enumerated by the SPIR_V_EXTENSIONS_ARB query?. RESOLVED. Yes. It's good to include it for consistency. Any SPIR-V functionality supported beyond the SPIR-V version that is required for the GL API version should be enumerated." So in addition to the core SPIR-V support, there is the possibility of specific GL extensions enabling specific SPIR-V extensions (so capabilities). That would mean that it is possible that OpenGL and Vulkan not having the same capabilities supported, even for the same driver. For this reason it is better to keep them separated. As an example: at the time of this patch writing Intel vulkan driver support multiview, but there isn't any OpenGL multiview GL extension supported. Note: we initialize SPIR-V capabilities at brwCreateContext instead of the usual brw_initialize_context_constants because we want to do that only if the extension is enabled. v2: * Rebase update (SpirVCapabilities not a pointer anymore) * Fill spirv capabilities for OpenGL >= 3.3 (Ian Romanick) v3: * Drop multiview support, as i965 doesn't support any multiview GL extension (Jason) * Fill spirv capabilities only if the extension is enabled (Jason) v4: Capabilities are supported only on gen7+. Added comment and assert (Jason)
* mesa: add gl_constants::SpirVCapabilitiesNicolai Hähnle2018-03-301-0/+3
| | | | | | | | For drivers to declare which SPIR-V features they support. v2: Don't use a pointer (Ian Romanick) Reviewed-by: Timothy Arceri <[email protected]>
* i965: Don't request GLSL IR lowering of gl_VertexIDIan Romanick2018-03-291-1/+0
| | | | | | | | | | | | | | | Let the lowering in NIR handle it instead. This hurts one shader that occurs twice in shader-db (SynMark GSCloth) on IVB and HSW. No other shaders or platforms were affected. total cycles in shared programs: 253438422 -> 253438426 (0.00%) cycles in affected programs: 412 -> 416 (0.97%) helped: 0 HURT: 2 Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Antia Puentes <[email protected]>
* i965: Silence unused parameter warningIan Romanick2018-03-291-5/+3
| | | | | | | | | | src/mesa/drivers/dri/i965/brw_draw_upload.c: In function ‘double_types’: src/mesa/drivers/dri/i965/brw_draw_upload.c:225:34: warning: unused parameter ‘brw’ [-Wunused-parameter] double_types(struct brw_context *brw, ^~~ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* spirv: Move SPIR-V building to Makefile.spirv.am and spirv/meson.buildIan Romanick2018-03-296-49/+100
| | | | | | | | | | | | | Future changes will add generated files used only from src/compiler/glsl. These can't be built from Makefile.nir.am, and we can't move all the rules from Makefile.nir.am to Makefile.spirv.am (and it would be silly anyway). v2: Do it for meson too. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> (the meson bits) Reviewed-by: Alejandro Piñeiro <[email protected]> (the automake bits)
* compiler: All leaf Makefile.am should use +=Ian Romanick2018-03-292-1/+2
| | | | | | | | This slightly simplifies later changes that add more Makefile.*.am files. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* util: Include bitscan.h directlyIan Romanick2018-03-295-1/+5
| | | | | | | | | | | | | | | Previously bitset.h would include u_math.h to get bitscan.h. u_math.h lives in src/gallium/auxiliary/util while both bitset.h and bitscan.h live in src/util. Having the one file directly include another file that lives in the same directory makes much more sense. As a side-effect, several files need to directly include standard header files that were previously indirectly included. v2: Fix build break in src/amd/common/ac_nir_to_llvm.c. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* util: Optimize util_is_power_of_two_nonzeroIan Romanick2018-03-291-0/+17
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Suggested-by: Matt Turner <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* util: Use util_is_power_of_two_nonzero in u_vectorIan Romanick2018-03-291-2/+2
| | | | | | | | Previously size=0, element_size=0 would have been allowed. That combination can only lead to despair. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* util: Add and use util_is_power_of_two_nonzeroIan Romanick2018-03-295-13/+19
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* util: Move util_is_power_of_two to bitscan.h and rename to ↵Ian Romanick2018-03-2937-73/+79
| | | | | | | | | | | util_is_power_of_two_or_zero The new name make the zero-input behavior more obvious. The next patch adds a new function with different zero-input behavior. Signed-off-by: Ian Romanick <[email protected]> Suggested-by: Matt Turner <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* meson: use dep_libdrm version for pkg-configDylan Baker2018-03-292-2/+2
| | | | | | | | | This corrects pkg-config to use the libdrm version (as computed by the previous patch) instead of using a hardcoded value that may or may not (probably not) be right. Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glapi: add glBlendBarrier(), glPrimitiveBoundingBox() prototypesBrian Paul2018-03-291-0/+2
| | | | | | | | in glapi_dispatch.c, as we have for many other GLES functions. Fixes a cross-compile issue (missing prototype) when GLES support is disabled. Reviewed-by: Sinclair Yeh <[email protected]>
* st/mesa: silence unhandled switch case warningBrian Paul2018-03-291-1/+2
| | | | | | And improve the unreachable() error message. Reviewed-by: Mathias Fröhlich <[email protected]>
* mesa: Inherit texture view multi-sample information from the original ↵Henri Verbeet2018-03-293-14/+26
| | | | | | | | | | | | | | texture images. Found running "The Witness" in Wine. Without this patch, texture views created on multi-sample textures would have a GL_TEXTURE_SAMPLES of 0. All things considered such views actually work surprisingly well, but when combined with (plain) multi-sample textures in a framebuffer object, the resulting FBO is incomplete because the sample counts don't match. CC: <[email protected]> Signed-off-by: Henri Verbeet <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* radv: fix scanning output_usage_mask with structsSamuel Pitoiset2018-03-291-4/+52
| | | | | | | | | | | | To fix a regression in: dEQP-VK.spirv_assembly.instruction.graphics.variable_init.output.struct And the following regressions (Polaris only): dEQP-VK.glsl.indexing.varying_array.* Fixes: f3275ca01c ("ac/nir: only enable used channels when exporting parameters") Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* nvc0/ir: fix emiting NOTs with predicatesKarol Herbst2018-03-291-0/+2
| | | | | Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>