MCPcopy Create free account
hub / github.com/google/gapid / simplifySampling

Function simplifySampling

gapis/api/vulkan/simplify_sampling.go:27–61  ·  view source on GitHub ↗

simplifySampling returns a transform that turns off anisotropic filtering and sets filtering modes to nearest neighbor

(ctx context.Context)

Source from the content-addressed store, hash-verified

25// simplifySampling returns a transform that turns off anisotropic filtering
26// and sets filtering modes to nearest neighbor
27func simplifySampling(ctx context.Context) transform.Transformer {
28 ctx = log.Enter(ctx, "Simplify sampling")
29 return transform.Transform("Simplify sampling", func(ctx context.Context,
30 id api.CmdID, cmd api.Cmd, out transform.Writer) {
31
32 s := out.State()
33 cb := CommandBuilder{Thread: cmd.Thread(), Arena: s.Arena}
34 switch cmd := cmd.(type) {
35 case *VkCreateSampler:
36 cmd.Extras().Observations().ApplyReads(s.Memory.ApplicationPool())
37
38 samplerCreateInfo := cmd.PCreateInfo().MustRead(ctx, cmd, s, nil)
39 samplerCreateInfo.SetAnisotropyEnable(VkBool32(0))
40 samplerCreateInfo.SetMinFilter(VkFilter_VK_FILTER_NEAREST)
41 samplerCreateInfo.SetMagFilter(VkFilter_VK_FILTER_NEAREST)
42
43 samplerCreateInfoData := s.AllocDataOrPanic(ctx, samplerCreateInfo)
44 defer samplerCreateInfoData.Free()
45
46 newCmd := cb.VkCreateSampler(cmd.Device(),
47 samplerCreateInfoData.Ptr(),
48 cmd.PAllocator(),
49 cmd.PSampler(),
50 VkResult_VK_SUCCESS,
51 ).AddRead(samplerCreateInfoData.Data())
52
53 for _, w := range cmd.Extras().Observations().Writes {
54 newCmd.AddWrite(w.Range, w.ID)
55 }
56 out.MutateAndWrite(ctx, id, newCmd)
57 default:
58 out.MutateAndWrite(ctx, id, cmd)
59 }
60 })
61}

Callers 1

ReplayMethod · 0.85

Calls 15

ApplyReadsMethod · 0.80
ObservationsMethod · 0.80
ApplicationPoolMethod · 0.80
AllocDataOrPanicMethod · 0.80
PtrMethod · 0.80
TransformMethod · 0.65
StateMethod · 0.65
ThreadMethod · 0.65
ExtrasMethod · 0.65
FreeMethod · 0.65
DataMethod · 0.65
MutateAndWriteMethod · 0.65

Tested by

no test coverage detected