summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render/d3d/d3dhlsl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/render/d3d/d3dhlsl.cpp')
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.cpp38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp
index 78e3e2f226f..57ab4943adb 100644
--- a/src/osd/modules/render/d3d/d3dhlsl.cpp
+++ b/src/osd/modules/render/d3d/d3dhlsl.cpp
@@ -115,7 +115,7 @@ public:
for (int y = 0; y < m_height; y++)
{
auto *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch);
- uint32_t *dst = &m_frame.pix32(y);
+ uint32_t *dst = &m_frame.pix(y);
for (int x = 0; x < m_width; x++)
{
@@ -223,7 +223,7 @@ shaders::~shaders()
if (options != nullptr)
{
- global_free(options);
+ delete options;
options = nullptr;
}
}
@@ -343,7 +343,7 @@ void shaders::render_snapshot(IDirect3DSurface9 *surface)
for (int y = 0; y < height; y++)
{
auto *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch);
- uint32_t *dst = &snapshot.pix32(y);
+ uint32_t *dst = &snapshot.pix(y);
for (int x = 0; x < width; x++)
{
@@ -359,14 +359,14 @@ void shaders::render_snapshot(IDirect3DSurface9 *surface)
// add two text entries describing the image
std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(emulator_info::get_build_version());
std::string text2 = std::string(machine->system().manufacturer).append(" ").append(machine->system().type.fullname());
- png_info pnginfo;
+ util::png_info pnginfo;
pnginfo.add_text("Software", text1.c_str());
pnginfo.add_text("System", text2.c_str());
// now do the actual work
- png_error error = png_write_bitmap(file, &pnginfo, snapshot, 1 << 24, nullptr);
- if (error != PNGERR_NONE)
- osd_printf_error("Error generating PNG for HLSL snapshot: png_error = %d\n", error);
+ util::png_error error = util::png_write_bitmap(file, &pnginfo, snapshot, 1 << 24, nullptr);
+ if (error != util::png_error::NONE)
+ osd_printf_error("Error generating PNG for HLSL snapshot: png_error = %d\n", std::underlying_type_t<util::png_error>(error));
result = snap_copy_target->UnlockRect();
if (FAILED(result))
@@ -499,7 +499,7 @@ bool shaders::init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *r
snap_width = winoptions.d3d_snap_width();
snap_height = winoptions.d3d_snap_height();
- this->options = (hlsl_options*)global_alloc_clear<hlsl_options>();
+ this->options = make_unique_clear<hlsl_options>().release();
this->options->params_init = false;
// copy last options if initialized
@@ -721,7 +721,11 @@ int shaders::create_resources()
osd_printf_verbose("Direct3D: Error %08lX during device SetRenderTarget call\n", result);
emu_file file(machine->options().art_path(), OPEN_FLAG_READ);
- render_load_png(shadow_bitmap, file, nullptr, options->shadow_mask_texture);
+ if (file.open(options->shadow_mask_texture) == osd_file::error::NONE)
+ {
+ render_load_png(shadow_bitmap, file);
+ file.close();
+ }
// experimental: if we have a shadow bitmap, create a texture for it
if (shadow_bitmap.valid())
@@ -742,7 +746,11 @@ int shaders::create_resources()
d3d->get_texture_manager()->m_texture_list.push_back(std::move(tex));
}
- render_load_png(lut_bitmap, file, nullptr, options->lut_texture);
+ if (file.open(options->lut_texture) == osd_file::error::NONE)
+ {
+ render_load_png(lut_bitmap, file);
+ file.close();
+ }
if (lut_bitmap.valid())
{
render_texinfo texture;
@@ -761,7 +769,11 @@ int shaders::create_resources()
d3d->get_texture_manager()->m_texture_list.push_back(std::move(tex));
}
- render_load_png(ui_lut_bitmap, file, nullptr, options->ui_lut_texture);
+ if (file.open(options->ui_lut_texture) == osd_file::error::NONE)
+ {
+ render_load_png(ui_lut_bitmap, file);
+ file.close();
+ }
if (ui_lut_bitmap.valid())
{
render_texinfo texture;
@@ -1976,7 +1988,7 @@ static void get_vector(const char *data, int count, float *out, bool report_erro
std::unique_ptr<slider_state> shaders::slider_alloc(int id, const char *title, int32_t minval, int32_t defval, int32_t maxval, int32_t incval, void *arg)
{
- auto state = make_unique_clear<slider_state>();
+ auto state = std::make_unique<slider_state>();
state->minval = minval;
state->defval = defval;
@@ -2431,7 +2443,7 @@ void uniform::update()
}
case CU_SCREEN_COUNT:
{
- int screen_count = win->target()->current_view().screen_count();
+ int screen_count = win->target()->current_view().visible_screen_count();
m_shader->set_int("ScreenCount", screen_count);
break;
}