forked from eden-emu/eden
		
	Merge pull request #7201 from ameerj/spirv-depth-sampling
emit_spirv_image: Fix depth image implicit lod sample in non-fragment stages
This commit is contained in:
		
						commit
						7aa0d97eed
					
				
					 1 changed files with 16 additions and 5 deletions
				
			
		|  | @ -355,11 +355,22 @@ Id EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& | ||||||
| Id EmitImageSampleDrefImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, | Id EmitImageSampleDrefImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, | ||||||
|                                   Id coords, Id dref, Id bias_lc, const IR::Value& offset) { |                                   Id coords, Id dref, Id bias_lc, const IR::Value& offset) { | ||||||
|     const auto info{inst->Flags<IR::TextureInstInfo>()}; |     const auto info{inst->Flags<IR::TextureInstInfo>()}; | ||||||
|     const ImageOperands operands(ctx, info.has_bias != 0, false, info.has_lod_clamp != 0, bias_lc, |     if (ctx.stage == Stage::Fragment) { | ||||||
|                                  offset); |         const ImageOperands operands(ctx, info.has_bias != 0, false, info.has_lod_clamp != 0, | ||||||
|  |                                      bias_lc, offset); | ||||||
|         return Emit(&EmitContext::OpImageSparseSampleDrefImplicitLod, |         return Emit(&EmitContext::OpImageSparseSampleDrefImplicitLod, | ||||||
|                     &EmitContext::OpImageSampleDrefImplicitLod, ctx, inst, ctx.F32[1], |                     &EmitContext::OpImageSampleDrefImplicitLod, ctx, inst, ctx.F32[1], | ||||||
|                 Texture(ctx, info, index), coords, dref, operands.MaskOptional(), operands.Span()); |                     Texture(ctx, info, index), coords, dref, operands.MaskOptional(), | ||||||
|  |                     operands.Span()); | ||||||
|  |     } else { | ||||||
|  |         // Implicit lods in compute behave on hardware as if sampling from LOD 0.
 | ||||||
|  |         // This check is to ensure all drivers behave this way.
 | ||||||
|  |         const Id lod{ctx.Const(0.0f)}; | ||||||
|  |         const ImageOperands operands(ctx, false, true, false, lod, offset); | ||||||
|  |         return Emit(&EmitContext::OpImageSparseSampleDrefExplicitLod, | ||||||
|  |                     &EmitContext::OpImageSampleDrefExplicitLod, ctx, inst, ctx.F32[1], | ||||||
|  |                     Texture(ctx, info, index), coords, dref, operands.Mask(), operands.Span()); | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Id EmitImageSampleDrefExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, | Id EmitImageSampleDrefExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Fernando S
						Fernando S