MCPcopy Create free account
hub / github.com/crosire/reshade / parse_technique_pass

Method parse_technique_pass

source/effect_parser_stmt.cpp:2120–2626  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2118 return expect('}') && parse_success;
2119}
2120bool 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 {

Callers

nothing calls this directly

Calls 12

to_stringFunction · 0.85
add_cast_operationMethod · 0.80
is_functionMethod · 0.80
is_textureMethod · 0.80
texture_dimensionMethod · 0.80
is_scalarMethod · 0.80
is_voidMethod · 0.80
is_structMethod · 0.80
get_samplerMethod · 0.80
define_entry_pointMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected