shader: Implement SampleMask
This commit is contained in:
		| @@ -1179,7 +1179,10 @@ void EmitContext::DefineOutputs(const IR::Program& program) { | ||||
|         if (info.stores_frag_depth) { | ||||
|             frag_depth = DefineOutput(*this, F32[1], std::nullopt); | ||||
|             Decorate(frag_depth, spv::Decoration::BuiltIn, spv::BuiltIn::FragDepth); | ||||
|             Name(frag_depth, "frag_depth"); | ||||
|         } | ||||
|         if (info.stores_sample_mask) { | ||||
|             sample_mask = DefineOutput(*this, U32[1], std::nullopt); | ||||
|             Decorate(sample_mask, spv::Decoration::BuiltIn, spv::BuiltIn::SampleMask); | ||||
|         } | ||||
|         break; | ||||
|     default: | ||||
|   | ||||
| @@ -215,6 +215,7 @@ public: | ||||
|     std::array<Id, 30> patches{}; | ||||
|  | ||||
|     std::array<Id, 8> frag_color{}; | ||||
|     Id sample_mask{}; | ||||
|     Id frag_depth{}; | ||||
|  | ||||
|     std::vector<Id> interfaces; | ||||
|   | ||||
| @@ -58,6 +58,7 @@ void EmitSetAttributeIndexed(EmitContext& ctx, Id offset, Id value, Id vertex); | ||||
| Id EmitGetPatch(EmitContext& ctx, IR::Patch patch); | ||||
| void EmitSetPatch(EmitContext& ctx, IR::Patch patch, Id value); | ||||
| void EmitSetFragColor(EmitContext& ctx, u32 index, u32 component, Id value); | ||||
| void EmitSetSampleMask(EmitContext& ctx, Id value); | ||||
| void EmitSetFragDepth(EmitContext& ctx, Id value); | ||||
| void EmitGetZFlag(EmitContext& ctx); | ||||
| void EmitGetSFlag(EmitContext& ctx); | ||||
|   | ||||
| @@ -343,6 +343,10 @@ void EmitSetFragColor(EmitContext& ctx, u32 index, u32 component, Id value) { | ||||
|     ctx.OpStore(pointer, value); | ||||
| } | ||||
|  | ||||
| void EmitSetSampleMask(EmitContext& ctx, Id value) { | ||||
|     ctx.OpStore(ctx.sample_mask, value); | ||||
| } | ||||
|  | ||||
| void EmitSetFragDepth(EmitContext& ctx, Id value) { | ||||
|     ctx.OpStore(ctx.frag_depth, value); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user