Re: [Mesa-dev] [PATCH 1/2] glsl: use without_array() rather than get_scalar_type()
On 04/26/2017 05:56 AM, Timothy Arceri wrote: Here get_scalar_type() was just geing use to remove the array after that we converted it back to bast_type anyway so just use the without_array() helper. Type: geing -> being I think we can just get rid of get_scalar_type() everywhere because it's similar to without_array(). --- src/compiler/glsl/ast_to_hir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index aeb223d..0ae87cb 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -3851,21 +3851,21 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, * "Fragment inputs can only be signed and unsigned integers and * integer vectors, float, floating-point vectors, matrices, or * arrays of these. Structures cannot be input. * * Similar text exists in the section on vertex shader outputs. * * Similar text exists in the GLSL ES 3.00 spec, except that the GLSL ES * 3.00 spec allows structs as well. Varying structs are also allowed * in GLSL 1.50. */ - switch (var->type->get_scalar_type()->base_type) { + switch (var->type->without_array()->base_type) { case GLSL_TYPE_FLOAT: /* Ok in all GLSL versions */ break; case GLSL_TYPE_UINT: case GLSL_TYPE_INT: if (state->is_version(130, 300)) break; _mesa_glsl_error(loc, state, "varying variables must be of base type float in %s", state->get_version_string()); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 12/31] glsl: allow bindless images to be declared inside structures
On 26.04.2017 04:45, Timothy Arceri wrote: Reviewed-by: Timothy Arceri On 24/04/17 20:35, Samuel Pitoiset wrote: The spec doesn't clearly state this, but I have got clarifiation from the spec authors. Okay, that answers my question from the other email. BTW, what about samplers? It seems that this code doesn't check for samplers at all? Anyway, this patch: Reviewed-by: Nicolai Hähnle Signed-off-by: Samuel Pitoiset --- src/compiler/glsl/ast_to_hir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index a63f9da912..5ef99bf504 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -6944,7 +6944,7 @@ ast_process_struct_or_iface_block_members(exec_list *instructions, _mesa_glsl_error(&loc, state, "atomic counter in structure"); } - if (decl_type->contains_image()) { + if (!state->has_bindless() && decl_type->contains_image()) { /* FINISHME: Same problem as with atomic counters. * FINISHME: Request clarification from Khronos and add * FINISHME: spec quotation here. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev -- Lerne, wie die Welt wirklich ist, Aber vergiss niemals, wie sie sein sollte. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 10/31] glsl: allow bindless samplers/images inside interface blocks
With Timothy's comments addressed, patch 9 & 10: Reviewed-by: Nicolai Hähnle On 24.04.2017 12:35, Samuel Pitoiset wrote: The ARB_bindless_texture spec says: "Modify Section 4.3.7, Interface Blocks, p. 38" "(remove the following bullet from the last list on p. 39, thereby permitting sampler types in interface blocks; image types are also permitted in blocks by this extension)" * sampler types are not allowed Signed-off-by: Samuel Pitoiset --- src/compiler/glsl/ast_to_hir.cpp | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index b100ded836..a63f9da912 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -6919,7 +6919,18 @@ ast_process_struct_or_iface_block_members(exec_list *instructions, assert(decl_type); if (is_interface) { - if (decl_type->contains_opaque()) { + /* The ARB_bindless_texture spec says: + * + * "Modify Section 4.3.7, Interface Blocks, p. 38" + * + * "(remove the following bullet from the last list on p. 39, thereby + * permitting sampler types in interface blocks; image types are also + * permitted in blocks by this extension)" + * + * * sampler types are not allowed + */ + if (decl_type->contains_atomic() || + (!state->has_bindless() && decl_type->contains_opaque())) { _mesa_glsl_error(&loc, state, "uniform/buffer in non-default " "interface block contains opaque variable"); } -- Lerne, wie die Welt wirklich ist, Aber vergiss niemals, wie sie sein sollte. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 11/31] glsl: fix std140/std430 interfaces for bindless samplers/images
On 26.04.2017 04:44, Timothy Arceri wrote: Can we just update is_scalar instead? It's probably worth a try. Cheers, Nicolai On 24/04/17 20:35, Samuel Pitoiset wrote: The ARB_bindless_texture spec says: "Samplers are represented using 64-bit integer handles". Signed-off-by: Samuel Pitoiset --- src/compiler/glsl_types.cpp | 28 1 file changed, 28 insertions(+) diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index df148cfd21..0b5cacd7f3 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -1497,6 +1497,13 @@ glsl_type::std140_base_alignment(bool row_major) const } } + /* The ARB_bindless_texture spec says: +* +* "Samplers are represented using 64-bit integer handles". +*/ + if (this->is_sampler() || this->is_image()) + return N; + /* (4) If the member is an array of scalars or vectors, the base alignment * and array stride are set to match the base alignment of a single * array element, according to rules (1), (2), and (3), and rounded up @@ -1607,6 +1614,13 @@ glsl_type::std140_size(bool row_major) const return this->vector_elements * N; } + /* The ARB_bindless_texture spec says: +* +* "Samplers are represented using 64-bit integer handles". +*/ + if (this->is_sampler() || this->is_image()) + return N; + /* (5) If the member is a column-major matrix with columns and * rows, the matrix is stored identically to an array of * column vectors with components each, according to @@ -1752,6 +1766,13 @@ glsl_type::std430_base_alignment(bool row_major) const } } + /* The ARB_bindless_texture spec says: +* +* "Samplers are represented using 64-bit integer handles". +*/ + if (this->is_sampler() || this->is_image()) + return N; + /* OpenGL 4.30 spec, section 7.6.2.2 "Standard Uniform Block Layout": * * "When using the std430 storage layout, shader storage blocks will be @@ -1868,6 +1889,13 @@ glsl_type::std430_size(bool row_major) const if (this->is_scalar() || this->is_vector()) return this->vector_elements * N; + /* The ARB_bindless_texture spec says: +* +* "Samplers are represented using 64-bit integer handles". +*/ + if (this->is_sampler() || this->is_image()) + return N; + if (this->without_array()->is_matrix()) { const struct glsl_type *element_type; const struct glsl_type *vec_type; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev -- Lerne, wie die Welt wirklich ist, Aber vergiss niemals, wie sie sein sollte. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 08/31] glsl: allow bindless samplers/images as out and inout parameters
Reviewed-by: Nicolai Hähnle On 24.04.2017 12:35, Samuel Pitoiset wrote: Signed-off-by: Samuel Pitoiset --- src/compiler/glsl/ast_to_hir.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index e4b076f700..24ad4b117c 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -5548,7 +5548,8 @@ ast_parameter_declarator::hir(exec_list *instructions, *assigned into." */ if ((var->data.mode == ir_var_function_inout || var->data.mode == ir_var_function_out) - && type->contains_opaque()) { + && (type->contains_atomic() || + (!state->has_bindless() && type->contains_opaque( { _mesa_glsl_error(&loc, state, "out and inout parameters cannot " "contain opaque variables"); type = glsl_type::error_type; -- Lerne, wie die Welt wirklich ist, Aber vergiss niemals, wie sie sein sollte. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 06/31] glsl: allow to declare bindless samplers/images as non-uniform
On 24.04.2017 12:35, Samuel Pitoiset wrote: The ARB_bindless_texture spec says: "Replace Section 4.1.7 (Samplers), p. 25" "Samplers may be declared as shader inputs and outputs, as uniform variables, as temporary variables, and as function parameters." "Replace Section 4.1.X, (Images)" "Images may be declared as shader inputs and outputs, as uniform variables, as temporary variables, and as function parameters." Signed-off-by: Samuel Pitoiset With or without Timothy's suggestions: Reviewed-by: Nicolai Hähnle --- src/compiler/glsl/ast_to_hir.cpp | 67 +--- 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index c9772ff83e..85015e140e 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -3312,11 +3312,26 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual, return; } - if (var->data.mode != ir_var_uniform && - var->data.mode != ir_var_function_in) { - _mesa_glsl_error(loc, state, "image variables may only be declared as " - "function parameters or uniform-qualified " - "global variables"); + if (state->has_bindless()) { + if (var->data.mode != ir_var_auto && + var->data.mode != ir_var_uniform && + var->data.mode != ir_var_shader_in && + var->data.mode != ir_var_shader_out && + var->data.mode != ir_var_function_in && + var->data.mode != ir_var_function_out && + var->data.mode != ir_var_function_inout) { + _mesa_glsl_error(loc, state, "bindless image variables may only be " + "declared as shader inputs and outputs, as uniform " + "variables, as temporary variables and as function " + "parameters"); + } + } else { + if (var->data.mode != ir_var_uniform && + var->data.mode != ir_var_function_in) { + _mesa_glsl_error(loc, state, "image variables may only be declared as " + "function parameters or uniform-qualified " + "global variables"); + } } var->data.image_read_only |= qual->flags.q.read_only; @@ -3656,11 +3671,26 @@ apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual, } if (var->type->contains_sampler()) { - if (var->data.mode != ir_var_uniform && - var->data.mode != ir_var_function_in) { - _mesa_glsl_error(loc, state, "sampler variables may only be declared " - "as function parameters or uniform-qualified " - "global variables"); + if (state->has_bindless()) { + if (var->data.mode != ir_var_auto && + var->data.mode != ir_var_uniform && + var->data.mode != ir_var_shader_in && + var->data.mode != ir_var_shader_out && + var->data.mode != ir_var_function_in && + var->data.mode != ir_var_function_out && + var->data.mode != ir_var_function_inout) { +_mesa_glsl_error(loc, state, "bindless sampler variables may only " + "be declared as shader inputs and outputs, as " + "uniform variables, as temporary variables and as " + "function parameters"); + } + } else { + if (var->data.mode != ir_var_uniform && + var->data.mode != ir_var_function_in) { +_mesa_glsl_error(loc, state, "sampler variables may only be " + "declared as function parameters or " + "uniform-qualified global variables"); + } } } @@ -5268,9 +5298,22 @@ ast_declarator_list::hir(exec_list *instructions, * *"[Opaque types] can only be declared as function * parameters or uniform-qualified variables." + * + * The ARB_bindless_texture spec says: + * + * "Replace Section 4.1.7 (Samplers), p. 25" + * + * "Samplers may be declared as shader inputs and outputs, as uniform + * variables, as temporary variables, and as function parameters." + * + * "Replace Section 4.1.X, (Images)" + * + * "Images may be declared as shader inputs and outputs, as uniform + * variables, as temporary variables, and as function parameters." */ - if (var_type->contains_opaque() && - !this->type->qualifier.flags.q.uniform) { + if (!this->type->qualifier.flags.q.uniform && + (var_type->contains_atomic() || + (!state->has_bindless() && var_type->contains_opaque( { _mesa_glsl_error(&loc, state, "opaque variables must be declared uniform"); } -- Lerne, wie die Welt wirklich ist, Aber
Re: [Mesa-dev] [PATCH v2 05/31] glsl: process bindless/bound layout qualifiers
On 24.04.2017 12:35, Samuel Pitoiset wrote: This adds bindless_sampler and bound_sampler (and respectively bindless_image and bound_image) to the parser. Signed-off-by: Samuel Pitoiset --- src/compiler/glsl/ast.h | 8 src/compiler/glsl/ast_to_hir.cpp | 65 src/compiler/glsl/ast_type.cpp | 53 ++ src/compiler/glsl/glsl_parser.yy | 21 +++ src/compiler/glsl/glsl_parser_extras.cpp | 11 ++ src/compiler/glsl/glsl_parser_extras.h | 10 + src/compiler/glsl/ir.cpp | 2 + src/compiler/glsl/ir.h | 12 ++ src/compiler/glsl/ir_print_visitor.cpp | 8 ++-- src/mesa/main/mtypes.h | 10 + 10 files changed, 197 insertions(+), 3 deletions(-) diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h index 455cb8113c..9327e03979 100644 --- a/src/compiler/glsl/ast.h +++ b/src/compiler/glsl/ast.h @@ -622,6 +622,14 @@ struct ast_type_qualifier { * is used. */ unsigned inner_coverage:1; + + /** \name Layout qualifiers for GL_ARB_bindless_texture */ + /** \{ */ + unsigned bindless_sampler:1; + unsigned bindless_image:1; + unsigned bound_sampler:1; + unsigned bound_image:1; + /** \} */ } /** \brief Set of flags, accessed by name. */ q; diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index aeb223db9e..c9772ff83e 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -3417,6 +3417,68 @@ validate_array_dimensions(const glsl_type *t, } static void +apply_bindless_qualifier_to_variable(const struct ast_type_qualifier *qual, + ir_variable *var, + struct _mesa_glsl_parse_state *state, + YYLTYPE *loc) +{ + bool has_local_qualifiers = qual->flags.q.bindless_sampler || + qual->flags.q.bindless_image || + qual->flags.q.bound_sampler || + qual->flags.q.bound_image; + + /* The ARB_bindless_texture spec says: +* +* "Modify Section 4.4.6 Opaque-Uniform Layout Qualifiers of the GLSL 4.30 +* spec" +* +* "If these layout qualifiers are applied to other types of default block +* uniforms, or variables with non-uniform storage, a compile-time error +* will be generated." +*/ + if (has_local_qualifiers && !qual->flags.q.uniform) { + _mesa_glsl_error(loc, state, "ARB_bindless_texture layout qualifiers " + "can only be applied to default block uniforms or " + "variables with uniform storage"); + return; + } + + /* The ARB_bindless_texture spec doesn't state anything in this situation, +* but it makes sense to only allow bindless_sampler/bound_sampler for +* sampler types, and respectively bindless_image/bound_image for image +* types. +*/ + if ((qual->flags.q.bindless_sampler || qual->flags.q.bound_sampler) && + !var->type->contains_sampler()) { + _mesa_glsl_error(loc, state, "bindless_sampler or bound_sampler can only " + "be applied to sampler types"); + return; + } + + if ((qual->flags.q.bindless_image || qual->flags.q.bound_image) && + !var->type->contains_image()) { + _mesa_glsl_error(loc, state, "bindless_image or bound_image can only be " + "applied to image types"); + return; + } + + /* The bindless_sampler/bindless_image (and respectively +* bound_sampler/bound_image) layout qualifiers can be set at global and at +* local scope. +*/ + if (var->type->contains_sampler() || var->type->contains_image()) { + var->data.bindless = qual->flags.q.bindless_sampler || + qual->flags.q.bindless_image || + state->bindless_sampler_specified || + state->bindless_image_specified; + var->data.bound = qual->flags.q.bound_sampler || +qual->flags.q.bound_image || +state->bound_sampler_specified || +state->bound_image_specified; + } +} + +static void apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual, ir_variable *var, struct _mesa_glsl_parse_state *state, @@ -3713,6 +3775,9 @@ apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual, _mesa_glsl_error(loc, state, "post_depth_coverage layout qualifier only " "valid in fragment shader input layout declaration."); } + + if (state->has_bindless()) + apply_bindless_qualifier_to_variable(qual, var, state, loc); } static void diff --g
Re: [Mesa-dev] [PATCH] anv: Don't place scratch buffers above the 32-bit boundary
Ken? On Sat, Apr 22, 2017 at 6:09 PM, Grazvydas Ignotas wrote: > Fixes: 651ec926fc1 "anv: Add support for 48-bit addresses" > Tested-by: Grazvydas Ignotas > > On Sun, Apr 23, 2017 at 1:55 AM, Jason Ekstrand > wrote: > >> This fixes rendering corruptions in DOOM. Hopefully, it will also make >> Jenkins a bit more stable as we've been seeing some random failures and >> GPU hangs ever since turning on 48bit. >> >> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100620 >> Cc: "17.1" >> --- >> src/intel/vulkan/anv_allocator.c | 16 >> 1 file changed, 16 insertions(+) >> >> diff --git a/src/intel/vulkan/anv_allocator.c >> b/src/intel/vulkan/anv_allocator.c >> index 78327df..28bfac4 100644 >> --- a/src/intel/vulkan/anv_allocator.c >> +++ b/src/intel/vulkan/anv_allocator.c >> @@ -994,6 +994,22 @@ anv_scratch_pool_alloc(struct anv_device *device, >> struct anv_scratch_pool *pool, >> >> anv_bo_init_new(&bo->bo, device, size); >> >> + /* Even though the Scratch base pointers in 3DSTATE_*S are 64 bits, >> they >> +* are still relative to the general state base address. When we emit >> +* STATE_BASE_ADDRESS, we set general state base address to 0 and the >> size >> +* to the maximum (1 page under 4GB). This allows us to just place >> the >> +* scratch buffers anywhere we wish in the bottom 32 bits of address >> space >> +* and just set the scratch base pointer in 3DSTATE_*S using a >> relocation. >> +* However, in order to do so, we need to ensure that the kernel does >> not >> +* place the scratch BO above the 32-bit boundary. >> +* >> +* NOTE: Technically, it can't go "anywhere" because the top page is >> off >> +* limits. However, it will never end up getting placed that high >> because >> +* the surface state and general state buffers will get placed first >> and >> +* the kernel likes to work top-down. >> +*/ >> + bo->bo.flags &= ~EXEC_OBJECT_SUPPORTS_48B_ADDRESS; >> + >> /* Set the exists last because it may be read by other threads */ >> __sync_synchronize(); >> bo->exists = true; >> -- >> 2.5.0.400.gff86faf >> >> ___ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev >> > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 04/31] glsl: make component_slots() returns 2 for samplers/images
On 24.04.2017 12:35, Samuel Pitoiset wrote: Bindless samplers/images are 64-bit unsigned integers, which means they consume two components as specified by ARB_bindless_texture. It looks like we are not wasting uniform storage by changing this because default-block uniforms are not packed. So, if we use N uint uniforms, they occupy N * 16 bytes in the constant buffer. This is something that could be improved. Though, count_uniform_size needs to be adjusted to not count a sampler (or image) twice. As a side effect, this will probably break the cache if you have one because it will consider sampler/image types as two components. Signed-off-by: Samuel Pitoiset --- src/compiler/glsl/link_uniforms.cpp | 8 ++-- src/compiler/glsl_types.cpp | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp index b462cb9d59..3331c85af4 100644 --- a/src/compiler/glsl/link_uniforms.cpp +++ b/src/compiler/glsl/link_uniforms.cpp @@ -340,9 +340,13 @@ private: if (type->contains_subroutine()) { this->num_shader_subroutines += values; } else if (type->contains_sampler()) { - this->num_shader_samplers += values; + /* Old-style (or bound) samplers are counted as two components as + * specified by ARB_bindless_texture. */ I think this comment is a bit confusing. All samplers are counted as two components by these changes. Question: Are samplers allowed in structs? If yes, then this code will need fixing to account for it. Either way, it would be good to add a corresponding test to piglit (whether negative or positive). I don't think the spec is clear on this. The general language on structures (Section 4.1.8 of GLSL 4.5) doesn't restrict the types in structs. The introduction of section 4.1.7 of GLSL 4.5 (Opaque types) implicitly says opaque types are not allowed in structs. The problem is that ARB_bindless_texture is written against GLSL 4.0, and a general "Opaque types" section simply doesn't exist there. There is a list in the replacement "Samplers" section which is probably meant to be exhaustive, which would suggest that samplers in structs are forbidden. Cheers, Nicolai + this->num_shader_samplers += values / 2; } else if (type->contains_image()) { - this->num_shader_images += values; + /* Old-style (or bound) images are counted as two components as + * specified by ARB_bindless_texture. */ + this->num_shader_images += values / 2; /* As drivers are likely to represent image uniforms as * scalar indices, count them against the limit of uniform diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index 0480bef80e..df148cfd21 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -1298,6 +1298,8 @@ glsl_type::component_slots() const case GLSL_TYPE_SAMPLER: case GLSL_TYPE_IMAGE: + return 2; + case GLSL_TYPE_SUBROUTINE: return 1; -- Lerne, wie die Welt wirklich ist, Aber vergiss niemals, wie sie sein sollte. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] anv/query: handle more cases of 'out of host memory'
--- src/intel/vulkan/genX_query.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/intel/vulkan/genX_query.c b/src/intel/vulkan/genX_query.c index 126431b..22de3c3 100644 --- a/src/intel/vulkan/genX_query.c +++ b/src/intel/vulkan/genX_query.c @@ -566,6 +566,11 @@ keep_gpr0_lower_n_bits(struct anv_batch *batch, uint32_t n) emit_load_alu_reg_imm64(batch, CS_GPR(1), (1ull << n) - 1); uint32_t *dw = anv_batch_emitn(batch, 5, GENX(MI_MATH)); + if (!dw) { + anv_batch_set_error(batch, VK_ERROR_OUT_OF_HOST_MEMORY); + return; + } + dw[1] = mi_alu(MI_ALU_LOAD, MI_ALU_SRCA, MI_ALU_REG0); dw[2] = mi_alu(MI_ALU_LOAD, MI_ALU_SRCB, MI_ALU_REG1); dw[3] = mi_alu(MI_ALU_AND, 0, 0); @@ -592,6 +597,11 @@ shl_gpr0_by_30_bits(struct anv_batch *batch) for (int o = 0; o < outer_count; o++) { /* Submit one MI_MATH to shift left by 6 bits */ uint32_t *dw = anv_batch_emitn(batch, cmd_len, GENX(MI_MATH)); + if (!dw) { + anv_batch_set_error(batch, VK_ERROR_OUT_OF_HOST_MEMORY); + return; + } + dw++; for (int i = 0; i < inner_count; i++, dw += 4) { dw[0] = mi_alu(MI_ALU_LOAD, MI_ALU_SRCA, MI_ALU_REG0); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev