소스 검색

spirv: add/hookup SpvCapabilityStencilExportEXT

v2:
An attempt to support SpvExecutionModeStencilRefReplacingEXT's behavior
also follows, with the interpretation to said mode being we prevent
writes to the built-in FragStencilRefEXT variable when the execution
mode isn't set.

v3:
A more cautious reading of 1db44252d0 led
me to a missing change that would stop (what I later discovered were)
GPU hangs on the CTS test written to exercise this.

v4:
Turn FragStencilRefEXT decoration usage without StencilRefReplacingEXT
mode into a warning, instead of trying to make the variable read-only.
If we are to follow the originating extension on GL, the built-in
variable in question should never be readable anyway.

v5/v6: rebases.

v7:
Fix check for gen9 lost in rebase. (Ilia)
Reduce the scope of the bool used to track whether
SpvExecutionModeStencilRefReplacingEXT was used. Was in shader_info,
moved to vtn_builder. (Jason)

v8:
Assert for fragment shader handling StencilRefReplacingEXT execution
mode. (Caio)
Remove warning logic, since an entry point might not have
StencilRefReplacingEXT execution mode, but the global output variable
might still exist for another entry point in the module. (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
tags/18.2-branchpoint
Gustavo Lima Chaves 7 년 전
부모
커밋
7cc5178bba
3개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 1
    0
      src/compiler/shader_info.h
  2. 8
    0
      src/compiler/spirv/spirv_to_nir.c
  3. 4
    0
      src/compiler/spirv/vtn_variables.c

+ 1
- 0
src/compiler/shader_info.h 파일 보기

@@ -56,6 +56,7 @@ struct spirv_supported_capabilities {
bool trinary_minmax;
bool descriptor_array_dynamic_indexing;
bool runtime_descriptor_array;
bool stencil_export;
};

typedef struct shader_info {

+ 8
- 0
src/compiler/spirv/spirv_to_nir.c 파일 보기

@@ -3408,6 +3408,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
spv_check_supported(runtime_descriptor_array, cap);
break;

case SpvCapabilityStencilExportEXT:
spv_check_supported(stencil_export, cap);
break;

default:
vtn_fail("Unhandled capability");
}
@@ -3585,6 +3589,10 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
case SpvExecutionModeContractionOff:
break; /* OpenCL */

case SpvExecutionModeStencilRefReplacingEXT:
vtn_assert(b->shader->info.stage == MESA_SHADER_FRAGMENT);
break;

default:
vtn_fail("Unhandled execution mode");
}

+ 4
- 0
src/compiler/spirv/vtn_variables.c 파일 보기

@@ -1354,6 +1354,10 @@ vtn_get_builtin_location(struct vtn_builder *b,
*location = SYSTEM_VALUE_SUBGROUP_LT_MASK,
set_mode_system_value(b, mode);
break;
case SpvBuiltInFragStencilRefEXT:
*location = FRAG_RESULT_STENCIL;
vtn_assert(*mode == nir_var_shader_out);
break;
default:
vtn_fail("unsupported builtin");
}

Loading…
취소
저장