mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-04 08:25:34 +00:00
[qfcc] Implement discard
I had no idea how to do it back when I started working on the glsl parser, but intrinsics made it very easy. It's just OpKill for now (and might stay that way for glsl).
This commit is contained in:
parent
6b0b1b24b8
commit
6af960cef2
3 changed files with 8 additions and 2 deletions
|
@ -1128,6 +1128,7 @@ SRC_LINE
|
|||
//fragment processing functions
|
||||
static const char *glsl_fragment_functions =
|
||||
SRC_LINE
|
||||
"void __discard() = " SPV(OpKill) ";" "\n"
|
||||
"@generic(genFType=@vector(float)) {" "\n"
|
||||
"genFType dFdx(genFType p) = " SPV(OpDPdx) ";" "\n"
|
||||
"genFType dFdy(genFType p) = " SPV(OpDPdy) ";" "\n"
|
||||
|
|
|
@ -1326,7 +1326,11 @@ jump_statement
|
|||
}
|
||||
| RETURN ';' { $$ = new_return_expr (nullptr); }
|
||||
| RETURN expression ';' { $$ = new_return_expr ($2); }
|
||||
| DISCARD ';' { $$ = nullptr; } //XXX
|
||||
| DISCARD ';'
|
||||
{
|
||||
auto func = new_name_expr ("__discard");
|
||||
$$ = new_call_expr (func, nullptr, nullptr);
|
||||
}
|
||||
;
|
||||
|
||||
%%
|
||||
|
|
|
@ -129,7 +129,8 @@ is_block_terminated (defspace_t *code_space)
|
|||
|| (INSN(last_insn, 0) & SpvOpCodeMask) == SpvOpReturnValue
|
||||
|| (INSN(last_insn, 0) & SpvOpCodeMask) == SpvOpUnreachable
|
||||
|| (INSN(last_insn, 0) & SpvOpCodeMask) == SpvOpBranchConditional
|
||||
|| (INSN(last_insn, 0) & SpvOpCodeMask) == SpvOpBranch)) {
|
||||
|| (INSN(last_insn, 0) & SpvOpCodeMask) == SpvOpBranch
|
||||
|| (INSN(last_insn, 0) & SpvOpCodeMask) == SpvOpKill)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue