1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Added a dump-the-input default RGB output shader. Which at least proves that the Atari 2600 is generally still working.

This commit is contained in:
Thomas Harte 2016-04-24 17:35:25 -04:00
parent 775fc270e6
commit d0f9a6c2f5
2 changed files with 15 additions and 4 deletions

View File

@ -40,7 +40,7 @@ void Machine::setup_output(float aspect_ratio)
// "float aOffset = 6.283185308 * (c.y - 3.0 / 16.0) * 1.14285714285714;\n" // "float aOffset = 6.283185308 * (c.y - 3.0 / 16.0) * 1.14285714285714;\n"
// "return y + step(0.03125, c.y) * 0.1 * cos((coordinate.x * 2.0 * 3.141592654) - aOffset);\n" // "return y + step(0.03125, c.y) * 0.1 * cos((coordinate.x * 2.0 * 3.141592654) - aOffset);\n"
"}"); "}");
_crt->set_output_device(Outputs::CRT::Television); _crt->set_output_device(Outputs::CRT::Monitor);
} }
Machine::~Machine() Machine::~Machine()

View File

@ -692,8 +692,20 @@ char *OpenGLOutputBuilder::get_composite_output_vertex_shader()
char *OpenGLOutputBuilder::get_rgb_output_fragment_shader() char *OpenGLOutputBuilder::get_rgb_output_fragment_shader()
{ {
return get_output_fragment_shader(_rgb_shader, "uniform usampler2D texID;", const char *rgb_shader = _rgb_shader;
if(!_rgb_shader)
{
rgb_shader =
"vec3 rgb_sample(usampler2D sampler, vec2 coordinate, vec2 icoordinate)"
"{"
"return texture(sampler, coordinate).rgb / vec3(255.0);"
"}";
}
char *result = get_output_fragment_shader(rgb_shader, "uniform usampler2D texID;",
"vec3 colour = rgb_sample(texID, srcCoordinatesVarying, iSrcCoordinatesVarying);"); "vec3 colour = rgb_sample(texID, srcCoordinatesVarying, iSrcCoordinatesVarying);");
return result;
} }
char *OpenGLOutputBuilder::get_composite_output_fragment_shader() char *OpenGLOutputBuilder::get_composite_output_fragment_shader()
@ -863,8 +875,7 @@ std::unique_ptr<OpenGL::Shader> OpenGLOutputBuilder::prepare_output_shader(char
void OpenGLOutputBuilder::prepare_rgb_output_shader() void OpenGLOutputBuilder::prepare_rgb_output_shader()
{ {
if(_rgb_shader) rgb_shader_program = prepare_output_shader(get_rgb_output_vertex_shader(), get_rgb_output_fragment_shader(), source_data_texture_unit);
rgb_shader_program = prepare_output_shader(get_rgb_output_vertex_shader(), get_rgb_output_fragment_shader(), source_data_texture_unit);
} }
void OpenGLOutputBuilder::prepare_composite_output_shader() void OpenGLOutputBuilder::prepare_composite_output_shader()