| 2118 | return expect('}') && parse_success; |
| 2119 | } |
| 2120 | bool reshadefx::parser::parse_technique_pass(pass &info) |
| 2121 | { |
| 2122 | if (!expect(tokenid::pass)) |
| 2123 | return false; |
| 2124 | |
| 2125 | const location pass_location = std::move(_token.location); |
| 2126 | |
| 2127 | // Passes can have an optional name |
| 2128 | if (accept(tokenid::identifier)) |
| 2129 | info.name = std::move(_token.literal_as_string); |
| 2130 | |
| 2131 | bool parse_success = true; |
| 2132 | bool targets_support_srgb = true; |
| 2133 | function vs_info = {}, ps_info = {}, cs_info = {}; |
| 2134 | |
| 2135 | if (!expect('{')) |
| 2136 | return false; |
| 2137 | |
| 2138 | while (!peek('}')) |
| 2139 | { |
| 2140 | // Parse pass states |
| 2141 | if (!expect(tokenid::identifier)) |
| 2142 | { |
| 2143 | consume_until('}'); |
| 2144 | return false; |
| 2145 | } |
| 2146 | |
| 2147 | location state_location = std::move(_token.location); |
| 2148 | const std::string state_name = std::move(_token.literal_as_string); |
| 2149 | |
| 2150 | if (!expect('=')) |
| 2151 | { |
| 2152 | consume_until('}'); |
| 2153 | return false; |
| 2154 | } |
| 2155 | |
| 2156 | const bool is_shader_state = state_name.size() > 6 && state_name.compare(state_name.size() - 6, 6, "Shader") == 0; // VertexShader, PixelShader, ComputeShader, ... |
| 2157 | const bool is_texture_state = state_name.compare(0, 12, "RenderTarget") == 0 && (state_name.size() == 12 || (state_name[12] >= '0' && state_name[12] < '8')); |
| 2158 | |
| 2159 | // Shader and render target assignment looks up values in the symbol table, so handle those separately from the other states |
| 2160 | if (is_shader_state || is_texture_state) |
| 2161 | { |
| 2162 | std::string identifier; |
| 2163 | scoped_symbol symbol; |
| 2164 | if (!accept_symbol(identifier, symbol)) |
| 2165 | { |
| 2166 | consume_until('}'); |
| 2167 | return false; |
| 2168 | } |
| 2169 | |
| 2170 | state_location = std::move(_token.location); |
| 2171 | |
| 2172 | int num_threads[3] = { 0, 0, 0 }; |
| 2173 | if (accept('<')) |
| 2174 | { |
| 2175 | expression x, y, z; |
| 2176 | if (!parse_expression_multary(x, 8) || !expect(',') || !parse_expression_multary(y, 8)) |
| 2177 | { |
nothing calls this directly
no test coverage detected