Re: [Mesa-dev] [PATCH 5/6] glsl: Allow int - uint implicit conversions on function parameters
This doesn't actually work -- call_link_visitor::find_matching_signature passes a NULL state pointer in here. On Sun, Apr 27, 2014 at 9:44 PM, Chris Forbes chr...@ijw.co.nz wrote: Signed-off-by: Chris Forbes chr...@ijw.co.nz --- src/glsl/glsl_types.cpp | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index eb03a66..39c34c0 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -688,10 +688,20 @@ glsl_type::can_implicitly_convert_to(const glsl_type *desired, if (this-matrix_columns 1 || desired-matrix_columns 1) return false; + /* Vector size must match. */ + if (this-vector_elements != desired-vector_elements) + return false; + /* int and uint can be converted to float. */ - return desired-is_float() - this-is_integer() - this-vector_elements == desired-vector_elements; + if (desired-is_float() this-is_integer()) + return true; + + /* With GLSL 4.0 / ARB_gpu_shader5, int can be converted to uint. */ + if ((state-is_version(400, 0) || state-ARB_gpu_shader5_enable) + desired-base_type == GLSL_TYPE_UINT this-base_type == GLSL_TYPE_INT) + return true; + + return false; } unsigned -- 1.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 4/9] glsl: Pass parse state to can_implicitly_convert_to()
Signed-off-by: Chris Forbes chr...@ijw.co.nz --- src/glsl/ast_function.cpp | 4 ++-- src/glsl/glsl_types.cpp | 3 ++- src/glsl/glsl_types.h | 3 ++- src/glsl/ir_function.cpp | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 4b84470..686f8c5 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -701,7 +701,7 @@ process_vec_mat_constructor(exec_list *instructions, glsl_type::get_instance(GLSL_TYPE_FLOAT, ir-type-vector_elements, ir-type-matrix_columns); - if (result-type-can_implicitly_convert_to(desired_type)) { + if (result-type-can_implicitly_convert_to(desired_type, state)) { /* Even though convert_component() implements the constructor * conversion rules (not the implicit conversion rules), its safe * to use it here because we already checked that the implicit @@ -830,7 +830,7 @@ process_array_constructor(exec_list *instructions, glsl_type::get_instance(GLSL_TYPE_FLOAT, ir-type-vector_elements, ir-type-matrix_columns); -if (result-type-can_implicitly_convert_to(desired_type)) { +if (result-type-can_implicitly_convert_to(desired_type, state)) { /* Even though convert_component() implements the constructor * conversion rules (not the implicit conversion rules), its safe * to use it here because we already checked that the implicit diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 849a79a..eb03a66 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -678,7 +678,8 @@ glsl_type::component_slots() const } bool -glsl_type::can_implicitly_convert_to(const glsl_type *desired) const +glsl_type::can_implicitly_convert_to(const glsl_type *desired, + _mesa_glsl_parse_state *state) const { if (this == desired) return true; diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index dca5492..35a4e6a 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -314,7 +314,8 @@ struct glsl_type { * integers. * \endverbatim */ - bool can_implicitly_convert_to(const glsl_type *desired) const; + bool can_implicitly_convert_to(const glsl_type *desired, + _mesa_glsl_parse_state *state) const; /** * Query whether or not a type is a scalar (non-vector and non-matrix). diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index 4f0d9da..0ea8895 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -80,12 +80,12 @@ parameter_lists_match(_mesa_glsl_parse_state *state, case ir_var_const_in: case ir_var_function_in: -if (!actual-type-can_implicitly_convert_to(param-type)) +if (!actual-type-can_implicitly_convert_to(param-type, state)) return PARAMETER_LIST_NO_MATCH; break; case ir_var_function_out: -if (!param-type-can_implicitly_convert_to(actual-type)) +if (!param-type-can_implicitly_convert_to(actual-type, state)) return PARAMETER_LIST_NO_MATCH; break; -- 1.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 5/9] glsl: Allow int - uint implicit conversions on function parameters
V2: Fix crashes during linking, where the parse state is NULL. In this case, all required checks have already been done, so we assume the extension is enabled. Signed-off-by: Chris Forbes chr...@ijw.co.nz --- src/glsl/glsl_types.cpp | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index eb03a66..e77146c 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -688,10 +688,23 @@ glsl_type::can_implicitly_convert_to(const glsl_type *desired, if (this-matrix_columns 1 || desired-matrix_columns 1) return false; + /* Vector size must match. */ + if (this-vector_elements != desired-vector_elements) + return false; + /* int and uint can be converted to float. */ - return desired-is_float() - this-is_integer() - this-vector_elements == desired-vector_elements; + if (desired-is_float() this-is_integer()) + return true; + + /* With GLSL 4.0 / ARB_gpu_shader5, int can be converted to uint. +* Note that state may be NULL here, when resolving function calls in the +* linker. By this time, all the state-dependent checks have already +* happened though, so allow anything that's allowed in any shader version. */ + if ((!state || state-is_version(400, 0) || state-ARB_gpu_shader5_enable) + desired-base_type == GLSL_TYPE_UINT this-base_type == GLSL_TYPE_INT) + return true; + + return false; } unsigned -- 1.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 3/9] glsl: Pass parse state to parameter_lists_match()
The available implicit conversions depend on the GLSL version we're compiling. Signed-off-by: Chris Forbes chr...@ijw.co.nz --- src/glsl/ir_function.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index 40cf589..4f0d9da 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -38,7 +38,8 @@ typedef enum { * \see matching_signature() */ static parameter_list_match_t -parameter_lists_match(const exec_list *list_a, const exec_list *list_b) +parameter_lists_match(_mesa_glsl_parse_state *state, + const exec_list *list_a, const exec_list *list_b) { const exec_node *node_a = list_a-head; const exec_node *node_b = list_b-head; @@ -148,7 +149,7 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state, if (sig-is_builtin() !sig-is_builtin_available(state)) continue; - switch (parameter_lists_match( sig-parameters, actual_parameters)) { + switch (parameter_lists_match(state, sig-parameters, actual_parameters)) { case PARAMETER_LIST_EXACT_MATCH: *is_exact = true; return sig; -- 1.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 8/9] glsl: Implement overload resolution for ARB_gpu_shader5
The ARB_gpu_shader5 spec says: A function definition A is considered a better match than function definition B if: * for at least one function argument, the conversion for that argument in A is better than the corresponding conversion in B; and * there is no function argument for which the conversion in B is better than the corresponding conversion in A. If a single function definition is considered a better match than every other matching function definition, it will be used. Otherwise, a semantic error occurs and the shader will fail to compile. Signed-off-by: Chris Forbes chr...@ijw.co.nz --- src/glsl/ir_function.cpp | 56 1 file changed, 56 insertions(+) diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index 6d2de47..7bd3399 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -184,6 +184,51 @@ is_better_parameter_match(parameter_match_t a_match, } +static bool +is_best_inexact_overload(const exec_list *actual_parameters, + ir_function_signature **matches, + int num_matches, + ir_function_signature *sig) +{ + for (ir_function_signature **other = matches; +other matches + num_matches; other++) { + if (*other == sig) + continue; + + const exec_node *node_a = sig-parameters.head; + const exec_node *node_b = (*other)-parameters.head; + const exec_node *node_p = actual_parameters-head; + + bool better_for_some_parameter = false; + + for (/* empty */ + ; !node_a-is_tail_sentinel() + ; node_a = node_a-next, + node_b = node_b-next, + node_p = node_p-next) { + parameter_match_t a_match = get_parameter_match_type( + (const ir_variable *)node_a, + (const ir_rvalue *)node_p); + parameter_match_t b_match = get_parameter_match_type( + (const ir_variable *)node_b, + (const ir_rvalue *)node_p); + + if (is_better_parameter_match(a_match, b_match)) + better_for_some_parameter = true; + + if (is_better_parameter_match(b_match, a_match)) + return false; /* B is better for this parameter */ + } + + if (!better_for_some_parameter) + return false; /* A must be better than B for some parameter */ + + } + + return true; +} + + static ir_function_signature * choose_best_inexact_overload(_mesa_glsl_parse_state *state, const exec_list *actual_parameters, @@ -196,6 +241,17 @@ choose_best_inexact_overload(_mesa_glsl_parse_state *state, if (num_matches == 1) return *matches; + /* Without GLSL 4.0 / ARB_gpu_shader5, there is no overload resolution +* among multiple inexact matches. Note that state may be NULL here if +* called from the linker; in that case we assume everything supported in +* any GLSL version is available. */ + if (!state || state-is_version(400, 0) || state-ARB_gpu_shader5_enable) { + for (ir_function_signature **sig = matches; sig matches + num_matches; sig++) { + if (is_best_inexact_overload(actual_parameters, matches, num_matches, *sig)) +return *sig; + } + } + return NULL; /* no best candidate */ } -- 1.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 1/9] glsl: Clean up apply_implicit_conversion
We're about to add new implicit conversions, first for ARB_gpu_shader5, and then later for ARB_gpu_shader_fp64. Pull out the opcode determination into its own function, and get rid of the bool - float case that could never be hit anyway [since it fails the is_numeric() check]. V2: Retain the vector width mangling. It turns out this is necessary for the conversions done (and then thrown away) when determining the return type of arithmetic operators. Signed-off-by: Chris Forbes chr...@ijw.co.nz --- src/glsl/ast_to_hir.cpp | 58 ++--- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 7516c33..b695132 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -164,6 +164,23 @@ _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) } +static ir_expression_operation +get_conversion_operation(const glsl_type *to, const glsl_type *from, + struct _mesa_glsl_parse_state *state) +{ + switch (to-base_type) { + case GLSL_TYPE_FLOAT: + switch (from-base_type) { + case GLSL_TYPE_INT: return ir_unop_i2f; + case GLSL_TYPE_UINT: return ir_unop_u2f; + default: return (ir_expression_operation)0; + } + + default: return (ir_expression_operation)0; + } +} + + /** * If a conversion is available, convert one operand to a different type * @@ -185,9 +202,7 @@ apply_implicit_conversion(const glsl_type *to, ir_rvalue * from, if (to-base_type == from-type-base_type) return true; - /* This conversion was added in GLSL 1.20. If the compilation mode is -* GLSL 1.10, the conversion is skipped. -*/ + /* Prior to GLSL 1.10, there are no implicit conversions */ if (!state-is_version(120, 0)) return false; @@ -195,36 +210,25 @@ apply_implicit_conversion(const glsl_type *to, ir_rvalue * from, * *There are no implicit array or structure conversions. For *example, an array of int cannot be implicitly converted to an -*array of float. There are no implicit conversions between -*signed and unsigned integers. -*/ - /* FINISHME: The above comment is partially a lie. There is int/uint -* FINISHME: conversion for immediate constants. +*array of float. */ - if (!to-is_float() || !from-type-is_numeric()) + if (!to-is_numeric() || !from-type-is_numeric()) return false; - /* Convert to a floating point type with the same number of components -* as the original type - i.e. int to float, not int to vec4. + /* We don't actually want the specific type `to`, we want a type +* with the same base type as `to`, but the same vector width as +* `from`. */ - to = glsl_type::get_instance(GLSL_TYPE_FLOAT, from-type-vector_elements, - from-type-matrix_columns); + to = glsl_type::get_instance(to-base_type, from-type-vector_elements, +from-type-matrix_columns); - switch (from-type-base_type) { - case GLSL_TYPE_INT: - from = new(ctx) ir_expression(ir_unop_i2f, to, from, NULL); - break; - case GLSL_TYPE_UINT: - from = new(ctx) ir_expression(ir_unop_u2f, to, from, NULL); - break; - case GLSL_TYPE_BOOL: - from = new(ctx) ir_expression(ir_unop_b2f, to, from, NULL); - break; - default: - assert(0); + ir_expression_operation op = get_conversion_operation(to, from-type, state); + if (op) { + from = new(ctx) ir_expression(op, to, from, NULL); + return true; + } else { + return false; } - - return true; } -- 1.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 2/9] glsl: Add support for int - uint implicit conversions
This is required for ARB_gpu_shader5. Signed-off-by: Chris Forbes chr...@ijw.co.nz --- src/glsl/ast_to_hir.cpp | 8 1 file changed, 8 insertions(+) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index b695132..f6c7409 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -176,6 +176,14 @@ get_conversion_operation(const glsl_type *to, const glsl_type *from, default: return (ir_expression_operation)0; } + case GLSL_TYPE_UINT: + if (!state-is_version(400, 0) !state-ARB_gpu_shader5_enable) + return (ir_expression_operation)0; + switch (from-base_type) { + case GLSL_TYPE_INT: return ir_unop_i2u; + default: return (ir_expression_operation)0; + } + default: return (ir_expression_operation)0; } } -- 1.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 6/9] glsl: Build a list of inexact function matches
This will facilitate GLSL 4.0 / ARB_gpu_shader5's enhanced overload resolution rules, and also possibly better error reporting for ambiguous function calls. Signed-off-by: Chris Forbes chr...@ijw.co.nz --- src/glsl/ir_function.cpp | 43 --- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index 0ea8895..2b88535 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -23,6 +23,7 @@ #include glsl_types.h #include ir.h +#include glsl_parser_extras.h typedef enum { PARAMETER_LIST_NO_MATCH, @@ -116,6 +117,22 @@ parameter_lists_match(_mesa_glsl_parse_state *state, } +static ir_function_signature * +choose_best_inexact_overload(_mesa_glsl_parse_state *state, + const exec_list *actual_parameters, + ir_function_signature **matches, + int num_matches) +{ + if (num_matches == 0) + return NULL; + + if (num_matches == 1) + return *matches; + + return NULL; /* no best candidate */ +} + + ir_function_signature * ir_function::matching_signature(_mesa_glsl_parse_state *state, const exec_list *actual_parameters) @@ -127,10 +144,11 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state, ir_function_signature * ir_function::matching_signature(_mesa_glsl_parse_state *state, const exec_list *actual_parameters, - bool *is_exact) +bool *is_exact) { + ir_function_signature **inexact_matches = NULL; ir_function_signature *match = NULL; - bool multiple_inexact_matches = false; + int num_inexact_matches = 0; /* From page 42 (page 49 of the PDF) of the GLSL 1.20 spec: * @@ -151,14 +169,16 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state, switch (parameter_lists_match(state, sig-parameters, actual_parameters)) { case PARAMETER_LIST_EXACT_MATCH: -*is_exact = true; -return sig; + *is_exact = true; + free(inexact_matches); + return sig; case PARAMETER_LIST_INEXACT_MATCH: -if (match == NULL) - match = sig; -else - multiple_inexact_matches = true; -continue; + inexact_matches = realloc(inexact_matches, + sizeof(*inexact_matches) * + (num_inexact_matches + 1)); + assert(inexact_matches); + inexact_matches[num_inexact_matches++] = sig; + continue; case PARAMETER_LIST_NO_MATCH: continue; default: @@ -176,9 +196,10 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state, */ *is_exact = false; - if (multiple_inexact_matches) - return NULL; + match = choose_best_inexact_overload(state, actual_parameters, +inexact_matches, num_inexact_matches); + free(inexact_matches); return match; } -- 1.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 0/9] ARB_gpu_shader5 implicit conversions and overloading
This series adds support for implicit conversions and overload resolution from ARB_gpu_shader5 / GLSL 4.0. The first 5 patches (and half of the 9th) were previously sent out on their own, but had some serious issues I had overlooked, as I hadn't done a full piglit run. Notable changes in this version: - Vector width mangling is retained in 1/9. This looked weird and unnecessary, but ast_to_hir (ab)uses apply_implicit_conversion to determine whether one side of an arithmetic operator can be converted to the type of the other side. - Avoid crashes from the linker looking up matching function signatures, while passing a NULL parse state. In this case, we have no idea what extensions were active at compile time, but the compiler has already rejected any attempts at using unavailable implicit conversions, so we just pretend it's supported and enabled. - New patches 6-8, adding the new overload resolution rules. This also lays some groundwork for providing better error messages in the case of ambiguous overload resolution. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 7/9] glsl: Add support for comparing function parameter conversions
The ARB_gpu_shader5 spec says: To determine whether the conversion for a single argument in one match is better than that for another match, the following rules are applied, in order: 1. An exact match is better than a match involving any implicit conversion. 2. A match involving an implicit conversion from float to double is better than a match involving any other implicit conversion. 3. A match involving an implicit conversion from either int or uint to float is better than a match involving an implicit conversion from either int or uint to double. If none of the rules above apply to a particular pair of conversions, neither conversion is considered better than the other. Signed-off-by: Chris Forbes chr...@ijw.co.nz --- src/glsl/ir_function.cpp | 74 ++-- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index 2b88535..6d2de47 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -117,6 +117,73 @@ parameter_lists_match(_mesa_glsl_parse_state *state, } +typedef enum { + PARAMETER_EXACT_MATCH, + PARAMETER_FLOAT_TO_DOUBLE, + PARAMETER_INT_TO_FLOAT, + PARAMETER_INT_TO_DOUBLE, + PARAMETER_OTHER_CONVERSION, +} parameter_match_t; + + +static parameter_match_t +get_parameter_match_type(const ir_variable *param, + const ir_rvalue *actual) +{ + const glsl_type *from_type; + const glsl_type *to_type; + + if (param-data.mode == ir_var_function_out) { + from_type = param-type; + to_type = actual-type; + } else { + from_type = actual-type; + to_type = param-type; + } + + if (from_type == to_type) + return PARAMETER_EXACT_MATCH; + + /* XXX: When ARB_gpu_shader_fp64 support is added, check for float-double, +* and int/uint-double conversions +*/ + + if (to_type-base_type == GLSL_TYPE_FLOAT) + return PARAMETER_INT_TO_FLOAT; + + /* int - uint and any other oddball conversions */ + return PARAMETER_OTHER_CONVERSION; +} + + +static bool +is_better_parameter_match(parameter_match_t a_match, + parameter_match_t b_match) +{ + /* 1. An exact match is better than a match involving any implicit +* conversion. +* +* 2. A match involving an implicit conversion from float to double +* is better than match involving any other implicit conversion. +* +* 3. A match involving an implicit conversion from either int or uint +* to float is better than a match involving an implicit conversion +* from either int or uint to double. +* +* If none of the rules above apply to a particular pair of conversions, +* neither conversion is considered better than the other. +* +* Notably, the int-uint conversion is *not* considered to be better +* or worse than int/uint-float or int/uint-double. +*/ + + if (a_match = PARAMETER_INT_TO_FLOAT b_match == PARAMETER_OTHER_CONVERSION) + return false; + + return a_match b_match; +} + + static ir_function_signature * choose_best_inexact_overload(_mesa_glsl_parse_state *state, const exec_list *actual_parameters, @@ -173,9 +240,10 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state, free(inexact_matches); return sig; case PARAMETER_LIST_INEXACT_MATCH: - inexact_matches = realloc(inexact_matches, - sizeof(*inexact_matches) * - (num_inexact_matches + 1)); + inexact_matches = (ir_function_signature **) + realloc(inexact_matches, + sizeof(*inexact_matches) * + (num_inexact_matches + 1)); assert(inexact_matches); inexact_matches[num_inexact_matches++] = sig; continue; -- 1.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] gallium: add support for sampling from stencil of depth_stencil texture
Gallium already supports stencil texturing and st/mesa has been using it for glDrawPixels for quite a while. The pipe_sampler_view bit is unnecessary. You can create a stencil sampler view by specifying one of these formats: PIPE_FORMAT_S8_UINT PIPE_FORMAT_X24S8_UINT PIPE_FORMAT_S8X24_UINT PIPE_FORMAT_X32_S8X24_UINT r600g and radeonsi already support it. I'm not sure how useful the CAP bit is, since you can just check if the stencil formats are supported as sampler views. Marek On Sat, May 3, 2014 at 4:42 AM, Ilia Mirkin imir...@alum.mit.edu wrote: Adds a PIPE_CAP_STENCIL_SAMPLING to indicate support for the feature, and a stencil_sampling bit in pipe_sampler_view to indicate that the stencil should be sampled instead of the depth. Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- src/gallium/docs/source/screen.rst | 3 ++- src/gallium/drivers/freedreno/freedreno_screen.c | 1 + src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/ilo/ilo_screen.c | 1 + src/gallium/drivers/llvmpipe/lp_screen.c | 1 + src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 + src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + src/gallium/drivers/r300/r300_screen.c | 1 + src/gallium/drivers/r600/r600_pipe.c | 1 + src/gallium/drivers/radeonsi/si_pipe.c | 1 + src/gallium/drivers/softpipe/sp_screen.c | 1 + src/gallium/drivers/svga/svga_screen.c | 1 + src/gallium/include/pipe/p_defines.h | 1 + src/gallium/include/pipe/p_state.h | 1 + 15 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index b292257..1451ad6 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -202,7 +202,8 @@ The integer capabilities: implemented. * ``PIPE_CAP_TEXTURE_GATHER_OFFSETS``: Whether the ``TG4`` instruction can accept 4 offsets. - +* ``PIPE_CAP_STENCIL_SAMPLING``: Whether sampling can be done on the stencil + component of DEPTH_STENCIL textures. Flag passed in ``pipe_sampler_view``. .. _pipe_capf: diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 4de3e3f..45390ed 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -210,6 +210,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TEXTURE_QUERY_LOD: case PIPE_CAP_SAMPLE_SHADING: case PIPE_CAP_TEXTURE_GATHER_OFFSETS: + case PIPE_CAP_STENCIL_SAMPLING: return 0; /* Stream output. */ diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index dfd7a2e..abc1d9b 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -222,6 +222,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_TEXTURE_QUERY_LOD: case PIPE_CAP_SAMPLE_SHADING: case PIPE_CAP_TEXTURE_GATHER_OFFSETS: + case PIPE_CAP_STENCIL_SAMPLING: return 0; case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index 0a1c56d..8862b55 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -441,6 +441,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TEXTURE_QUERY_LOD: case PIPE_CAP_SAMPLE_SHADING: case PIPE_CAP_TEXTURE_GATHER_OFFSETS: + case PIPE_CAP_STENCIL_SAMPLING: return 0; default: diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index e236802..14bea7e 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -243,6 +243,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TEXTURE_QUERY_LOD: case PIPE_CAP_SAMPLE_SHADING: case PIPE_CAP_TEXTURE_GATHER_OFFSETS: + case PIPE_CAP_STENCIL_SAMPLING: return 0; case PIPE_CAP_FAKE_SW_MSAA: return 1; diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 7157e0c..5734169 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -137,6 +137,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TEXTURE_QUERY_LOD: case PIPE_CAP_SAMPLE_SHADING: case PIPE_CAP_TEXTURE_GATHER_OFFSETS: + case PIPE_CAP_STENCIL_SAMPLING: return 0; case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: case
Re: [Mesa-dev] [PATCH 1/3] gallium: add support for sampling from stencil of depth_stencil texture
Yeah, I actually sent a follow-up patch which does this in a totally different and much simpler way. On Sun, May 4, 2014 at 6:47 AM, Marek Olšák mar...@gmail.com wrote: Gallium already supports stencil texturing and st/mesa has been using it for glDrawPixels for quite a while. The pipe_sampler_view bit is unnecessary. You can create a stencil sampler view by specifying one of these formats: PIPE_FORMAT_S8_UINT PIPE_FORMAT_X24S8_UINT PIPE_FORMAT_S8X24_UINT PIPE_FORMAT_X32_S8X24_UINT r600g and radeonsi already support it. I'm not sure how useful the CAP bit is, since you can just check if the stencil formats are supported as sampler views. Marek On Sat, May 3, 2014 at 4:42 AM, Ilia Mirkin imir...@alum.mit.edu wrote: Adds a PIPE_CAP_STENCIL_SAMPLING to indicate support for the feature, and a stencil_sampling bit in pipe_sampler_view to indicate that the stencil should be sampled instead of the depth. Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- src/gallium/docs/source/screen.rst | 3 ++- src/gallium/drivers/freedreno/freedreno_screen.c | 1 + src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/ilo/ilo_screen.c | 1 + src/gallium/drivers/llvmpipe/lp_screen.c | 1 + src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 + src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + src/gallium/drivers/r300/r300_screen.c | 1 + src/gallium/drivers/r600/r600_pipe.c | 1 + src/gallium/drivers/radeonsi/si_pipe.c | 1 + src/gallium/drivers/softpipe/sp_screen.c | 1 + src/gallium/drivers/svga/svga_screen.c | 1 + src/gallium/include/pipe/p_defines.h | 1 + src/gallium/include/pipe/p_state.h | 1 + 15 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index b292257..1451ad6 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -202,7 +202,8 @@ The integer capabilities: implemented. * ``PIPE_CAP_TEXTURE_GATHER_OFFSETS``: Whether the ``TG4`` instruction can accept 4 offsets. - +* ``PIPE_CAP_STENCIL_SAMPLING``: Whether sampling can be done on the stencil + component of DEPTH_STENCIL textures. Flag passed in ``pipe_sampler_view``. .. _pipe_capf: diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 4de3e3f..45390ed 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -210,6 +210,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TEXTURE_QUERY_LOD: case PIPE_CAP_SAMPLE_SHADING: case PIPE_CAP_TEXTURE_GATHER_OFFSETS: + case PIPE_CAP_STENCIL_SAMPLING: return 0; /* Stream output. */ diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index dfd7a2e..abc1d9b 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -222,6 +222,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_TEXTURE_QUERY_LOD: case PIPE_CAP_SAMPLE_SHADING: case PIPE_CAP_TEXTURE_GATHER_OFFSETS: + case PIPE_CAP_STENCIL_SAMPLING: return 0; case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index 0a1c56d..8862b55 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -441,6 +441,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TEXTURE_QUERY_LOD: case PIPE_CAP_SAMPLE_SHADING: case PIPE_CAP_TEXTURE_GATHER_OFFSETS: + case PIPE_CAP_STENCIL_SAMPLING: return 0; default: diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index e236802..14bea7e 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -243,6 +243,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TEXTURE_QUERY_LOD: case PIPE_CAP_SAMPLE_SHADING: case PIPE_CAP_TEXTURE_GATHER_OFFSETS: + case PIPE_CAP_STENCIL_SAMPLING: return 0; case PIPE_CAP_FAKE_SW_MSAA: return 1; diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 7157e0c..5734169 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -137,6 +137,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TEXTURE_QUERY_LOD: case PIPE_CAP_SAMPLE_SHADING:
Re: [Mesa-dev] [PATCH] st/egl: Flush resources before presentation (android - bug 77966)
Reviewed-by: Marek Olšák marek.ol...@amd.com Marek On Fri, May 2, 2014 at 5:00 PM, pstglia pstg...@gmail.com wrote: --- src/gallium/state_trackers/egl/android/native_android.cpp | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/state_trackers/egl/android/native_android.cpp b/src/gallium/state_trackers/egl/android/native_android.cpp index e73d031..8620ed8 100644 --- a/src/gallium/state_trackers/egl/android/native_android.cpp +++ b/src/gallium/state_trackers/egl/android/native_android.cpp @@ -396,6 +396,13 @@ android_surface_swap_buffers(struct native_surface *nsurf) struct android_surface *asurf = android_surface(nsurf); struct android_display *adpy = asurf-adpy; + struct native_display *ndpy = adpy-base; + struct pipe_context *pipe = ndpy_get_copy_context(ndpy); + + /* flush buffer */ + pipe-flush_resource(pipe, asurf-buf_res); + pipe-flush(pipe, NULL, 0); + android_surface_enqueue_buffer(asurf-base); asurf-stamp++; -- 1.7.12.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH V2 9/9] docs: Update GL3.txt
One question: Should we have a list of drivers supporting a gpu_shader5 feature after DONE like the other extensions have? For features without driver changes, that would be DONE (all drivers). Marek On Sun, May 4, 2014 at 10:24 AM, Chris Forbes chr...@ijw.co.nz wrote: Signed-off-by: Chris Forbes chr...@ijw.co.nz --- docs/GL3.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/GL3.txt b/docs/GL3.txt index 55906f2..7853724 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -104,7 +104,7 @@ GL 4.0: - 'precise' qualifiernot started - Dynamically uniform sampler array indices not started - Dynamically uniform UBO array indices not started - - Implicit signed - unsigned conversionsnot started + - Implicit signed - unsigned conversionsDONE - Fused multiply-add DONE - Packing/bitfield/conversion functions DONE - Enhanced textureGather DONE @@ -112,7 +112,7 @@ GL 4.0: - Geometry shader multiple streams not started - Enhanced per-sample shadingDONE - Interpolation functionsstarted - - New overload resolution rules not started + - New overload resolution rules DONE GL_ARB_gpu_shader_fp64 not started GL_ARB_sample_shadingDONE (i965, nv50, nvc0) GL_ARB_shader_subroutine not started -- 1.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH V2 9/9] docs: Update GL3.txt
Yes, we probably should. Some of the other features require a significant amount of hardware-specific work. On Sun, May 4, 2014 at 11:11 PM, Marek Olšák mar...@gmail.com wrote: One question: Should we have a list of drivers supporting a gpu_shader5 feature after DONE like the other extensions have? For features without driver changes, that would be DONE (all drivers). Marek On Sun, May 4, 2014 at 10:24 AM, Chris Forbes chr...@ijw.co.nz wrote: Signed-off-by: Chris Forbes chr...@ijw.co.nz --- docs/GL3.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/GL3.txt b/docs/GL3.txt index 55906f2..7853724 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -104,7 +104,7 @@ GL 4.0: - 'precise' qualifiernot started - Dynamically uniform sampler array indices not started - Dynamically uniform UBO array indices not started - - Implicit signed - unsigned conversionsnot started + - Implicit signed - unsigned conversionsDONE - Fused multiply-add DONE - Packing/bitfield/conversion functions DONE - Enhanced textureGather DONE @@ -112,7 +112,7 @@ GL 4.0: - Geometry shader multiple streams not started - Enhanced per-sample shadingDONE - Interpolation functionsstarted - - New overload resolution rules not started + - New overload resolution rules DONE GL_ARB_gpu_shader_fp64 not started GL_ARB_sample_shadingDONE (i965, nv50, nvc0) GL_ARB_shader_subroutine not started -- 1.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] mesa/st: implement ARB_stencil_texturing
Reviewed-by: Marek Olšák marek.ol...@amd.com Marek On Sat, May 3, 2014 at 11:25 AM, Ilia Mirkin imir...@alum.mit.edu wrote: If StencilSampling is enabled on the texture object, pass in an equivalent stencil-only format. Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- This replaces my earlier series, based on a suggestion from Michel Dänzer on IRC. Much simpler, and enables it for pretty much all gallium drivers. src/mesa/state_tracker/st_atom_texture.c | 4 src/mesa/state_tracker/st_extensions.c | 5 + 2 files changed, 9 insertions(+) diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index afc6d9d..928a4ff 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -271,6 +271,10 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st, sv = st_texture_get_sampler_view(st, stObj); + if (stObj-base.StencilSampling + util_format_is_depth_and_stencil(format)) + format = util_format_stencil_only(format); + /* if sampler view has changed dereference it */ if (*sv) { if (check_sampler_swizzle(stObj, *sv) || diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 33cd129..12ba82d 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -507,6 +507,11 @@ void st_init_extensions(struct st_context *st) { { o(OES_compressed_ETC1_RGB8_texture) }, { PIPE_FORMAT_ETC1_RGB8 } }, + + { { o(ARB_stencil_texturing) }, +{ PIPE_FORMAT_X24S8_UINT, + PIPE_FORMAT_S8X24_UINT }, +GL_TRUE }, /* at least one format must be supported */ }; /* Required: vertex fetch support. */ -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] gallium: conditional rendering and glBlitFramebuffer
I think the plan was to add struct pipe_query *render_condition to pipe_blit_info. The value of NULL would mean the conditional rendering is disabled. Marek On Sat, May 3, 2014 at 10:42 AM, Ilia Mirkin imir...@alum.mit.edu wrote: Hello, I've noticed that nv50 fails the latest version of the conditional rendering tests with glBlitFramebuffer. After looking at the changes to the test, I just adjusted the nouveau blit code to not turn off the current query. That fixed the failing test, but then the copyteximage/etc tests started failing. This is probably because pipe-blit is used for more than just the literal glBlitFramebuffer (like glCopyTexImage). I briefly tested with llvmpipe which exhibits the same failure as nv50 originally did, I'm guessing this is a general problem with gallium rather than being nv50- (or nouveau-) specific. So... what's the right way of dealing with this? Adding a bit to pipe_blit_info that indicates whether to leave the current query enabled? Or perhaps pipe_query reference? Something else? Thanks, -ilia P.S. The failing test is bin/nv_conditional_render-blitframebuffer -auto -fbo And the tests that start failing after changing the logic to not disable the query: bin/nv_conditional_render-copyteximage -auto bin/nv_conditional_render-copytexsubimage -auto bin/nv_conditional_render-generatemipmap -auto ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 78258] New: make check link_varyings.gl_ClipDistance failure
https://bugs.freedesktop.org/show_bug.cgi?id=78258 Priority: medium Bug ID: 78258 Keywords: regression Assignee: mesa-dev@lists.freedesktop.org Summary: make check link_varyings.gl_ClipDistance failure Severity: major Classification: Unclassified OS: All Reporter: v...@freedesktop.org Hardware: x86-64 (AMD64) Status: NEW Version: git Component: Mesa core Product: Mesa mesa: b7e7ae9f605283076dba6d9e826fbbd1f1db1c4b (10.3.0-devel) $ make check [...] make check-TESTS PASS: glcpp/tests/glcpp-test FAIL: tests/general-ir-test PASS: tests/optimization-test PASS: tests/ralloc-test PASS: tests/sampler-types-test PASS: tests/uniform-initializer-test make all-am make[7]: Nothing to be done for `all-am'. Testsuite summary for Mesa 10.3.0-devel # TOTAL: 6 # PASS: 5 # SKIP: 0 # XFAIL: 0 # FAIL: 1 # XPASS: 0 # ERROR: 0 [ RUN ] link_varyings.gl_ClipDistance tests/varyings_test.cpp:201: Failure Value of: hash_table_find(consumer_inputs, gl_ClipDistance) Actual: NULL Expected: (void *) clipdistance Which is: 0x7fad7ac196b0 tests/varyings_test.cpp:202: Failure Value of: num_elements(consumer_inputs) Actual: 0 Expected: 1u Which is: 1 [ FAILED ] link_varyings.gl_ClipDistance (0 ms) [ RUN ] link_varyings.single_interface_input [ OK ] link_varyings.single_interface_input (1 ms) [ RUN ] link_varyings.one_interface_and_one_simple_input [ OK ] link_varyings.one_interface_and_one_simple_input (0 ms) [ RUN ] link_varyings.invalid_interface_input [ OK ] link_varyings.invalid_interface_input (0 ms) [ RUN ] link_varyings.interface_field_doesnt_match_noninterface [ OK ] link_varyings.interface_field_doesnt_match_noninterface (0 ms) [ RUN ] link_varyings.interface_field_doesnt_match_noninterface_vice_versa [ OK ] link_varyings.interface_field_doesnt_match_noninterface_vice_versa (0 ms) [--] 7 tests from link_varyings (1 ms total) [--] Global test environment tear-down [==] 33 tests from 6 test cases ran. (8 ms total) [ PASSED ] 32 tests. [ FAILED ] 1 test, listed below: [ FAILED ] link_varyings.gl_ClipDistance -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] mesa/st: implement ARB_stencil_texturing
Am 03.05.2014 11:25, schrieb Ilia Mirkin: If StencilSampling is enabled on the texture object, pass in an equivalent stencil-only format. Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- This replaces my earlier series, based on a suggestion from Michel Dänzer on IRC. Much simpler, and enables it for pretty much all gallium drivers. src/mesa/state_tracker/st_atom_texture.c | 4 src/mesa/state_tracker/st_extensions.c | 5 + 2 files changed, 9 insertions(+) diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index afc6d9d..928a4ff 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -271,6 +271,10 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st, sv = st_texture_get_sampler_view(st, stObj); + if (stObj-base.StencilSampling + util_format_is_depth_and_stencil(format)) + format = util_format_stencil_only(format); + /* if sampler view has changed dereference it */ if (*sv) { if (check_sampler_swizzle(stObj, *sv) || diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 33cd129..12ba82d 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -507,6 +507,11 @@ void st_init_extensions(struct st_context *st) { { o(OES_compressed_ETC1_RGB8_texture) }, { PIPE_FORMAT_ETC1_RGB8 } }, + + { { o(ARB_stencil_texturing) }, +{ PIPE_FORMAT_X24S8_UINT, + PIPE_FORMAT_S8X24_UINT }, +GL_TRUE }, /* at least one format must be supported */ }; /* Required: vertex fetch support. */ This version looks good to me. I guess you had to support stencil texturing for all depthstencil formats the driver claims to support, but presumably this isn't a problem for any hardware which can do it in the first place. (Gallium actually is a bit lenient wrt to sampling depthstencil textures, if you pass in a depthstencil format it will assume you want the depth part - it would be cleaner if you'd have to specify the corresponding depth-only format in the view). Roland ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] gallium: conditional rendering and glBlitFramebuffer
Why would you need the whole query? A boolean if it should honor the currently set render condition sounds simpler and good enough to me. Roland Am 04.05.2014 13:17, schrieb Marek Olšák: I think the plan was to add struct pipe_query *render_condition to pipe_blit_info. The value of NULL would mean the conditional rendering is disabled. Marek On Sat, May 3, 2014 at 10:42 AM, Ilia Mirkin imir...@alum.mit.edu wrote: Hello, I've noticed that nv50 fails the latest version of the conditional rendering tests with glBlitFramebuffer. After looking at the changes to the test, I just adjusted the nouveau blit code to not turn off the current query. That fixed the failing test, but then the copyteximage/etc tests started failing. This is probably because pipe-blit is used for more than just the literal glBlitFramebuffer (like glCopyTexImage). I briefly tested with llvmpipe which exhibits the same failure as nv50 originally did, I'm guessing this is a general problem with gallium rather than being nv50- (or nouveau-) specific. So... what's the right way of dealing with this? Adding a bit to pipe_blit_info that indicates whether to leave the current query enabled? Or perhaps pipe_query reference? Something else? Thanks, -ilia P.S. The failing test is bin/nv_conditional_render-blitframebuffer -auto -fbo And the tests that start failing after changing the logic to not disable the query: bin/nv_conditional_render-copyteximage -auto bin/nv_conditional_render-copytexsubimage -auto bin/nv_conditional_render-generatemipmap -auto ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-devk=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=F4msKE2WxRzA%2BwN%2B25muztFm5TSPwE8HKJfWfR2NgfY%3D%0Am=P1%2BL030G%2FTyy%2FweQvmtDo86ewkfcsf3PU17P02pfSk8%3D%0As=9460e7e4d37d97dc73af65632a4f1674c0d6c485efc221257637e4a70b6b1983 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-devk=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=F4msKE2WxRzA%2BwN%2B25muztFm5TSPwE8HKJfWfR2NgfY%3D%0Am=P1%2BL030G%2FTyy%2FweQvmtDo86ewkfcsf3PU17P02pfSk8%3D%0As=9460e7e4d37d97dc73af65632a4f1674c0d6c485efc221257637e4a70b6b1983 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 78258] make check link_varyings.gl_ClipDistance failure
https://bugs.freedesktop.org/show_bug.cgi?id=78258 Vinson Lee v...@freedesktop.org changed: What|Removed |Added CC||i...@freedesktop.org --- Comment #1 from Vinson Lee v...@freedesktop.org --- # only skipped commits left to test # possible first bad commit: [e608449d3e7dc86b90acfb31d9c948c57cf0e920] mesa/sso: Enable GL_ARB_separate_shader_objects by default # possible first bad commit: [0939d3d0974a579fa65b76ebc6074d61e11f03b0] sso: Add display list support for ARB_separate_shader_objects new functions # possible first bad commit: [7ff937e5793dc8709c916e043b41142033c8e69e] linker: Modify cross_validate_outputs_to_inputs to match using explicit locations # possible first bad commit: [d030a3404ca0fedf365cb0fd41eaad7abc8ff132] linker: Sort shader I/O variables into a canonical order # possible first bad commit: [c557eb77225433fa9415a94fc9db3ce36374df64] linker: Allow geometry shader without vertex shader for separable programs # possible first bad commit: [1ff5a2b1ba2148b772f5e5c86d64c3cb18e1ce97] linker: Assign varying locations for separable programs # possible first bad commit: [7d73c3e99ec14031e3834096f7e8e257338b64d4] linker: Allow consumer stage or producer stage to be NULL # possible first bad commit: [fe37cb0ac67071759a88ea767027368399e1fdb6] linker: Refactor code that gets an input matching an output # possible first bad commit: [5699220cd5719be6fbafdefd75025a817bcb200a] glsl: Exit when the shader IR contains an interface block instance # possible first bad commit: [ba7195d126ce20bf74a27725224662aaca4d90ef] glsl/tests: Add first simple tests of populate_consumer_input_sets # possible first bad commit: [8f5852bd2b91df7b259e5aeafb6a62a4268ca4c4] linker: Refactor code that builds hash tables of varyings during linking # possible first bad commit: [ca21cffebd063354291d561eadc2ded8795a5333] meta: Fix saving the program pipeline state -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] gallium: conditional rendering and glBlitFramebuffer
Yes, you are right, a boolean flag would be simpler. Marek On Sun, May 4, 2014 at 6:06 PM, Roland Scheidegger srol...@vmware.com wrote: Why would you need the whole query? A boolean if it should honor the currently set render condition sounds simpler and good enough to me. Roland Am 04.05.2014 13:17, schrieb Marek Olšák: I think the plan was to add struct pipe_query *render_condition to pipe_blit_info. The value of NULL would mean the conditional rendering is disabled. Marek On Sat, May 3, 2014 at 10:42 AM, Ilia Mirkin imir...@alum.mit.edu wrote: Hello, I've noticed that nv50 fails the latest version of the conditional rendering tests with glBlitFramebuffer. After looking at the changes to the test, I just adjusted the nouveau blit code to not turn off the current query. That fixed the failing test, but then the copyteximage/etc tests started failing. This is probably because pipe-blit is used for more than just the literal glBlitFramebuffer (like glCopyTexImage). I briefly tested with llvmpipe which exhibits the same failure as nv50 originally did, I'm guessing this is a general problem with gallium rather than being nv50- (or nouveau-) specific. So... what's the right way of dealing with this? Adding a bit to pipe_blit_info that indicates whether to leave the current query enabled? Or perhaps pipe_query reference? Something else? Thanks, -ilia P.S. The failing test is bin/nv_conditional_render-blitframebuffer -auto -fbo And the tests that start failing after changing the logic to not disable the query: bin/nv_conditional_render-copyteximage -auto bin/nv_conditional_render-copytexsubimage -auto bin/nv_conditional_render-generatemipmap -auto ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-devk=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=F4msKE2WxRzA%2BwN%2B25muztFm5TSPwE8HKJfWfR2NgfY%3D%0Am=P1%2BL030G%2FTyy%2FweQvmtDo86ewkfcsf3PU17P02pfSk8%3D%0As=9460e7e4d37d97dc73af65632a4f1674c0d6c485efc221257637e4a70b6b1983 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-devk=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=F4msKE2WxRzA%2BwN%2B25muztFm5TSPwE8HKJfWfR2NgfY%3D%0Am=P1%2BL030G%2FTyy%2FweQvmtDo86ewkfcsf3PU17P02pfSk8%3D%0As=9460e7e4d37d97dc73af65632a4f1674c0d6c485efc221257637e4a70b6b1983 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 02/21] glsl: protect locale_t with a mutex
On Sat, May 3, 2014 at 1:52 AM, Ian Romanick i...@freedesktop.org wrote: On 04/22/2014 01:58 AM, Chia-I Wu wrote: There may be two contexts compiling shaders at the same time. locale_t needs to be protected. Rather than calling glsl_initialize_strtod from other places in the compiler, it seems better to use call_once from the strtof and strtod functions. How about having a static object to call newlocale()/freelocale() in its constructor/destructor? It will impose no overead on glsl_strtod(), at the expense of little wasted memory when the applications do not compile shaders. -- o...@lunarg.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 03/21] glsl: protect anonymous struct id with a mutex
On Sat, May 3, 2014 at 1:33 AM, Ian Romanick i...@freedesktop.org wrote: On 04/22/2014 01:58 AM, Chia-I Wu wrote: There may be two contexts compiling shaders at the same time, and we want the anonymous struct id to be globally unique. I am not very excited about this. Is there any chance of getting stdatomic.h for the MSVC compilers that people care about? I'd much rather have this code be... if (identifier == NULL) { static volatile atomic_uint_t anon_count = ATOMIC_VAR_INIT(1); unsigned count; count = atomic_fetch_add(anon_count, 1); identifier = ralloc_asprintf(this, #anon_struct_%04x, count); } I could not find any portable stdatomic.h implementation from a quick search. One thing we may do is to have $ cat $mesa/include/c11/stdatomic.h #if __STDC_VERSION__ = 201112L !defined(__STDC_NO_ATOMICS__) #include stdatomic.h #else /* a implementation that is good enough for us */ #include threads.h #define ATOMIC_VAR_INIT(val) { _MTX_INITIALIZER_NP, (val) } typedef struct atomic_uint_t { mtx_t mutex; unsigned int val; } atomic_uint_t; static inline unsigned int atomic_fetch_add(volatile atomic_uint_t *a) { unsigned int val; mtx_lock(a-mutex); val = a-val++; mtx_unlock(a-mutex); return val; } #endif Whoever needs more than reference counting with unsigned int will need to extend it a bit on systems where there is no stdatomic.h. And maybe we are better off without naming it stdatomic.h. Ideas? Signed-off-by: Chia-I Wu o...@lunarg.com --- src/glsl/glsl_parser_extras.cpp | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 91c9285..30e284b 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -1332,9 +1332,15 @@ ast_struct_specifier::ast_struct_specifier(const char *identifier, ast_declarator_list *declarator_list) { if (identifier == NULL) { + static mtx_t mutex = _MTX_INITIALIZER_NP; static unsigned anon_count = 1; - identifier = ralloc_asprintf(this, #anon_struct_%04x, anon_count); - anon_count++; + unsigned count; + + mtx_lock(mutex); + count = anon_count++; + mtx_unlock(mutex); + + identifier = ralloc_asprintf(this, #anon_struct_%04x, count); } name = identifier; this-declarations.push_degenerate_list_at_head(declarator_list-link); -- o...@lunarg.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 20/21] mesa: add support for threaded glCompileShader
On Sat, May 3, 2014 at 1:59 AM, Ian Romanick i...@freedesktop.org wrote: On 04/22/2014 01:58 AM, Chia-I Wu wrote: From: Chia-I Wu o...@lunarg.com Threaded glCompileShader can be enabled for a context by calling _mesa_enable_glsl_threadpool. It will initialize the singleton GLSL thread pool and defer glCompileShader calls to the thread pool. For applications to benefit from threaded glCompileShader, they have to compile shaders in this fashion for (i = 0; i num_shaders; i++) glCompileShader(shaders[i]); for (i = 0; i num_shaders; i++) glGetShaderiv(shaders[i], GL_COMPILE_STATUS, val); I think when you try this series on some real applications, you will be disappointed. Eric had a pretty similar branch (http://cgit.freedesktop.org/~anholt/mesa/log/?h=compiler-threads), but it saw no benefit on any applications... because everybody does for (i = 0; i num_shaders; i++) { glCompileShader(shaders[i]); glGetShaderiv(shaders[i], GL_COMPILE_STATUS, val); } or for (i = 0; i num_shaders; i++) { glCompileShader(shaders[i]); glAttachShader(prog, shaders[i]); } glLinkProgram(prog); Yeah, I am aware of the situation with real-world applications. Only applications that are modified to not immediately check compilation results will get the speed up in compile times. That is why this feature needs to be enabled through drirc. We, at LunarG, are working with major game engines vendors to ensure this performance benefit is realized. I'm also curious about your test case... did you link the shaders? As far as I'm aware, the bulk of time spent in the compiler happens during linking (final optimizations and register allocation). Eric's data (http://lists.freedesktop.org/archives/mesa-dev/2014-April/057494.html) says we spend more than 2x time in linking than in compiling. No, I did not. In my other experiment with Unigine Tropics, the distribution of time was more like glCompileShader: 50% glLinkProgram FE: 25% glLinkProgram BE: 25% But, yeah, I will modify my test case to collect more numbers. Given Pierre-Loup's numbers on DOTA2, we could expect much more reduction of shader compiling/linking time if Eric's data are correct. Despite all that, if this series is to be accepted after concerns are resolved, what I plan to do based on it are * defer FE work in glLinkProgram to the thread pool * defer glCreateShaderProgramv * defer BE work in glLinkProgram to the thread pool The priorities will be driven by where CPU time is spent. I am sorry I wasn't aware of the mail thread you pointed out. I would have responded to it if I knew. I am still on the road and away from my desktop. I will read the thread carefully when I get to sit down and work. As each glGetShaderiv call will force mesa to wait for the deferred glCompileShader to complete, compiling shaders in the traditional way will defeat this feature. This is also why the feature needs to be explicitly enabled with _mesa_enable_glsl_threadpool. Signed-off-by: Chia-I Wu o...@lunarg.com --- src/glsl/glsl_parser_extras.cpp | 4 +++ src/glsl/threadpool.c | 72 + src/glsl/threadpool.h | 9 ++ src/mesa/main/context.c | 25 ++ src/mesa/main/context.h | 3 ++ src/mesa/main/mtypes.h | 13 src/mesa/main/shaderapi.c | 48 +-- src/mesa/main/shaderobj.c | 20 src/mesa/main/shaderobj.h | 2 ++ 9 files changed, 194 insertions(+), 2 deletions(-) diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 30e284b..c035474 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -37,6 +37,7 @@ extern C { #include glsl_parser.h #include ir_optimization.h #include loop_analysis.h +#include threadpool.h /** * Format a short human-readable description of the given GLSL version. @@ -1567,6 +1568,8 @@ extern C { void _mesa_destroy_shader_compiler(void) { + _mesa_glsl_destroy_threadpool(); + _mesa_destroy_shader_compiler_caches(); _mesa_glsl_release_types(); @@ -1580,6 +1583,7 @@ _mesa_destroy_shader_compiler(void) void _mesa_destroy_shader_compiler_caches(void) { + _mesa_glsl_wait_threadpool(); _mesa_glsl_release_builtin_functions(); } diff --git a/src/glsl/threadpool.c b/src/glsl/threadpool.c index 0aaac3a..3d54ec0 100644 --- a/src/glsl/threadpool.c +++ b/src/glsl/threadpool.c @@ -55,6 +55,7 @@ struct _mesa_threadpool_task { struct _mesa_threadpool { mtx_t mutex; int refcnt; + bool shutdown; enum _mesa_threadpool_control thread_control; thrd_t *threads; @@ -158,6 +159,12 @@ _mesa_threadpool_queue_task(struct _mesa_threadpool *pool, mtx_lock(pool-mutex); + if (unlikely(pool-shutdown)) { + mtx_unlock(pool-mutex); +
Re: [Mesa-dev] [PATCH] st/egl: Flush resources before presentation (android - bug 77966)
On Sun, May 4, 2014 at 7:02 PM, Marek Olšák mar...@gmail.com wrote: Reviewed-by: Marek Olšák marek.ol...@amd.com Looks good to me too, except please use your real name. Marek On Fri, May 2, 2014 at 5:00 PM, pstglia pstg...@gmail.com wrote: --- src/gallium/state_trackers/egl/android/native_android.cpp | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/state_trackers/egl/android/native_android.cpp b/src/gallium/state_trackers/egl/android/native_android.cpp index e73d031..8620ed8 100644 --- a/src/gallium/state_trackers/egl/android/native_android.cpp +++ b/src/gallium/state_trackers/egl/android/native_android.cpp @@ -396,6 +396,13 @@ android_surface_swap_buffers(struct native_surface *nsurf) struct android_surface *asurf = android_surface(nsurf); struct android_display *adpy = asurf-adpy; + struct native_display *ndpy = adpy-base; + struct pipe_context *pipe = ndpy_get_copy_context(ndpy); + + /* flush buffer */ + pipe-flush_resource(pipe, asurf-buf_res); + pipe-flush(pipe, NULL, 0); + android_surface_enqueue_buffer(asurf-base); asurf-stamp++; -- 1.7.12.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev -- o...@lunarg.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 03/21] glsl: protect anonymous struct id with a mutex
On Fri, May 2, 2014 at 10:33 AM, Ian Romanick i...@freedesktop.org wrote: On 04/22/2014 01:58 AM, Chia-I Wu wrote: There may be two contexts compiling shaders at the same time, and we want the anonymous struct id to be globally unique. I am not very excited about this. Is there any chance of getting stdatomic.h for the MSVC compilers that people care about? I'd much rather have this code be... if (identifier == NULL) { static volatile atomic_uint_t anon_count = ATOMIC_VAR_INIT(1); unsigned count; count = atomic_fetch_add(anon_count, 1); identifier = ralloc_asprintf(this, #anon_struct_%04x, count); } Note that gcc-4.9 is the first version to have stdatomic.h. gcc has supported atomic built-ins for a long time though: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] mesa/st: implement ARB_stencil_texturing
On Sun, May 4, 2014 at 11:59 AM, Roland Scheidegger srol...@vmware.com wrote: Am 03.05.2014 11:25, schrieb Ilia Mirkin: If StencilSampling is enabled on the texture object, pass in an equivalent stencil-only format. Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- This replaces my earlier series, based on a suggestion from Michel Dänzer on IRC. Much simpler, and enables it for pretty much all gallium drivers. src/mesa/state_tracker/st_atom_texture.c | 4 src/mesa/state_tracker/st_extensions.c | 5 + 2 files changed, 9 insertions(+) diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index afc6d9d..928a4ff 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -271,6 +271,10 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st, sv = st_texture_get_sampler_view(st, stObj); + if (stObj-base.StencilSampling + util_format_is_depth_and_stencil(format)) + format = util_format_stencil_only(format); + /* if sampler view has changed dereference it */ if (*sv) { if (check_sampler_swizzle(stObj, *sv) || diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 33cd129..12ba82d 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -507,6 +507,11 @@ void st_init_extensions(struct st_context *st) { { o(OES_compressed_ETC1_RGB8_texture) }, { PIPE_FORMAT_ETC1_RGB8 } }, + + { { o(ARB_stencil_texturing) }, +{ PIPE_FORMAT_X24S8_UINT, + PIPE_FORMAT_S8X24_UINT }, +GL_TRUE }, /* at least one format must be supported */ }; /* Required: vertex fetch support. */ This version looks good to me. I guess you had to support stencil texturing for all depthstencil formats the driver claims to support, but presumably this isn't a problem for any hardware which can do it in the first place. At a quick glance at a few drivers I didn't notice any problems. Should any issues come up, we can do something cleverer, like checking directly that for each supported DEPTH_STENCIL format, that its related STENCIL format is also supported. It didn't seem that the complexity was worth it for now. (Gallium actually is a bit lenient wrt to sampling depthstencil textures, if you pass in a depthstencil format it will assume you want the depth part - it would be cleaner if you'd have to specify the corresponding depth-only format in the view). Hmm... that seems akin to poking a dragon with a stick. In theory that seems like it should work, but I'd like to leave it to someone else to find out :) -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/egl: Flush resources before presentation (android - bug 77966)
On Mon, May 5, 2014 at 6:12 AM, Paulo Sergio pstg...@gmail.com wrote: Ok. Name is Paulo Sergio Travaglia. Shall I resend the patch? I've committed it. Thanks. Thanks Em 04/05/2014 18:40, Chia-I Wu olva...@gmail.com escreveu: On Sun, May 4, 2014 at 7:02 PM, Marek Olšák mar...@gmail.com wrote: Reviewed-by: Marek Olšák marek.ol...@amd.com Looks good to me too, except please use your real name. Marek On Fri, May 2, 2014 at 5:00 PM, pstglia pstg...@gmail.com wrote: --- src/gallium/state_trackers/egl/android/native_android.cpp | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/state_trackers/egl/android/native_android.cpp b/src/gallium/state_trackers/egl/android/native_android.cpp index e73d031..8620ed8 100644 --- a/src/gallium/state_trackers/egl/android/native_android.cpp +++ b/src/gallium/state_trackers/egl/android/native_android.cpp @@ -396,6 +396,13 @@ android_surface_swap_buffers(struct native_surface *nsurf) struct android_surface *asurf = android_surface(nsurf); struct android_display *adpy = asurf-adpy; + struct native_display *ndpy = adpy-base; + struct pipe_context *pipe = ndpy_get_copy_context(ndpy); + + /* flush buffer */ + pipe-flush_resource(pipe, asurf-buf_res); + pipe-flush(pipe, NULL, 0); + android_surface_enqueue_buffer(asurf-base); asurf-stamp++; -- 1.7.12.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev -- o...@lunarg.com -- o...@lunarg.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [v2 03/10] mesa: add new enum MAX_UNIFORM_LOCATIONS
Patch adds new implementation dependent value required by the GL_ARB_explicit_uniform_location extension. Default value for user assignable locations is calculated as sum of MaxUniformComponents for each stage. v2: fix descriptor in get_hash_params.py (Petri) Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/mesa/main/context.c | 10 +- src/mesa/main/get.c | 1 + src/mesa/main/get_hash_params.py | 1 + src/mesa/main/mtypes.h | 5 + src/mesa/main/tests/enum_strings.cpp | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 860ae86..8b77df1 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -610,8 +610,16 @@ _mesa_init_constants(struct gl_context *ctx) ctx-Const.MaxUniformBlockSize = 16384; ctx-Const.UniformBufferOffsetAlignment = 1; - for (i = 0; i MESA_SHADER_STAGES; i++) + /* GL_ARB_explicit_uniform_location, initial value calculated +* as sum of MaxUniformComponents for each stage. +*/ + ctx-Const.MaxUserAssignableUniformLocations = 0; + + for (i = 0; i MESA_SHADER_STAGES; i++) { init_program_limits(ctx, i, ctx-Const.Program[i]); + ctx-Const.MaxUserAssignableUniformLocations += + ctx-Const.Program[i].MaxUniformComponents; + } ctx-Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES; ctx-Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH; diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 80a5839..f0e9b7b 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -395,6 +395,7 @@ EXTRA_EXT(ARB_compute_shader); EXTRA_EXT(ARB_gpu_shader5); EXTRA_EXT2(ARB_transform_feedback3, ARB_gpu_shader5); EXTRA_EXT(INTEL_performance_query); +EXTRA_EXT(ARB_explicit_uniform_location); static const int extra_ARB_color_buffer_float_or_glcore[] = { diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index d40fa07..9ac372e 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -480,6 +480,7 @@ descriptor=[ [ MAX_LIST_NESTING, CONST(MAX_LIST_NESTING), NO_EXTRA ], [ MAX_NAME_STACK_DEPTH, CONST(MAX_NAME_STACK_DEPTH), NO_EXTRA ], [ MAX_PIXEL_MAP_TABLE, CONST(MAX_PIXEL_MAP_TABLE), NO_EXTRA ], + [ MAX_UNIFORM_LOCATIONS, CONTEXT_INT(Const.MaxUserAssignableUniformLocations), extra_ARB_explicit_uniform_location ], [ NAME_STACK_DEPTH, CONTEXT_INT(Select.NameStackDepth), NO_EXTRA ], [ PACK_LSB_FIRST, CONTEXT_BOOL(Pack.LsbFirst), NO_EXTRA ], [ PACK_SWAP_BYTES, CONTEXT_BOOL(Pack.SwapBytes), NO_EXTRA ], diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 9ca76bc..85fa785 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3319,6 +3319,11 @@ struct gl_constants GLuint UniformBufferOffsetAlignment; /** @} */ + /** +* GL_ARB_explicit_uniform_location +*/ + GLuint MaxUserAssignableUniformLocations; + /** GL_ARB_geometry_shader4 */ GLuint MaxGeometryOutputVertices; GLuint MaxGeometryTotalOutputComponents; diff --git a/src/mesa/main/tests/enum_strings.cpp b/src/mesa/main/tests/enum_strings.cpp index d16eb36..5291a38 100644 --- a/src/mesa/main/tests/enum_strings.cpp +++ b/src/mesa/main/tests/enum_strings.cpp @@ -787,6 +787,7 @@ const struct enum_info everything[] = { { 0x8256, GL_RESET_NOTIFICATION_STRATEGY_ARB }, { 0x8257, GL_PROGRAM_BINARY_RETRIEVABLE_HINT }, { 0x8261, GL_NO_RESET_NOTIFICATION_ARB }, + { 0x826E, GL_MAX_UNIFORM_LOCATIONS }, { 0x82DF, GL_TEXTURE_IMMUTABLE_LEVELS }, { 0x8362, GL_UNSIGNED_BYTE_2_3_3_REV }, { 0x8363, GL_UNSIGNED_SHORT_5_6_5 }, -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glsl: fix bogus layout qualifier warnings
Print out GL_ARB_explicit_attrib_location warnings only when parsing attribute that uses location qualifier. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77245 Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/glsl/glsl_parser.yy | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index e3ee16a..b09d6e5 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -1319,6 +1319,13 @@ layout_qualifier_id: if (match_layout_qualifier(location, $1, state) == 0) { $$.flags.q.explicit_location = 1; + if ($$.flags.q.attribute == 1 + state-ARB_explicit_attrib_location_warn) { +_mesa_glsl_warning( @1, state, + GL_ARB_explicit_attrib_location layout + identifier `%s' used, $1); + } + if ($3 = 0) { $$.location = $3; } else { @@ -1426,10 +1433,6 @@ layout_qualifier_id: _mesa_glsl_error( @1, state, unrecognized layout identifier `%s', $1); YYERROR; - } else if (state-ARB_explicit_attrib_location_warn) { - _mesa_glsl_warning( @1, state, -GL_ARB_explicit_attrib_location layout -identifier `%s' used, $1); } } | interface_block_layout_qualifier -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] drawtex: resolve glDrawTexfOES extension function
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78101 Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/egl/opengles1/drawtex.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/egl/opengles1/drawtex.c b/src/egl/opengles1/drawtex.c index 524f931..1ba8ac7 100644 --- a/src/egl/opengles1/drawtex.c +++ b/src/egl/opengles1/drawtex.c @@ -25,13 +25,14 @@ static GLfloat width = 200, height = 200; static GLboolean animate = GL_FALSE; static int win; +static PFNGLDRAWTEXFOESPROC glDrawTexfOES_func = NULL; static void draw(void) { glClear(GL_COLOR_BUFFER_BIT); - glDrawTexfOES(view_posx, view_posy, 0.0, width, height); + glDrawTexfOES_func(view_posx, view_posy, 0.0, width, height); } @@ -128,6 +129,13 @@ init(void) exit(1); } + glDrawTexfOES_func = eglGetProcAddress(glDrawTexfOES); + + if (!glDrawTexfOES_func) { + fprintf(stderr, Sorry, failed to resolve glDrawTexfOES function\n); + exit(1); + } + glClearColor(0.4, 0.4, 0.4, 0.0); make_smile_texture(); -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 78101] [bisected] Mesa demos fails to link with drawtex.c:34: undefined reference to `glDrawTexfOES'
https://bugs.freedesktop.org/show_bug.cgi?id=78101 Tapani Pälli lem...@gmail.com changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|mesa-dev@lists.freedesktop. |lem...@gmail.com |org | --- Comment #7 from Tapani Pälli lem...@gmail.com --- I've send a modified patch to mesa-dev mailing list. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev