Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 910 vs 911 for /trunk/Source Code/Rendering/PostFX/PreRenderBatch.cpp

Diff revisions: vs.
  @@ -45,13 +45,7 @@
45 45 _renderTarget = renderTarget;
46 46
47 47 const RenderTarget& rt = inputRT();
48 - // make the texture square sized and power of two
49 - U16 lumaRez = to_U16(nextPOW2(to_U32(rt.getWidth() / 3.0f)));
50 -
51 - _previousLuminance = _context.allocateRT(vec2<U16>(1), "PreviousLuminance");
52 - _currentLuminance = _context.allocateRT(vec2<U16>(lumaRez), "Luminance");
53 48
54 - _postFXOutput = _context.allocateRT(vec2<U16>(rt.getWidth(), rt.getHeight()), "PostFXOutput");
55 49 SamplerDescriptor screenSampler;
56 50 screenSampler.setWrapMode(TextureWrap::CLAMP_TO_EDGE);
57 51 screenSampler.setFilters(TextureFilter::LINEAR);
  @@ -61,9 +55,20 @@
61 55 GFXImageFormat::RGBA8,
62 56 GFXDataFormat::UNSIGNED_BYTE);
63 57 outputDescriptor.setSampler(screenSampler);
64 - //Colour0 holds the LDR screen texture
65 - _postFXOutput._rt->addAttachment(outputDescriptor, RTAttachment::Type::Colour, 0);
66 - _postFXOutput._rt->create();
58 + {
59 + //Colour0 holds the LDR screen texture
60 + vectorImpl<RTAttachmentDescriptor> att = {
61 + { outputDescriptor, RTAttachment::Type::Colour },
62 + };
63 +
64 + RenderTargetDescriptor desc = {};
65 + desc._name = "PostFXOutput";
66 + desc._resolution = vec2<U16>(rt.getWidth(), rt.getHeight());
67 + desc._attachmentCount = to_U32(att.size());
68 + desc._attachments = att.data();
69 +
70 + _postFXOutput = _context.allocateRT(desc);
71 + }
67 72
68 73 SamplerDescriptor lumaSampler;
69 74 lumaSampler.setWrapMode(TextureWrap::CLAMP_TO_EDGE);
  @@ -74,14 +79,37 @@
74 79 GFXDataFormat::FLOAT_16);
75 80 lumaDescriptor.setSampler(lumaSampler);
76 81 lumaDescriptor.toggleAutomaticMipMapGeneration(false);
77 - _currentLuminance._rt->addAttachment(lumaDescriptor, RTAttachment::Type::Colour, 0);
78 - _currentLuminance._rt->create();
82 + {
83 + // make the texture square sized and power of two
84 + U16 lumaRez = to_U16(nextPOW2(to_U32(rt.getWidth() / 3.0f)));
85 +
86 + vectorImpl<RTAttachmentDescriptor> att = {
87 + { lumaDescriptor, RTAttachment::Type::Colour },
88 + };
89 +
90 + RenderTargetDescriptor desc = {};
91 + desc._name = "Luminance";
92 + desc._resolution = vec2<U16>(lumaRez);
93 + desc._attachmentCount = to_U32(att.size());
94 + desc._attachments = att.data();
79 95
96 + _currentLuminance = _context.allocateRT(desc);
97 + }
80 98 lumaSampler.setFilters(TextureFilter::LINEAR);
81 99 lumaDescriptor.setSampler(lumaSampler);
82 - _previousLuminance._rt->addAttachment(lumaDescriptor, RTAttachment::Type::Colour, 0);
83 - _previousLuminance._rt->setClearColour(RTAttachment::Type::COUNT, 0, DefaultColours::BLACK());
84 - _previousLuminance._rt->create();
100 + {
101 + vectorImpl<RTAttachmentDescriptor> att = {
102 + { lumaDescriptor, RTAttachment::Type::Colour, 0, DefaultColours::BLACK() },
103 + };
104 +
105 + RenderTargetDescriptor desc = {};
106 + desc._name = "PreviousLuminance";
107 + desc._resolution = vec2<U16>(1);
108 + desc._attachmentCount = to_U32(att.size());
109 + desc._attachments = att.data();
110 +
111 + _previousLuminance = _context.allocateRT(desc);
112 + }
85 113
86 114 // Order is very important!
87 115 OperatorBatch& hdrBatch = _operators[to_base(FilterSpace::FILTER_SPACE_HDR)];